summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Memory.h
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-10-28 20:57:25 +0000
committerRui Ueyama <ruiu@google.com>2016-10-28 20:57:25 +0000
commit55518e7dd873904eea19e943d526a9d064a3b6cb (patch)
treea6d6e65f58e7ec39da10526642a4e6c9d71ea11a /lld/ELF/Memory.h
parent8ee6f0c30f460ffe09d3c9d47d1ee1efdac82a6a (diff)
downloadbcm5719-llvm-55518e7dd873904eea19e943d526a9d064a3b6cb.tar.gz
bcm5719-llvm-55518e7dd873904eea19e943d526a9d064a3b6cb.zip
Consolidate BumpPtrAllocators.
Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
Diffstat (limited to 'lld/ELF/Memory.h')
-rw-r--r--lld/ELF/Memory.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/lld/ELF/Memory.h b/lld/ELF/Memory.h
new file mode 100644
index 00000000000..6ac312baa79
--- /dev/null
+++ b/lld/ELF/Memory.h
@@ -0,0 +1,37 @@
+//===- Memory.h -------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines arena allocators.
+//
+// Almost all large objects, such as files, sections or symbols, are
+// used for the entire lifetime of the linker once they are created.
+// This usage characteristic makes arena allocator an attractive choice
+// where the entire linker is one arena. With an arena, newly created
+// objects belong to the arena and freed all at once when everything is done.
+// Arena allocators are efficient and easy to understand.
+// Most objects are allocated using the arena allocators defined by this file.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_ELF_MEMORY_H
+#define LLD_ELF_MEMORY_H
+
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/StringSaver.h"
+
+namespace lld {
+namespace elf {
+extern llvm::BumpPtrAllocator BAlloc;
+extern llvm::StringSaver Saver;
+
+void freeArena();
+}
+}
+
+#endif
OpenPOWER on IntegriCloud