mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
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`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -676,7 +676,7 @@ class MCAssembler {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
typedef iplist<MCSectionData> SectionDataListType;
|
typedef iplist<MCSectionData> SectionDataListType;
|
||||||
typedef std::vector<MCSymbolData *> SymbolDataListType;
|
typedef std::vector<const MCSymbol *> SymbolDataListType;
|
||||||
|
|
||||||
typedef SectionDataListType::const_iterator const_iterator;
|
typedef SectionDataListType::const_iterator const_iterator;
|
||||||
typedef SectionDataListType::iterator iterator;
|
typedef SectionDataListType::iterator iterator;
|
||||||
@ -1052,7 +1052,7 @@ public:
|
|||||||
*Created = !hasSymbolData(Symbol);
|
*Created = !hasSymbolData(Symbol);
|
||||||
if (!hasSymbolData(Symbol)) {
|
if (!hasSymbolData(Symbol)) {
|
||||||
Symbol.getUnsafeData().initialize(Symbol, nullptr, 0);
|
Symbol.getUnsafeData().initialize(Symbol, nullptr, 0);
|
||||||
Symbols.push_back(&Symbol.getData());
|
Symbols.push_back(&Symbol);
|
||||||
}
|
}
|
||||||
return Symbol.getData();
|
return Symbol.getData();
|
||||||
}
|
}
|
||||||
|
@ -422,8 +422,8 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
// The presence of symbol versions causes undefined symbols and
|
// The presence of symbol versions causes undefined symbols and
|
||||||
// versions declared with @@@ to be renamed.
|
// versions declared with @@@ to be renamed.
|
||||||
|
|
||||||
for (MCSymbolData &OriginalData : Asm.symbols()) {
|
for (const MCSymbol &Alias : Asm.symbols()) {
|
||||||
const MCSymbol &Alias = OriginalData.getSymbol();
|
MCSymbolData &OriginalData = Alias.getData();
|
||||||
|
|
||||||
// Not an alias.
|
// Not an alias.
|
||||||
if (!Alias.isVariable())
|
if (!Alias.isVariable())
|
||||||
@ -936,8 +936,8 @@ void ELFObjectWriter::computeSymbolTable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the data for the symbols.
|
// Add the data for the symbols.
|
||||||
for (MCSymbolData &SD : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
const MCSymbol &Symbol = SD.getSymbol();
|
MCSymbolData &SD = Symbol.getData();
|
||||||
|
|
||||||
bool Used = UsedInReloc.count(&Symbol);
|
bool Used = UsedInReloc.count(&Symbol);
|
||||||
bool WeakrefUsed = WeakrefUsedInReloc.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
|
// First, scan the symbol table to build a lookup table from fragments to
|
||||||
// defining symbols.
|
// defining symbols.
|
||||||
DenseMap<const MCFragment*, MCSymbolData*> DefiningSymbolMap;
|
DenseMap<const MCFragment*, MCSymbolData*> DefiningSymbolMap;
|
||||||
for (MCSymbolData &SD : getAssembler().symbols()) {
|
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
||||||
if (getAssembler().isSymbolLinkerVisible(SD.getSymbol()) &&
|
MCSymbolData &SD = Symbol.getData();
|
||||||
SD.getFragment()) {
|
if (getAssembler().isSymbolLinkerVisible(Symbol) && SD.getFragment()) {
|
||||||
// An atom defining symbol should never be internal to a fragment.
|
// An atom defining symbol should never be internal to a fragment.
|
||||||
assert(SD.getOffset() == 0 && "Invalid offset in atom defining symbol!");
|
assert(SD.getOffset() == 0 && "Invalid offset in atom defining symbol!");
|
||||||
DefiningSymbolMap[SD.getFragment()] = &SD;
|
DefiningSymbolMap[SD.getFragment()] = &SD;
|
||||||
|
@ -548,8 +548,7 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||||||
assert(Index <= 256 && "Too many sections!");
|
assert(Index <= 256 && "Too many sections!");
|
||||||
|
|
||||||
// Build the string table.
|
// Build the string table.
|
||||||
for (MCSymbolData &SD : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
const MCSymbol &Symbol = SD.getSymbol();
|
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -562,8 +561,8 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||||||
// The particular order that we collect and then sort the symbols is chosen to
|
// 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
|
// match 'as'. Even though it doesn't matter for correctness, this is
|
||||||
// important for letting us diff .o files.
|
// important for letting us diff .o files.
|
||||||
for (MCSymbolData &SD : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
const MCSymbol &Symbol = SD.getSymbol();
|
MCSymbolData &SD = Symbol.getData();
|
||||||
|
|
||||||
// Ignore non-linker visible symbols.
|
// Ignore non-linker visible symbols.
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||||
@ -590,8 +589,8 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now add the data for local symbols.
|
// Now add the data for local symbols.
|
||||||
for (MCSymbolData &SD : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
const MCSymbol &Symbol = SD.getSymbol();
|
MCSymbolData &SD = Symbol.getData();
|
||||||
|
|
||||||
// Ignore non-linker visible symbols.
|
// Ignore non-linker visible symbols.
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||||
|
@ -642,9 +642,9 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
for (const auto &Section : Asm)
|
for (const auto &Section : Asm)
|
||||||
DefineSection(Section);
|
DefineSection(Section);
|
||||||
|
|
||||||
for (MCSymbolData &SD : Asm.symbols())
|
for (const MCSymbol &Symbol : Asm.symbols())
|
||||||
if (ExportSymbol(SD.getSymbol(), Asm))
|
if (ExportSymbol(Symbol, Asm))
|
||||||
DefineSymbol(SD, Asm, Layout);
|
DefineSymbol(Symbol.getData(), Asm, Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
||||||
|
Reference in New Issue
Block a user