@@ -1769,6 +1769,13 @@ def FuncOp : CIR_Op<"func", [
17691769 return getFunctionType().getReturnTypes();
17701770 }
17711771
1772+ // TODO(cir): this should be an operand attribute, but for now we just hard-
1773+ // wire this as a function. Will later add a $no_proto argument to this op.
1774+ bool getNoProto() {
1775+ assert(!cir::MissingFeatures::opFuncNoProto());
1776+ return false;
1777+ }
1778+
17721779 //===------------------------------------------------------------------===//
17731780 // SymbolOpInterface Methods
17741781 //===------------------------------------------------------------------===//
@@ -1789,6 +1796,41 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
17891796 !listconcat(extra_traits,
17901797 [DeclareOpInterfaceMethods<CIRCallOpInterface>,
17911798 DeclareOpInterfaceMethods<SymbolUserOpInterface>])> {
1799+ let extraClassDeclaration = [{
1800+ /// Get the argument operands to the called function.
1801+ mlir::OperandRange getArgOperands() {
1802+ return getArgs();
1803+ }
1804+
1805+ mlir::MutableOperandRange getArgOperandsMutable() {
1806+ return getArgsMutable();
1807+ }
1808+
1809+ /// Return the callee of this operation
1810+ mlir::CallInterfaceCallable getCallableForCallee() {
1811+ return (*this)->getAttrOfType<mlir::SymbolRefAttr>("callee");
1812+ }
1813+
1814+ /// Set the callee for this operation.
1815+ void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
1816+ (*this)->setAttr(getCalleeAttrName(),
1817+ mlir::cast<mlir::SymbolRefAttr>(callee));
1818+ }
1819+
1820+ mlir::ArrayAttr getArgAttrsAttr() { return {}; }
1821+ ::mlir::ArrayAttr getResAttrsAttr() { return {}; }
1822+
1823+ void setResAttrsAttr(::mlir::ArrayAttr attrs) {}
1824+ void setArgAttrsAttr(::mlir::ArrayAttr attrs) {}
1825+
1826+ ::mlir::Attribute removeArgAttrsAttr() { return {}; }
1827+ ::mlir::Attribute removeResAttrsAttr() { return {}; }
1828+
1829+ void setArg(unsigned index, mlir::Value value) {
1830+ setOperand(index, value);
1831+ }
1832+ }];
1833+
17921834 let hasCustomAssemblyFormat = 1;
17931835 let skipDefaultBuilders = 1;
17941836 let hasVerifier = 0;
@@ -1798,7 +1840,8 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
17981840 // the upstreaming process moves on. The verifiers is also missing for now,
17991841 // will add in the future.
18001842
1801- dag commonArgs = (ins FlatSymbolRefAttr:$callee);
1843+ dag commonArgs = (ins FlatSymbolRefAttr:$callee,
1844+ Variadic<CIR_AnyType>:$args);
18021845}
18031846
18041847def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
@@ -1819,7 +1862,9 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
18191862 let arguments = commonArgs;
18201863
18211864 let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
1822- "mlir::Type":$resType), [{
1865+ "mlir::Type":$resType,
1866+ "mlir::ValueRange":$operands), [{
1867+ $_state.addOperands(operands);
18231868 $_state.addAttribute("callee", callee);
18241869 if (resType && !isa<VoidType>(resType))
18251870 $_state.addTypes(resType);
0 commit comments