summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMAsmBackend.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-12-06 23:57:07 +0000
committerJim Grosbach <grosbach@apple.com>2010-12-06 23:57:07 +0000
commit9e1994698d3da8cecec5a6cc5e95b18db913ef4b (patch)
tree20a23f5e416ff59c063b01b2934dda18fa620e1b /llvm/lib/Target/ARM/ARMAsmBackend.cpp
parentf6c7308bb1e04a08e711abec9ee3afb1a7dc4aab (diff)
downloadbcm5719-llvm-9e1994698d3da8cecec5a6cc5e95b18db913ef4b.tar.gz
bcm5719-llvm-9e1994698d3da8cecec5a6cc5e95b18db913ef4b.zip
Add fixup for Thumb1 BL/BLX instructions.
llvm-svn: 121072
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmBackend.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
index 536923e47bf..7b9e59f9a9d 100644
--- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
@@ -103,7 +103,18 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
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.
- return 0xFFFFFF & ((Value - 8) >> 2);
+ return 0xffffff & ((Value - 8) >> 2);
+ case ARM::fixup_arm_thumb_bl: {
+ // The value doesn't encode the low bit (always zero) and is offset by
+ // four. The value is encoded into disjoint bit positions in the destination
+ // opcode. x = unchanged, I = immediate value bit, S = sign extension bit
+ // xxxxxSIIIIIIIIII xxxxxIIIIIIIIIII
+ // Note that the halfwords are stored high first, low second; so we need
+ // to transpose the fixup value here to map properly.
+ uint32_t Binary = 0x3fffff & ((Value - 4) >> 1);
+ Binary = ((Binary & 0x7ff) << 16) | (Binary >> 11);
+ return Binary;
+ }
case ARM::fixup_arm_pcrel_10: {
// Offset by 8 just as above.
Value = Value - 8;
@@ -198,12 +209,17 @@ public:
static unsigned getFixupKindNumBytes(unsigned Kind) {
switch (Kind) {
- default: llvm_unreachable("Unknown fixup kind!");
- case FK_Data_4: return 4;
- case ARM::fixup_arm_ldst_pcrel_12: return 3;
- case ARM::fixup_arm_pcrel_10: return 3;
- case ARM::fixup_arm_adr_pcrel_12: return 3;
- case ARM::fixup_arm_branch: return 3;
+ default:
+ llvm_unreachable("Unknown fixup kind!");
+ case FK_Data_4:
+ return 4;
+ case ARM::fixup_arm_ldst_pcrel_12:
+ case ARM::fixup_arm_pcrel_10:
+ case ARM::fixup_arm_adr_pcrel_12:
+ case ARM::fixup_arm_branch:
+ return 3;
+ case ARM::fixup_arm_thumb_bl:
+ return 4;
}
}
OpenPOWER on IntegriCloud