aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMMCInstLower.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-09-22 23:27:36 +0000
committerJim Grosbach <grosbach@apple.com>2010-09-22 23:27:36 +0000
commit637d89fe0eca4fa2b9c95f6c15eb69a99bae83bc (patch)
tree297d494459ff003f9e2d1d7bd36c0e90414d01c4 /lib/Target/ARM/ARMMCInstLower.cpp
parentdf046f078e95417f0ece761c92b8cc549f7ab105 (diff)
downloadexternal_llvm-637d89fe0eca4fa2b9c95f6c15eb69a99bae83bc.zip
external_llvm-637d89fe0eca4fa2b9c95f6c15eb69a99bae83bc.tar.gz
external_llvm-637d89fe0eca4fa2b9c95f6c15eb69a99bae83bc.tar.bz2
Add support for ELF PLT references for ARM MC asm printing. Adding a
new VariantKind to the MCSymbolExpr seems like overkill, but I'm not sure there's a more straightforward way to get the printing difference captured. (i.e., x86 uses @PLT, ARM uses (PLT)). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMMCInstLower.cpp')
-rw-r--r--lib/Target/ARM/ARMMCInstLower.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/lib/Target/ARM/ARMMCInstLower.cpp b/lib/Target/ARM/ARMMCInstLower.cpp
index ecd289c..e2155f1 100644
--- a/lib/Target/ARM/ARMMCInstLower.cpp
+++ b/lib/Target/ARM/ARMMCInstLower.cpp
@@ -33,7 +33,6 @@ MCSymbol *ARMMCInstLower::GetGlobalAddressSymbol(const GlobalValue *GV) const {
const MCSymbolRefExpr *ARMMCInstLower::
GetSymbolRef(const MachineOperand &MO) const {
assert(MO.isGlobal() && "Isn't a global address reference?");
- // FIXME: HANDLE PLT references how??
const MCSymbolRefExpr *SymRef;
const MCSymbol *Symbol = GetGlobalAddressSymbol(MO.getGlobal());
@@ -49,22 +48,36 @@ GetSymbolRef(const MachineOperand &MO) const {
case ARMII::MO_HI16:
SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_ARM_HI16, Ctx);
break;
+ case ARMII::MO_PLT:
+ SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_ARM_PLT, Ctx);
+ break;
}
return SymRef;
}
-MCSymbol *ARMMCInstLower::
+const MCSymbolRefExpr *ARMMCInstLower::
GetExternalSymbolSymbol(const MachineOperand &MO) const {
- // FIXME: HANDLE PLT references how??
- // FIXME: This probably needs to be merged with the above SymbolRef stuff
- // to handle :lower16: and :upper16: (?)
+ const MCSymbolRefExpr *SymRef;
+ const MCSymbol *Symbol = Printer.GetExternalSymbolSymbol(MO.getSymbolName());
+
switch (MO.getTargetFlags()) {
- default: assert(0 && "Unknown target flag on GV operand");
- case 0: break;
+ default: assert(0 && "Unknown target flag on external symbol operand");
+ case 0:
+ SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None, Ctx);
+ break;
+ case ARMII::MO_LO16:
+ SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_ARM_LO16, Ctx);
+ break;
+ case ARMII::MO_HI16:
+ SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_ARM_HI16, Ctx);
+ break;
+ case ARMII::MO_PLT:
+ SymRef = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_ARM_PLT, Ctx);
+ break;
}
- return Printer.GetExternalSymbolSymbol(MO.getSymbolName());
+ return SymRef;
}
@@ -157,7 +170,7 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
MCOp = LowerSymbolRefOperand(MO, GetSymbolRef(MO));
break;
case MachineOperand::MO_ExternalSymbol:
- MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
+ MCOp = LowerSymbolRefOperand(MO, GetExternalSymbolSymbol(MO));
break;
case MachineOperand::MO_JumpTableIndex:
MCOp = LowerSymbolOperand(MO, GetJumpTableSymbol(MO));