-cir-drop-ast
Remove clang AST nodes attached to CIR operations
Some CIR operations have references back to Clang AST, this is necessary to perform lots of useful checks without having to duplicate all rich AST information in CIR. As we move down in the pipeline (e.g. generating LLVM or other MLIR dialects), the need for such nodes diminish and AST information can be dropped.
Right now this is enabled by default in Clang prior to dialect codegen from CIR, but not before lifetime check, where AST is required to be present.
-cir-idiom-recognizer
Raise calls to C/C++ libraries to CIR operations
This pass recognize idiomatic C++ usage and incorporate C++ standard containers, library functions calls, and types into CIR operation, attributes and types.
Detections done by this pass can be inspected by users by using remarks. Currently supported are all
and found-calls
.
-remarks : Diagnostic remarks to enable Supported styles: {all|found-calls}
-cir-lib-opt
Optimize C/C++ library calls
By using higher level information from cir-idiom-recognize
, this pass apply transformations to CIR based on specific C/C++ library semantics.
Transformations done by this pass can be inspected by users by using remarks. Currently supported are all
and transforms
.
-remarks : Diagnostic remarks to enable Supported styles: {all|transforms}
-cir-lifetime-check
Check lifetime safety and generate diagnostics
This pass relies on a lifetime analysis pass and uses the diagnostics mechanism to report to the user. It does not change any code.
A default ctor is specified but is solely in order to make tablegen happy, since this pass requires the presence of an ASTContext, one can set that up using mlir::createLifetimeCheckPass(clang::ASTContext &)
instead.
-history : List of history styles to emit as part of diagnostics. Supported styles: {all|null|invalid}
-remarks : List of remark styles to enable as part of diagnostics. Supported styles: {all|pset}
-history_limit : Max amount of diagnostics to emit on pointer history
-cir-lowering-prepare
Preparation work before lowering to LLVM dialect
This pass does preparation work for LLVM lowering. For example, it may expand the global variable initialziation in a more ABI-friendly form.
-cir-merge-cleanups
Remove unnecessary branches to cleanup blocks
Canonicalize pass is too aggressive for CIR when the pipeline is used for C/C++ analysis. This pass runs some rewrites for scopes, merging some blocks and eliminating unnecessary control-flow.