diff options
author | Jason W Kim <jason.w.kim.2009@gmail.com> | 2010-12-01 22:46:50 +0000 |
---|---|---|
committer | Jason W Kim <jason.w.kim.2009@gmail.com> | 2010-12-01 22:46:50 +0000 |
commit | fc5c522864b9e96a5bf557262ebf3fb01c249a82 (patch) | |
tree | 339c522748b30ea22cae4ca2a1c9139fe9d3c39c /llvm/lib/Target/ARM/ARMAsmBackend.cpp | |
parent | 3c14438fe87660578c39533e388f7938fb2b8625 (diff) | |
download | bcm5719-llvm-fc5c522864b9e96a5bf557262ebf3fb01c249a82.tar.gz bcm5719-llvm-fc5c522864b9e96a5bf557262ebf3fb01c249a82.zip |
fixing style nit: move class static to global static
llvm-svn: 120619
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMAsmBackend.cpp | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp index 0672899d7b3..c07a8160684 100644 --- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp +++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp @@ -38,48 +38,6 @@ public: unsigned getPointerSize() const { return 4; } - -protected: - static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { - switch (Kind) { - default: - llvm_unreachable("Unknown fixup kind!"); - case FK_Data_4: - case ARM::fixup_arm_movt_hi16: - case ARM::fixup_arm_movw_lo16: - return Value; - case ARM::fixup_arm_pcrel_12: { - bool isAdd = true; - // ARM PC-relative values are offset by 8. - Value -= 8; - if ((int64_t)Value < 0) { - Value = -Value; - isAdd = false; - } - assert ((Value < 4096) && "Out of range pc-relative fixup value!"); - Value |= isAdd << 23; - return 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 (Value - 8) >> 2; - case ARM::fixup_arm_pcrel_10: { - // Offset by 8 just as above. - Value = Value - 8; - bool isAdd = true; - if ((int64_t)Value < 0) { - Value = -Value; - isAdd = false; - } - // These values don't encode the low two bits since they're always zero. - Value >>= 2; - assert ((Value < 256) && "Out of range pc-relative fixup value!"); - Value |= isAdd << 23; - return Value; - } - } - } }; } // end anonymous namespace @@ -101,6 +59,47 @@ bool ARMAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { return true; } +static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { + switch (Kind) { + default: + llvm_unreachable("Unknown fixup kind!"); + case FK_Data_4: + case ARM::fixup_arm_movt_hi16: + case ARM::fixup_arm_movw_lo16: + return Value; + case ARM::fixup_arm_pcrel_12: { + bool isAdd = true; + // ARM PC-relative values are offset by 8. + Value -= 8; + if ((int64_t)Value < 0) { + Value = -Value; + isAdd = false; + } + assert ((Value < 4096) && "Out of range pc-relative fixup value!"); + Value |= isAdd << 23; + return 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 (Value - 8) >> 2; + case ARM::fixup_arm_pcrel_10: { + // Offset by 8 just as above. + Value = Value - 8; + bool isAdd = true; + if ((int64_t)Value < 0) { + Value = -Value; + isAdd = false; + } + // These values don't encode the low two bits since they're always zero. + Value >>= 2; + assert ((Value < 256) && "Out of range pc-relative fixup value!"); + Value |= isAdd << 23; + return Value; + } + } +} + namespace { // FIXME: This should be in a separate file. // ELF is an ELF of course... |