mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 04:35:00 +00:00
[AVX] Make TernOpInit Unique
Make sure TernOpInits are unique and created only once. This will be important for AVX/SIMD as many operators will be used to generate patterns and other relevant data. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65a5b8cb3b
commit
b76a1e6993
@ -975,7 +975,26 @@ std::string BinOpInit::getAsString() const {
|
||||
const TernOpInit *TernOpInit::get(TernaryOp opc, const Init *lhs,
|
||||
const Init *mhs, const Init *rhs,
|
||||
RecTy *Type) {
|
||||
return new TernOpInit(opc, lhs, mhs, rhs, Type);
|
||||
typedef std::pair<
|
||||
std::pair<
|
||||
std::pair<std::pair<unsigned, RecTy *>, const Init *>,
|
||||
const Init *
|
||||
>,
|
||||
const Init *
|
||||
> Key;
|
||||
|
||||
typedef DenseMap<Key, TernOpInit *> Pool;
|
||||
static Pool ThePool;
|
||||
|
||||
Key TheKey(std::make_pair(std::make_pair(std::make_pair(std::make_pair(opc,
|
||||
Type),
|
||||
lhs),
|
||||
mhs),
|
||||
rhs));
|
||||
|
||||
TernOpInit *&I = ThePool[TheKey];
|
||||
if (!I) I = new TernOpInit(opc, lhs, mhs, rhs, Type);
|
||||
return I;
|
||||
}
|
||||
|
||||
static const Init *ForeachHelper(const Init *LHS, const Init *MHS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user