Skip to content

Commit 94289aa

Browse files
committed
Revert "[CIR][NFC] Move LoweringPrepare into CIRGen (#1092)"
This reverts commit 4463352.
1 parent f220fa7 commit 94289aa

26 files changed

+48
-69
lines changed

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class CIRGenerator : public clang::ASTConsumer {
9898
std::unique_ptr<mlir::MLIRContext> takeContext() {
9999
return std::move(mlirCtx);
100100
};
101-
clang::CIRGen::CIRGenModule &getCGM() { return *CGM; }
102101

103102
bool verifyModule();
104103

clang/include/clang/CIR/CIRToCIRPasses.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
namespace clang {
2020
class ASTContext;
21-
namespace CIRGen {
22-
class CIRGenModule;
23-
} // namespace CIRGen
24-
} // namespace clang
21+
}
2522

2623
namespace mlir {
2724
class MLIRContext;
@@ -33,12 +30,12 @@ namespace cir {
3330
// Run set of cleanup/prepare/etc passes CIR <-> CIR.
3431
mlir::LogicalResult runCIRToCIRPasses(
3532
mlir::ModuleOp theModule, mlir::MLIRContext *mlirCtx,
36-
clang::CIRGen::CIRGenModule &cgm, clang::ASTContext &astCtx,
37-
bool enableVerifier, bool enableLifetime, llvm::StringRef lifetimeOpts,
38-
bool enableIdiomRecognizer, llvm::StringRef idiomRecognizerOpts,
39-
bool enableLibOpt, llvm::StringRef libOptOpts,
40-
std::string &passOptParsingFailure, bool enableCIRSimplify, bool flattenCIR,
41-
bool emitMLIR, bool enableCallConvLowering, bool enableMem2reg);
33+
clang::ASTContext &astCtx, bool enableVerifier, bool enableLifetime,
34+
llvm::StringRef lifetimeOpts, bool enableIdiomRecognizer,
35+
llvm::StringRef idiomRecognizerOpts, bool enableLibOpt,
36+
llvm::StringRef libOptOpts, std::string &passOptParsingFailure,
37+
bool enableCIRSimplify, bool flattenCIR, bool emitMLIR,
38+
bool enableCallConvLowering, bool enableMem2reg);
4239

4340
} // namespace cir
4441

clang/include/clang/CIR/Dialect/Passes.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717

1818
namespace clang {
1919
class ASTContext;
20-
namespace CIRGen {
21-
class CIRGenModule;
22-
} // namespace CIRGen
23-
} // namespace clang
24-
20+
}
2521
namespace mlir {
2622

2723
std::unique_ptr<Pass> createLifetimeCheckPass();
@@ -35,9 +31,7 @@ std::unique_ptr<Pass> createCIRSimplifyPass();
3531
std::unique_ptr<Pass> createDropASTPass();
3632
std::unique_ptr<Pass> createSCFPreparePass();
3733
std::unique_ptr<Pass> createLoweringPreparePass();
38-
std::unique_ptr<Pass>
39-
createLoweringPreparePass(clang::ASTContext *astCtx,
40-
clang::CIRGen::CIRGenModule &cgm);
34+
std::unique_ptr<Pass> createLoweringPreparePass(clang::ASTContext *astCtx);
4135
std::unique_ptr<Pass> createIdiomRecognizerPass();
4236
std::unique_ptr<Pass> createIdiomRecognizerPass(clang::ASTContext *astCtx);
4337
std::unique_ptr<Pass> createLibOptPass();

clang/include/clang/CIR/Dialect/Passes.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def SCFPrepare : Pass<"cir-mlir-scf-prepare"> {
109109

110110
def HoistAllocas : Pass<"cir-hoist-allocas"> {
111111
let summary = "Hoist allocas to the entry of the function";
112-
let description = [{
112+
let description = [{
113113
This pass hoist all non-dynamic allocas to the entry of the function.
114114
This is helpful for later code generation.
115115
}];
@@ -119,7 +119,7 @@ def HoistAllocas : Pass<"cir-hoist-allocas"> {
119119

120120
def FlattenCFG : Pass<"cir-flatten-cfg"> {
121121
let summary = "Produces flatten cfg";
122-
let description = [{
122+
let description = [{
123123
This pass transforms CIR and inline all the nested regions. Thus,
124124
the next post condtions are met after the pass applied:
125125
- there is not any nested region in a function body

clang/lib/CIR/CodeGen/CIRPasses.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "clang/AST/ASTContext.h"
1414
#include "clang/CIR/Dialect/Passes.h"
1515

16-
#include "CIRGenModule.h"
1716
#include "mlir/IR/BuiltinOps.h"
1817
#include "mlir/Pass/Pass.h"
1918
#include "mlir/Pass/PassManager.h"
@@ -25,12 +24,12 @@
2524
namespace cir {
2625
mlir::LogicalResult runCIRToCIRPasses(
2726
mlir::ModuleOp theModule, mlir::MLIRContext *mlirCtx,
28-
clang::CIRGen::CIRGenModule &cgm, clang::ASTContext &astCtx,
29-
bool enableVerifier, bool enableLifetime, llvm::StringRef lifetimeOpts,
30-
bool enableIdiomRecognizer, llvm::StringRef idiomRecognizerOpts,
31-
bool enableLibOpt, llvm::StringRef libOptOpts,
32-
std::string &passOptParsingFailure, bool enableCIRSimplify, bool flattenCIR,
33-
bool emitMLIR, bool enableCallConvLowering, bool enableMem2Reg) {
27+
clang::ASTContext &astCtx, bool enableVerifier, bool enableLifetime,
28+
llvm::StringRef lifetimeOpts, bool enableIdiomRecognizer,
29+
llvm::StringRef idiomRecognizerOpts, bool enableLibOpt,
30+
llvm::StringRef libOptOpts, std::string &passOptParsingFailure,
31+
bool enableCIRSimplify, bool flattenCIR, bool emitMLIR,
32+
bool enableCallConvLowering, bool enableMem2Reg) {
3433

3534
llvm::TimeTraceScope scope("CIR To CIR Passes");
3635

@@ -74,7 +73,7 @@ mlir::LogicalResult runCIRToCIRPasses(
7473
if (enableCIRSimplify)
7574
pm.addPass(mlir::createCIRSimplifyPass());
7675

77-
pm.addPass(mlir::createLoweringPreparePass(&astCtx, cgm));
76+
pm.addPass(mlir::createLoweringPreparePass(&astCtx));
7877

7978
if (flattenCIR || enableMem2Reg)
8079
mlir::populateCIRPreLoweringPasses(pm, enableCallConvLowering);

clang/lib/CIR/CodeGen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ add_clang_library(clangCIR
4444
CIRPasses.cpp
4545
CIRRecordLayoutBuilder.cpp
4646
ConstantInitBuilder.cpp
47-
LoweringPrepare.cpp
4847
TargetInfo.cpp
4948

5049
DEPENDS

clang/lib/CIR/Dialect/Transforms/CIRCanonicalize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "PassDetail.h"
910
#include "mlir/Dialect/Func/IR/FuncOps.h"
1011
#include "mlir/IR/Block.h"
1112
#include "mlir/IR/Operation.h"
@@ -15,7 +16,6 @@
1516
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
1617
#include "clang/CIR/Dialect/IR/CIRDialect.h"
1718
#include "clang/CIR/Dialect/Passes.h"
18-
#include "clang/CIR/Dialect/Transforms/PassDetail.h"
1919

2020
using namespace mlir;
2121
using namespace cir;

clang/lib/CIR/Dialect/Transforms/CIRSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "PassDetail.h"
910
#include "mlir/Dialect/Func/IR/FuncOps.h"
1011
#include "mlir/IR/Block.h"
1112
#include "mlir/IR/Operation.h"
@@ -15,7 +16,6 @@
1516
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
1617
#include "clang/CIR/Dialect/IR/CIRDialect.h"
1718
#include "clang/CIR/Dialect/Passes.h"
18-
#include "clang/CIR/Dialect/Transforms/PassDetail.h"
1919
#include "llvm/ADT/SmallVector.h"
2020

2121
using namespace mlir;

clang/lib/CIR/Dialect/Transforms/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ add_subdirectory(TargetLowering)
22

33
add_clang_library(MLIRCIRTransforms
44
LifetimeCheck.cpp
5+
LoweringPrepare.cpp
56
CIRCanonicalize.cpp
67
CIRSimplify.cpp
78
DropAST.cpp

clang/lib/CIR/Dialect/Transforms/DropAST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
#include "clang/CIR/Dialect/Passes.h"
1010

11+
#include "PassDetail.h"
1112
#include "mlir/Dialect/Func/IR/FuncOps.h"
1213
#include "clang/AST/ASTContext.h"
1314
#include "clang/CIR/Dialect/IR/CIRDialect.h"
14-
#include "clang/CIR/Dialect/Transforms/PassDetail.h"
1515

1616
#include "llvm/ADT/SetOperations.h"
1717
#include "llvm/ADT/SmallSet.h"

0 commit comments

Comments
 (0)