[AVX] Make VarInit Unique

Make sure VarInits are unique and created only once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene 2011-07-29 19:07:21 +00:00
parent b76a1e6993
commit e0be0e361a

View File

@ -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,