summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:21 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:21 +0000
commitcde30d04b7c21e80fda34fed4c47b87e0869bf45 (patch)
tree9ce363bc84079e46281e6041a8bc5b41b4f2329b /llvm/utils/TableGen/Record.cpp
parentdaba48800fa94e3c712fcf300c31bf4f5a27d550 (diff)
downloadbcm5719-llvm-cde30d04b7c21e80fda34fed4c47b87e0869bf45.tar.gz
bcm5719-llvm-cde30d04b7c21e80fda34fed4c47b87e0869bf45.zip
[AVX] Make VarInit Unique
Make sure VarInits are unique and created only once. llvm-svn: 136497
Diffstat (limited to 'llvm/utils/TableGen/Record.cpp')
-rw-r--r--llvm/utils/TableGen/Record.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp
index a6b5c4b884d..68f9f2a2471 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/utils/TableGen/Record.cpp
@@ -1294,7 +1294,15 @@ TypedInit::convertInitListSlice(const std::vector<unsigned> &Elements) const {
const VarInit *VarInit::get(const std::string &VN, RecTy *T) {
- return new VarInit(VN, T);
+ typedef std::pair<RecTy *, TableGenStringKey> Key;
+ typedef DenseMap<Key, VarInit *> Pool;
+ static Pool ThePool;
+
+ Key TheKey(std::make_pair(T, VN));
+
+ VarInit *&I = ThePool[TheKey];
+ if (!I) I = new VarInit(VN, T);
+ return I;
}
const Init *VarInit::resolveBitReference(Record &R, const RecordVal *IRV,
OpenPOWER on IntegriCloud