[llvm-commits] [llvm] r108950 - in /llvm/trunk/lib/Target/X86: X86MCInstLower.cpp X86MCInstLower.h
Chris Lattner
sabre at nondot.org
Tue Jul 20 15:30:53 PDT 2010
Author: lattner
Date: Tue Jul 20 17:30:53 2010
New Revision: 108950
URL: http://llvm.org/viewvc/llvm-project?rev=108950&view=rev
Log:
reduce X86MCInstLower dependencies on asmprinter.
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=108950&r1=108949&r2=108950&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Tue Jul 20 17:30:53 2010
@@ -29,8 +29,10 @@
using namespace llvm;
X86MCInstLower::X86MCInstLower(MCContext &ctx, Mangler *mang,
- X86AsmPrinter &asmprinter)
-: Ctx(ctx), Mang(mang), AsmPrinter(asmprinter), MF(*AsmPrinter.MF) {}
+ X86AsmPrinter &asmprinter,
+ const TargetMachine &tm)
+: Ctx(ctx), Mang(mang), AsmPrinter(asmprinter), MF(*AsmPrinter.MF),
+ TM(tm), MAI(*TM.getMCAsmInfo()) {}
MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const {
return MF.getMMI().getObjFileInfo<MachineModuleInfoMachO>();
@@ -38,8 +40,7 @@
MCSymbol *X86MCInstLower::GetPICBaseSymbol() const {
- const TargetLowering *TLI = AsmPrinter.TM.getTargetLowering();
- return static_cast<const X86TargetLowering*>(TLI)->
+ return static_cast<const X86TargetLowering*>(TM.getTargetLowering())->
getPICBaseSymbol(&MF, Ctx);
}
@@ -53,7 +54,7 @@
if (!MO.isGlobal()) {
assert(MO.isSymbol());
- Name += AsmPrinter.MAI->getGlobalPrefix();
+ Name += MAI.getGlobalPrefix();
Name += MO.getSymbolName();
} else {
const GlobalValue *GV = MO.getGlobal();
@@ -175,7 +176,7 @@
Expr = MCBinaryExpr::CreateSub(Expr,
MCSymbolRefExpr::Create(GetPICBaseSymbol(), Ctx),
Ctx);
- if (MO.isJTI() && AsmPrinter.MAI->hasSetDirective()) {
+ if (MO.isJTI() && MAI.hasSetDirective()) {
// If .set directive is supported, use it to reduce the number of
// relocations the assembler will generate for differences between
// local labels. This is only safe when the symbols are in the same
@@ -504,7 +505,7 @@
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
- X86MCInstLower MCInstLowering(OutContext, Mang, *this);
+ X86MCInstLower MCInstLowering(OutContext, Mang, *this, TM);
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=108950&r1=108949&r2=108950&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.h (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.h Tue Jul 20 17:30:53 2010
@@ -13,6 +13,7 @@
#include "llvm/Support/Compiler.h"
namespace llvm {
+ class MCAsmInfo;
class MCContext;
class MCInst;
class MCOperand;
@@ -22,6 +23,7 @@
class MachineModuleInfoMachO;
class MachineOperand;
class Mangler;
+ class TargetMachine;
class X86AsmPrinter;
/// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
@@ -30,8 +32,11 @@
Mangler *Mang;
X86AsmPrinter &AsmPrinter;
const MachineFunction &MF;
+ const TargetMachine &TM;
+ const MCAsmInfo &MAI;
public:
- X86MCInstLower(MCContext &ctx, Mangler *mang, X86AsmPrinter &asmprinter);
+ X86MCInstLower(MCContext &ctx, Mangler *mang, X86AsmPrinter &asmprinter,
+ const TargetMachine &TM);
void Lower(const MachineInstr *MI, MCInst &OutMI) const;
More information about the llvm-commits
mailing list