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:
08f71e3
)
[AVX] Make FieldInit Unique
author
David Greene
<greened@obbligato.org>
Fri, 29 Jul 2011 19:07:24 +0000
(19:07 +0000)
committer
David Greene
<greened@obbligato.org>
Fri, 29 Jul 2011 19:07:24 +0000
(19:07 +0000)
Make sure FieldInits are unique and created only once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136500
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 89de3edfd192a607a8f9d442222c2149ec5082d6..d4e60839753a17f443e80a2793b4c98ec7808239 100644
(file)
--- a/
utils/TableGen/Record.cpp
+++ b/
utils/TableGen/Record.cpp
@@
-1475,7
+1475,15
@@
std::string DefInit::getAsString() const {
}
const FieldInit *FieldInit::get(const Init *R, const std::string &FN) {
- return new FieldInit(R, FN);
+ typedef std::pair<const Init *, TableGenStringKey> Key;
+ typedef DenseMap<Key, FieldInit *> Pool;
+ static Pool ThePool;
+
+ Key TheKey(std::make_pair(R, FN));
+
+ FieldInit *&I = ThePool[TheKey];
+ if (!I) I = new FieldInit(R, FN);
+ return I;
}
const Init *FieldInit::resolveBitReference(Record &R, const RecordVal *RV,