diff options
| author | Jeff Niu <jeff@modular.com> | 2022-12-06 12:55:43 -0800 |
|---|---|---|
| committer | Jeff Niu <jeff@modular.com> | 2022-12-08 11:32:38 -0800 |
| commit | dd74e6b6f4fb7a4685086a4895c1934e043f875b (patch) | |
| tree | e8bd2d750f90070964190942e1271a304ed46760 /mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp | |
| parent | 15511c2e6cc4b0dcba0592bfd3a96b9b6be5db4a (diff) | |
[mlir] FunctionOpInterface: arg and result attrs dispatch to interface
This patch removes the `arg_attrs` and `res_attrs` named attributes as a
requirement for FunctionOpInterface and replaces them with interface
methods for the getters, setters, and removers of the relevent
attributes. This allows operations to use their own storage for the
argument and result attributes.
Depends on D139471
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139472
Diffstat (limited to 'mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp')
| -rw-r--r-- | mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp b/mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp index 27c613088df5..31ed5ad3b987 100644 --- a/mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp +++ b/mlir/lib/Dialect/MLProgram/IR/MLProgramOps.cpp @@ -153,12 +153,14 @@ ParseResult FuncOp::parse(OpAsmParser &parser, OperationState &result) { return function_interface_impl::parseFunctionOp( parser, result, /*allowVariadic=*/false, - getFunctionTypeAttrName(result.name), buildFuncType); + getFunctionTypeAttrName(result.name), buildFuncType, + getArgAttrsAttrName(result.name), getResAttrsAttrName(result.name)); } void FuncOp::print(OpAsmPrinter &p) { - function_interface_impl::printFunctionOp(p, *this, /*isVariadic=*/false, - getFunctionTypeAttrName()); + function_interface_impl::printFunctionOp( + p, *this, /*isVariadic=*/false, getFunctionTypeAttrName(), + getArgAttrsAttrName(), getResAttrsAttrName()); } //===----------------------------------------------------------------------===// @@ -316,12 +318,14 @@ ParseResult SubgraphOp::parse(OpAsmParser &parser, OperationState &result) { return function_interface_impl::parseFunctionOp( parser, result, /*allowVariadic=*/false, - getFunctionTypeAttrName(result.name), buildFuncType); + getFunctionTypeAttrName(result.name), buildFuncType, + getArgAttrsAttrName(result.name), getResAttrsAttrName(result.name)); } void SubgraphOp::print(OpAsmPrinter &p) { - function_interface_impl::printFunctionOp(p, *this, /*isVariadic=*/false, - getFunctionTypeAttrName()); + function_interface_impl::printFunctionOp( + p, *this, /*isVariadic=*/false, getFunctionTypeAttrName(), + getArgAttrsAttrName(), getResAttrsAttrName()); } //===----------------------------------------------------------------------===// |
