[flang][driver][openmp] Write MLIR for -save-temps
authorSergio Afonso <safonsof@amd.com>
Tue, 14 Mar 2023 17:40:04 +0000 (17:40 +0000)
committerSergio Afonso <safonsof@amd.com>
Fri, 24 Mar 2023 17:13:40 +0000 (17:13 +0000)
commit33be83415c9b5e9a874fcbddee8e64ecf464c203
treea29e56032d7335964e0fca03a61acb5b4c42e8db
parente74834f9bb6bb608e00e2cd230cb3b63df0803b9
[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
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Flang.cpp
flang/include/flang/Frontend/CodeGenOptions.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/test/Driver/driver-help.f90
flang/test/Driver/frontend-forwarding.f90
flang/test/Driver/save-mlir-temps.f90 [new file with mode: 0644]