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

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 09:38:23 PDT 2026


https://github.com/adams381 commented:

I don't have any objections to this being implemented as-is. Having the `calling_conv` attribute on `FuncOp` is something the ABI lowering pass will need.

In the architecture we're building, the pipeline naturally separates the two states you're concerned about:

1. **CIRGen** sets the `calling_conv` attribute based on the AST (recording *which* convention applies)
2. **CallConvLowering** reads that attribute later to select the appropriate ABI classifier and rewrite the function signature (applying the ABI *constraints* of that convention)

So the attribute being present before ABI lowering runs is the intended state — it's an input to the pass, not an output.  The distinction between "convention is known" and "ABI constraints have been applied" is implicit in the pass ordering rather than requiring a separate flag.

This is especially relevant for multi-target support — when we add AArch64, the pass will need to dispatch to a different classifier (AAPCS vs System V) based on the calling convention + target triple.  Having the convention recorded on the op is the right mechanism for that.

The fact that CIRGen doesn't actually compute and set non-C conventions yet is fine — the TODOs capture that accurately, and this PR provides the infrastructure needed when that wiring is added.

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


More information about the cfe-commits mailing list