[PATCH] D23601: [TII] add new target hook isAdd

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 06:09:55 PDT 2016


kparzysz added a comment.

In https://reviews.llvm.org/D23601#519181, @hfinkel wrote:

> I'd really like an interface that allows converting from an MI entity to something with known semantics; I think that, with the new generic opcodes being introduced for GlobalISel, we have a good opportunity here. How about the following interface (modulo bikeshedding)?
>
>   MachineOperand *Op0, *Op1, *Op2;
>   if (TII->convertToGenericOp(MI, Op0, Op1, Op2) == G_ADD) {
>     // This MI is equivalent to Op0 = G_ADD Op1, Op2
>   }


I've been planning to implement something along the lines of the m_xxx pattern matching for MachineInstr. There would be some set of predefined generic operations, such as add, mul, shift, etc. but an object that can match an "add" operation could also be annotated with flags indicating that the "add" should be saturating, for example.  In the absence of such annotations, the matched object would acquire such annotations from the instruction that it matched.


https://reviews.llvm.org/D23601





More information about the llvm-commits mailing list