Add a hook to AssemblyAnnotationWriter to allow custom info comments
authorDan Gohman <gohman@apple.com>
Wed, 10 Feb 2010 20:41:46 +0000 (20:41 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 10 Feb 2010 20:41:46 +0000 (20:41 +0000)
to be printed, in place of the familiar "uses=" comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95798 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Assembly/AsmAnnotationWriter.h
lib/VMCore/AsmWriter.cpp

index 8d7cbc6fac2495cb8103b2f38689bbdf2a91180e..6d75720164115ccb20dff1564428dbeddb23323b 100644 (file)
@@ -23,6 +23,7 @@ class Function;
 class BasicBlock;
 class Instruction;
 class raw_ostream;
+class formatted_raw_ostream;
 
 class AssemblyAnnotationWriter {
 public:
@@ -46,6 +47,10 @@ public:
   /// emitInstructionAnnot - This may be implemented to emit a string right
   /// before an instruction is emitted.
   virtual void emitInstructionAnnot(const Instruction *I, raw_ostream &OS) {}
+
+  /// printInfoComment - This may be implemented to emit a comment to the
+  /// right of an instruction or global value.
+  virtual void printInfoComment(const Value &V, formatted_raw_ostream &OS) {}
 };
 
 } // End llvm namespace
index ab5f45a2b94711092cf924b2c9dde2ba99ed99a9..586817073bd7ca97741ca4cade5d842510ea8d36 100644 (file)
@@ -1694,6 +1694,11 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
 /// which slot it occupies.
 ///
 void AssemblyWriter::printInfoComment(const Value &V) {
+  if (AnnotationWriter) {
+    AnnotationWriter->printInfoComment(V, Out);
+    return;
+  }
+
   if (V.getType()->isVoidTy()) return;
   
   Out.PadToColumn(50);