[llvm] r240773 - Optimize the creation of mapping symbols.
Rafael Espindola
rafael.espindola at gmail.com
Fri Jun 26 04:31:14 PDT 2015
Author: rafael
Date: Fri Jun 26 06:31:13 2015
New Revision: 240773
URL: http://llvm.org/viewvc/llvm-project?rev=240773&view=rev
Log:
Optimize the creation of mapping symbols.
No need to create two symbols just to assign one to the other.
Modified:
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp?rev=240773&r1=240772&r2=240773&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp Fri Jun 26 06:31:13 2015
@@ -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;
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=240773&r1=240772&r2=240773&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Fri Jun 26 06:31:13 2015
@@ -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 {
More information about the llvm-commits
mailing list