summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2017-08-29 09:47:55 +0000
committerDiana Picus <diana.picus@linaro.org>2017-08-29 09:47:55 +0000
commitc9f29c62ccfc076a5c821d61671705d2dd7ff8dc (patch)
tree1cf10ed1c77e9c75933245f7eb8df3cdbe288340 /llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
parentd8132c303e1bc31908ed01b3b024130f8a118a97 (diff)
downloadbcm5719-llvm-c9f29c62ccfc076a5c821d61671705d2dd7ff8dc.tar.gz
bcm5719-llvm-c9f29c62ccfc076a5c821d61671705d2dd7ff8dc.zip
[ARM] GlobalISel: Select globals in PIC mode
Support the selection of G_GLOBAL_VALUE in the PIC relocation model. For simplicity we use the same pseudoinstructions for both Darwin and ELF: (MOV|LDRLIT)_ga_pcrel(_ldr). This is new for ELF, so it requires a small update to the ARM pseudo expansion pass to make sure it adds the correct constant pool modifier and add-current-address in the case of ELF. Differential Revision: https://reviews.llvm.org/D36507 llvm-svn: 311992
Diffstat (limited to 'llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp b/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
index 1a5b7d273aa..18fd077c2bd 100644
--- a/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
+++ b/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
@@ -1308,9 +1308,11 @@ bool ARMExpandPseudo::ExpandMI(MachineBasicBlock &MBB,
if (IsPIC) {
unsigned PCAdj = IsARM ? 8 : 4;
+ auto Modifier = STI->getCPModifier(GV);
ARMPCLabelIndex = AFI->createPICLabelUId();
- CPV = ARMConstantPoolConstant::Create(GV, ARMPCLabelIndex,
- ARMCP::CPValue, PCAdj);
+ CPV = ARMConstantPoolConstant::Create(
+ GV, ARMPCLabelIndex, ARMCP::CPValue, PCAdj, Modifier,
+ /*AddCurrentAddr*/ Modifier == ARMCP::GOT_PREL);
} else
CPV = ARMConstantPoolConstant::Create(GV, ARMCP::no_modifier);
OpenPOWER on IntegriCloud