mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
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:
parent
d4b0d61105
commit
8b8feaae29
@ -156,22 +156,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitMappingSymbol(StringRef Name) {
|
void EmitMappingSymbol(StringRef Name) {
|
||||||
MCSymbol *Start = getContext().createTempSymbol();
|
|
||||||
EmitLabel(Start);
|
|
||||||
|
|
||||||
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
|
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
|
||||||
Name + "." + Twine(MappingSymbolCounter++)));
|
Name + "." + Twine(MappingSymbolCounter++)));
|
||||||
|
EmitLabel(Symbol);
|
||||||
getAssembler().registerSymbol(*Symbol);
|
|
||||||
Symbol->setType(ELF::STT_NOTYPE);
|
Symbol->setType(ELF::STT_NOTYPE);
|
||||||
Symbol->setBinding(ELF::STB_LOCAL);
|
Symbol->setBinding(ELF::STB_LOCAL);
|
||||||
Symbol->setExternal(false);
|
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;
|
int64_t MappingSymbolCounter;
|
||||||
|
@ -563,20 +563,13 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitMappingSymbol(StringRef Name) {
|
void EmitMappingSymbol(StringRef Name) {
|
||||||
MCSymbol *Start = getContext().createTempSymbol();
|
|
||||||
EmitLabel(Start);
|
|
||||||
|
|
||||||
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
|
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
|
||||||
Name + "." + Twine(MappingSymbolCounter++)));
|
Name + "." + Twine(MappingSymbolCounter++)));
|
||||||
|
EmitLabel(Symbol);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
|
||||||
Symbol->setType(ELF::STT_NOTYPE);
|
Symbol->setType(ELF::STT_NOTYPE);
|
||||||
Symbol->setBinding(ELF::STB_LOCAL);
|
Symbol->setBinding(ELF::STB_LOCAL);
|
||||||
Symbol->setExternal(false);
|
Symbol->setExternal(false);
|
||||||
AssignSection(Symbol, getCurrentSection().first);
|
|
||||||
|
|
||||||
const MCExpr *Value = MCSymbolRefExpr::create(Start, getContext());
|
|
||||||
Symbol->setVariableValue(Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitThumbFunc(MCSymbol *Func) override {
|
void EmitThumbFunc(MCSymbol *Func) override {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user