[llvm] r334734 - Revert "[MC] Factor MCObjectStreamer::addFragmentAtoms out of MachO streamer."
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 10:11:20 PDT 2018
Author: sbc
Date: Thu Jun 14 10:11:19 2018
New Revision: 334734
URL: http://llvm.org/viewvc/llvm-project?rev=334734&view=rev
Log:
Revert "[MC] Factor MCObjectStreamer::addFragmentAtoms out of MachO streamer."
This reverts rL331412. We didn't up using fragment atoms
in the wasm object writer after all.
Differential Revision: https://reviews.llvm.org/D48173
Modified:
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
Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=334734&r1=334733&r2=334734&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Thu Jun 14 10:11:19 2018
@@ -87,8 +87,6 @@ protected:
/// 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;
Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=334734&r1=334733&r2=334734&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Thu Jun 14 10:11:19 2018
@@ -459,7 +459,30 @@ void MCMachOStreamer::FinishImpl() {
// 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();
}
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=334734&r1=334733&r2=334734&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Thu Jun 14 10:11:19 2018
@@ -59,32 +59,6 @@ void MCObjectStreamer::flushPendingLabel
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,
Modified: llvm/trunk/lib/MC/MCWasmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCWasmStreamer.cpp?rev=334734&r1=334733&r2=334734&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCWasmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCWasmStreamer.cpp Thu Jun 14 10:11:19 2018
@@ -191,9 +191,6 @@ void MCWasmStreamer::EmitInstToData(cons
void MCWasmStreamer::FinishImpl() {
EmitFrames(nullptr);
- // Set fragment atoms so we can map from code fragment to defining symbol
- addFragmentAtoms();
-
this->MCObjectStreamer::FinishImpl();
}
More information about the llvm-commits
mailing list