mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-28 16:11:29 +00:00
[RISCV] Add tablegen helper classes to create PatFrag to check for one use. NFC
Reduces code and the class can be instantiated in isel patterns to avoid creating more *_oneuse classes.
This commit is contained in:
parent
b905864845
commit
e9d4922543
@ -1091,13 +1091,14 @@ def assertzexti32 : PatFrag<(ops node:$src), (assertzext node:$src), [{
|
||||
}]>;
|
||||
def zexti32 : ComplexPattern<i64, 1, "selectZExti32">;
|
||||
|
||||
def add_oneuse : PatFrag<(ops node:$A, node:$B), (add node:$A, node:$B), [{
|
||||
class binop_oneuse<SDPatternOperator operator>
|
||||
: PatFrag<(ops node:$A, node:$B),
|
||||
(operator node:$A, node:$B), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
|
||||
def mul_oneuse : PatFrag<(ops node:$A, node:$B), (mul node:$A, node:$B), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
def add_oneuse : binop_oneuse<add>;
|
||||
def mul_oneuse : binop_oneuse<mul>;
|
||||
|
||||
def mul_const_oneuse : PatFrag<(ops node:$A, node:$B),
|
||||
(mul node:$A, node:$B), [{
|
||||
@ -1107,22 +1108,16 @@ def mul_const_oneuse : PatFrag<(ops node:$A, node:$B),
|
||||
return false;
|
||||
}]>;
|
||||
|
||||
def sext_oneuse : PatFrag<(ops node:$A), (sext node:$A), [{
|
||||
class unop_oneuse<SDPatternOperator operator>
|
||||
: PatFrag<(ops node:$A),
|
||||
(operator node:$A), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
|
||||
def zext_oneuse : PatFrag<(ops node:$A), (zext node:$A), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
|
||||
def anyext_oneuse : PatFrag<(ops node:$A), (anyext node:$A), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
|
||||
def fpext_oneuse : PatFrag<(ops node:$A),
|
||||
(any_fpextend node:$A), [{
|
||||
return N->hasOneUse();
|
||||
}]>;
|
||||
def sext_oneuse : unop_oneuse<sext>;
|
||||
def zext_oneuse : unop_oneuse<zext>;
|
||||
def anyext_oneuse : unop_oneuse<anyext>;
|
||||
def fpext_oneuse : unop_oneuse<any_fpextend>;
|
||||
|
||||
/// Simple arithmetic operations
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user