diff options
author | Owen Anderson <resistor@mac.com> | 2010-12-14 00:36:49 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-12-14 00:36:49 +0000 |
commit | a838a25d59838adfa91463f6a918ae3adeb352c1 (patch) | |
tree | 2993f422e346bd2efa6a917c95c6a2b55bfcaccf /lib/Target/ARM/ARMAsmBackend.cpp | |
parent | 2d9220e8f5b45390d64e943fa4eef1562b87f04b (diff) | |
download | external_llvm-a838a25d59838adfa91463f6a918ae3adeb352c1.zip external_llvm-a838a25d59838adfa91463f6a918ae3adeb352c1.tar.gz external_llvm-a838a25d59838adfa91463f6a918ae3adeb352c1.tar.bz2 |
Second attempt at make Thumb2 LEAs pseudos. This time, perform the lowering much later, which makes the entire
process cleaner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r-- | lib/Target/ARM/ARMAsmBackend.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp index cb0c543..789bae0 100644 --- a/lib/Target/ARM/ARMAsmBackend.cpp +++ b/lib/Target/ARM/ARMAsmBackend.cpp @@ -136,6 +136,25 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { // Encode the immediate and shift the opcode into place. return ARM_AM::getSOImmVal(Value) | (opc << 21); } + + case ARM::fixup_t2_adr_pcrel_12: { + Value -= 4; + unsigned opc = 0; + if ((int64_t)Value < 0) { + Value = -Value; + opc = 5; + } + + uint32_t out = (opc << 21); + out |= (Value & 0x800) << 14; + out |= (Value & 0x700) << 4; + out |= (Value & 0x0FF); + + uint64_t swapped = (out & 0xFFFF0000) >> 16; + swapped |= (out & 0x0000FFFF) << 16; + return swapped; + } + case ARM::fixup_arm_branch: // These values don't encode the low two bits since they're always zero. // Offset by 8 just as above. @@ -356,6 +375,7 @@ static unsigned getFixupKindNumBytes(unsigned Kind) { case ARM::fixup_t2_condbranch: case ARM::fixup_t2_uncondbranch: case ARM::fixup_t2_pcrel_10: + case ARM::fixup_t2_adr_pcrel_12: case ARM::fixup_arm_thumb_bl: case ARM::fixup_arm_thumb_blx: return 4; |