@@ -1496,6 +1496,10 @@ def FuncOp : CIR_Op<"func", [
14961496 return getFunctionType().getReturnTypes();
14971497 }
14981498
1499+ // TODO(cir): this should be an operand attribute, but for now we just hard-
1500+ // wire this as a function. Will later add a $no_proto argument to this op.
1501+ bool getNoProto() { return false; }
1502+
14991503 //===------------------------------------------------------------------===//
15001504 // SymbolOpInterface Methods
15011505 //===------------------------------------------------------------------===//
@@ -1516,6 +1520,41 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
15161520 !listconcat(extra_traits,
15171521 [DeclareOpInterfaceMethods<CIRCallOpInterface>,
15181522 DeclareOpInterfaceMethods<SymbolUserOpInterface>])> {
1523+ let extraClassDeclaration = [{
1524+ /// Get the argument operands to the called function.
1525+ mlir::OperandRange getArgOperands() {
1526+ return {arg_operand_begin(), arg_operand_end()};
1527+ }
1528+
1529+ mlir::MutableOperandRange getArgOperandsMutable() {
1530+ llvm_unreachable("NYI");
1531+ }
1532+
1533+ /// Return the callee of this operation
1534+ mlir::CallInterfaceCallable getCallableForCallee() {
1535+ return (*this)->getAttrOfType<mlir::SymbolRefAttr>("callee");
1536+ }
1537+
1538+ /// Set the callee for this operation.
1539+ void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
1540+ (*this)->setAttr(getCalleeAttrName(),
1541+ mlir::cast<mlir::SymbolRefAttr>(callee));
1542+ }
1543+
1544+ ::mlir::ArrayAttr getArgAttrsAttr() { return {}; }
1545+ ::mlir::ArrayAttr getResAttrsAttr() { return {}; }
1546+
1547+ void setResAttrsAttr(::mlir::ArrayAttr attrs) {}
1548+ void setArgAttrsAttr(::mlir::ArrayAttr attrs) {}
1549+
1550+ ::mlir::Attribute removeArgAttrsAttr() { return {}; }
1551+ ::mlir::Attribute removeResAttrsAttr() { return {}; }
1552+
1553+ void setArg(unsigned index, mlir::Value value) {
1554+ setOperand(index, value);
1555+ }
1556+ }];
1557+
15191558 let hasCustomAssemblyFormat = 1;
15201559 let skipDefaultBuilders = 1;
15211560 let hasVerifier = 0;
@@ -1525,7 +1564,8 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
15251564 // the upstreaming process moves on. The verifiers is also missing for now,
15261565 // will add in the future.
15271566
1528- dag commonArgs = (ins FlatSymbolRefAttr:$callee);
1567+ dag commonArgs = (ins FlatSymbolRefAttr:$callee,
1568+ Variadic<CIR_AnyType>:$args);
15291569}
15301570
15311571def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
@@ -1546,7 +1586,9 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
15461586 let arguments = commonArgs;
15471587
15481588 let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
1549- "mlir::Type":$resType), [{
1589+ "mlir::Type":$resType,
1590+ "mlir::ValueRange":$operands), [{
1591+ $_state.addOperands(operands);
15501592 $_state.addAttribute("callee", callee);
15511593 if (resType && !isa<VoidType>(resType))
15521594 $_state.addTypes(resType);
0 commit comments