clean up the asmprinter interface a bit, rename a few

"Print" methods to "Emit".  Emit is something that goes
to an mc streamer, Print is something that goes to a
raw_ostream (for inline asm) 

llvm-svn: 100337
This commit is contained in:
Chris Lattner 2010-04-04 18:14:01 +00:00
parent 21dc46e256
commit 4a4710a055
2 changed files with 21 additions and 36 deletions

View File

@ -62,9 +62,6 @@ namespace llvm {
/// function. /// function.
/// ///
MachineLoopInfo *LI; MachineLoopInfo *LI;
public:
/// MMI - This is a pointer to the current MachineModuleInfo.
MachineModuleInfo *MMI;
protected: protected:
/// DW - If available, this is a pointer to the current dwarf writer. /// DW - If available, this is a pointer to the current dwarf writer.
@ -76,9 +73,6 @@ namespace llvm {
/// ///
TargetMachine &TM; TargetMachine &TM;
/// getObjFileLowering - Return information about object file lowering.
TargetLoweringObjectFile &getObjFileLowering() const;
/// Target Asm Printer information. /// Target Asm Printer information.
/// ///
const MCAsmInfo *MAI; const MCAsmInfo *MAI;
@ -97,6 +91,9 @@ namespace llvm {
/// The current machine function. /// The current machine function.
const MachineFunction *MF; const MachineFunction *MF;
/// MMI - This is a pointer to the current MachineModuleInfo.
MachineModuleInfo *MMI;
/// Name-mangler for global names. /// Name-mangler for global names.
/// ///
Mangler *Mang; Mangler *Mang;
@ -108,12 +105,13 @@ namespace llvm {
/// getCurrentSection() - Return the current section we are emitting to. /// getCurrentSection() - Return the current section we are emitting to.
const MCSection *getCurrentSection() const; const MCSection *getCurrentSection() const;
/// VerboseAsm - Emit comments in assembly output if this is true. /// VerboseAsm - Emit comments in assembly output if this is true.
/// ///
bool VerboseAsm; bool VerboseAsm;
/// getObjFileLowering - Return information about object file lowering.
TargetLoweringObjectFile &getObjFileLowering() const;
private: private:
// GCMetadataPrinters - The garbage collection metadata printer table. // GCMetadataPrinters - The garbage collection metadata printer table.
@ -140,7 +138,6 @@ namespace llvm {
/// ///
unsigned getFunctionNumber() const; unsigned getFunctionNumber() const;
protected:
/// getAnalysisUsage - Record analysis usage. /// getAnalysisUsage - Record analysis usage.
/// ///
void getAnalysisUsage(AnalysisUsage &AU) const; void getAnalysisUsage(AnalysisUsage &AU) const;
@ -244,7 +241,7 @@ namespace llvm {
public: public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Emission and print routines // Emission routines.
// //
/// EmitInt8 - Emit a byte directive and value. /// EmitInt8 - Emit a byte directive and value.
@ -287,10 +284,6 @@ namespace llvm {
unsigned ForcedAlignBits = 0, unsigned ForcedAlignBits = 0,
bool UseFillExpr = true) const; bool UseFillExpr = true) const;
/// printDeclare - This method prints a local variable declaration used by
/// debug tables.
void printDeclare(const MachineInstr *MI) const;
/// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
/// global value name as its base, with the specified suffix, and where the /// global value name as its base, with the specified suffix, and where the
/// symbol is forced to have private linkage if ForcePrivate is true. /// symbol is forced to have private linkage if ForcePrivate is true.
@ -350,18 +343,16 @@ namespace llvm {
/// instruction's DebugLoc. /// instruction's DebugLoc.
void processDebugLoc(const MachineInstr *MI, bool BeforePrintingInsn); void processDebugLoc(const MachineInstr *MI, bool BeforePrintingInsn);
void printLabelInst(const MachineInstr *MI) const; /// EmitInlineAsm - This method formats and emits the specified machine
/// printInlineAsm - This method formats and prints the specified machine
/// instruction that is an inline asm. /// instruction that is an inline asm.
void printInlineAsm(const MachineInstr *MI) const; void EmitInlineAsm(const MachineInstr *MI) const;
/// printImplicitDef - This method prints the specified machine instruction /// EmitImplicitDef - This method emits the specified machine instruction
/// that is an implicit def. /// that is an implicit def.
void printImplicitDef(const MachineInstr *MI) const; void EmitImplicitDef(const MachineInstr *MI) const;
/// printKill - This method prints the specified kill machine instruction. /// EmitKill - This method emits the specified kill machine instruction.
void printKill(const MachineInstr *MI) const; void EmitKill(const MachineInstr *MI) const;
/// EmitVisibility - This emits visibility information about symbol, if /// EmitVisibility - This emits visibility information about symbol, if
/// this is suported by the target. /// this is suported by the target.

View File

@ -440,16 +440,16 @@ void AsmPrinter::EmitFunctionBody() {
case TargetOpcode::DBG_LABEL: case TargetOpcode::DBG_LABEL:
case TargetOpcode::EH_LABEL: case TargetOpcode::EH_LABEL:
case TargetOpcode::GC_LABEL: case TargetOpcode::GC_LABEL:
printLabelInst(II); OutStreamer.EmitLabel(II->getOperand(0).getMCSymbol());
break; break;
case TargetOpcode::INLINEASM: case TargetOpcode::INLINEASM:
printInlineAsm(II); EmitInlineAsm(II);
break; break;
case TargetOpcode::IMPLICIT_DEF: case TargetOpcode::IMPLICIT_DEF:
printImplicitDef(II); EmitImplicitDef(II);
break; break;
case TargetOpcode::KILL: case TargetOpcode::KILL:
printKill(II); EmitKill(II);
break; break;
default: default:
EmitInstruction(II); EmitInstruction(II);
@ -1385,9 +1385,9 @@ void AsmPrinter::processDebugLoc(const MachineInstr *MI,
} }
/// printInlineAsm - This method formats and prints the specified machine /// EmitInlineAsm - This method formats and emits the specified machine
/// instruction that is an inline asm. /// instruction that is an inline asm.
void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms"); assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms");
unsigned NumOperands = MI->getNumOperands(); unsigned NumOperands = MI->getNumOperands();
@ -1606,9 +1606,9 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
MAI->getInlineAsmEnd()); MAI->getInlineAsmEnd());
} }
/// printImplicitDef - This method prints the specified machine instruction /// EmitImplicitDef - This method emits the specified machine instruction
/// that is an implicit def. /// that is an implicit def.
void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { void AsmPrinter::EmitImplicitDef(const MachineInstr *MI) const {
if (!VerboseAsm) return; if (!VerboseAsm) return;
unsigned RegNo = MI->getOperand(0).getReg(); unsigned RegNo = MI->getOperand(0).getReg();
OutStreamer.AddComment(Twine("implicit-def: ") + OutStreamer.AddComment(Twine("implicit-def: ") +
@ -1616,7 +1616,7 @@ void AsmPrinter::printImplicitDef(const MachineInstr *MI) const {
OutStreamer.AddBlankLine(); OutStreamer.AddBlankLine();
} }
void AsmPrinter::printKill(const MachineInstr *MI) const { void AsmPrinter::EmitKill(const MachineInstr *MI) const {
if (!VerboseAsm) return; if (!VerboseAsm) return;
std::string Str = "kill:"; std::string Str = "kill:";
@ -1631,12 +1631,6 @@ void AsmPrinter::printKill(const MachineInstr *MI) const {
OutStreamer.AddBlankLine(); OutStreamer.AddBlankLine();
} }
/// printLabel - This method prints a local label used by debug and
/// exception handling tables.
void AsmPrinter::printLabelInst(const MachineInstr *MI) const {
OutStreamer.EmitLabel(MI->getOperand(0).getMCSymbol());
}
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
/// instruction, using the specified assembler variant. Targets should /// instruction, using the specified assembler variant. Targets should
/// override this to format as appropriate. /// override this to format as appropriate.