aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-16 20:04:29 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-16 20:04:29 +0000
commit843aa1f15b06fc3c2b39740ffb5bffd2fa6827ce (patch)
tree77dd9a4770ea1b9a3449869ef937398cb15309c5
parent83b467178a8295048f3ee7b44ff9c7ea244a96cc (diff)
downloadexternal_llvm-843aa1f15b06fc3c2b39740ffb5bffd2fa6827ce.zip
external_llvm-843aa1f15b06fc3c2b39740ffb5bffd2fa6827ce.tar.gz
external_llvm-843aa1f15b06fc3c2b39740ffb5bffd2fa6827ce.tar.bz2
MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106142 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCAssembler.h2
-rw-r--r--lib/MC/MCAssembler.cpp11
-rw-r--r--lib/MC/MCMachOStreamer.cpp4
-rw-r--r--lib/MC/MachObjectWriter.cpp4
4 files changed, 10 insertions, 11 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index d9963ec..6ee1fe0 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -641,7 +641,7 @@ public:
/// in the symbol table, or whether it can be discarded by the assembler. This
/// also effects whether the assembler treats the label as potentially
/// defining a separate atom.
- bool isSymbolLinkerVisible(const MCSymbolData *SD) const;
+ bool isSymbolLinkerVisible(const MCSymbol &SD) const;
/// Emit the section contents using the given object writer.
//
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index c971ee2..69f40a1 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -308,24 +308,23 @@ static bool isScatteredFixupFullyResolved(const MCAssembler &Asm,
return !B_Base && BaseSymbol == A_Base;
}
-bool MCAssembler::isSymbolLinkerVisible(const MCSymbolData *SD) const {
+bool MCAssembler::isSymbolLinkerVisible(const MCSymbol &Symbol) const {
// Non-temporary labels should always be visible to the linker.
- if (!SD->getSymbol().isTemporary())
+ if (!Symbol.isTemporary())
return true;
// Absolute temporary labels are never visible.
- if (!SD->getFragment())
+ if (!Symbol.isInSection())
return false;
// Otherwise, check if the section requires symbols even for temporary labels.
- return getBackend().doesSectionRequireSymbols(
- SD->getFragment()->getParent()->getSection());
+ return getBackend().doesSectionRequireSymbols(Symbol.getSection());
}
const MCSymbolData *MCAssembler::getAtom(const MCAsmLayout &Layout,
const MCSymbolData *SD) const {
// Linker visible symbols define atoms.
- if (isSymbolLinkerVisible(SD))
+ if (isSymbolLinkerVisible(SD->getSymbol()))
return SD;
// Absolute and undefined symbols have no defining atom.
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index d0ea3b6..9eb1cb9 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -159,7 +159,7 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
// Update the current atom map, if necessary.
bool MustCreateFragment = false;
- if (getAssembler().isSymbolLinkerVisible(&SD)) {
+ if (getAssembler().isSymbolLinkerVisible(SD.getSymbol())) {
CurrentAtomMap[getCurrentSectionData()] = &SD;
// We have to create a new fragment, fragments cannot span atoms.
@@ -328,7 +328,7 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData);
SD.setFragment(F);
- if (getAssembler().isSymbolLinkerVisible(&SD))
+ if (getAssembler().isSymbolLinkerVisible(SD.getSymbol()))
F->setAtom(&SD);
Symbol->setSection(*Section);
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp
index f5f444c..7be7af2 100644
--- a/lib/MC/MachObjectWriter.cpp
+++ b/lib/MC/MachObjectWriter.cpp
@@ -936,7 +936,7 @@ public:
const MCSymbol &Symbol = it->getSymbol();
// Ignore non-linker visible symbols.
- if (!Asm.isSymbolLinkerVisible(it))
+ if (!Asm.isSymbolLinkerVisible(it->getSymbol()))
continue;
if (!it->isExternal() && !Symbol.isUndefined())
@@ -972,7 +972,7 @@ public:
const MCSymbol &Symbol = it->getSymbol();
// Ignore non-linker visible symbols.
- if (!Asm.isSymbolLinkerVisible(it))
+ if (!Asm.isSymbolLinkerVisible(it->getSymbol()))
continue;
if (it->isExternal() || Symbol.isUndefined())