diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-11-07 19:40:04 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-11-07 19:40:04 +0000 |
commit | 8b5278a46639b7695d2fd6d1054c21fe1872121f (patch) | |
tree | 19eda08473a6f4af4e2ebe627545a2a9c35e52d5 /llvm/lib/Target/ARM/Thumb1InstrInfo.cpp | |
parent | 63ffdc748a10eee896fea196a1b25e6315c46eee (diff) | |
download | bcm5719-llvm-8b5278a46639b7695d2fd6d1054c21fe1872121f.tar.gz bcm5719-llvm-8b5278a46639b7695d2fd6d1054c21fe1872121f.zip |
t2ldrpci_pic can be used for blockaddress as well.
llvm-svn: 86400
Diffstat (limited to 'llvm/lib/Target/ARM/Thumb1InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb1InstrInfo.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp index 4e4561db729..b1ddf05db87 100644 --- a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp +++ b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp @@ -16,6 +16,8 @@ #include "ARMConstantPoolValue.h" #include "ARMGenInstrInfo.inc" #include "ARMMachineFunctionInfo.h" +#include "llvm/Constants.h" +#include "llvm/Function.h" #include "llvm/GlobalValue.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -290,10 +292,19 @@ void Thumb1InstrInfo::reMaterialize(MachineBasicBlock &MBB, "Expecting a machine constantpool entry!"); ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>(MCPE.Val.MachineCPVal); - assert(ACPV->isGlobalValue() && "Expecting a GV!"); unsigned PCLabelId = AFI->createConstPoolEntryUId(); - ARMConstantPoolValue *NewCPV = - new ARMConstantPoolValue(ACPV->getGV(), PCLabelId, ARMCP::CPValue, 4); + ARMConstantPoolValue *NewCPV = 0; + if (ACPV->isGlobalValue()) + NewCPV = new ARMConstantPoolValue(ACPV->getGV(), PCLabelId, + ARMCP::CPValue, 4); + else if (ACPV->isExtSymbol()) + NewCPV = new ARMConstantPoolValue(MF.getFunction()->getContext(), + ACPV->getSymbol(), PCLabelId, 4); + else if (ACPV->isBlockAddress()) + NewCPV = new ARMConstantPoolValue(ACPV->getBlockAddress(), PCLabelId, + ARMCP::CPBlockAddress, 4); + else + llvm_unreachable("Unexpected ARM constantpool value type!!"); CPI = MCP->getConstantPoolIndex(NewCPV, MCPE.getAlignment()); MachineInstrBuilder MIB = BuildMI(MBB, I, Orig->getDebugLoc(), get(Opcode), DestReg) |