summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-12-07 23:05:20 +0000
committerBill Wendling <isanbard@gmail.com>2010-12-07 23:05:20 +0000
commit721724e64318e737625bd524e3fbb45e6ce10539 (patch)
tree6c9201d4fa9b3a9af526ba87ddde34102f88760a
parent26c935f564b4ffafac011bd749f749b2792f7f86 (diff)
downloadbcm5719-llvm-721724e64318e737625bd524e3fbb45e6ce10539.tar.gz
bcm5719-llvm-721724e64318e737625bd524e3fbb45e6ce10539.zip
A bit of cleanup: early exit ApplyFixup and cache the Fixup offset. No
functionality change. llvm-svn: 121195
-rw-r--r--llvm/lib/Target/ARM/ARMAsmBackend.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
index 7b9e59f9a9d..81bc8f18d0f 100644
--- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
@@ -133,6 +133,7 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
}
namespace {
+
// FIXME: This should be in a separate file.
// ELF is an ELF of course...
class ELFARMAsmBackend : public ARMAsmBackend {
@@ -160,24 +161,24 @@ public:
}
};
-// Fixme: Raise this to share code between Darwin and ELF.
+// FIXME: Raise this to share code between Darwin and ELF.
void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, char *Data,
unsigned DataSize, uint64_t Value) const {
- // Fixme: 2 for Thumb
- unsigned NumBytes = 4;
+ unsigned NumBytes = 4; // FIXME: 2 for Thumb
+
Value = adjustFixupValue(Fixup.getKind(), Value);
+ if (!Value) return; // No need to encode nothing.
- assert((Fixup.getOffset() % NumBytes == 0)
- && "Offset mod NumBytes is nonzero!");
- // For each byte of the fragment that the fixup touches, mask in the
- // bits from the fixup value.
- // The Value has been "split up" into the appropriate bitfields above.
- for (unsigned i = 0; i != NumBytes; ++i) {
- Data[Fixup.getOffset() + i] |= uint8_t(Value >> (i * 8));
- }
+ unsigned Offset = Fixup.getOffset();
+ assert(Offset % NumBytes == 0 && "Offset mod NumBytes is nonzero!");
+
+ // For each byte of the fragment that the fixup touches, mask in the bits from
+ // the fixup value. The Value has been "split up" into the appropriate
+ // bitfields above.
+ for (unsigned i = 0; i != NumBytes; ++i)
+ Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);
}
-namespace {
// FIXME: This should be in a separate file.
class DarwinARMAsmBackend : public ARMAsmBackend {
MCMachOObjectFormat Format;
@@ -205,7 +206,6 @@ public:
return false;
}
};
-} // end anonymous namespace
static unsigned getFixupKindNumBytes(unsigned Kind) {
switch (Kind) {
@@ -235,6 +235,7 @@ void DarwinARMAsmBackend::ApplyFixup(const MCFixup &Fixup, char *Data,
for (unsigned i = 0; i != NumBytes; ++i)
Data[Fixup.getOffset() + i] |= uint8_t(Value >> (i * 8));
}
+
} // end anonymous namespace
TargetAsmBackend *llvm::createARMAsmBackend(const Target &T,
OpenPOWER on IntegriCloud