summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMAsmBackend.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-11-11 18:04:49 +0000
committerJim Grosbach <grosbach@apple.com>2010-11-11 18:04:49 +0000
commit9d6d77a9f448b71cfc3ceeb77e5810733334cbfd (patch)
treefd576b82e90143a7d01222ff5898ea3fc054ed0a /llvm/lib/Target/ARM/ARMAsmBackend.cpp
parentf11344d770dd781144d073c0ee2aef792b77ee7a (diff)
downloadbcm5719-llvm-9d6d77a9f448b71cfc3ceeb77e5810733334cbfd.tar.gz
bcm5719-llvm-9d6d77a9f448b71cfc3ceeb77e5810733334cbfd.zip
Encoding of destination fixup for ARM branch and conditional branch
instructions. llvm-svn: 118801
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmBackend.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
index be3c7111665..54cd1aefd4f 100644
--- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
@@ -138,12 +138,13 @@ public:
}
};
-static unsigned getFixupKindLog2Size(unsigned Kind) {
+static unsigned getFixupKindNumBytes(unsigned Kind) {
switch (Kind) {
default: llvm_unreachable("Unknown fixup kind!");
- case FK_Data_4: return 2;
+ case FK_Data_4: return 4;
case ARM::fixup_arm_pcrel_12: return 2;
case ARM::fixup_arm_vfp_pcrel_12: return 1;
+ case ARM::fixup_arm_branch: return 3;
}
}
@@ -156,16 +157,17 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
case ARM::fixup_arm_pcrel_12:
// ARM PC-relative values are offset by 8.
return Value - 8;
+ case ARM::fixup_arm_branch:
case ARM::fixup_arm_vfp_pcrel_12:
- // The VFP ld/st immediate value doesn't encode the low two bits since
- // they're always zero. Offset by 8 just as above.
+ // These values don't encode the low two bits since they're always zero.
+ // Offset by 8 just as above.
return (Value - 8) >> 2;
}
}
void DarwinARMAsmBackend::ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF,
- uint64_t Value) const {
- unsigned NumBytes = getFixupKindLog2Size(Fixup.getKind());
+ uint64_t Value) const {
+ unsigned NumBytes = getFixupKindNumBytes(Fixup.getKind());
Value = adjustFixupValue(Fixup.getKind(), Value);
assert(Fixup.getOffset() + NumBytes <= DF.getContents().size() &&
OpenPOWER on IntegriCloud