Pack InputSectionData from 72 to 64 bytes. NFC.
llvm-svn: 280925
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index b8db080..d4f7acb 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -65,7 +65,7 @@
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 @@
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 @@
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>
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 @@
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 @@
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 @@
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 47d0e29..9e66c6c 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -45,12 +45,19 @@
InputSectionData(Kind SectionKind, bool Compressed, bool Live)
: SectionKind(SectionKind), Live(Live), Compressed(Compressed) {}
- Kind SectionKind;
- uint32_t Alignment;
- // Used for garbage collection.
- bool Live;
+private:
+ unsigned SectionKind : 3;
- bool Compressed;
+public:
+ Kind kind() const { return (Kind)SectionKind; }
+
+ // Used for garbage collection.
+ unsigned Live : 1;
+
+ unsigned Compressed : 1;
+
+ uint32_t Alignment;
+
// 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 278e5c5..4eda445 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -1836,7 +1836,7 @@
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;