Add infrastructure to allow post instruction printing action triggers.

We'll eventually use this to print comments in asm files and do other
fun things.

This adds interfaces to the AsmPrinter and changes TableGen to invoke
the postInstructionAction when appropriate.  It also add parameters to
TargetAsmInfo to control comment layout.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene
2009-07-13 20:25:48 +00:00
parent b8ac841c9a
commit 014700c1a8
5 changed files with 59 additions and 9 deletions

View File

@ -34,6 +34,7 @@ namespace llvm {
class MachineConstantPoolEntry;
class MachineConstantPoolValue;
class MachineModuleInfo;
class MCInst;
class DwarfWriter;
class Mangler;
class Section;
@ -64,7 +65,7 @@ namespace llvm {
/// DW - If available, this is a pointer to the current dwarf writer.
DwarfWriter *DW;
public:
/// Output stream on which we're printing assembly code.
///
@ -332,6 +333,17 @@ namespace llvm {
/// debug tables.
void printDeclare(const MachineInstr *MI) const;
/// postInstructionAction - Handling printing of items after the
/// instruction iteself has been printed (e.g. comments)
void postInstructionAction(const MachineInstr &MI) const {
postInstructionActionImpl(MI);
EmitComments(MI);
}
void postInstructionAction(const MCInst &MI) const {
postInstructionActionImpl(MI);
EmitComments(MI);
}
protected:
/// EmitZeros - Emit a block of zeros.
///
@ -396,7 +408,7 @@ namespace llvm {
/// printOffset - This is just convenient handler for printing offsets.
void printOffset(int64_t Offset) const;
private:
const GlobalValue *findGlobalValue(const Constant* CV);
void EmitLLVMUsedList(Constant *List);
@ -408,6 +420,14 @@ namespace llvm {
void EmitGlobalConstantFP(const ConstantFP* CFP, unsigned AddrSpace);
void EmitGlobalConstantLargeInt(const ConstantInt* CI, unsigned AddrSpace);
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
/// EmitComments - Pretty-print comments for instructions
void EmitComments(const MachineInstr &MI) const;
/// EmitComments - Pretty-print comments for instructions
void EmitComments(const MCInst &MI) const;
virtual void postInstructionActionImpl(const MachineInstr &MI) const {}
virtual void postInstructionActionImpl(const MCInst &MI) const {}
};
}