aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/ARM/ARMMCInstLower.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-14 20:58:38 +0000
committerChris Lattner <sabre@nondot.org>2010-11-14 20:58:38 +0000
commitc5afd125574886efd40d08bf8b7f5525e6d98d38 (patch)
treecb88d7eb9f4a38690b7aee9ce2922bdd3829441e /llvm/lib/Target/ARM/ARMMCInstLower.cpp
parent7c4dfc28ce450be58934ec215e0cd22dd7b70262 (diff)
downloadllvm-c5afd125574886efd40d08bf8b7f5525e6d98d38.zip
llvm-c5afd125574886efd40d08bf8b7f5525e6d98d38.tar.gz
llvm-c5afd125574886efd40d08bf8b7f5525e6d98d38.tar.bz2
even more simplifications. ARM MCInstLowering is now just
a single function instead of a class. It doesn't need the complexity that X86 does. llvm-svn: 119070
Diffstat (limited to 'llvm/lib/Target/ARM/ARMMCInstLower.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMMCInstLower.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/Target/ARM/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
index e500ca8..6e7fa47 100644
--- a/llvm/lib/Target/ARM/ARMMCInstLower.cpp
+++ b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
@@ -12,7 +12,6 @@
//
//===----------------------------------------------------------------------===//
-#include "ARMMCInstLower.h"
#include "ARM.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Constants.h"
@@ -26,8 +25,10 @@
#include "llvm/ADT/SmallString.h"
using namespace llvm;
-MCOperand ARMMCInstLower::
-GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol) const {
+
+static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+ AsmPrinter &Printer) {
+ MCContext &Ctx = Printer.OutContext;
const MCExpr *Expr;
switch (MO.getTargetFlags()) {
default: assert(0 && "Unknown target flag on symbol operand");
@@ -53,7 +54,7 @@ GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol) const {
}
-void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
+void llvm::LowerToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP){
OutMI.setOpcode(MI->getOpcode());
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
@@ -75,24 +76,23 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
break;
case MachineOperand::MO_MachineBasicBlock:
MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
- MO.getMBB()->getSymbol(), Ctx));
+ MO.getMBB()->getSymbol(), AP.OutContext));
break;
case MachineOperand::MO_GlobalAddress:
- MCOp = GetSymbolRef(MO, Printer.Mang->getSymbol(MO.getGlobal()));
+ MCOp = GetSymbolRef(MO, AP.Mang->getSymbol(MO.getGlobal()), AP);
break;
case MachineOperand::MO_ExternalSymbol:
MCOp = GetSymbolRef(MO,
- Printer.GetExternalSymbolSymbol(MO.getSymbolName()));
+ AP.GetExternalSymbolSymbol(MO.getSymbolName()), AP);
break;
case MachineOperand::MO_JumpTableIndex:
- MCOp = GetSymbolRef(MO, Printer.GetJTISymbol(MO.getIndex()));
+ MCOp = GetSymbolRef(MO, AP.GetJTISymbol(MO.getIndex()), AP);
break;
case MachineOperand::MO_ConstantPoolIndex:
- MCOp = GetSymbolRef(MO, Printer.GetCPISymbol(MO.getIndex()));
+ MCOp = GetSymbolRef(MO, AP.GetCPISymbol(MO.getIndex()), AP);
break;
case MachineOperand::MO_BlockAddress:
- MCOp = GetSymbolRef(MO,
- Printer.GetBlockAddressSymbol(MO.getBlockAddress()));
+ MCOp = GetSymbolRef(MO,AP.GetBlockAddressSymbol(MO.getBlockAddress()),AP);
break;
case MachineOperand::MO_FPImmediate:
APFloat Val = MO.getFPImm()->getValueAPF();
@@ -104,5 +104,4 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
OutMI.addOperand(MCOp);
}
-
}