[llvm-commits] [llvm] r100343 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 4 11:58:53 PDT 2010
Author: lattner
Date: Sun Apr 4 13:58:53 2010
New Revision: 100343
URL: http://llvm.org/viewvc/llvm-project?rev=100343&view=rev
Log:
more interface cleanup make some helpers static functions.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=100343&r1=100342&r2=100343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sun Apr 4 13:58:53 2010
@@ -59,8 +59,7 @@
public:
/// DW - If available, this is a pointer to the current dwarf writer.
DwarfWriter *DW;
-
-
+
/// Target machine description.
///
TargetMachine &TM;
@@ -219,6 +218,16 @@
assert(0 && "EmitInstruction not implemented");
}
+ virtual void EmitFunctionEntryLabel();
+
+ virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
+
+ /// isBlockOnlyReachableByFallthough - Return true if the basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ virtual bool
+ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
+
//===------------------------------------------------------------------===//
// Lowering Routines.
//===------------------------------------------------------------------===//
@@ -276,51 +285,15 @@
void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
- // Data emission.
-
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
void EmitGlobalConstant(const Constant *CV, unsigned AddrSpace = 0);
- protected:
- virtual void EmitFunctionEntryLabel();
-
- virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
-
- /// printOffset - This is just convenient handler for printing offsets.
- void printOffset(int64_t Offset, raw_ostream &OS) const;
-
- /// isBlockOnlyReachableByFallthough - Return true if the basic block has
- /// exactly one predecessor and the control transfer mechanism between
- /// the predecessor and this block is a fall-through.
- virtual bool
- isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
-
- private:
- /// EmitImplicitDef - This method emits the specified machine instruction
- /// that is an implicit def.
- void EmitImplicitDef(const MachineInstr *MI) const;
-
- /// EmitKill - This method emits the specified kill machine instruction.
- void EmitKill(const MachineInstr *MI) const;
-
- /// EmitVisibility - This emits visibility information about symbol, if
- /// this is suported by the target.
- void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const;
-
- void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const;
-
- void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
- const MachineBasicBlock *MBB,
- unsigned uid) const;
- void EmitLLVMUsedList(Constant *List);
- void EmitXXStructorList(Constant *List);
- GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
-
-
//===------------------------------------------------------------------===//
// Emission Helper Routines.
//===------------------------------------------------------------------===//
public:
+ /// printOffset - This is just convenient handler for printing offsets.
+ void printOffset(int64_t Offset, raw_ostream &OS) const;
/// EmitInt8 - Emit a byte directive and value.
///
@@ -388,6 +361,23 @@
/// EmitInlineAsm - This method formats and emits the specified machine
/// instruction that is an inline asm.
void EmitInlineAsm(const MachineInstr *MI) const;
+
+ //===------------------------------------------------------------------===//
+ // Internal Implementation Details
+ //===------------------------------------------------------------------===//
+
+ /// EmitVisibility - This emits visibility information about symbol, if
+ /// this is suported by the target.
+ void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const;
+
+ void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const;
+
+ void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
+ const MachineBasicBlock *MBB,
+ unsigned uid) const;
+ void EmitLLVMUsedList(Constant *List);
+ void EmitXXStructorList(Constant *List);
+ GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
};
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=100343&r1=100342&r2=100343&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Apr 4 13:58:53 2010
@@ -401,6 +401,28 @@
}
}
+/// EmitImplicitDef - This method emits the specified machine instruction
+/// that is an implicit def.
+static void EmitImplicitDef(const MachineInstr *MI, AsmPrinter &AP) {
+ unsigned RegNo = MI->getOperand(0).getReg();
+ AP.OutStreamer.AddComment(Twine("implicit-def: ") +
+ AP.TM.getRegisterInfo()->getName(RegNo));
+ AP.OutStreamer.AddBlankLine();
+}
+
+static void EmitKill(const MachineInstr *MI, AsmPrinter &AP) {
+ std::string Str = "kill:";
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ const MachineOperand &Op = MI->getOperand(i);
+ assert(Op.isReg() && "KILL instruction must have only register operands");
+ Str += ' ';
+ Str += AP.TM.getRegisterInfo()->getName(Op.getReg());
+ Str += (Op.isDef() ? "<def>" : "<kill>");
+ }
+ AP.OutStreamer.AddComment(Str);
+ AP.OutStreamer.AddBlankLine();
+}
+
/// EmitFunctionBody - This method emits the body and trailer for a
@@ -442,10 +464,10 @@
EmitInlineAsm(II);
break;
case TargetOpcode::IMPLICIT_DEF:
- EmitImplicitDef(II);
+ if (isVerbose()) EmitImplicitDef(II, *this);
break;
case TargetOpcode::KILL:
- EmitKill(II);
+ if (isVerbose()) EmitKill(II, *this);
break;
default:
EmitInstruction(II);
@@ -1324,31 +1346,6 @@
}
-/// EmitImplicitDef - This method emits the specified machine instruction
-/// that is an implicit def.
-void AsmPrinter::EmitImplicitDef(const MachineInstr *MI) const {
- if (!isVerbose()) return;
- unsigned RegNo = MI->getOperand(0).getReg();
- OutStreamer.AddComment(Twine("implicit-def: ") +
- TM.getRegisterInfo()->getName(RegNo));
- OutStreamer.AddBlankLine();
-}
-
-void AsmPrinter::EmitKill(const MachineInstr *MI) const {
- if (!isVerbose()) return;
-
- std::string Str = "kill:";
- for (unsigned n = 0, e = MI->getNumOperands(); n != e; ++n) {
- const MachineOperand &Op = MI->getOperand(n);
- assert(Op.isReg() && "KILL instruction must have only register operands");
- Str += ' ';
- Str += TM.getRegisterInfo()->getName(Op.getReg());
- Str += (Op.isDef() ? "<def>" : "<kill>");
- }
- OutStreamer.AddComment(Str);
- OutStreamer.AddBlankLine();
-}
-
MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const {
return MMI->getAddrLabelSymbol(BA->getBasicBlock());
}
More information about the llvm-commits
mailing list