diff options
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/Record.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index a6b5c4b..68f9f2a 100644 --- 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, |