Hi,
a rather basic table-gen question, but quite recurring issue I have.
Is there a way to allow PatFrags to always match an input, returning the matching node it self in worst case, without an operation?
For example, now I need to do this:
def NoZeroChange : PatFrags<(ops node:$a),
[(abs node:$a),
(sub node:$a, 0)]>;
def HasZero : PatFrags<(ops node:$a),
[(icmp (NoZeroChange node:$a), 0),
(icmp node:$a, 0)]>; <<< I want to avoid this line
I would like something like this:
def NoZeroChange : PatFrags<(ops node:$a),
[(abs node:$a),
(sub node:$a, 0),
(node:$a)]>; <<<< This is not allowed
def HasZero : PatFrag<(ops node:$a),
(icmp (NoZeroChange node:$a), 0)>;
This would highly make life easier in not having to expand that by hand, especially useful if the matching patfrag is used in multiple operands:
def ManyArgs : PatFrags<(opt node:$a, node:$b, node:$c, node:$d),
(int_my_crazyop
(NoZeroChange node:$a),
(NoZeroChange node:$b),
(NoZeroChange node:$c),
(NoZeroChange node:$d))>; << A single line instead of 16.
Perhaps is it possible to do an always matching SDNode?
def NoZeroChange : PatFrags<(ops node:$a),
[(abs node:$a),
(sub node:$a, 0),
(True node:$a)]>; ???
Does anyone done something alike this?
Thanks in advance.
Diogo.