summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-20 00:56:16 +0000
committerChris Lattner <sabre@nondot.org>2009-10-20 00:56:16 +0000
commit43c5589a7ea55a1f33447173460db92cab8f93a7 (patch)
tree5cd26dbec04325c3a0b00768380f506b8c694e97
parent1b06acbd70296fa2f0f7ec46f526d6fccee11b21 (diff)
downloadbcm5719-llvm-43c5589a7ea55a1f33447173460db92cab8f93a7.tar.gz
bcm5719-llvm-43c5589a7ea55a1f33447173460db92cab8f93a7.zip
add support for external symbols. The mc instprinter can now handle
reasonable code like Codegen/ARM/2009-02-27-SpillerBug.ll, producing identical output except for superior formatting of constant pool entries. llvm-svn: 84582
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp18
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h2
2 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp
index 2520b2c27ec..757164e682a 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp
@@ -54,6 +54,22 @@ GetGlobalAddressSymbol(const MachineOperand &MO) const {
return Ctx.GetOrCreateSymbol(Name.str());
}
+MCSymbol *ARMMCInstLower::
+GetExternalSymbolSymbol(const MachineOperand &MO) const {
+ SmallString<128> Name;
+ Name += Printer.MAI->getGlobalPrefix();
+ Name += MO.getSymbolName();
+
+ // FIXME: HANDLE PLT references how??
+ switch (MO.getTargetFlags()) {
+ default: assert(0 && "Unknown target flag on GV operand");
+ case 0: break;
+ }
+
+ return Ctx.GetOrCreateSymbol(Name.str());
+}
+
+
MCSymbol *ARMMCInstLower::
GetJumpTableSymbol(const MachineOperand &MO) const {
@@ -133,11 +149,9 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
case MachineOperand::MO_GlobalAddress:
MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
break;
-#if 0
case MachineOperand::MO_ExternalSymbol:
MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
break;
-#endif
case MachineOperand::MO_JumpTableIndex:
MCOp = LowerSymbolOperand(MO, GetJumpTableSymbol(MO));
break;
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h b/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h
index 1b73e811f59..383d30d5de5 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h
@@ -40,7 +40,7 @@ public:
//MCSymbol *GetPICBaseSymbol() const;
MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
- //MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
+ MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const;
MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const;
MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
OpenPOWER on IntegriCloud