[llvm-commits] [llvm] r112903 - in /llvm/trunk: include/llvm/Assembly/AsmAnnotationWriter.h tools/llvm-prof/llvm-prof.cpp

Chris Lattner sabre at nondot.org
Thu Sep 2 16:07:12 PDT 2010


Author: lattner
Date: Thu Sep  2 18:07:12 2010
New Revision: 112903

URL: http://llvm.org/viewvc/llvm-project?rev=112903&view=rev
Log:
AsmPrinter has a formatted stream, pass it down through AsmAnnotationWriter

Modified:
    llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h
    llvm/trunk/tools/llvm-prof/llvm-prof.cpp

Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h?rev=112903&r1=112902&r2=112903&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h (original)
+++ llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Thu Sep  2 18:07:12 2010
@@ -32,21 +32,26 @@
 
   /// 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.

Modified: llvm/trunk/tools/llvm-prof/llvm-prof.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/llvm-prof.cpp?rev=112903&r1=112902&r2=112903&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-prof/llvm-prof.cpp (original)
+++ llvm/trunk/tools/llvm-prof/llvm-prof.cpp Thu Sep  2 18:07:12 2010
@@ -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 @@
   class ProfileAnnotator : public AssemblyAnnotationWriter {
     ProfileInfo Π
   public:
-    ProfileAnnotator(ProfileInfo& pi) : 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 @@
       }
     }
     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 @@
       }
     }
 
-    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;
 





More information about the llvm-commits mailing list