Optimize the creation of mapping symbols.

No need to create two symbols just to assign one to the other.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-06-26 11:31:13 +00:00
parent d4b0d61105
commit 8b8feaae29
2 changed files with 2 additions and 19 deletions

View File

@ -156,22 +156,12 @@ private:
}
void EmitMappingSymbol(StringRef Name) {
MCSymbol *Start = getContext().createTempSymbol();
EmitLabel(Start);
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
Name + "." + Twine(MappingSymbolCounter++)));
getAssembler().registerSymbol(*Symbol);
EmitLabel(Symbol);
Symbol->setType(ELF::STT_NOTYPE);
Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false);
auto Sec = getCurrentSection().first;
assert(Sec && "need a section");
Symbol->setSection(*Sec);
const MCExpr *Value = MCSymbolRefExpr::create(Start, getContext());
Symbol->setVariableValue(Value);
}
int64_t MappingSymbolCounter;

View File

@ -563,20 +563,13 @@ private:
}
void EmitMappingSymbol(StringRef Name) {
MCSymbol *Start = getContext().createTempSymbol();
EmitLabel(Start);
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
Name + "." + Twine(MappingSymbolCounter++)));
EmitLabel(Symbol);
getAssembler().registerSymbol(*Symbol);
Symbol->setType(ELF::STT_NOTYPE);
Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false);
AssignSection(Symbol, getCurrentSection().first);
const MCExpr *Value = MCSymbolRefExpr::create(Start, getContext());
Symbol->setVariableValue(Value);
}
void EmitThumbFunc(MCSymbol *Func) override {