[Mlir-commits] [mlir] [mlir][emitc] Add a `declare_func` operation (PR #80297)

Marius Brehler llvmlistbot at llvm.org
Thu Feb 1 10:16:37 PST 2024


================
@@ -393,6 +393,24 @@ FunctionType CallOp::getCalleeType() {
   return FunctionType::get(getContext(), getOperandTypes(), getResultTypes());
 }
 
+//===----------------------------------------------------------------------===//
+// DeclareFuncOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+DeclareFuncOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
+  // Check that the callee attribute was specified.
+  auto fnAttr = (*this)->getAttrOfType<FlatSymbolRefAttr>("callee");
+  if (!fnAttr)
+    return emitOpError("requires a 'callee' symbol reference attribute");
----------------
marbre wrote:

I had the same in mind but more or less followed what `func.call`does (we do the same for `emitc.call`):

https://github.com/llvm/llvm-project/blob/6a3fde6d600cccd2ffbede6dd54519036cc4089c/mlir/lib/Dialect/Func/IR/FuncOps.cpp#L64-L66

But I am happy to revise this and adjust it for `emitc.call` as well.

https://github.com/llvm/llvm-project/pull/80297


More information about the Mlir-commits mailing list