diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-08 12:33:41 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-08 12:33:41 +0000 |
commit | 16853bb00f37f1093049be7d2996f3f0f077e64f (patch) | |
tree | 44083ad2ea1b7be9e8553d5034e629581922f9fc | |
parent | 3c7f070956c7305656d0bd4a59317c09a5186941 (diff) | |
download | bcm5719-llvm-16853bb00f37f1093049be7d2996f3f0f077e64f.tar.gz bcm5719-llvm-16853bb00f37f1093049be7d2996f3f0f077e64f.zip |
Pack InputSectionData from 72 to 64 bytes. NFC.
llvm-svn: 280925
-rw-r--r-- | lld/ELF/InputSection.cpp | 14 | ||||
-rw-r--r-- | lld/ELF/InputSection.h | 15 | ||||
-rw-r--r-- | lld/ELF/OutputSections.cpp | 2 |
3 files changed, 19 insertions, 12 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index b8db080ea9a..d4f7acb2c1d 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -65,7 +65,7 @@ template <class SectionT> static std::string getName(SectionT *Sec) { template <class ELFT> typename ELFT::uint InputSectionBase<ELFT>::getOffset(uintX_t Offset) const { - switch (SectionKind) { + switch (kind()) { case Regular: return cast<InputSection<ELFT>>(this)->OutSecOff + Offset; case EHFrame: @@ -126,7 +126,7 @@ InputSection<ELFT>::InputSection(elf::ObjectFile<ELFT> *F, template <class ELFT> bool InputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == Base::Regular; + return S->kind() == Base::Regular; } template <class ELFT> @@ -446,7 +446,7 @@ EhInputSection<ELFT>::EhInputSection(elf::ObjectFile<ELFT> *F, template <class ELFT> bool EhInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == InputSectionBase<ELFT>::EHFrame; + return S->kind() == InputSectionBase<ELFT>::EHFrame; } // Returns the index of the first relocation that points to a region between @@ -570,7 +570,7 @@ template <class ELFT> void MergeInputSection<ELFT>::splitIntoPieces() { template <class ELFT> bool MergeInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == InputSectionBase<ELFT>::Merge; + return S->kind() == InputSectionBase<ELFT>::Merge; } // Do binary search to get a section piece at a given input offset. @@ -647,7 +647,7 @@ MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(elf::ObjectFile<ELFT> *F, template <class ELFT> bool MipsReginfoInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == InputSectionBase<ELFT>::MipsReginfo; + return S->kind() == InputSectionBase<ELFT>::MipsReginfo; } template <class ELFT> @@ -672,7 +672,7 @@ MipsOptionsInputSection<ELFT>::MipsOptionsInputSection(elf::ObjectFile<ELFT> *F, template <class ELFT> bool MipsOptionsInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == InputSectionBase<ELFT>::MipsOptions; + return S->kind() == InputSectionBase<ELFT>::MipsOptions; } template <class ELFT> @@ -690,7 +690,7 @@ MipsAbiFlagsInputSection<ELFT>::MipsAbiFlagsInputSection( template <class ELFT> bool MipsAbiFlagsInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { - return S->SectionKind == InputSectionBase<ELFT>::MipsAbiFlags; + return S->kind() == InputSectionBase<ELFT>::MipsAbiFlags; } template <class ELFT> diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 47d0e29359d..9e66c6c096b 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -45,12 +45,19 @@ public: InputSectionData(Kind SectionKind, bool Compressed, bool Live) : SectionKind(SectionKind), Live(Live), Compressed(Compressed) {} - Kind SectionKind; - uint32_t Alignment; +private: + unsigned SectionKind : 3; + +public: + Kind kind() const { return (Kind)SectionKind; } + // Used for garbage collection. - bool Live; + unsigned Live : 1; + + unsigned Compressed : 1; + + uint32_t Alignment; - bool Compressed; // If a section is compressed, this vector has uncompressed section data. SmallVector<char, 0> Uncompressed; diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 278e5c586e5..4eda44549d9 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1836,7 +1836,7 @@ OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C, if (Sec) return {Sec, false}; - switch (C->SectionKind) { + switch (C->kind()) { case InputSectionBase<ELFT>::Regular: Sec = new OutputSection<ELFT>(Key.Name, Key.Type, Key.Flags); break; |