[clang] [CIR] Add calling_conv attribute to FuncOp with lowering support (PR #189345)

Rana Pratap Reddy via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 23:57:22 PDT 2026


================
@@ -3586,9 +3586,16 @@ def CIR_OptionalPriorityAttr : OptionalAttr<
   >
 >;
 
-// TODO(CIR): CallingConv is a placeholder here so we can use it in
-// infrastructure calls, but it currently has no values.
-def CIR_CallingConv : CIR_I32EnumAttr<"CallingConv", "calling convention", []>;
+// The enumeration values are not necessarily in sync with `clang::CallingConv`
+// or `llvm::CallingConv`.
+def CIR_CallingConv : CIR_I32EnumAttr<"CallingConv", "calling convention", [
+  I32EnumAttrCase<"C", 1, "c">,
----------------
ranapratap55 wrote:

Cases are now ordered to match the ordering in `llvm::CallingConv`. The integer values remain CIR-specific (0–4) rather than using LLVM's actual IDs. 

My assumption is CIR is target-agnostic IR, using LLVM dialect attribute directly would tie `cir.func` to LLVM backend at representation level, which contradicts CIR's layered design.

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


More information about the cfe-commits mailing list