Pack InputSectionData from 72 to 64 bytes. NFC.

llvm-svn: 280925
This commit is contained in:
Rafael Espindola 2016-09-08 12:33:41 +00:00
parent 3c7f070956
commit 16853bb00f
3 changed files with 20 additions and 13 deletions

View File

@ -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>

View File

@ -45,12 +45,19 @@ public:
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;
public:
Kind kind() const { return (Kind)SectionKind; }
// Used for garbage collection.
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;

View File

@ -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;