summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:15 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:15 +0000
commit3468b0f4832245ad7aa316db11773666a15b07c3 (patch)
tree272d3b8b55195d5e893a2cf256f327883708020b /llvm
parent3ff33c9123e943af2230c4e37becf826d937d725 (diff)
downloadbcm5719-llvm-3468b0f4832245ad7aa316db11773666a15b07c3.tar.gz
bcm5719-llvm-3468b0f4832245ad7aa316db11773666a15b07c3.zip
[AVX] Make CodeInit Unique
Use a StringMap to ensure CodeInits are unique and created only once. llvm-svn: 136492
Diffstat (limited to 'llvm')
-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 ee5db4713dc..133a1581c0e 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/utils/TableGen/Record.cpp
@@ -575,7 +575,12 @@ const StringInit *StringInit::get(const std::string &V) {
}
const CodeInit *CodeInit::get(const std::string &V) {
- return new CodeInit(V);
+ typedef StringMap<CodeInit *> Pool;
+ static Pool ThePool;
+
+ CodeInit *&I = ThePool[V];
+ if (!I) I = new CodeInit(V);
+ return I;
}
const ListInit *ListInit::get(ArrayRef<const Init *> Range, RecTy *EltTy) {
OpenPOWER on IntegriCloud