[PATCH] D48173: Revert "[MC] Factor MCObjectStreamer::addFragmentAtoms out of MachO streamer."

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 10:15:58 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334734: Revert "[MC] Factor MCObjectStreamer::addFragmentAtoms out of MachO streamer." (authored by sbc, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48173

Files:
  llvm/trunk/include/llvm/MC/MCObjectStreamer.h
  llvm/trunk/lib/MC/MCMachOStreamer.cpp
  llvm/trunk/lib/MC/MCObjectStreamer.cpp
  llvm/trunk/lib/MC/MCWasmStreamer.cpp


Index: llvm/trunk/lib/MC/MCMachOStreamer.cpp
===================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp
@@ -459,7 +459,30 @@
 
   // We have to set the fragment atom associations so we can relax properly for
   // Mach-O.
-  addFragmentAtoms();
+
+  // First, scan the symbol table to build a lookup table from fragments to
+  // defining symbols.
+  DenseMap<const MCFragment *, const MCSymbol *> DefiningSymbolMap;
+  for (const MCSymbol &Symbol : getAssembler().symbols()) {
+    if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() &&
+        !Symbol.isVariable()) {
+      // An atom defining symbol should never be internal to a fragment.
+      assert(Symbol.getOffset() == 0 &&
+             "Invalid offset in atom defining symbol!");
+      DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
+    }
+  }
+
+  // Set the fragment atom associations by tracking the last seen atom defining
+  // symbol.
+  for (MCSection &Sec : getAssembler()) {
+    const MCSymbol *CurrentAtom = nullptr;
+    for (MCFragment &Frag : Sec) {
+      if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
+        CurrentAtom = Symbol;
+      Frag.setAtom(CurrentAtom);
+    }
+  }
 
   this->MCObjectStreamer::FinishImpl();
 }
Index: llvm/trunk/lib/MC/MCWasmStreamer.cpp
===================================================================
--- llvm/trunk/lib/MC/MCWasmStreamer.cpp
+++ llvm/trunk/lib/MC/MCWasmStreamer.cpp
@@ -191,9 +191,6 @@
 void MCWasmStreamer::FinishImpl() {
   EmitFrames(nullptr);
 
-  // Set fragment atoms so we can map from code fragment to defining symbol
-  addFragmentAtoms();
-
   this->MCObjectStreamer::FinishImpl();
 }
 
Index: llvm/trunk/lib/MC/MCObjectStreamer.cpp
===================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp
@@ -59,32 +59,6 @@
   PendingLabels.clear();
 }
 
-void MCObjectStreamer::addFragmentAtoms() {
-  // First, scan the symbol table to build a lookup table from fragments to
-  // defining symbols.
-  DenseMap<const MCFragment *, const MCSymbol *> DefiningSymbolMap;
-  for (const MCSymbol &Symbol : getAssembler().symbols()) {
-    if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() &&
-        !Symbol.isVariable()) {
-      // An atom defining symbol should never be internal to a fragment.
-      assert(Symbol.getOffset() == 0 &&
-             "Invalid offset in atom defining symbol!");
-      DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
-    }
-  }
-
-  // Set the fragment atom associations by tracking the last seen atom defining
-  // symbol.
-  for (MCSection &Sec : getAssembler()) {
-    const MCSymbol *CurrentAtom = nullptr;
-    for (MCFragment &Frag : Sec) {
-      if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
-        CurrentAtom = Symbol;
-      Frag.setAtom(CurrentAtom);
-    }
-  }
-}
-
 // As a compile-time optimization, avoid allocating and evaluating an MCExpr
 // tree for (Hi - Lo) when Hi and Lo are offsets into the same fragment.
 static Optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
Index: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
===================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h
@@ -87,8 +87,6 @@
   /// will be used as a symbol offset within the fragment.
   void flushPendingLabels(MCFragment *F, uint64_t FOffset = 0);
 
-  void addFragmentAtoms();
-
 public:
   void visitUsedSymbol(const MCSymbol &Sym) override;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48173.151375.patch
Type: text/x-patch
Size: 3699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180614/2d795cd7/attachment.bin>


More information about the llvm-commits mailing list