MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 16 Jun 2010 20:04:29 +0000 (20:04 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 16 Jun 2010 20:04:29 +0000 (20:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106142 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
lib/MC/MCAssembler.cpp
lib/MC/MCMachOStreamer.cpp
lib/MC/MachObjectWriter.cpp

index d9963ec4821a569901e327a0ff152904df0f2242..6ee1fe0cd831632ef08dc1e22716315e774b14c6 100644 (file)
@@ -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.
   //
index c971ee207f9be1512143ef275039624c22df3b80..69f40a1c1915e39e05ed0ffc88bb0863d5d0d70b 100644 (file)
@@ -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.
index d0ea3b6780681b1e2d2f5c2a518daeb674008dff..9eb1cb9baea19291f2d9e034698a113aea3874d5 100644 (file)
@@ -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);
index f5f444c78c2398b39dff459e4d629648f94e9b75..7be7af21b3f0181217839544bead5fa6cafd4748 100644 (file)
@@ -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())