summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/Atoms.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-06-28 03:41:07 +0000
committerRui Ueyama <ruiu@google.com>2013-06-28 03:41:07 +0000
commit1a54aad50b3547e025f4e553d548ae9e5cd7d783 (patch)
tree30f958687f99aabe22073eb99aee181994e3a884 /lld/lib/ReaderWriter/PECOFF/Atoms.cpp
parentfbfdced30ff483dd8e4dd74b811122a63da06611 (diff)
downloadbcm5719-llvm-1a54aad50b3547e025f4e553d548ae9e5cd7d783.tar.gz
bcm5719-llvm-1a54aad50b3547e025f4e553d548ae9e5cd7d783.zip
[PECOFF][Writer] Templatize connectAtomsWithLayoutEdge()
Templatize connectAtomsWithLayoutEdge() so that it can handle other types of defined atoms. llvm-svn: 185125
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/Atoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/Atoms.cpp48
1 files changed, 0 insertions, 48 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/Atoms.cpp b/lld/lib/ReaderWriter/PECOFF/Atoms.cpp
deleted file mode 100644
index 2fb1aa19aec..00000000000
--- a/lld/lib/ReaderWriter/PECOFF/Atoms.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===- lib/ReaderWriter/PECOFF/Atoms.cpp ----------------------------------===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Atoms.h"
-
-namespace lld {
-namespace coff {
-
-namespace {
-void addEdge(COFFDefinedAtom *a, COFFDefinedAtom *b,
- lld::Reference::Kind kind) {
- auto ref = new COFFReference(kind);
- ref->setTarget(b);
- a->addReference(std::unique_ptr<COFFReference>(ref));
-}
-
-void connectWithLayoutEdge(COFFDefinedAtom *a, COFFDefinedAtom *b) {
- addEdge(a, b, lld::Reference::kindLayoutAfter);
- addEdge(b, a, lld::Reference::kindLayoutBefore);
-}
-} // anonymous namespace
-
-/// Connect atoms with layout-{before,after} edges. It usually serves two
-/// purposes.
-///
-/// - To prevent atoms from being GC'ed (aka dead-stripped) if there is a
-/// reference to one of the atoms. In that case we want to emit all the
-/// atoms appeared in the same section, because the referenced "live" atom
-/// may reference other atoms in the same section. If we don't add layout
-/// edges between atoms, unreferenced atoms in the same section would be
-/// GC'ed.
-/// - To preserve the order of atmos. We want to emit the atoms in the
-/// same order as they appeared in the input object file.
-void connectAtomsWithLayoutEdge(std::vector<COFFDefinedAtom *> atoms) {
- if (atoms.size() < 2)
- return;
- for (auto it = atoms.begin(), e = atoms.end(); it + 1 != e; ++it)
- connectWithLayoutEdge(*it, *(it + 1));
-}
-
-} // namespace coff
-} // namespace lld
OpenPOWER on IntegriCloud