ARM: Use the PICADD opcode calculated.

We were figuring out whether to use tPICADD or PICADD, then just using
tPICADD unconditionally anyway. Oops.

A testcase from someone familiar enough with ELF to produce one would
be appreciated. The existing PIC testcase correctly verifies the .s
generated, but that doesn't catch this bug, which only showed up in
direct-to-object mode.

http://llvm.org/bugs/show_bug.cgi?id=17180

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2013-09-10 17:21:39 +00:00
parent 28823ec408
commit 1039e106d0

View File

@ -136,8 +136,12 @@ namespace {
unsigned GlobalBaseReg = AFI->getGlobalBaseReg();
Opc = TM->getSubtarget<ARMSubtarget>().isThumb2() ? ARM::tPICADD
: ARM::PICADD;
BuildMI(FirstMBB, MBBI, DL, TII.get(ARM::tPICADD), GlobalBaseReg)
.addReg(TempReg).addImm(ARMPCLabelIndex);
MIB = BuildMI(FirstMBB, MBBI, DL, TII.get(Opc), GlobalBaseReg)
.addReg(TempReg)
.addImm(ARMPCLabelIndex);
if (Opc == ARM::PICADD)
AddDefaultPred(MIB);
return true;
}