================ @@ -1737,25 +1737,51 @@ def GetMemberOp : CIR_Op<"get_member"> { def FuncOp : CIR_Op<"func", [ AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface, + DeclareOpInterfaceMethods<CIRGlobalValueInterface>, IsolatedFromAbove ]> { let summary = "Declare or define a function"; let description = [{ The `cir.func` operation defines a function, similar to the `mlir::FuncOp` built-in. + + The function linkage information is specified by `linkage`, as defined by + `GlobalLinkageKind` attribute. + + Example: + + ```mlir + // External function definitions. + cir.func @abort() + + // A function with internal linkage. + cir.func internal @count(%x: i64) -> (i64) + return %x : i64 + + // Linkage information + cir.func linkonce_odr @some_method(...) + ``` }]; let arguments = (ins SymbolNameAttr:$sym_name, + CIR_VisibilityAttr:$global_visibility, TypeAttrOf<CIR_FuncType>:$function_type, + UnitAttr:$dso_local, ---------------- andykaylor wrote:
There's a 1-to-1 correspondance between this and the `dso_local` representation in LLVM IR, and we are able to model the computation of this flag after the same computation in classic codegen. I don't think there's benefit in trying to generalize this as an intermediate state when we'll need to recreate it when lowering to LLVM IR anyway. https://github.com/llvm/llvm-project/pull/145600 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits