mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-05 02:28:51 +00:00
[AVX] Make VarListElementInit Unique
Make sure VarListElementInits are unique and created only once. llvm-svn: 136499
This commit is contained in:
parent
488cb6519c
commit
619a865a18
@ -1414,7 +1414,16 @@ const Init *VarBitInit::resolveReferences(Record &R,
|
||||
|
||||
const VarListElementInit *VarListElementInit::get(const TypedInit *T,
|
||||
unsigned E) {
|
||||
return new VarListElementInit(T, E);
|
||||
typedef std::pair<const TypedInit *, unsigned> Key;
|
||||
typedef DenseMap<Key, VarListElementInit *> Pool;
|
||||
|
||||
static Pool ThePool;
|
||||
|
||||
Key TheKey(std::make_pair(T, E));
|
||||
|
||||
VarListElementInit *&I = ThePool[TheKey];
|
||||
if (!I) I = new VarListElementInit(T, E);
|
||||
return I;
|
||||
}
|
||||
|
||||
std::string VarListElementInit::getAsString() const {
|
||||
|
Loading…
Reference in New Issue
Block a user