@@ -1121,11 +1121,12 @@ void fir::CallOp::print(mlir::OpAsmPrinter &p) {
11211121
11221122 p.printOptionalAttrDict ((*this )->getAttrs (),
11231123 {fir::CallOp::getCalleeAttrNameStr (),
1124- getFastmathAttrName (), getProcedureAttrsAttrName ()});
1125- auto resultTypes{getResultTypes ()};
1126- llvm::SmallVector<mlir::Type> argTypes (
1127- llvm::drop_begin (getOperandTypes (), isDirect ? 0 : 1 ));
1128- p << " : " << mlir::FunctionType::get (getContext (), argTypes, resultTypes);
1124+ getFastmathAttrName (), getProcedureAttrsAttrName (),
1125+ getArgAttrsAttrName (), getResAttrsAttrName ()});
1126+ p << " : " ;
1127+ mlir::call_interface_impl::printFunctionSignature (
1128+ p, getArgs ().drop_front (isDirect ? 0 : 1 ).getTypes (), getArgAttrsAttr (),
1129+ /* isVariadic=*/ false , getResultTypes (), getResAttrsAttr ());
11291130}
11301131
11311132mlir::ParseResult fir::CallOp::parse (mlir::OpAsmParser &parser,
@@ -1142,7 +1143,6 @@ mlir::ParseResult fir::CallOp::parse(mlir::OpAsmParser &parser,
11421143 attrs))
11431144 return mlir::failure ();
11441145
1145- mlir::Type type;
11461146 if (parser.parseOperandList (operands, mlir::OpAsmParser::Delimiter::Paren))
11471147 return mlir::failure ();
11481148
@@ -1163,13 +1163,17 @@ mlir::ParseResult fir::CallOp::parse(mlir::OpAsmParser &parser,
11631163 fmfAttrName, attrs))
11641164 return mlir::failure ();
11651165
1166- if (parser.parseOptionalAttrDict (attrs) || parser.parseColon () ||
1167- parser.parseType (type))
1166+ if (parser.parseOptionalAttrDict (attrs) || parser.parseColon ())
11681167 return mlir::failure ();
1169-
1170- auto funcType = mlir::dyn_cast<mlir::FunctionType>(type);
1171- if (!funcType)
1168+ llvm::SmallVector<mlir::Type> argTypes;
1169+ llvm::SmallVector<mlir::Type> resTypes;
1170+ llvm::SmallVector<mlir::DictionaryAttr> argAttrs;
1171+ llvm::SmallVector<mlir::DictionaryAttr> resultAttrs;
1172+ if (mlir::call_interface_impl::parseFunctionSignature (
1173+ parser, argTypes, argAttrs, resTypes, resultAttrs))
11721174 return parser.emitError (parser.getNameLoc (), " expected function type" );
1175+ mlir::FunctionType funcType =
1176+ mlir::FunctionType::get (parser.getContext (), argTypes, resTypes);
11731177 if (isDirect) {
11741178 if (parser.resolveOperands (operands, funcType.getInputs (),
11751179 parser.getNameLoc (), result.operands ))
@@ -1183,8 +1187,11 @@ mlir::ParseResult fir::CallOp::parse(mlir::OpAsmParser &parser,
11831187 parser.getNameLoc (), result.operands ))
11841188 return mlir::failure ();
11851189 }
1186- result.addTypes (funcType.getResults ());
11871190 result.attributes = attrs;
1191+ mlir::call_interface_impl::addArgAndResultAttrs (
1192+ parser.getBuilder (), result, argAttrs, resultAttrs,
1193+ getArgAttrsAttrName (result.name ), getResAttrsAttrName (result.name ));
1194+ result.addTypes (funcType.getResults ());
11881195 return mlir::success ();
11891196}
11901197
0 commit comments