mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-11 21:38:46 +00:00
[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:
parent
b76a1e6993
commit
e0be0e361a
@ -1294,7 +1294,15 @@ TypedInit::convertInitListSlice(const std::vector<unsigned> &Elements) const {
|
|||||||
|
|
||||||
|
|
||||||
const VarInit *VarInit::get(const std::string &VN, RecTy *T) {
|
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,
|
const Init *VarInit::resolveBitReference(Record &R, const RecordVal *IRV,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user