diff --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td --- a/mlir/examples/toy/Ch2/include/toy/Ops.td +++ b/mlir/examples/toy/Ch2/include/toy/Ops.td @@ -113,7 +113,7 @@ //===----------------------------------------------------------------------===// def FuncOp : Toy_Op<"func", [ - FunctionOpInterface, IsolatedFromAbove, Symbol + FunctionOpInterface, IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/examples/toy/Ch3/include/toy/Ops.td b/mlir/examples/toy/Ch3/include/toy/Ops.td --- a/mlir/examples/toy/Ch3/include/toy/Ops.td +++ b/mlir/examples/toy/Ch3/include/toy/Ops.td @@ -112,7 +112,7 @@ //===----------------------------------------------------------------------===// def FuncOp : Toy_Op<"func", [ - FunctionOpInterface, IsolatedFromAbove, Symbol + FunctionOpInterface, IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td --- a/mlir/examples/toy/Ch4/include/toy/Ops.td +++ b/mlir/examples/toy/Ch4/include/toy/Ops.td @@ -142,7 +142,7 @@ def FuncOp : Toy_Op<"func", [ DeclareOpInterfaceMethods, FunctionOpInterface, - IsolatedFromAbove, Symbol + IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td --- a/mlir/examples/toy/Ch5/include/toy/Ops.td +++ b/mlir/examples/toy/Ch5/include/toy/Ops.td @@ -142,7 +142,7 @@ def FuncOp : Toy_Op<"func", [ DeclareOpInterfaceMethods, FunctionOpInterface, - IsolatedFromAbove, Symbol + IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td --- a/mlir/examples/toy/Ch6/include/toy/Ops.td +++ b/mlir/examples/toy/Ch6/include/toy/Ops.td @@ -142,7 +142,7 @@ def FuncOp : Toy_Op<"func", [ DeclareOpInterfaceMethods, FunctionOpInterface, - IsolatedFromAbove, Symbol + IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td --- a/mlir/examples/toy/Ch7/include/toy/Ops.td +++ b/mlir/examples/toy/Ch7/include/toy/Ops.td @@ -165,7 +165,7 @@ def FuncOp : Toy_Op<"func", [ DeclareOpInterfaceMethods, FunctionOpInterface, - IsolatedFromAbove, Symbol + IsolatedFromAbove ]> { let summary = "user defined function operation"; let description = [{ diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td --- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td +++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td @@ -106,7 +106,7 @@ def Async_FuncOp : Async_Op<"func", [CallableOpInterface, FunctionOpInterface, - IsolatedFromAbove, OpAsmOpInterface, Symbol]> { + IsolatedFromAbove, OpAsmOpInterface]> { let summary = "async function operation"; let description = [{ An async function is like a normal function, but supports non-blocking diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td --- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td +++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td @@ -208,7 +208,7 @@ def FuncOp : Func_Op<"func", [ AffineScope, AutomaticAllocationScope, CallableOpInterface, - FunctionOpInterface, IsolatedFromAbove, OpAsmOpInterface, Symbol + FunctionOpInterface, IsolatedFromAbove, OpAsmOpInterface ]> { let summary = "An operation with a name containing a single `SSACFG` region"; let description = [{ diff --git a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td --- a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td +++ b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td @@ -180,7 +180,7 @@ def GPU_GPUFuncOp : GPU_Op<"func", [ HasParent<"GPUModuleOp">, AutomaticAllocationScope, FunctionOpInterface, - IsolatedFromAbove, Symbol + IsolatedFromAbove ]> { let summary = "Function executable on a GPU"; diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -1278,7 +1278,7 @@ def LLVM_LLVMFuncOp : LLVM_Op<"func", [ AutomaticAllocationScope, IsolatedFromAbove, FunctionOpInterface, - CallableOpInterface, Symbol + CallableOpInterface ]> { let summary = "LLVM dialect function."; diff --git a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td --- a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td +++ b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td @@ -630,7 +630,7 @@ //===----------------------------------------------------------------------===// def PDLInterp_FuncOp : PDLInterp_Op<"func", [ - FunctionOpInterface, IsolatedFromAbove, Symbol + FunctionOpInterface, IsolatedFromAbove ]> { let summary = "PDL Interpreter Function Operation"; let description = [{ diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td @@ -257,7 +257,7 @@ def SPIRV_FuncOp : SPIRV_Op<"func", [ AutomaticAllocationScope, DeclareOpInterfaceMethods, - FunctionOpInterface, InModuleScope, IsolatedFromAbove, Symbol + FunctionOpInterface, InModuleScope, IsolatedFromAbove ]> { let summary = "Declare or define a function"; diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td @@ -1097,7 +1097,7 @@ def Shape_FuncOp : Shape_Op<"func", [AffineScope, AutomaticAllocationScope, CallableOpInterface, - FunctionOpInterface, IsolatedFromAbove, OpAsmOpInterface, Symbol]> { + FunctionOpInterface, IsolatedFromAbove, OpAsmOpInterface]> { let summary = "Shape function"; let description = [{ An operation with a name containing a single `SSACFG` region which diff --git a/mlir/include/mlir/IR/FunctionInterfaces.td b/mlir/include/mlir/IR/FunctionInterfaces.td --- a/mlir/include/mlir/IR/FunctionInterfaces.td +++ b/mlir/include/mlir/IR/FunctionInterfaces.td @@ -14,13 +14,13 @@ #ifndef MLIR_IR_FUNCTIONINTERFACES_TD_ #define MLIR_IR_FUNCTIONINTERFACES_TD_ -include "mlir/IR/OpBase.td" +include "mlir/IR/SymbolInterfaces.td" //===----------------------------------------------------------------------===// // FunctionOpInterface //===----------------------------------------------------------------------===// -def FunctionOpInterface : OpInterface<"FunctionOpInterface"> { +def FunctionOpInterface : OpInterface<"FunctionOpInterface", [Symbol]> { let cppNamespace = "::mlir"; let description = [{ This interfaces provides support for interacting with operations that @@ -164,14 +164,6 @@ }]>, ]; - let extraClassDeclaration = [{ - //===------------------------------------------------------------------===// - // Name - //===------------------------------------------------------------------===// - - /// Return the name of the function. - StringRef getName() { return SymbolTable::getSymbolName(*this); } - }]; let extraTraitClassDeclaration = [{ //===------------------------------------------------------------------===// // Builders diff --git a/mlir/test/Dialect/Func/invalid.mlir b/mlir/test/Dialect/Func/invalid.mlir --- a/mlir/test/Dialect/Func/invalid.mlir +++ b/mlir/test/Dialect/Func/invalid.mlir @@ -181,12 +181,12 @@ // ----- // expected-error @+1 {{arguments may only have dialect attributes}} -func.func @invalid_func_arg_attr(i1 {non_dialect_attr = 10}) +func.func private @invalid_func_arg_attr(i1 {non_dialect_attr = 10}) // ----- // expected-error @+1 {{results may only have dialect attributes}} -func.func @invalid_func_result_attr() -> (i1 {non_dialect_attr = 10}) +func.func private @invalid_func_result_attr() -> (i1 {non_dialect_attr = 10}) // -----