mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
[AVX] Make VarBitInit Unique
Make sure VarBitInits are unique and created only once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136498 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e0be0e361a
commit
aa839b8fa3
@ -1389,7 +1389,16 @@ const Init *VarInit::resolveReferences(Record &R, const RecordVal *RV) const {
|
||||
}
|
||||
|
||||
const VarBitInit *VarBitInit::get(const TypedInit *T, unsigned B) {
|
||||
return new VarBitInit(T, B);
|
||||
typedef std::pair<const TypedInit *, unsigned> Key;
|
||||
typedef DenseMap<Key, VarBitInit *> Pool;
|
||||
|
||||
static Pool ThePool;
|
||||
|
||||
Key TheKey(std::make_pair(T, B));
|
||||
|
||||
VarBitInit *&I = ThePool[TheKey];
|
||||
if (!I) I = new VarBitInit(T, B);
|
||||
return I;
|
||||
}
|
||||
|
||||
std::string VarBitInit::getAsString() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user