[llvm] r238607 - Rename getOrCreateSymbolData to registerSymbol and return void.
Rafael Espindola
rafael.espindola at gmail.com
Fri May 29 13:21:03 PDT 2015
Author: rafael
Date: Fri May 29 15:21:02 2015
New Revision: 238607
URL: http://llvm.org/viewvc/llvm-project?rev=238607&view=rev
Log:
Rename getOrCreateSymbolData to registerSymbol and return void.
Another step in merging MCSymbol and MCSymbolData.
Modified:
llvm/trunk/include/llvm/MC/MCAssembler.h
llvm/trunk/include/llvm/MC/MCObjectStreamer.h
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCELFStreamer.cpp
llvm/trunk/lib/MC/MCMachOStreamer.cpp
llvm/trunk/lib/MC/MCObjectStreamer.cpp
llvm/trunk/lib/MC/MachObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFStreamer.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Fri May 29 15:21:02 2015
@@ -884,15 +884,13 @@ public:
bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
- MCSymbolData &getOrCreateSymbolData(const MCSymbol &Symbol,
- bool *Created = nullptr) {
+ void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr) {
if (Created)
*Created = !hasSymbolData(Symbol);
if (!hasSymbolData(Symbol)) {
Symbol.initializeData();
Symbols.push_back(&Symbol);
}
- return Symbol.getData();
}
ArrayRef<std::string> getFileNames() { return FileNames; }
Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Fri May 29 15:21:02 2015
@@ -56,8 +56,8 @@ public:
/// Object streamers require the integrated assembler.
bool isIntegratedAssemblerRequired() const override { return true; }
- MCSymbolData &getOrCreateSymbolData(const MCSymbol *Symbol) {
- return getAssembler().getOrCreateSymbolData(*Symbol);
+ void getOrCreateSymbolData(const MCSymbol *Symbol) {
+ getAssembler().registerSymbol(*Symbol);
}
void EmitFrames(MCAsmBackend *MAB);
void EmitCFISections(bool EH, bool Debug) override;
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri May 29 15:21:02 2015
@@ -1256,7 +1256,7 @@ void ELFObjectWriter::WriteObject(MCAsse
MCSectionELF *RelSection = createRelocationSection(Ctx, Section);
if (SignatureSymbol) {
- Asm.getOrCreateSymbolData(*SignatureSymbol);
+ Asm.registerSymbol(*SignatureSymbol);
unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
if (!GroupIdx) {
MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Fri May 29 15:21:02 2015
@@ -155,7 +155,7 @@ void MCELFStreamer::ChangeSection(MCSect
auto *SectionELF = static_cast<const MCSectionELF *>(Section);
const MCSymbol *Grp = SectionELF->getGroup();
if (Grp)
- Asm.getOrCreateSymbolData(*Grp);
+ Asm.registerSymbol(*Grp);
this->MCObjectStreamer::ChangeSection(Section, Subsection);
MCContext &Ctx = getContext();
@@ -165,13 +165,13 @@ void MCELFStreamer::ChangeSection(MCSect
Section->setBeginSymbol(Begin);
}
if (Begin->isUndefined()) {
- Asm.getOrCreateSymbolData(*Begin);
+ Asm.registerSymbol(*Begin);
MCELF::SetType(*Begin, ELF::STT_SECTION);
}
}
void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
- getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
const MCExpr *Value = MCSymbolRefExpr::Create(
Symbol, MCSymbolRefExpr::VK_WEAKREF, getContext());
Alias->setVariableValue(Value);
@@ -211,9 +211,10 @@ bool MCELFStreamer::EmitSymbolAttribute(
}
// Adding a symbol attribute always introduces the symbol, note that an
- // important side effect of calling getOrCreateSymbolData here is to register
+ // important side effect of calling registerSymbol here is to register
// the symbol with the assembler.
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
// The implementation of symbol attributes is designed to match 'as', but it
// leaves much to desired. It doesn't really make sense to arbitrarily add and
@@ -311,8 +312,9 @@ bool MCELFStreamer::EmitSymbolAttribute(
}
void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
- unsigned ByteAlignment) {
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ unsigned ByteAlignment) {
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
if (!BindingExplicitlySet.count(Symbol)) {
MCELF::SetBinding(*Symbol, ELF::STB_GLOBAL);
@@ -343,7 +345,8 @@ void MCELFStreamer::EmitELFSize(MCSymbol
void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
// FIXME: Should this be caught and done earlier?
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
SD.setExternal(false);
BindingExplicitlySet.insert(Symbol);
@@ -460,7 +463,7 @@ void MCELFStreamer::fixSymbolsInTLSFixup
case MCSymbolRefExpr::VK_PPC_TLSLD:
break;
}
- getAssembler().getOrCreateSymbolData(symRef.getSymbol());
+ getAssembler().registerSymbol(symRef.getSymbol());
MCELF::SetType(symRef.getSymbol(), ELF::STT_TLS);
break;
}
Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Fri May 29 15:21:02 2015
@@ -172,8 +172,8 @@ void MCMachOStreamer::ChangeSection(MCSe
void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
MCSymbol *EHSymbol) {
- MCSymbolData &SD =
- getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
if (SD.isExternal())
EmitSymbolAttribute(EHSymbol, MCSA_Global);
if (Symbol->getFlags() & SF_WeakDefinition)
@@ -293,9 +293,10 @@ bool MCMachOStreamer::EmitSymbolAttribut
}
// Adding a symbol attribute always introduces the symbol, note that an
- // important side effect of calling getOrCreateSymbolData here is to register
+ // important side effect of calling registerSymbol here is to register
// the symbol with the assembler.
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
// The implementation of symbol attributes is designed to match 'as', but it
// leaves much to desired. It doesn't really make sense to arbitrarily add and
@@ -378,7 +379,7 @@ void MCMachOStreamer::EmitSymbolDesc(MCS
// Encode the 'desc' value into the lowest implementation defined bits.
assert(DescValue == (DescValue & SF_DescFlagsMask) &&
"Invalid .desc value!");
- getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
Symbol->setFlags(DescValue & SF_DescFlagsMask);
}
@@ -389,7 +390,8 @@ void MCMachOStreamer::EmitCommonSymbol(M
AssignSection(Symbol, nullptr);
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
SD.setExternal(true);
Symbol->setCommon(Size, ByteAlignment);
}
@@ -414,7 +416,8 @@ void MCMachOStreamer::EmitZerofill(MCSec
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
// Emit an align fragment if necessary.
if (ByteAlignment != 1)
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Fri May 29 15:21:02 2015
@@ -121,7 +121,7 @@ MCDataFragment *MCObjectStreamer::getOrC
}
void MCObjectStreamer::visitUsedSymbol(const MCSymbol &Sym) {
- Assembler->getOrCreateSymbolData(Sym);
+ Assembler->registerSymbol(Sym);
}
void MCObjectStreamer::EmitCFISections(bool EH, bool Debug) {
@@ -163,7 +163,8 @@ void MCObjectStreamer::EmitCFIEndProcImp
void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
MCStreamer::EmitLabel(Symbol);
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
// If there is a current fragment, mark the symbol as pointing into it.
@@ -226,7 +227,7 @@ bool MCObjectStreamer::changeSectionImpl
}
void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
- getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
MCStreamer::EmitAssignment(Symbol, Value);
}
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Fri May 29 15:21:02 2015
@@ -500,7 +500,7 @@ void MachObjectWriter::BindIndirectSymbo
// Initialize the section indirect symbol base, if necessary.
IndirectSymBase.insert(std::make_pair(it->Section, IndirectIndex));
- Asm.getOrCreateSymbolData(*it->Symbol);
+ Asm.registerSymbol(*it->Symbol);
}
// Then lazy symbol pointers and symbol stubs.
@@ -520,7 +520,7 @@ void MachObjectWriter::BindIndirectSymbo
//
// FIXME: Do not hardcode.
bool Created;
- Asm.getOrCreateSymbolData(*it->Symbol, &Created);
+ Asm.registerSymbol(*it->Symbol, &Created);
if (Created)
it->Symbol->setFlags(it->Symbol->getFlags() | 0x0001);
}
Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Fri May 29 15:21:02 2015
@@ -96,7 +96,8 @@ bool MCWinCOFFStreamer::EmitSymbolAttrib
Symbol->getSection().getVariant() == MCSection::SV_COFF) &&
"Got non-COFF section in the COFF backend!");
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
switch (Attribute) {
default: return false;
@@ -136,7 +137,7 @@ void MCWinCOFFStreamer::EmitCOFFSymbolSt
FatalError("storage class value '" + Twine(StorageClass) +
"' out of range");
- getAssembler().getOrCreateSymbolData(*CurSymbol);
+ getAssembler().registerSymbol(*CurSymbol);
CurSymbol->modifyFlags(StorageClass << COFF::SF_ClassShift,
COFF::SF_ClassMask);
}
@@ -148,7 +149,7 @@ void MCWinCOFFStreamer::EmitCOFFSymbolTy
if (Type & ~0xffff)
FatalError("type value '" + Twine(Type) + "' out of range");
- getAssembler().getOrCreateSymbolData(*CurSymbol);
+ getAssembler().registerSymbol(*CurSymbol);
CurSymbol->modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask);
}
@@ -195,7 +196,8 @@ void MCWinCOFFStreamer::EmitCommonSymbol
AssignSection(Symbol, nullptr);
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
SD.setExternal(true);
Symbol->setCommon(Size, ByteAlignment);
@@ -224,7 +226,8 @@ void MCWinCOFFStreamer::EmitLocalCommonS
if (Section->getAlignment() < ByteAlignment)
Section->setAlignment(ByteAlignment);
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
SD.setExternal(false);
AssignSection(Symbol, Section);
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=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp Fri May 29 15:21:02 2015
@@ -164,7 +164,8 @@ private:
MCSymbol *Symbol = getContext().getOrCreateSymbol(
Name + "." + Twine(MappingSymbolCounter++));
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
SD.setExternal(false);
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=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Fri May 29 15:21:02 2015
@@ -566,7 +566,8 @@ private:
getContext().getOrCreateSymbol(Name + "." +
Twine(MappingSymbolCounter++));
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
+ getAssembler().registerSymbol(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
SD.setExternal(false);
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp?rev=238607&r1=238606&r2=238607&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp Fri May 29 15:21:02 2015
@@ -689,7 +689,7 @@ void MipsTargetELFStreamer::emitDirectiv
StringRef SymName("_gp_disp");
MCAssembler &MCA = getStreamer().getAssembler();
MCSymbol *GP_Disp = MCA.getContext().getOrCreateSymbol(SymName);
- MCA.getOrCreateSymbolData(*GP_Disp);
+ MCA.registerSymbol(*GP_Disp);
MCInst TmpInst;
TmpInst.setOpcode(Mips::LUi);
More information about the llvm-commits
mailing list