summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:12 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:12 +0000
commit2855b0f0730b1a31aa156ea667fee79f66be4b03 (patch)
treefbf8a8dd8c055009d6c395e4d75a3b8181d5a7d2 /utils/TableGen
parent726bbde3c4ac5a279c86d1632b7b94498b01854a (diff)
downloadllvm-2855b0f0730b1a31aa156ea667fee79f66be4b03.tar.gz
llvm-2855b0f0730b1a31aa156ea667fee79f66be4b03.tar.bz2
llvm-2855b0f0730b1a31aa156ea667fee79f66be4b03.tar.xz
[AVX] Make IntInit Unique
Use a DenseMap to make sure only one IntInit of any value exists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/Record.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 77c0d1a491..54edfe5ea8 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -539,7 +539,12 @@ const Init *BitsInit::resolveReferences(Record &R, const RecordVal *RV) const {
}
const IntInit *IntInit::get(int64_t V) {
- return new IntInit(V);
+ typedef DenseMap<int64_t, IntInit *> Pool;
+ static Pool ThePool;
+
+ IntInit *&I = ThePool[V];
+ if (!I) I = new IntInit(V);
+ return I;
}
std::string IntInit::getAsString() const {