aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/Record.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index ee5db47..133a158 100644
--- a/utils/TableGen/Record.cpp
+++ b/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) {