summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:23 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:23 +0000
commit08f71e3e7437359f94fed3207bc64d8cc54ef3f3 (patch)
treee6b5637aeda8016c19322530cec193b4ad9830dc /utils
parentaa839b8fa3e4500551f23b20491c1c55e89567b5 (diff)
downloadllvm-08f71e3e7437359f94fed3207bc64d8cc54ef3f3.tar.gz
llvm-08f71e3e7437359f94fed3207bc64d8cc54ef3f3.tar.bz2
llvm-08f71e3e7437359f94fed3207bc64d8cc54ef3f3.tar.xz
[AVX] Make VarListElementInit Unique
Make sure VarListElementInits are unique and created only once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/Record.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 3a022fc151..89de3edfd1 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -1414,7 +1414,16 @@ const Init *VarBitInit::resolveReferences(Record &R,
const VarListElementInit *VarListElementInit::get(const TypedInit *T,
unsigned E) {
- return new VarListElementInit(T, E);
+ typedef std::pair<const TypedInit *, unsigned> Key;
+ typedef DenseMap<Key, VarListElementInit *> Pool;
+
+ static Pool ThePool;
+
+ Key TheKey(std::make_pair(T, E));
+
+ VarListElementInit *&I = ThePool[TheKey];
+ if (!I) I = new VarListElementInit(T, E);
+ return I;
}
std::string VarListElementInit::getAsString() const {