[AVX] Make FieldInit Unique

Make sure FieldInits are unique and created only once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene 2011-07-29 19:07:24 +00:00
parent 08f71e3e74
commit 65bf3ca9aa

View File

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