[clang] [CIR] Upstream initial function call support (PR #134673)
Sirui Mu via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 07:55:30 PDT 2025
================
@@ -441,6 +441,87 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) {
return tryFoldCastChain(*this);
}
+//===----------------------------------------------------------------------===//
+// CallOp
+//===----------------------------------------------------------------------===//
+
+static mlir::ParseResult parseCallCommon(mlir::OpAsmParser &parser,
+ mlir::OperationState &result) {
+ mlir::FlatSymbolRefAttr calleeAttr;
+
+ if (!parser.parseOptionalAttribute(calleeAttr, "callee", result.attributes)
+ .has_value())
+ return mlir::failure();
+
+ if (parser.parseLParen())
+ return mlir::failure();
+
+ // TODO(cir): parse argument list here
+
+ if (parser.parseRParen())
+ return mlir::failure();
+
+ if (parser.parseOptionalAttrDict(result.attributes))
+ return ::mlir::failure();
+
+ if (parser.parseColon())
+ return ::mlir::failure();
+
+ mlir::FunctionType opsFnTy;
+ if (parser.parseType(opsFnTy))
+ return mlir::failure();
+
+ return mlir::success();
+}
+
+static void printCallCommon(mlir::Operation *op,
+ mlir::FlatSymbolRefAttr calleeSym,
+ mlir::OpAsmPrinter &printer) {
+ printer << ' ';
+
+ printer.printAttributeWithoutType(calleeSym);
+ printer << "(";
+ // TODO(cir): print call args here
----------------
Lancern wrote:
Updated.
https://github.com/llvm/llvm-project/pull/134673
More information about the cfe-commits
mailing list