[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)
Nathan Lanza via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 16:10:48 PDT 2024
================
@@ -2900,7 +2900,7 @@ defm clangir : BoolFOption<"clangir",
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Use the ClangIR pipeline to compile">,
NegFlag<SetFalse, [], [ClangOption, CC1Option], "Use the AST -> LLVM pipeline to compile">,
BothFlags<[], [ClangOption, CC1Option], "">>;
-def emit_cir : Flag<["-"], "emit-cir">, Visibility<[CC1Option]>,
+def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
----------------
lanza wrote:
> Then `-c -Xclang -emit-cir` can be used to override the assumed action passed by clangDriver to cc1.
It would be incorrect to only use `-Xclang -emit-cir -c` as it would output a `.o` file for a textual `.cir` file. I've plugged in ClangIR to the action building system. `-c` requests actions through the assembler. We're stopping with ClangIR via `-emit-cir` after the `Compile` phase.
> -flto modifies -c to emit a bitcode file and -S to emit a textual IR file. -fcir can be modeled like -flto.
That's an inaccurate comparison. `-fcir` is supposed to only change from using codegen to cirgen&lowering. The output shouldn't change. `-emit-cir` is supposed to emit a file with the suffix `.cir`. The *driver* has to be told the preferred output type to tell the action system to emit a `.cir` suffixed file.
https://github.com/llvm/llvm-project/pull/91007
More information about the cfe-commits
mailing list