Skip to content

Commit 29ea13b

Browse files
committed
Replace -emit-fir with -emit-mlir
Also included changes that I forgot to include in the previous commit (fix CMake dependencies, clang-format).
1 parent f3b35bd commit 29ea13b

File tree

8 files changed

+16
-21
lines changed

8 files changed

+16
-21
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4468,8 +4468,8 @@ def fintrinsic_modules_path : Separate<["-"], "fintrinsic-modules-path">, Group
44684468
DocBrief<[{This option specifies the location of pre-compiled intrinsic modules,
44694469
if they are not in the default location expected by the compiler.}]>;
44704470

4471-
def emit_fir : Flag<["-"], "emit-fir">, Group<Action_Group>,
4472-
HelpText<"Build the parse tree, then convert to FIR and dump">;
4471+
def emit_mlir : Flag<["-"], "emit-mlir">, Group<Action_Group>,
4472+
HelpText<"Build the parse tree, then lower it to MLIR and dump">;
44734473
}
44744474

44754475
def J : JoinedOrSeparate<["-"], "J">,

flang/include/flang/Frontend/FrontendActions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class CodeGenAction : public FrontendAction {
136136
bool BeginSourceFileAction() override;
137137
};
138138

139-
class EmitFirAction : public CodeGenAction {
139+
class EmitMLIRAction : public CodeGenAction {
140140
void ExecuteAction() override;
141141
};
142142

flang/include/flang/Frontend/FrontendOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum ActionKind {
3232
ParseSyntaxOnly,
3333

3434
/// Emit a .mlir file
35-
EmitFir,
35+
EmitMLIR,
3636

3737
/// Emit a .o file.
3838
EmitObj,

flang/lib/Frontend/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ add_flang_library(flangFrontend
2424
FIRDialect
2525
FIRAnalysis
2626
FIRSupport
27-
FIRTransforms
2827
FIRBuilder
29-
FIRRuntime
3028
${dialect_libs}
31-
MLIRAffineToStandard
32-
MLIRSCFToStandard
3329

3430
LINK_COMPONENTS
3531
Option

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
124124
opts.programAction = ParseSyntaxOnly;
125125
break;
126126
case clang::driver::options::OPT_emit_fir:
127-
opts.programAction = EmitFir;
127+
opts.programAction = EmitMLIR;
128128
break;
129129
case clang::driver::options::OPT_emit_obj:
130130
opts.programAction = EmitObj;

flang/lib/Frontend/FrontendActions.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "flang/Frontend/FrontendActions.h"
10+
#include "mlir/IR/Dialect.h"
11+
#include "mlir/Pass/PassManager.h"
12+
#include "mlir/Support/LogicalResult.h"
1013
#include "flang/Common/default-kinds.h"
1114
#include "flang/Frontend/CompilerInstance.h"
1215
#include "flang/Frontend/FrontendOptions.h"
1316
#include "flang/Frontend/PreprocessorOptions.h"
1417
#include "flang/Lower/Bridge.h"
1518
#include "flang/Lower/PFTBuilder.h"
19+
#include "flang/Lower/Support/Verifier.h"
1620
#include "flang/Optimizer/Dialect/FIRType.h"
21+
#include "flang/Optimizer/Support/InitFIR.h"
22+
#include "flang/Optimizer/Support/KindMapping.h"
1723
#include "flang/Parser/dump-parse-tree.h"
1824
#include "flang/Parser/parsing.h"
1925
#include "flang/Parser/provenance.h"
@@ -27,13 +33,6 @@
2733
#include "llvm/Support/raw_ostream.h"
2834
#include <clang/Basic/Diagnostic.h>
2935
#include <memory>
30-
#include "mlir/IR/Dialect.h"
31-
#include "flang/Optimizer/Support/InitFIR.h"
32-
#include "flang/Optimizer/Support/KindMapping.h"
33-
#include "flang/Lower/Bridge.h"
34-
#include "mlir/Pass/PassManager.h"
35-
#include "mlir/Support/LogicalResult.h"
36-
#include "flang/Lower/Support/Verifier.h"
3736

3837
using namespace Fortran::frontend;
3938

@@ -382,7 +381,7 @@ fromDefaultKinds(const Fortran::common::IntrinsicTypeDefaultKinds &defKinds) {
382381
defKinds.GetDefaultKind(Fortran::common::TypeCategory::Real))};
383382
}
384383

385-
void EmitFirAction::ExecuteAction() {
384+
void EmitMLIRAction::ExecuteAction() {
386385
CompilerInstance &ci = this->instance();
387386

388387
// Load the MLIR dialects required by Flang

flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ static std::unique_ptr<FrontendAction> CreateFrontendBaseAction(
3232
return std::make_unique<PrintPreprocessedAction>();
3333
case ParseSyntaxOnly:
3434
return std::make_unique<ParseSyntaxOnlyAction>();
35-
case EmitFir:
36-
return std::make_unique<EmitFirAction>();
35+
case EmitMLIR:
36+
return std::make_unique<EmitMLIRAction>();
3737
case EmitObj:
3838
return std::make_unique<EmitObjAction>();
3939
case DebugUnparse:

flang/unittests/Frontend/FrontendActionTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ TEST_F(FrontendActionTest, ParseSyntaxOnly) {
162162
":1:14: error: IF statement is not allowed in IF statement\n"));
163163
}
164164

165-
TEST_F(FrontendActionTest, EmitFir) {
165+
TEST_F(FrontendActionTest, EmitMLIR) {
166166
// Populate the input file with the pre-defined input and flush it.
167167
*(inputFileOs_) << "end program";
168168
inputFileOs_.reset();
169169

170170
// Set-up the action kind.
171-
compInst_.invocation().frontendOpts().programAction = EmitFir;
171+
compInst_.invocation().frontendOpts().programAction = EmitMLIR;
172172
compInst_.invocation().preprocessorOpts().noReformat = true;
173173

174174
// Set-up the output stream. We are using output buffer wrapped as an output

0 commit comments

Comments
 (0)