diff --git a/mlir/include/mlir/IR/FunctionImplementation.h b/mlir/include/mlir/IR/FunctionImplementation.h --- a/mlir/include/mlir/IR/FunctionImplementation.h +++ b/mlir/include/mlir/IR/FunctionImplementation.h @@ -78,23 +78,15 @@ /// whether the function is variadic. If the builder returns a null type, /// `result` will not contain the `type` attribute. The caller can then add a /// type, report the error or delegate the reporting to the op's verifier. -/// If `allowInlineVisibility` is true, then the parser will allow visibility -/// to be specified after the operation name. If the visibility is not specified -/// there or `allowInlineVisibility` is false, visibility will be allowed in the -/// attribute dict. ParseResult parseFunctionLikeOp(OpAsmParser &parser, OperationState &result, bool allowVariadic, - FuncTypeBuilder funcTypeBuilder, - bool allowInlineVisibility = false); + FuncTypeBuilder funcTypeBuilder); /// Printer implementation for function-like operations. Accepts lists of -/// argument and result types to use while printing. If `printVisibilityInline` -/// is true, visibility is printed "inline" after the operation name and elided -/// from the attributes dict. Otherwise, it is printed in the attribute dict. +/// argument and result types to use while printing. void printFunctionLikeOp(OpAsmPrinter &p, Operation *op, ArrayRef argTypes, bool isVariadic, - ArrayRef resultTypes, - bool printVisibilityInline = false); + ArrayRef resultTypes); /// Prints the signature of the function-like operation `op`. Assumes `op` has /// the FunctionLike trait and passed the verification. diff --git a/mlir/lib/IR/Function.cpp b/mlir/lib/IR/Function.cpp --- a/mlir/lib/IR/Function.cpp +++ b/mlir/lib/IR/Function.cpp @@ -69,15 +69,13 @@ }; return impl::parseFunctionLikeOp(parser, result, /*allowVariadic=*/false, - buildFuncType, - /*allowInlineVisibility=*/true); + buildFuncType); } void FuncOp::print(OpAsmPrinter &p) { FunctionType fnType = getType(); impl::printFunctionLikeOp(p, *this, fnType.getInputs(), /*isVariadic=*/false, - fnType.getResults(), - /*printVisibilityInline=*/true); + fnType.getResults()); } LogicalResult FuncOp::verify() { diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp --- a/mlir/lib/IR/FunctionImplementation.cpp +++ b/mlir/lib/IR/FunctionImplementation.cpp @@ -159,9 +159,10 @@ /// Parser implementation for function-like operations. Uses `funcTypeBuilder` /// to construct the custom function type given lists of input and output types. -ParseResult mlir::impl::parseFunctionLikeOp( - OpAsmParser &parser, OperationState &result, bool allowVariadic, - mlir::impl::FuncTypeBuilder funcTypeBuilder, bool allowInlineVisibility) { +ParseResult +mlir::impl::parseFunctionLikeOp(OpAsmParser &parser, OperationState &result, + bool allowVariadic, + mlir::impl::FuncTypeBuilder funcTypeBuilder) { SmallVector entryArgs; SmallVector argAttrs; SmallVector resultAttrs; @@ -169,9 +170,8 @@ SmallVector resultTypes; auto &builder = parser.getBuilder(); - // Parse visibility if inline visibility is allowed. - if (allowInlineVisibility) - impl::parseOptionalVisibilityKeyword(parser, result.attributes); + // Parse visibility. + impl::parseOptionalVisibilityKeyword(parser, result.attributes); // Parse the name as a symbol. StringAttr nameAttr; @@ -306,24 +306,21 @@ /// argument and result types to use while printing. void mlir::impl::printFunctionLikeOp(OpAsmPrinter &p, Operation *op, ArrayRef argTypes, bool isVariadic, - ArrayRef resultTypes, - bool printVisibilityInline) { + ArrayRef resultTypes) { // Print the operation and the function name. auto funcName = op->getAttrOfType(SymbolTable::getSymbolAttrName()) .getValue(); p << op->getName() << ' '; - StringRef elidedAttr; - if (printVisibilityInline) { - elidedAttr = SymbolTable::getVisibilityAttrName(); - if (auto visibility = op->getAttrOfType(elidedAttr)) - p << visibility.getValue() << ' '; - } + + StringRef visibilityAttrName = SymbolTable::getVisibilityAttrName(); + if (auto visibility = op->getAttrOfType(visibilityAttrName)) + p << visibility.getValue() << ' '; p.printSymbolName(funcName); printFunctionSignature(p, op, argTypes, isVariadic, resultTypes); printFunctionAttributes(p, op, argTypes.size(), resultTypes.size(), - {elidedAttr}); + {visibilityAttrName}); // Print the body if this is not an external function. Region &body = op->getRegion(0); if (!body.empty())