projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b76a1e6
)
[AVX] Make VarInit Unique
author
David Greene
<greened@obbligato.org>
Fri, 29 Jul 2011 19:07:21 +0000
(19:07 +0000)
committer
David Greene
<greened@obbligato.org>
Fri, 29 Jul 2011 19:07:21 +0000
(19:07 +0000)
Make sure VarInits are unique and created only once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136497
91177308
-0d34-0410-b5e6-
96231b3b80d8
utils/TableGen/Record.cpp
patch
|
blob
|
history
diff --git
a/utils/TableGen/Record.cpp
b/utils/TableGen/Record.cpp
index a6b5c4b884d93e5a48523783b4acc63c46731c7a..68f9f2a2471412fe1ad3106285b371b73af11e3c 100644
(file)
--- a/
utils/TableGen/Record.cpp
+++ b/
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,