summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/utils/TableGen/Record.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp
index 4608d7aa149..8fc0c18cd4b 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/utils/TableGen/Record.cpp
@@ -714,7 +714,16 @@ const Init *OpInit::resolveListElementReference(Record &R, const RecordVal *IRV,
}
const UnOpInit *UnOpInit::get(UnaryOp opc, const Init *lhs, RecTy *Type) {
- return new UnOpInit(opc, lhs, Type);
+ typedef std::pair<std::pair<unsigned, const Init *>, RecTy *> Key;
+
+ typedef DenseMap<Key, UnOpInit *> Pool;
+ static Pool ThePool;
+
+ Key TheKey(std::make_pair(std::make_pair(opc, lhs), Type));
+
+ UnOpInit *&I = ThePool[TheKey];
+ if (!I) I = new UnOpInit(opc, lhs, Type);
+ return I;
}
const Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
OpenPOWER on IntegriCloud