Issue 87459
Summary [GISel] Add variable operand MIR patterns
Labels llvm:globalisel
Assignees Pierre-vh
Reporter Pierre-vh
    ## Description

Allow "parameter packs" or similar for MIR patterns to support matching any number of operands.
e.g. `G_BUILD_VECTOR` has a variable number of operands, and currently we can only write patterns for a fixed number of operands.

## Optional goals:
 - Accessing the front or back of the variadic operands list
 - Accessing the nth item of the variadic operands list
 - Additional constraints such as min/max number of arguments.
 - Rewriting the variadic operands
   - This isn't as important I think, I can't think of many patterns that'd need a variadic instruction in and out. Do it if it's trivial?

## Syntax suggestion

- `G_BUILD_VECTOR $x, $y, varargs:$others`
- `G_BUILD_VECTOR $x, $y, varargs<2,4>:$others // 2 to 4 operands`


## Potential issues

- Should the variadic operand(s) act as "one or more" or "zero or more"? e.g. in the first example above, should a 2-operand BUILD_VECTOR be allowed, or does `varargs:$others` implies at least 3 operands in total?

## Related

#87194 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to