mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[MC] Reorder members of MCFragment's subclasses to decrease padding
On a 64-bit platform: sizeof(MCBoundaryAlignFragment): 64 -> 56 sizeof(MCOrgFragment): 72 -> 64 sizeof(MCFillFragment): 80 -> 72 sizeof(MCLEBFragment): 88 -> 80
This commit is contained in:
parent
2e7fc6eeed
commit
20e1b9e897
@ -299,9 +299,6 @@ public:
|
||||
: MCFragment(FT_Align, false, Sec), Alignment(Alignment), EmitNops(false),
|
||||
Value(Value), ValueSize(ValueSize), MaxBytesToEmit(MaxBytesToEmit) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
unsigned getAlignment() const { return Alignment; }
|
||||
|
||||
int64_t getValue() const { return Value; }
|
||||
@ -313,17 +310,15 @@ public:
|
||||
bool hasEmitNops() const { return EmitNops; }
|
||||
void setEmitNops(bool Value) { EmitNops = Value; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_Align;
|
||||
}
|
||||
};
|
||||
|
||||
class MCFillFragment : public MCFragment {
|
||||
uint8_t ValueSize;
|
||||
/// Value to use for filling bytes.
|
||||
uint64_t Value;
|
||||
uint8_t ValueSize;
|
||||
/// The number of bytes to insert.
|
||||
const MCExpr &NumValues;
|
||||
|
||||
@ -333,7 +328,7 @@ class MCFillFragment : public MCFragment {
|
||||
public:
|
||||
MCFillFragment(uint64_t Value, uint8_t VSize, const MCExpr &NumValues,
|
||||
SMLoc Loc, MCSection *Sec = nullptr)
|
||||
: MCFragment(FT_Fill, false, Sec), Value(Value), ValueSize(VSize),
|
||||
: MCFragment(FT_Fill, false, Sec), ValueSize(VSize), Value(Value),
|
||||
NumValues(NumValues), Loc(Loc) {}
|
||||
|
||||
uint64_t getValue() const { return Value; }
|
||||
@ -348,22 +343,20 @@ public:
|
||||
};
|
||||
|
||||
class MCOrgFragment : public MCFragment {
|
||||
/// The offset this fragment should start at.
|
||||
const MCExpr *Offset;
|
||||
|
||||
/// Value to use for filling bytes.
|
||||
int8_t Value;
|
||||
|
||||
/// The offset this fragment should start at.
|
||||
const MCExpr *Offset;
|
||||
|
||||
/// Source location of the directive that this fragment was created for.
|
||||
SMLoc Loc;
|
||||
|
||||
public:
|
||||
MCOrgFragment(const MCExpr &Offset, int8_t Value, SMLoc Loc,
|
||||
MCSection *Sec = nullptr)
|
||||
: MCFragment(FT_Org, false, Sec), Offset(&Offset), Value(Value), Loc(Loc) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
: MCFragment(FT_Org, false, Sec), Value(Value), Offset(&Offset),
|
||||
Loc(Loc) {}
|
||||
|
||||
const MCExpr &getOffset() const { return *Offset; }
|
||||
|
||||
@ -371,31 +364,26 @@ public:
|
||||
|
||||
SMLoc getLoc() const { return Loc; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_Org;
|
||||
}
|
||||
};
|
||||
|
||||
class MCLEBFragment : public MCFragment {
|
||||
/// The value this fragment should contain.
|
||||
const MCExpr *Value;
|
||||
|
||||
/// True if this is a sleb128, false if uleb128.
|
||||
bool IsSigned;
|
||||
|
||||
/// The value this fragment should contain.
|
||||
const MCExpr *Value;
|
||||
|
||||
SmallString<8> Contents;
|
||||
|
||||
public:
|
||||
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSection *Sec = nullptr)
|
||||
: MCFragment(FT_LEB, false, Sec), Value(&Value_), IsSigned(IsSigned_) {
|
||||
: MCFragment(FT_LEB, false, Sec), IsSigned(IsSigned_), Value(&Value_) {
|
||||
Contents.push_back(0);
|
||||
}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
const MCExpr &getValue() const { return *Value; }
|
||||
|
||||
bool isSigned() const { return IsSigned; }
|
||||
@ -425,15 +413,10 @@ public:
|
||||
: MCEncodedFragmentWithFixups<8, 1>(FT_Dwarf, false, Sec),
|
||||
LineDelta(LineDelta), AddrDelta(&AddrDelta) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
int64_t getLineDelta() const { return LineDelta; }
|
||||
|
||||
const MCExpr &getAddrDelta() const { return *AddrDelta; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_Dwarf;
|
||||
}
|
||||
@ -449,13 +432,8 @@ public:
|
||||
: MCEncodedFragmentWithFixups<8, 1>(FT_DwarfFrame, false, Sec),
|
||||
AddrDelta(&AddrDelta) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
const MCExpr &getAddrDelta() const { return *AddrDelta; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_DwarfFrame;
|
||||
}
|
||||
@ -469,14 +447,9 @@ public:
|
||||
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
|
||||
: MCFragment(FT_SymbolId, false, Sec), Sym(Sym) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
const MCSymbol *getSymbol() { return Sym; }
|
||||
const MCSymbol *getSymbol() const { return Sym; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_SymbolId;
|
||||
}
|
||||
@ -505,17 +478,12 @@ public:
|
||||
StartFileId(StartFileId), StartLineNum(StartLineNum),
|
||||
FnStartSym(FnStartSym), FnEndSym(FnEndSym) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
const MCSymbol *getFnStartSym() const { return FnStartSym; }
|
||||
const MCSymbol *getFnEndSym() const { return FnEndSym; }
|
||||
|
||||
SmallString<8> &getContents() { return Contents; }
|
||||
const SmallString<8> &getContents() const { return Contents; }
|
||||
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_CVInlineLines;
|
||||
}
|
||||
@ -538,14 +506,11 @@ public:
|
||||
Ranges(Ranges.begin(), Ranges.end()),
|
||||
FixedSizePortion(FixedSizePortion) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> getRanges() const {
|
||||
return Ranges;
|
||||
}
|
||||
|
||||
StringRef getFixedSizePortion() const { return FixedSizePortion; }
|
||||
/// @}
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_CVDefRange;
|
||||
@ -556,10 +521,6 @@ public:
|
||||
/// does not cross a particular power-of-two boundary. The other fragments must
|
||||
/// follow this one within the same section.
|
||||
class MCBoundaryAlignFragment : public MCFragment {
|
||||
private:
|
||||
/// The size of the fragment. The size is lazily set during relaxation, and
|
||||
/// is not meaningful before that.
|
||||
uint64_t Size = 0;
|
||||
/// The alignment requirement of the branch to be aligned.
|
||||
Align AlignBoundary;
|
||||
/// Flag to indicate whether the branch is fused. Use in determining the
|
||||
@ -567,6 +528,9 @@ private:
|
||||
bool Fused : 1;
|
||||
/// Flag to indicate whether NOPs should be emitted.
|
||||
bool EmitNops : 1;
|
||||
/// The size of the fragment. The size is lazily set during relaxation, and
|
||||
/// is not meaningful before that.
|
||||
uint64_t Size = 0;
|
||||
|
||||
public:
|
||||
MCBoundaryAlignFragment(Align AlignBoundary, bool Fused = false,
|
||||
@ -574,8 +538,6 @@ public:
|
||||
: MCFragment(FT_BoundaryAlign, false, Sec), AlignBoundary(AlignBoundary),
|
||||
Fused(Fused), EmitNops(EmitNops) {}
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
uint64_t getSize() const { return Size; }
|
||||
void setSize(uint64_t Value) { Size = Value; }
|
||||
|
||||
@ -586,8 +548,6 @@ public:
|
||||
|
||||
bool canEmitNops() const { return EmitNops; }
|
||||
void setEmitNops(bool Value) { EmitNops = Value; }
|
||||
/// @}
|
||||
//
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_BoundaryAlign;
|
||||
|
Loading…
x
Reference in New Issue
Block a user