[llvm] [GlobalISel][TableGen] MIR Pattern Variadics (PR #100563)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 06:18:08 PDT 2024


================
@@ -713,6 +731,12 @@ class GIMatchTableExecutor {
     return Ret;
   }
 
+  static ArrayRef<MachineOperand> getVariadicOperands(const MachineInstr &MI,
----------------
Pierre-vh wrote:

Will do, this can probably go into a separate file as well with other Combiner utils.

The direction I took with GIVariadic is that it's just a "variable operand pack", so 1 or more operands bundled together. It's not tied to the nature of the instruction itself.
You could write `G_MUL $x, GIVariadic<>:$lhsAndRhs` and that would also work.

Writing that now I realize that maybe this should be called something else, maybe something like a operand "bundle" or "pack". Or I should revert that decision and make it all about variadic instructions?

I like the idea of making them neutral because it gives more room to breathe for future feature, for instance if we have some kind of templated pattern for multiple opcodes each with a different number of inputs, we could use a GIVariadic to model the operands.

https://github.com/llvm/llvm-project/pull/100563


More information about the llvm-commits mailing list