MC: Merge MCSymbol and MCSymbolData

Turn `MCSymbolData` into a field inside of `MCSymbol`.  Keep all the old
API alive for now, so that consumers can be updated in a later commit.
This means we still temporarily need the back pointer from
`MCSymbolData` to `MCSymbol`, but I'll remove it in a follow-up.

This optimizes for object emission over assembly emission.  By removing
the `DenseMap` in `MCAssembler`, llc memory usage drops from around 1040
MB to 1001 MB (3.8%).

(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@237490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-05-16 00:03:06 +00:00
parent b42b9f8563
commit c5f2ba0401
3 changed files with 37 additions and 25 deletions

View File

@ -360,10 +360,18 @@ void MCSectionData::setBundleLockState(BundleLockStateType NewState) {
MCSymbolData::MCSymbolData() : Symbol(nullptr) {}
MCSymbolData::MCSymbolData(const MCSymbol &Symbol, MCFragment *Fragment,
uint64_t Offset)
: Symbol(&Symbol), Fragment(Fragment), Offset(Offset), SymbolSize(nullptr),
CommonAlign(-1U), Flags(0), Index(0) {}
void MCSymbolData::initialize(const MCSymbol &Symbol, MCFragment *Fragment,
uint64_t Offset) {
assert(!isInitialized() && "Expected uninitialized symbol");
this->Symbol = &Symbol;
this->Fragment.setPointer(Fragment);
this->Offset = Offset;
this->SymbolSize = nullptr;
this->CommonAlign = -1U;
this->Flags = 0;
this->Index = 0;
}
/* *** */
@ -383,7 +391,6 @@ void MCAssembler::reset() {
Sections.clear();
Symbols.clear();
SectionMap.clear();
SymbolMap.clear();
IndirectSymbols.clear();
DataRegions.clear();
LinkerOptions.clear();