MC: Simplify MCSymbolData initialization and remove MCSymbol pointer

Finally remove the `MCSymbolData::Symbol` pointer.  It was still being
used to track whether `MCSymbolData` had been initialized, but this is
better tracked by the bitfield in `MCSymbol`.

The only caller of `MCSymbolData::initialize()` was `MCAssembler`, which
(other than `Symbol`) passed in all-0 values.  Replace all that
indirection with a default constructor.

The main point is a cleanup (and there's more cleanup to do), but there
are also some small memory savings.  I measured ~989 MB down to ~975 MB,
cutting a little over 1% off the top of `llc`.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237873 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-05-21 01:33:03 +00:00
parent 0141c66026
commit 4652459f64
3 changed files with 17 additions and 42 deletions

View File

@@ -1033,9 +1033,7 @@ public:
return *Entry;
}
bool hasSymbolData(const MCSymbol &Symbol) const {
return Symbol.getUnsafeData().isInitialized();
}
bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
MCSymbolData &getSymbolData(const MCSymbol &Symbol) {
return const_cast<MCSymbolData &>(
@@ -1051,7 +1049,7 @@ public:
if (Created)
*Created = !hasSymbolData(Symbol);
if (!hasSymbolData(Symbol)) {
Symbol.getUnsafeData().initialize(Symbol, nullptr, 0);
Symbol.initializeData();
Symbols.push_back(&Symbol);
}
return Symbol.getData();