aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAndrzej Warzynski <andrzej.warzynski@arm.com>2022-06-01 16:00:31 +0000
committerAndrzej Warzynski <andrzej.warzynski@arm.com>2022-06-10 10:58:54 +0000
commitcc3c6b61095a47687858b21e93d1a2fc3a6e192b (patch)
tree4fedfa676f411b893596bddec9185f5b8dfc60d9 /flang/lib/Frontend/CompilerInvocation.cpp
parentd50d9946d1d7e5f20881f0bc71fbd025040b1c96 (diff)
downloadllvm-cc3c6b61095a47687858b21e93d1a2fc3a6e192b.zip
llvm-cc3c6b61095a47687858b21e93d1a2fc3a6e192b.tar.gz
llvm-cc3c6b61095a47687858b21e93d1a2fc3a6e192b.tar.bz2
[flang][driver] Make `flang-new -fc1` accept MLIR files
This relatively small change will allow Flang's frontend driver, `flang-new -fc1`, to consume and parse MLIR files. Semantically (i.e. from user's perspective) this is identical to reading LLVM IR files. Two file extensions are associated with MLIR files: .fir and .mlir. Note that reading MLIR files makes only sense when running one of the code-generation actions, i.e. when using one of the following action flags: -S, -emit-obj, -emit-llvm, -emit-llvm-bc. The majority of tests that required `tco` to run are updated to also run with `flang-new -fc1`. A few tests are updated to use `fir-opt` instead of `tco` (that's the preferred choice when testing a particular MLIR pass). basic-program.fir is not updated as that test is intended to verify the behaviour of `tco` specifically. Differential Revision: https://reviews.llvm.org/D126890
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index cc376f3..8f2167b 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -269,10 +269,12 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
.Case("f95-cpp-input", Language::Fortran)
.Default(Language::Unknown);
- // Some special cases cannot be combined with suffixes.
+ // Flang's intermediate representations.
if (dashX.isUnknown())
dashX = llvm::StringSwitch<InputKind>(xValue)
.Case("ir", Language::LLVM_IR)
+ .Case("fir", Language::MLIR)
+ .Case("mlir", Language::MLIR)
.Default(Language::Unknown);
if (dashX.isUnknown())