[lld] r233186 - [Mips] Factor out the code that extracts a relocation 'tag' into
Simon Atanasyan
simon at atanasyan.com
Wed Mar 25 06:13:00 PDT 2015
Author: atanasyan
Date: Wed Mar 25 08:12:59 2015
New Revision: 233186
URL: http://llvm.org/viewvc/llvm-project?rev=233186&view=rev
Log:
[Mips] Factor out the code that extracts a relocation 'tag' into
the separate function
That keeps "extracting" logic into the single place and removes a VC++
compilation warning.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=233186&r1=233185&r2=233186&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Wed Mar 25 08:12:59 2015
@@ -101,19 +101,23 @@ public:
: ELFReference<ELFT>(
&rel, rel.r_offset - symValue, Reference::KindArch::Mips,
rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)),
- _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}
+ _tag(extractTag(rel)) {}
MipsELFReference(uint64_t symValue, const Elf_Rel &rel)
: ELFReference<ELFT>(rel.r_offset - symValue, Reference::KindArch::Mips,
rel.getType(_isMips64EL) & 0xff,
rel.getSymbol(_isMips64EL)),
- _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}
+ _tag(extractTag(rel)) {}
uint32_t tag() const override { return _tag; }
void setTag(uint32_t tag) { _tag = tag; }
private:
uint32_t _tag;
+
+ template <class R> static uint32_t extractTag(const R &rel) {
+ return (rel.getType(_isMips64EL) & 0xffffff00) >> 8;
+ }
};
template <class ELFT> class MipsELFFile : public ELFFile<ELFT> {
More information about the llvm-commits
mailing list