mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
reduce X86MCInstLower dependencies on asmprinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,8 +29,10 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
X86MCInstLower::X86MCInstLower(MCContext &ctx, Mangler *mang,
|
X86MCInstLower::X86MCInstLower(MCContext &ctx, Mangler *mang,
|
||||||
X86AsmPrinter &asmprinter)
|
X86AsmPrinter &asmprinter,
|
||||||
: Ctx(ctx), Mang(mang), AsmPrinter(asmprinter), MF(*AsmPrinter.MF) {}
|
const TargetMachine &tm)
|
||||||
|
: Ctx(ctx), Mang(mang), AsmPrinter(asmprinter), MF(*AsmPrinter.MF),
|
||||||
|
TM(tm), MAI(*TM.getMCAsmInfo()) {}
|
||||||
|
|
||||||
MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const {
|
MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const {
|
||||||
return MF.getMMI().getObjFileInfo<MachineModuleInfoMachO>();
|
return MF.getMMI().getObjFileInfo<MachineModuleInfoMachO>();
|
||||||
@@ -38,8 +40,7 @@ MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const {
|
|||||||
|
|
||||||
|
|
||||||
MCSymbol *X86MCInstLower::GetPICBaseSymbol() const {
|
MCSymbol *X86MCInstLower::GetPICBaseSymbol() const {
|
||||||
const TargetLowering *TLI = AsmPrinter.TM.getTargetLowering();
|
return static_cast<const X86TargetLowering*>(TM.getTargetLowering())->
|
||||||
return static_cast<const X86TargetLowering*>(TLI)->
|
|
||||||
getPICBaseSymbol(&MF, Ctx);
|
getPICBaseSymbol(&MF, Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
|||||||
|
|
||||||
if (!MO.isGlobal()) {
|
if (!MO.isGlobal()) {
|
||||||
assert(MO.isSymbol());
|
assert(MO.isSymbol());
|
||||||
Name += AsmPrinter.MAI->getGlobalPrefix();
|
Name += MAI.getGlobalPrefix();
|
||||||
Name += MO.getSymbolName();
|
Name += MO.getSymbolName();
|
||||||
} else {
|
} else {
|
||||||
const GlobalValue *GV = MO.getGlobal();
|
const GlobalValue *GV = MO.getGlobal();
|
||||||
@@ -175,7 +176,7 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
|||||||
Expr = MCBinaryExpr::CreateSub(Expr,
|
Expr = MCBinaryExpr::CreateSub(Expr,
|
||||||
MCSymbolRefExpr::Create(GetPICBaseSymbol(), Ctx),
|
MCSymbolRefExpr::Create(GetPICBaseSymbol(), Ctx),
|
||||||
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
|
// If .set directive is supported, use it to reduce the number of
|
||||||
// relocations the assembler will generate for differences between
|
// relocations the assembler will generate for differences between
|
||||||
// local labels. This is only safe when the symbols are in the same
|
// local labels. This is only safe when the symbols are in the same
|
||||||
@@ -504,7 +505,7 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
|||||||
|
|
||||||
|
|
||||||
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||||
X86MCInstLower MCInstLowering(OutContext, Mang, *this);
|
X86MCInstLower MCInstLowering(OutContext, Mang, *this, TM);
|
||||||
switch (MI->getOpcode()) {
|
switch (MI->getOpcode()) {
|
||||||
case TargetOpcode::DBG_VALUE:
|
case TargetOpcode::DBG_VALUE:
|
||||||
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
|
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MCAsmInfo;
|
||||||
class MCContext;
|
class MCContext;
|
||||||
class MCInst;
|
class MCInst;
|
||||||
class MCOperand;
|
class MCOperand;
|
||||||
@@ -22,6 +23,7 @@ namespace llvm {
|
|||||||
class MachineModuleInfoMachO;
|
class MachineModuleInfoMachO;
|
||||||
class MachineOperand;
|
class MachineOperand;
|
||||||
class Mangler;
|
class Mangler;
|
||||||
|
class TargetMachine;
|
||||||
class X86AsmPrinter;
|
class X86AsmPrinter;
|
||||||
|
|
||||||
/// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
|
/// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
|
||||||
@@ -30,8 +32,11 @@ class LLVM_LIBRARY_VISIBILITY X86MCInstLower {
|
|||||||
Mangler *Mang;
|
Mangler *Mang;
|
||||||
X86AsmPrinter &AsmPrinter;
|
X86AsmPrinter &AsmPrinter;
|
||||||
const MachineFunction &MF;
|
const MachineFunction &MF;
|
||||||
|
const TargetMachine &TM;
|
||||||
|
const MCAsmInfo &MAI;
|
||||||
public:
|
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;
|
void Lower(const MachineInstr *MI, MCInst &OutMI) const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user