llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
308 stars 84 forks source link

[CIR][Passes] Add CallConvLowering pass skeleton #642

Closed sitio-couto closed 1 month ago

sitio-couto commented 1 month ago

This patch adds a new CallConvLowering pass that aims to lower the calling conventions of the functions in the module. It also includes a new Clang command line option to enable it. Also, it is considered a part of the lowering prepare set of passes, as it is unlikely to be used elsewhere in the pipeline.

Since this will be dealing with ABI/Target-specific information, it requires AST info. For this reason, it can only be executed through the clang driver or cc1 tool for now as CIR does not encode AST info.

This pass is disabled by default and can be enabled by passing the flag -fclangir-call-conv-lowering. Once this pass is more mature, it should be enabled by default as a required step to lower to LLVM Dialect.