[clang] [CIR] Add calling convention values to CIR_CallingConv (PR #188715)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 26 03:08:19 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clangir
Author: Rana Pratap Reddy (ranapratap55)
<details>
<summary>Changes</summary>
Populates the `CIR_CallingConv` enum with calling convention values: `C`, `SpirKernel`, `SpirFunction`, `OpenCLKernel`, `PTXKernel`, and `AMDGPUKernel`.
This is a partial upstreaming of [clangir#<!-- -->760](https://github.com/llvm/clangir/pull/760/).
Follow-up PRs:
1. Add `calling_conv` attribute to `FuncOp`
2. Add LLVM lowering support for calling conventions
Tests will be added in follow-up PRs.
---
Full diff: https://github.com/llvm/llvm-project/pull/188715.diff
1 Files Affected:
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+8-3)
``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index b15dc30ffb87d..0f3d2c10cf678 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -3586,9 +3586,14 @@ 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", []>;
+def CIR_CallingConv : CIR_I32EnumAttr<"CallingConv", "calling convention", [
+ I32EnumAttrCase<"C", 1, "c">,
+ I32EnumAttrCase<"SpirKernel", 2, "spir_kernel">,
+ I32EnumAttrCase<"SpirFunction", 3, "spir_function">,
+ I32EnumAttrCase<"OpenCLKernel", 4, "opencl_kernel">,
+ I32EnumAttrCase<"PTXKernel", 5, "ptx_kernel">,
+ I32EnumAttrCase<"AMDGPUKernel", 6, "amdgpu_kernel">
+]>;
def CIR_FuncOp : CIR_Op<"func", [
AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface,
``````````
</details>
https://github.com/llvm/llvm-project/pull/188715
More information about the cfe-commits
mailing list