summaryrefslogtreecommitdiffstats
path: root/lld
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-11-28 20:39:17 +0000
committerRui Ueyama <ruiu@google.com>2017-11-28 20:39:17 +0000
commit2017d52b54c181f2236e6c94d43f4aa43c30583f (patch)
tree9c6f4a2dab676e0725580e905e9a1d01be4287ac /lld
parent7b361b50d88fd142cada51b3545ae6c0803c44a5 (diff)
downloadbcm5719-llvm-2017d52b54c181f2236e6c94d43f4aa43c30583f.tar.gz
bcm5719-llvm-2017d52b54c181f2236e6c94d43f4aa43c30583f.zip
Move Memory.{h,cpp} to Common.
Differential Revision: https://reviews.llvm.org/D40571 llvm-svn: 319221
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/Driver.cpp6
-rw-r--r--lld/COFF/DriverUtils.cpp2
-rw-r--r--lld/COFF/InputFiles.cpp2
-rw-r--r--lld/COFF/Memory.h52
-rw-r--r--lld/COFF/SymbolTable.cpp2
-rw-r--r--lld/COFF/Symbols.cpp2
-rw-r--r--lld/COFF/Symbols.h2
-rw-r--r--lld/COFF/Writer.cpp2
-rw-r--r--lld/Common/CMakeLists.txt1
-rw-r--r--lld/Common/Memory.cpp23
-rw-r--r--lld/ELF/Driver.cpp6
-rw-r--r--lld/ELF/DriverUtils.cpp2
-rw-r--r--lld/ELF/GdbIndex.cpp2
-rw-r--r--lld/ELF/InputFiles.cpp2
-rw-r--r--lld/ELF/InputSection.cpp2
-rw-r--r--lld/ELF/LinkerScript.cpp2
-rw-r--r--lld/ELF/MarkLive.cpp2
-rw-r--r--lld/ELF/OutputSections.cpp2
-rw-r--r--lld/ELF/Relocations.cpp2
-rw-r--r--lld/ELF/ScriptParser.cpp2
-rw-r--r--lld/ELF/SymbolTable.cpp2
-rw-r--r--lld/ELF/SyntheticSections.cpp2
-rw-r--r--lld/ELF/Thunks.cpp2
-rw-r--r--lld/ELF/Writer.cpp2
-rw-r--r--lld/include/lld/Common/Memory.h (renamed from lld/ELF/Memory.h)15
-rw-r--r--lld/wasm/Driver.cpp4
-rw-r--r--lld/wasm/InputFiles.cpp2
-rw-r--r--lld/wasm/Memory.h52
-rw-r--r--lld/wasm/OutputSections.cpp2
-rw-r--r--lld/wasm/SymbolTable.cpp2
-rw-r--r--lld/wasm/Writer.cpp2
31 files changed, 54 insertions, 151 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 5125030f775..7ce74b80f56 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -10,13 +10,13 @@
#include "Driver.h"
#include "Config.h"
#include "InputFiles.h"
-#include "Memory.h"
#include "MinGW.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "Writer.h"
#include "lld/Common/Driver.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
@@ -50,10 +50,6 @@ namespace coff {
Configuration *Config;
LinkerDriver *Driver;
-BumpPtrAllocator BAlloc;
-StringSaver Saver{BAlloc};
-std::vector<SpecificAllocBase *> SpecificAllocBase::Instances;
-
bool link(ArrayRef<const char *> Args, bool CanExitEarly, raw_ostream &Diag) {
errorHandler().LogName = Args[0];
errorHandler().ErrorOS = &Diag;
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 64856999902..818a02466d4 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -15,9 +15,9 @@
#include "Config.h"
#include "Driver.h"
-#include "Memory.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/COFF.h"
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 20844b2ff11..1873a2163f0 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -11,10 +11,10 @@
#include "Chunks.h"
#include "Config.h"
#include "Driver.h"
-#include "Memory.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm-c/lto.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
diff --git a/lld/COFF/Memory.h b/lld/COFF/Memory.h
deleted file mode 100644
index 526f11344a0..00000000000
--- a/lld/COFF/Memory.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- Memory.h -------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// See ELF/Memory.h
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_COFF_MEMORY_H
-#define LLD_COFF_MEMORY_H
-
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/StringSaver.h"
-#include <vector>
-
-namespace lld {
-namespace coff {
-
-extern llvm::BumpPtrAllocator BAlloc;
-extern llvm::StringSaver Saver;
-
-struct SpecificAllocBase {
- SpecificAllocBase() { Instances.push_back(this); }
- virtual ~SpecificAllocBase() = default;
- virtual void reset() = 0;
- static std::vector<SpecificAllocBase *> Instances;
-};
-
-template <class T> struct SpecificAlloc : public SpecificAllocBase {
- void reset() override { Alloc.DestroyAll(); }
- llvm::SpecificBumpPtrAllocator<T> Alloc;
-};
-
-template <typename T, typename... U> T *make(U &&... Args) {
- static SpecificAlloc<T> Alloc;
- return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
-}
-
-inline void freeArena() {
- for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
- Alloc->reset();
- BAlloc.Reset();
-}
-}
-}
-
-#endif
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index 538173d7554..02c82b00d19 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -11,9 +11,9 @@
#include "Config.h"
#include "Driver.h"
#include "LTO.h"
-#include "Memory.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp
index 22a2ce6f245..4c5ab48c756 100644
--- a/lld/COFF/Symbols.cpp
+++ b/lld/COFF/Symbols.cpp
@@ -9,9 +9,9 @@
#include "Symbols.h"
#include "InputFiles.h"
-#include "Memory.h"
#include "Strings.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h
index 2d7811b7120..d8a030705e2 100644
--- a/lld/COFF/Symbols.h
+++ b/lld/COFF/Symbols.h
@@ -12,8 +12,8 @@
#include "Chunks.h"
#include "Config.h"
-#include "Memory.h"
#include "lld/Common/LLVM.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFF.h"
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index f76d7d7e075..a676ed993aa 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -12,11 +12,11 @@
#include "DLL.h"
#include "InputFiles.h"
#include "MapFile.h"
-#include "Memory.h"
#include "PDB.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
diff --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index 36b762372ca..2d783830fc3 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -5,6 +5,7 @@ endif()
add_lld_library(lldCommon
Args.cpp
ErrorHandler.cpp
+ Memory.cpp
Reproduce.cpp
Strings.cpp
TargetOptionsCommandFlags.cpp
diff --git a/lld/Common/Memory.cpp b/lld/Common/Memory.cpp
new file mode 100644
index 00000000000..efc5bcc2218
--- /dev/null
+++ b/lld/Common/Memory.cpp
@@ -0,0 +1,23 @@
+//===- Memory.cpp ---------------------------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lld/Common/Memory.h"
+
+using namespace llvm;
+using namespace lld;
+
+BumpPtrAllocator lld::BAlloc;
+StringSaver lld::Saver{BAlloc};
+std::vector<SpecificAllocBase *> lld::SpecificAllocBase::Instances;
+
+void lld::freeArena() {
+ for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
+ Alloc->reset();
+ BAlloc.Reset();
+}
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index d0a1451f9a7..a7882387fb1 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -30,7 +30,6 @@
#include "InputFiles.h"
#include "InputSection.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "ScriptParser.h"
#include "Strings.h"
@@ -41,6 +40,7 @@
#include "lld/Common/Args.h"
#include "lld/Common/Driver.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/StringExtras.h"
@@ -65,10 +65,6 @@ using namespace lld::elf;
Configuration *elf::Config;
LinkerDriver *elf::Driver;
-BumpPtrAllocator elf::BAlloc;
-StringSaver elf::Saver{BAlloc};
-std::vector<SpecificAllocBase *> elf::SpecificAllocBase::Instances;
-
static void setConfigs();
bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly,
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index f6d462cac25..56f9c0ffc3d 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -14,8 +14,8 @@
//===----------------------------------------------------------------------===//
#include "Driver.h"
-#include "Memory.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Reproduce.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Optional.h"
diff --git a/lld/ELF/GdbIndex.cpp b/lld/ELF/GdbIndex.cpp
index 59de26281d6..3b82beed5f6 100644
--- a/lld/ELF/GdbIndex.cpp
+++ b/lld/ELF/GdbIndex.cpp
@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
#include "GdbIndex.h"
-#include "Memory.h"
+#include "lld/Common/Memory.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
#include "llvm/Object/ELFObjectFile.h"
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 7d06fd755d4..666781aa64b 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -10,11 +10,11 @@
#include "InputFiles.h"
#include "InputSection.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index f94f133b15b..2f6f7e7e59e 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -12,13 +12,13 @@
#include "EhFrame.h"
#include "InputFiles.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Relocations.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/Object/Decompressor.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Compression.h"
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 2140eb4148e..e5cf10d1350 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -14,7 +14,6 @@
#include "LinkerScript.h"
#include "Config.h"
#include "InputSection.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
@@ -22,6 +21,7 @@
#include "SyntheticSections.h"
#include "Target.h"
#include "Writer.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index e619a955b7f..e27d35c9a89 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -22,13 +22,13 @@
#include "InputSection.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "Target.h"
#include "Writer.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Object/ELF.h"
#include <functional>
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index bc67a000e88..f87b52441bd 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -10,11 +10,11 @@
#include "OutputSections.h"
#include "Config.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Compression.h"
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 2ebb58bf4e6..4280f10741f 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -44,13 +44,13 @@
#include "Relocations.h"
#include "Config.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
+#include "lld/Common/Memory.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 8130f27a53e..d56500ae7dd 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -17,11 +17,11 @@
#include "Driver.h"
#include "InputSection.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "ScriptLexer.h"
#include "Symbols.h"
#include "Target.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 08a6d2feddb..6b61213896f 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -17,10 +17,10 @@
#include "SymbolTable.h"
#include "Config.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Strings.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index f38eda50117..79fd0ef298f 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -19,13 +19,13 @@
#include "Config.h"
#include "InputFiles.h"
#include "LinkerScript.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"
#include "Writer.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "lld/Common/Version.h"
#include "llvm/BinaryFormat/Dwarf.h"
diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index 81b5a3b35d3..65c8de738ad 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -24,12 +24,12 @@
#include "Thunks.h"
#include "Config.h"
#include "InputSection.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 0ab33f585db..e8e0235ac45 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -12,13 +12,13 @@
#include "Filesystem.h"
#include "LinkerScript.h"
#include "MapFile.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "Relocations.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
diff --git a/lld/ELF/Memory.h b/lld/include/lld/Common/Memory.h
index 4000f2f9f1c..699f7c1654c 100644
--- a/lld/ELF/Memory.h
+++ b/lld/include/lld/Common/Memory.h
@@ -17,24 +17,23 @@
// Arena allocators are efficient and easy to understand.
// Most objects are allocated using the arena allocators defined by this file.
//
-// If you edit this file, please edit COFF/Memory.h too.
-//
//===----------------------------------------------------------------------===//
-#ifndef LLD_ELF_MEMORY_H
-#define LLD_ELF_MEMORY_H
+#ifndef LLD_COMMON_MEMORY_H
+#define LLD_COMMON_MEMORY_H
#include "llvm/Support/Allocator.h"
#include "llvm/Support/StringSaver.h"
#include <vector>
namespace lld {
-namespace elf {
// Use this arena if your object doesn't have a destructor.
extern llvm::BumpPtrAllocator BAlloc;
extern llvm::StringSaver Saver;
+void freeArena();
+
// These two classes are hack to keep track of all
// SpecificBumpPtrAllocator instances.
struct SpecificAllocBase {
@@ -56,12 +55,6 @@ template <typename T, typename... U> T *make(U &&... Args) {
return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
}
-inline void freeArena() {
- for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
- Alloc->reset();
- BAlloc.Reset();
-}
-} // namespace elf
} // namespace lld
#endif
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index c266600ca6d..d6667b63f3a 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -9,11 +9,11 @@
#include "lld/Common/Driver.h"
#include "Config.h"
-#include "Memory.h"
#include "SymbolTable.h"
#include "Writer.h"
#include "lld/Common/Args.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Twine.h"
@@ -61,9 +61,7 @@ private:
} // anonymous namespace
-std::vector<SpecificAllocBase *> lld::wasm::SpecificAllocBase::Instances;
Configuration *lld::wasm::Config;
-BumpPtrAllocator lld::wasm::BAlloc;
bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
raw_ostream &Error) {
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index 81b6e7c0c49..9cb4e08619c 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -11,10 +11,10 @@
#include "Config.h"
#include "InputSegment.h"
-#include "Memory.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Wasm.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/Memory.h b/lld/wasm/Memory.h
deleted file mode 100644
index 2141bc3e125..00000000000
--- a/lld/wasm/Memory.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- Memory.h -------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// See WASM/Memory.h
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_WASM_MEMORY_H
-#define LLD_WASM_MEMORY_H
-
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/StringSaver.h"
-#include <vector>
-
-namespace lld {
-namespace wasm {
-
-extern llvm::BumpPtrAllocator BAlloc;
-extern llvm::StringSaver Saver;
-
-struct SpecificAllocBase {
- SpecificAllocBase() { Instances.push_back(this); }
- virtual ~SpecificAllocBase() = default;
- virtual void reset() = 0;
- static std::vector<SpecificAllocBase *> Instances;
-};
-
-template <class T> struct SpecificAlloc : public SpecificAllocBase {
- void reset() override { Alloc.DestroyAll(); }
- llvm::SpecificBumpPtrAllocator<T> Alloc;
-};
-
-template <typename T, typename... U> T *make(U &&... Args) {
- static SpecificAlloc<T> Alloc;
- return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
-}
-
-inline void freeArena() {
- for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
- Alloc->reset();
- BAlloc.Reset();
-}
-} // namespace wasm
-} // namespace lld
-
-#endif
diff --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp
index 444099ca832..8bb46a71ef0 100644
--- a/lld/wasm/OutputSections.cpp
+++ b/lld/wasm/OutputSections.cpp
@@ -11,10 +11,10 @@
#include "Config.h"
#include "InputFiles.h"
-#include "Memory.h"
#include "OutputSegment.h"
#include "SymbolTable.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/LEB128.h"
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 722d5a0da16..72f6bdd8e8f 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -10,9 +10,9 @@
#include "SymbolTable.h"
#include "Config.h"
-#include "Memory.h"
#include "Strings.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include <unordered_set>
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index a97d6887a2b..301326ba375 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -10,12 +10,12 @@
#include "Writer.h"
#include "Config.h"
-#include "Memory.h"
#include "OutputSections.h"
#include "OutputSegment.h"
#include "SymbolTable.h"
#include "WriterUtils.h"
#include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/Format.h"
OpenPOWER on IntegriCloud