AsmPrinter has a formatted stream, pass it down through AsmAnnotationWriter
authorChris Lattner <sabre@nondot.org>
Thu, 2 Sep 2010 23:07:12 +0000 (23:07 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 2 Sep 2010 23:07:12 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112903 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Assembly/AsmAnnotationWriter.h
tools/llvm-prof/llvm-prof.cpp

index 6d75720164115ccb20dff1564428dbeddb23323b..1e2568dd1b1f2093a8973c29276a2c8e08f83057 100644 (file)
@@ -32,21 +32,26 @@ public:
 
   /// emitFunctionAnnot - This may be implemented to emit a string right before
   /// the start of a function.
-  virtual void emitFunctionAnnot(const Function *F, raw_ostream &OS) {}
+  virtual void emitFunctionAnnot(const Function *F,
+                                 formatted_raw_ostream &OS) {}
 
   /// emitBasicBlockStartAnnot - This may be implemented to emit a string right
-  /// after the basic block label, but before the first instruction in the block.
-  virtual void emitBasicBlockStartAnnot(const BasicBlock *BB, raw_ostream &OS){
+  /// after the basic block label, but before the first instruction in the
+  /// block.
+  virtual void emitBasicBlockStartAnnot(const BasicBlock *BB,
+                                        formatted_raw_ostream &OS){
   }
 
   /// emitBasicBlockEndAnnot - This may be implemented to emit a string right
   /// after the basic block.
-  virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, raw_ostream &OS){
+  virtual void emitBasicBlockEndAnnot(const BasicBlock *BB,
+                                      formatted_raw_ostream &OS){
   }
 
   /// emitInstructionAnnot - This may be implemented to emit a string right
   /// before an instruction is emitted.
-  virtual void emitInstructionAnnot(const Instruction *I, raw_ostream &OS) {}
+  virtual void emitInstructionAnnot(const Instruction *I, 
+                                    formatted_raw_ostream &OS) {}
 
   /// printInfoComment - This may be implemented to emit a comment to the
   /// right of an instruction or global value.
index 0c6c4d7bb7826a4f9e657248252a192f342b15d5..aff5b86a8a86500fd10a8ca3d8bf2cad0fd94db9 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
@@ -75,9 +76,10 @@ namespace {
   class ProfileAnnotator : public AssemblyAnnotationWriter {
     ProfileInfo &PI;
   public:
-    ProfileAnnotator(ProfileInfopi) : PI(pi) {}
+    ProfileAnnotator(ProfileInfo &pi) : PI(pi) {}
 
-    virtual void emitFunctionAnnot(const Function *F, raw_ostream &OS) {
+    virtual void emitFunctionAnnot(const Function *F,
+                                   formatted_raw_ostream &OS) {
       double w = PI.getExecutionCount(F);
       if (w != ProfileInfo::MissingValue) {
         OS << ";;; %" << F->getName() << " called "<<(unsigned)w
@@ -85,7 +87,7 @@ namespace {
       }
     }
     virtual void emitBasicBlockStartAnnot(const BasicBlock *BB,
-                                          raw_ostream &OS) {
+                                          formatted_raw_ostream &OS) {
       double w = PI.getExecutionCount(BB);
       if (w != ProfileInfo::MissingValue) {
         if (w != 0) {
@@ -96,7 +98,8 @@ namespace {
       }
     }
 
-    virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, raw_ostream &OS) {
+    virtual void emitBasicBlockEndAnnot(const BasicBlock *BB,
+                                        formatted_raw_ostream &OS) {
       // Figure out how many times each successor executed.
       std::vector<std::pair<ProfileInfo::Edge, double> > SuccCounts;