[llvm-commits] [llvm] r95798 - in /llvm/trunk: include/llvm/Assembly/AsmAnnotationWriter.h lib/VMCore/AsmWriter.cpp
Dan Gohman
gohman at apple.com
Wed Feb 10 12:41:47 PST 2010
Author: djg
Date: Wed Feb 10 14:41:46 2010
New Revision: 95798
URL: http://llvm.org/viewvc/llvm-project?rev=95798&view=rev
Log:
Add a hook to AssemblyAnnotationWriter to allow custom info comments
to be printed, in place of the familiar "uses=" comments.
Modified:
llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h?rev=95798&r1=95797&r2=95798&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h (original)
+++ llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Wed Feb 10 14:41:46 2010
@@ -23,6 +23,7 @@
class BasicBlock;
class Instruction;
class raw_ostream;
+class formatted_raw_ostream;
class AssemblyAnnotationWriter {
public:
@@ -46,6 +47,10 @@
/// 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
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=95798&r1=95797&r2=95798&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Feb 10 14:41:46 2010
@@ -1694,6 +1694,11 @@
/// 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);
More information about the llvm-commits
mailing list