summaryrefslogtreecommitdiffstats
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
commita44263c0cc9e279b4f250cb39886312bff166dff (patch)
tree2d82b64e1d9336170711771a3d187c4ed1aca7bc
parentdc7b96e909ec5fb8f49f900936356cc2f2e478aa (diff)
downloadbcm5719-llvm-a44263c0cc9e279b4f250cb39886312bff166dff.tar.gz
bcm5719-llvm-a44263c0cc9e279b4f250cb39886312bff166dff.zip
[AVX] Make IntInit Unique
Use a DenseMap to make sure only one IntInit of any value exists. llvm-svn: 136490
-rw-r--r--llvm/utils/TableGen/Record.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp
index 77c0d1a491d..54edfe5ea8f 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/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 {
OpenPOWER on IntegriCloud