From 33be83415c9b5e9a874fcbddee8e64ecf464c203 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 14 Mar 2023 17:40:04 +0000 Subject: [flang][driver][openmp] Write MLIR for -save-temps This patch adds support for producing MLIR files when using -save-temps on flang. One MLIR file will be produced before lowering and optimization passes, containing the operations produced by the PFT-to-MLIR lowering bridge, and another at the end of the process, just before LLVM IR generation. This is accomplished by forwarding the -save-temps flag from the driver to the frontend, and modifying it to output MLIR files accordingly. Differential Revision: https://reviews.llvm.org/D146075 --- flang/lib/Frontend/CompilerInvocation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index a4183a5..49dfeed 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -150,6 +150,9 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts, opts.PrepareForThinLTO = true; } + if (auto *a = args.getLastArg(clang::driver::options::OPT_save_temps_EQ)) + opts.SaveTempsDir = a->getValue(); + // -mrelocation-model option. if (const llvm::opt::Arg *a = args.getLastArg(clang::driver::options::OPT_mrelocation_model)) { -- cgit v1.1