aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/Record.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 89de3ed..d4e6083 100644
--- 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,