[lld] r280925 - Pack InputSectionData from 72 to 64 bytes. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 05:33:41 PDT 2016
Author: rafael
Date: Thu Sep 8 07:33:41 2016
New Revision: 280925
URL: http://llvm.org/viewvc/llvm-project?rev=280925&view=rev
Log:
Pack InputSectionData from 72 to 64 bytes. NFC.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/OutputSections.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=280925&r1=280924&r2=280925&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Sep 8 07:33:41 2016
@@ -65,7 +65,7 @@ template <class SectionT> static std::st
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::Ob
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
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 MergeInputSec
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>::MipsRegin
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>::MipsOptio
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>::MipsAbiF
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>
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=280925&r1=280924&r2=280925&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Sep 8 07:33:41 2016
@@ -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;
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=280925&r1=280924&r2=280925&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Sep 8 07:33:41 2016
@@ -1836,7 +1836,7 @@ OutputSectionFactory<ELFT>::create(Input
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;
More information about the llvm-commits
mailing list