[Mlir-commits] [mlir] [mlir][LLVMIR] Add IFuncOp to LLVM dialect (PR #147697)
Tobias Gysi
llvmlistbot at llvm.org
Fri Jul 11 12:13:03 PDT 2025
================
@@ -1601,6 +1605,67 @@ def LLVM_AliasOp : LLVM_Op<"mlir.alias",
let hasRegionVerifier = 1;
}
+def LLVM_IFuncOp : LLVM_Op<"mlir.ifunc",
+ [IsolatedFromAbove, Symbol, DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
+ let arguments = (ins
+ SymbolNameAttr:$sym_name,
+ TypeAttr:$i_func_type,
+ FlatSymbolRefAttr:$resolver,
+ TypeAttr:$resolver_type,
+ Linkage:$linkage,
+ UnitAttr:$dso_local,
+ DefaultValuedAttr<ConfinedAttr<I32Attr, [IntNonNegative]>, "0">:$address_space,
+ DefaultValuedAttr<UnnamedAddr, "mlir::LLVM::UnnamedAddr::None">:$unnamed_addr,
+ DefaultValuedAttr<Visibility, "mlir::LLVM::Visibility::Default">:$visibility_
+ );
+ let summary = "LLVM dialect ifunc";
+ let description = [{
+ `llvm.mlir.ifunc` is a top level operation that defines a global ifunc.
+ It defines a new symbol and takes a symbol refering to a resolver function.
+ IFuncs can be called as regular functions. The function type is the same
+ as the IFuncType. The symbol is resolved at runtime by calling a resolver
+ function.
+
+ Examples:
+
+ ```mlir
+ // IFuncs have @-identifier and use a resolver function.
----------------
gysit wrote:
```suggestion
// IFuncs resolve a symbol at runtime using a resovler function.
```
nit: I would make it a bit more specific.
https://github.com/llvm/llvm-project/pull/147697
More information about the Mlir-commits
mailing list