diff options
author | Andy Kaylor <akaylor@nvidia.com> | 2025-02-19 09:08:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-19 09:08:37 -0800 |
commit | 75ea7aed93ec8afa43634a41c2e94380ba0d671e (patch) | |
tree | 6cbda8cde083a6441b515a668117c066d228cb73 /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
parent | ddf24086f119cacf2a0fc489773f8af302f4a489 (diff) | |
download | llvm-75ea7aed93ec8afa43634a41c2e94380ba0d671e.zip llvm-75ea7aed93ec8afa43634a41c2e94380ba0d671e.tar.gz llvm-75ea7aed93ec8afa43634a41c2e94380ba0d671e.tar.bz2 |
[CIR] Add additional frontend actions (#127249)
Add frontend actions to support emitting assembly, bitcode, and object
files when compiling with ClangIR. This change also correctly sets and
propagates the target triple in the MLIR and LLVM modules, which was a
necessary prerequisite for emitting assembly and object files.
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r-- | clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index c8d0041..bb3bb0a 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -62,8 +62,18 @@ CreateFrontendBaseAction(CompilerInstance &CI) { return std::make_unique<DumpCompilerOptionsAction>(); case DumpRawTokens: return std::make_unique<DumpRawTokensAction>(); case DumpTokens: return std::make_unique<DumpTokensAction>(); - case EmitAssembly: return std::make_unique<EmitAssemblyAction>(); - case EmitBC: return std::make_unique<EmitBCAction>(); + case EmitAssembly: +#if CLANG_ENABLE_CIR + if (UseCIR) + return std::make_unique<cir::EmitAssemblyAction>(); +#endif + return std::make_unique<EmitAssemblyAction>(); + case EmitBC: +#if CLANG_ENABLE_CIR + if (UseCIR) + return std::make_unique<cir::EmitBCAction>(); +#endif + return std::make_unique<EmitBCAction>(); case EmitCIR: #if CLANG_ENABLE_CIR return std::make_unique<cir::EmitCIRAction>(); @@ -80,7 +90,12 @@ CreateFrontendBaseAction(CompilerInstance &CI) { } case EmitLLVMOnly: return std::make_unique<EmitLLVMOnlyAction>(); case EmitCodeGenOnly: return std::make_unique<EmitCodeGenOnlyAction>(); - case EmitObj: return std::make_unique<EmitObjAction>(); + case EmitObj: +#if CLANG_ENABLE_CIR + if (UseCIR) + return std::make_unique<cir::EmitObjAction>(); +#endif + return std::make_unique<EmitObjAction>(); case ExtractAPI: return std::make_unique<ExtractAPIAction>(); case FixIt: return std::make_unique<FixItAction>(); |