[llvm-commits] [llvm] r109154 - in /llvm/trunk/lib/Target/X86: X86MCInstLower.cpp X86MCInstLower.h
Chris Lattner
sabre at nondot.org
Thu Jul 22 14:10:04 PDT 2010
Author: lattner
Date: Thu Jul 22 16:10:04 2010
New Revision: 109154
URL: http://llvm.org/viewvc/llvm-project?rev=109154&view=rev
Log:
X86MCInstLower now depends on AsmPrinter being around.
Modified:
llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
llvm/trunk/lib/Target/X86/X86MCInstLower.h
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=109154&r1=109153&r2=109154&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Thu Jul 22 16:10:04 2010
@@ -29,7 +29,7 @@
using namespace llvm;
X86MCInstLower::X86MCInstLower(Mangler *mang, const MachineFunction &mf,
- X86AsmPrinter *asmprinter)
+ X86AsmPrinter &asmprinter)
: Ctx(mf.getContext()), Mang(mang), MF(mf), TM(mf.getTarget()),
MAI(*TM.getMCAsmInfo()), AsmPrinter(asmprinter) {}
@@ -181,7 +181,7 @@
// local labels. This is only safe when the symbols are in the same
// section so we are restricting it to jumptable references.
MCSymbol *Label = Ctx.CreateTempSymbol();
- AsmPrinter->OutStreamer.EmitAssignment(Label, Expr);
+ AsmPrinter.OutStreamer.EmitAssignment(Label, Expr);
Expr = MCSymbolRefExpr::Create(Label, Ctx);
}
break;
@@ -320,38 +320,20 @@
MO.getMBB()->getSymbol(), Ctx));
break;
case MachineOperand::MO_GlobalAddress:
- // If we don't have an asmprinter, we're converting to MCInst to get
- // instruction sizes, which doesn't need precise value information for
- // symbols, just lower to a 0 immediate.
- if (AsmPrinter != 0)
- MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
- else
- MCOp = MCOperand::CreateImm(0);
+ MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
break;
case MachineOperand::MO_ExternalSymbol:
- if (AsmPrinter != 0)
- MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
- else
- MCOp = MCOperand::CreateImm(0);
+ MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
break;
case MachineOperand::MO_JumpTableIndex:
- if (AsmPrinter != 0)
- MCOp = LowerSymbolOperand(MO, AsmPrinter->GetJTISymbol(MO.getIndex()));
- else
- MCOp = MCOperand::CreateImm(0);
+ MCOp = LowerSymbolOperand(MO, AsmPrinter.GetJTISymbol(MO.getIndex()));
break;
case MachineOperand::MO_ConstantPoolIndex:
- if (AsmPrinter != 0)
- MCOp = LowerSymbolOperand(MO, AsmPrinter->GetCPISymbol(MO.getIndex()));
- else
- MCOp = MCOperand::CreateImm(0);
+ MCOp = LowerSymbolOperand(MO, AsmPrinter.GetCPISymbol(MO.getIndex()));
break;
case MachineOperand::MO_BlockAddress:
- if (AsmPrinter != 0)
- MCOp = LowerSymbolOperand(MO,
- AsmPrinter->GetBlockAddressSymbol(MO.getBlockAddress()));
- else
- MCOp = MCOperand::CreateImm(0);
+ MCOp = LowerSymbolOperand(MO,
+ AsmPrinter.GetBlockAddressSymbol(MO.getBlockAddress()));
break;
}
@@ -522,7 +504,7 @@
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
- X86MCInstLower MCInstLowering(Mang, *MF, this);
+ X86MCInstLower MCInstLowering(Mang, *MF, *this);
switch (MI->getOpcode()) {
case TargetOpcode::DBG_VALUE:
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.h?rev=109154&r1=109153&r2=109154&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.h (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.h Thu Jul 22 16:10:04 2010
@@ -33,13 +33,10 @@
const MachineFunction &MF;
const TargetMachine &TM;
const MCAsmInfo &MAI;
-
- /// AsmPrinter - This is the asmprinter when emission is actually happening,
- /// or null if an instruction is being lowered for some other reason.
- X86AsmPrinter *AsmPrinter;
+ X86AsmPrinter &AsmPrinter;
public:
X86MCInstLower(Mangler *mang, const MachineFunction &MF,
- X86AsmPrinter *asmprinter);
+ X86AsmPrinter &asmprinter);
void Lower(const MachineInstr *MI, MCInst &OutMI) const;
More information about the llvm-commits
mailing list