mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 18:20:39 +00:00
MC: Remove most remaining uses of MCSymbolData::getSymbol(), NFC
Remove most remaining calls to `MCSymbolData::getSymbol()`, instead using the already available `MCSymbol` directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -464,13 +464,13 @@ 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 *, const MCSymbol *> DefiningSymbolMap;
|
||||||
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
||||||
MCSymbolData &SD = Symbol.getData();
|
MCSymbolData &SD = Symbol.getData();
|
||||||
if (getAssembler().isSymbolLinkerVisible(Symbol) && 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()] = &Symbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,8 +481,8 @@ void MCMachOStreamer::FinishImpl() {
|
|||||||
const MCSymbol *CurrentAtom = nullptr;
|
const MCSymbol *CurrentAtom = nullptr;
|
||||||
for (MCSectionData::iterator it2 = it->begin(),
|
for (MCSectionData::iterator it2 = it->begin(),
|
||||||
ie2 = it->end(); it2 != ie2; ++it2) {
|
ie2 = it->end(); it2 != ie2; ++it2) {
|
||||||
if (MCSymbolData *SD = DefiningSymbolMap.lookup(it2))
|
if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(it2))
|
||||||
CurrentAtom = &SD->getSymbol();
|
CurrentAtom = Symbol;
|
||||||
it2->setAtom(CurrentAtom);
|
it2->setAtom(CurrentAtom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,6 @@ void AArch64MachObjectWriter::RecordRelocation(
|
|||||||
Asm.addLocalUsedInReloc(*Symbol);
|
Asm.addLocalUsedInReloc(*Symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSymbolData &SD = Asm.getSymbolData(*Symbol);
|
|
||||||
const MCSymbol *Base = Asm.getAtom(*Symbol);
|
const MCSymbol *Base = Asm.getAtom(*Symbol);
|
||||||
|
|
||||||
// If the symbol is a variable and we weren't able to get a Base for it
|
// If the symbol is a variable and we weren't able to get a Base for it
|
||||||
@@ -305,7 +304,7 @@ void AArch64MachObjectWriter::RecordRelocation(
|
|||||||
// If the evaluation is an absolute value, just use that directly
|
// If the evaluation is an absolute value, just use that directly
|
||||||
// to keep things easy.
|
// to keep things easy.
|
||||||
int64_t Res;
|
int64_t Res;
|
||||||
if (SD.getSymbol().getVariableValue()->EvaluateAsAbsolute(
|
if (Symbol->getVariableValue()->EvaluateAsAbsolute(
|
||||||
Res, Layout, Writer->getSectionAddressMap())) {
|
Res, Layout, Writer->getSectionAddressMap())) {
|
||||||
FixedValue = Res;
|
FixedValue = Res;
|
||||||
return;
|
return;
|
||||||
@@ -350,19 +349,18 @@ void AArch64MachObjectWriter::RecordRelocation(
|
|||||||
"'. Must have non-local symbol earlier in section.");
|
"'. Must have non-local symbol earlier in section.");
|
||||||
// Adjust the relocation to be section-relative.
|
// Adjust the relocation to be section-relative.
|
||||||
// The index is the section ordinal (1-based).
|
// The index is the section ordinal (1-based).
|
||||||
const MCSectionData &SymSD =
|
const MCSectionData &SymSD = Asm.getSectionData(Symbol->getSection());
|
||||||
Asm.getSectionData(SD.getSymbol().getSection());
|
|
||||||
Index = SymSD.getOrdinal() + 1;
|
Index = SymSD.getOrdinal() + 1;
|
||||||
Value += Writer->getSymbolAddress(SD.getSymbol(), Layout);
|
Value += Writer->getSymbolAddress(*Symbol, Layout);
|
||||||
|
|
||||||
if (IsPCRel)
|
if (IsPCRel)
|
||||||
Value -= Writer->getFragmentAddress(Fragment, Layout) +
|
Value -= Writer->getFragmentAddress(Fragment, Layout) +
|
||||||
Fixup.getOffset() + (1ULL << Log2Size);
|
Fixup.getOffset() + (1ULL << Log2Size);
|
||||||
} else {
|
} else {
|
||||||
// Resolve constant variables.
|
// Resolve constant variables.
|
||||||
if (SD.getSymbol().isVariable()) {
|
if (Symbol->isVariable()) {
|
||||||
int64_t Res;
|
int64_t Res;
|
||||||
if (SD.getSymbol().getVariableValue()->EvaluateAsAbsolute(
|
if (Symbol->getVariableValue()->EvaluateAsAbsolute(
|
||||||
Res, Layout, Writer->getSectionAddressMap())) {
|
Res, Layout, Writer->getSectionAddressMap())) {
|
||||||
FixedValue = Res;
|
FixedValue = Res;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user