mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-05 02:28:51 +00:00
[AVX] Make BinOpInit Unique
Make sure BinOpInits 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. llvm-svn: 136495
This commit is contained in:
parent
9ee3433c62
commit
b561cf4112
@ -860,7 +860,20 @@ std::string UnOpInit::getAsString() const {
|
||||
|
||||
const BinOpInit *BinOpInit::get(BinaryOp opc, const Init *lhs,
|
||||
const Init *rhs, RecTy *Type) {
|
||||
return new BinOpInit(opc, lhs, rhs, Type);
|
||||
typedef std::pair<
|
||||
std::pair<std::pair<unsigned, const Init *>, const Init *>,
|
||||
RecTy *
|
||||
> Key;
|
||||
|
||||
typedef DenseMap<Key, BinOpInit *> Pool;
|
||||
static Pool ThePool;
|
||||
|
||||
Key TheKey(std::make_pair(std::make_pair(std::make_pair(opc, lhs), rhs),
|
||||
Type));
|
||||
|
||||
BinOpInit *&I = ThePool[TheKey];
|
||||
if (!I) I = new BinOpInit(opc, lhs, rhs, Type);
|
||||
return I;
|
||||
}
|
||||
|
||||
const Init *BinOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
|
||||
|
Loading…
Reference in New Issue
Block a user