Skip to content

Commit 6cb69d6

Browse files
committed
[MC] Move bool members earlier. NFC
RelaxAll/SubsectionsViaSyms are used more frequently then vector members like Sections/Symbols. The size of MCAssembler doesn't particularly matter, so avoid bit fields.
1 parent a9b1e80 commit 6cb69d6

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

llvm/include/llvm/MC/MCAssembler.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ class MCAssembler {
115115
MCContext &Context;
116116

117117
std::unique_ptr<MCAsmBackend> Backend;
118-
119118
std::unique_ptr<MCCodeEmitter> Emitter;
120-
121119
std::unique_ptr<MCObjectWriter> Writer;
122120

121+
bool RelaxAll = false;
122+
bool SubsectionsViaSymbols = false;
123+
bool IncrementalLinkerCompatible = false;
124+
123125
SectionListType Sections;
124126

125127
SymbolDataListType Symbols;
@@ -150,18 +152,14 @@ class MCAssembler {
150152
/// The bundle alignment size currently set in the assembler.
151153
///
152154
/// By default it's 0, which means bundling is disabled.
153-
unsigned BundleAlignSize;
154-
155-
bool RelaxAll : 1;
156-
bool SubsectionsViaSymbols : 1;
157-
bool IncrementalLinkerCompatible : 1;
155+
unsigned BundleAlignSize = 0;
158156

159157
/// ELF specific e_header flags
160158
// It would be good if there were an MCELFAssembler class to hold this.
161159
// ELF header flags are used both by the integrated and standalone assemblers.
162160
// Access to the flags is necessary in cases where assembler directives affect
163161
// which flags to be set.
164-
unsigned ELFHeaderEFlags;
162+
unsigned ELFHeaderEFlags = 0;
165163

166164
/// Used to communicate Linker Optimization Hint information between
167165
/// the Streamer and the .o writer

llvm/lib/MC/MCAssembler.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ MCAssembler::MCAssembler(MCContext &Context,
8585
std::unique_ptr<MCCodeEmitter> Emitter,
8686
std::unique_ptr<MCObjectWriter> Writer)
8787
: Context(Context), Backend(std::move(Backend)),
88-
Emitter(std::move(Emitter)), Writer(std::move(Writer)),
89-
BundleAlignSize(0), RelaxAll(false), SubsectionsViaSymbols(false),
90-
IncrementalLinkerCompatible(false), ELFHeaderEFlags(0) {
88+
Emitter(std::move(Emitter)), Writer(std::move(Writer)) {
9189
VersionInfo.Major = 0; // Major version == 0 for "none specified"
9290
DarwinTargetVariantVersionInfo.Major = 0;
9391
}
9492

9593
MCAssembler::~MCAssembler() = default;
9694

9795
void MCAssembler::reset() {
96+
RelaxAll = false;
97+
SubsectionsViaSymbols = false;
98+
IncrementalLinkerCompatible = false;
9899
Sections.clear();
99100
Symbols.clear();
100101
IndirectSymbols.clear();
@@ -103,9 +104,6 @@ void MCAssembler::reset() {
103104
FileNames.clear();
104105
ThumbFuncs.clear();
105106
BundleAlignSize = 0;
106-
RelaxAll = false;
107-
SubsectionsViaSymbols = false;
108-
IncrementalLinkerCompatible = false;
109107
ELFHeaderEFlags = 0;
110108
LOHContainer.reset();
111109
VersionInfo.Major = 0;

0 commit comments

Comments
 (0)