Given a trivial example here:
func.func private @apply(%f: (i32) -> i32, %x : i32) -> i32
func.func @double(%x : i32) -> i32 {
%0 = llvm.mlir.constant(2 : i32) : i32
%1 = arith.muli %x, %0 : i32
llvm.return %1 : i32
}
func.func @main() {
%f = func.constant @double : (i32) -> i32
%x = arith.constant 5 : i32
%result = func.call @apply(%f, %x) : ((i32) -> i32, i32) -> i32
llvm.return
}
Is there a way to generalize @apply so that it binds on any callable that takes arbitrarily typed variadic arguments?
The documentation on func dialect operations itself is minimal and doesn’t seem to address variadics that much, hence this post.
Note that the functions I want to use @apply on aren’t variadic themselves, but may each have different signatures.
One can’t seem to write func.func private @apply(%f: (...) -> i32, ...) -> i32 or anything similar to that.