llvm-project
cfc03d62 - [CIR] Add CallConvLowering pass + Direct/Ignore ABI rewriting (#195737)

Commit
67 days ago
[CIR] Add CallConvLowering pass + Direct/Ignore ABI rewriting (#195737) Depends on #195725 (merged). Stacked on #195725 (PR A1). The diff in this PR is the CIR side; A1 has the dialect-agnostic infrastructure. Adds the `cir-call-conv-lowering` pass plus the `CIRABIRewriteContext` skeleton with handlers for Direct (true pass-through) and Ignore (drop empty-record args/returns). Subsequent PRs in the split add Extend, Direct-with-coercion + a new reinterpret op, Indirect/sret, Indirect/byval, and Expand — each is purely additive because the rewriter dispatches on `argClass.kind` via a switch with explicit "not yet implemented" diagnostics for every other kind. The pass takes one of two driver options: `target=test` uses the test target from PR A1, and `classification-attr=<name>` reads a pre-built `DictionaryAttr` from each `cir.func` (also via the helper from PR A1). It also requires `dlti.dl_spec` on the module and emits a clear diagnostic otherwise, since classification can't run without sizes/alignments. Six `.cir` tests covering the Direct/Ignore behavior via both drivers, plus the missing-DataLayout error case. `check-clang-cir` and `check-clang-cir-codegen` both pass with no regressions. `clang/docs/CIR/ABILowering.rst` gets a short pipeline-position section (where this pass runs vs CXXABILowering and HoistAllocas, the DataLayout requirement, the alloca-placement invariant). The 11 C++ unit tests in #192119 each map onto a `.cir` test in this series — 6 ported here (Direct passthrough, Ignore arg, Ignore return, declaration rewrite, plus their call-site variants), 3 deferred to PR B (Extend), 2 deferred to PR C (Direct-with-coercion). The 5 from #192124 split between PRs D and E. None get dropped, and the original C++ test file lives only on the closed branches. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Author
Parents
Loading