forked from OSchip/llvm-project
MC: Change MCAssembler::Symbols to store MCSymbol, NFC
Instead of storing a list of the `MCSymbolData` in use, store the `MCSymbol`s. Churning in the direction of removing the back pointer from `MCSymbolData`. llvm-svn: 237496
This commit is contained in:
parent
7f6290ca9a
commit
f48de1cb7b
|
@ -676,7 +676,7 @@ class MCAssembler {
|
|||
|
||||
public:
|
||||
typedef iplist<MCSectionData> SectionDataListType;
|
||||
typedef std::vector<MCSymbolData *> SymbolDataListType;
|
||||
typedef std::vector<const MCSymbol *> SymbolDataListType;
|
||||
|
||||
typedef SectionDataListType::const_iterator const_iterator;
|
||||
typedef SectionDataListType::iterator iterator;
|
||||
|
@ -1052,7 +1052,7 @@ public:
|
|||
*Created = !hasSymbolData(Symbol);
|
||||
if (!hasSymbolData(Symbol)) {
|
||||
Symbol.getUnsafeData().initialize(Symbol, nullptr, 0);
|
||||
Symbols.push_back(&Symbol.getData());
|
||||
Symbols.push_back(&Symbol);
|
||||
}
|
||||
return Symbol.getData();
|
||||
}
|
||||
|
|
|
@ -422,8 +422,8 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||
// The presence of symbol versions causes undefined symbols and
|
||||
// versions declared with @@@ to be renamed.
|
||||
|
||||
for (MCSymbolData &OriginalData : Asm.symbols()) {
|
||||
const MCSymbol &Alias = OriginalData.getSymbol();
|
||||
for (const MCSymbol &Alias : Asm.symbols()) {
|
||||
MCSymbolData &OriginalData = Alias.getData();
|
||||
|
||||
// Not an alias.
|
||||
if (!Alias.isVariable())
|
||||
|
@ -936,8 +936,8 @@ void ELFObjectWriter::computeSymbolTable(
|
|||
}
|
||||
|
||||
// Add the data for the symbols.
|
||||
for (MCSymbolData &SD : Asm.symbols()) {
|
||||
const MCSymbol &Symbol = SD.getSymbol();
|
||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||
MCSymbolData &SD = Symbol.getData();
|
||||
|
||||
bool Used = UsedInReloc.count(&Symbol);
|
||||
bool WeakrefUsed = WeakrefUsedInReloc.count(&Symbol);
|
||||
|
|
|
@ -465,9 +465,9 @@ void MCMachOStreamer::FinishImpl() {
|
|||
// First, scan the symbol table to build a lookup table from fragments to
|
||||
// defining symbols.
|
||||
DenseMap<const MCFragment*, MCSymbolData*> DefiningSymbolMap;
|
||||
for (MCSymbolData &SD : getAssembler().symbols()) {
|
||||
if (getAssembler().isSymbolLinkerVisible(SD.getSymbol()) &&
|
||||
SD.getFragment()) {
|
||||
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
||||
MCSymbolData &SD = Symbol.getData();
|
||||
if (getAssembler().isSymbolLinkerVisible(Symbol) && SD.getFragment()) {
|
||||
// An atom defining symbol should never be internal to a fragment.
|
||||
assert(SD.getOffset() == 0 && "Invalid offset in atom defining symbol!");
|
||||
DefiningSymbolMap[SD.getFragment()] = &SD;
|
||||
|
|
|
@ -548,8 +548,7 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||
assert(Index <= 256 && "Too many sections!");
|
||||
|
||||
// Build the string table.
|
||||
for (MCSymbolData &SD : Asm.symbols()) {
|
||||
const MCSymbol &Symbol = SD.getSymbol();
|
||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||
continue;
|
||||
|
||||
|
@ -562,8 +561,8 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||
// The particular order that we collect and then sort the symbols is chosen to
|
||||
// match 'as'. Even though it doesn't matter for correctness, this is
|
||||
// important for letting us diff .o files.
|
||||
for (MCSymbolData &SD : Asm.symbols()) {
|
||||
const MCSymbol &Symbol = SD.getSymbol();
|
||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||
MCSymbolData &SD = Symbol.getData();
|
||||
|
||||
// Ignore non-linker visible symbols.
|
||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||
|
@ -590,8 +589,8 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||
}
|
||||
|
||||
// Now add the data for local symbols.
|
||||
for (MCSymbolData &SD : Asm.symbols()) {
|
||||
const MCSymbol &Symbol = SD.getSymbol();
|
||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||
MCSymbolData &SD = Symbol.getData();
|
||||
|
||||
// Ignore non-linker visible symbols.
|
||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||
|
|
|
@ -642,9 +642,9 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||
for (const auto &Section : Asm)
|
||||
DefineSection(Section);
|
||||
|
||||
for (MCSymbolData &SD : Asm.symbols())
|
||||
if (ExportSymbol(SD.getSymbol(), Asm))
|
||||
DefineSymbol(SD, Asm, Layout);
|
||||
for (const MCSymbol &Symbol : Asm.symbols())
|
||||
if (ExportSymbol(Symbol, Asm))
|
||||
DefineSymbol(Symbol.getData(), Asm, Layout);
|
||||
}
|
||||
|
||||
bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
||||
|
|
Loading…
Reference in New Issue