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