1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Add a hook to AssemblyAnnotationWriter to allow custom info comments

to be printed, in place of the familiar "uses=" comments.

llvm-svn: 95798
This commit is contained in:
Dan Gohman 2010-02-10 20:41:46 +00:00
parent ec527fddf4
commit f2323826d2
2 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,7 @@ class Function;
class BasicBlock; class BasicBlock;
class Instruction; class Instruction;
class raw_ostream; class raw_ostream;
class formatted_raw_ostream;
class AssemblyAnnotationWriter { class AssemblyAnnotationWriter {
public: public:
@ -46,6 +47,10 @@ public:
/// emitInstructionAnnot - This may be implemented to emit a string right /// emitInstructionAnnot - This may be implemented to emit a string right
/// before an instruction is emitted. /// before an instruction is emitted.
virtual void emitInstructionAnnot(const Instruction *I, raw_ostream &OS) {} 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 } // End llvm namespace

View File

@ -1694,6 +1694,11 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
/// which slot it occupies. /// which slot it occupies.
/// ///
void AssemblyWriter::printInfoComment(const Value &V) { void AssemblyWriter::printInfoComment(const Value &V) {
if (AnnotationWriter) {
AnnotationWriter->printInfoComment(V, Out);
return;
}
if (V.getType()->isVoidTy()) return; if (V.getType()->isVoidTy()) return;
Out.PadToColumn(50); Out.PadToColumn(50);