[flang-commits] [flang] [flang][CodeGen][NFC] Reduce BoxedProcedurePass boilerplate (PR #94200)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Jun 3 02:48:34 PDT 2024
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/94200
The pass constructor can be generated automatically by tablegen.
The pass is module-level and iterates over every operation within the module so it should not need any changes to support alternative top level operations.
>From 8f390e45bc56f2816a784fd06087d9781d0f9e6b Mon Sep 17 00:00:00 2001
From: Tom Eccles <tom.eccles at arm.com>
Date: Thu, 23 May 2024 14:53:15 +0000
Subject: [PATCH] [flang][CodeGen][NFC] Reduce BoxedProcedurePass boilerplate
The pass constructor can be generated automatically by tablegen.
The pass is module-level and iterates over every operation within the
module so it should not need any changes to support alternative top
level operations.
---
flang/include/flang/Optimizer/CodeGen/CGPasses.td | 1 -
flang/include/flang/Optimizer/CodeGen/CodeGen.h | 5 -----
flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp | 11 +----------
3 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/flang/include/flang/Optimizer/CodeGen/CGPasses.td b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
index 565920e55e6a8..d23f07a5c8f11 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGPasses.td
+++ b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
@@ -85,7 +85,6 @@ def TargetRewritePass : Pass<"target-rewrite", "mlir::ModuleOp"> {
}
def BoxedProcedurePass : Pass<"boxed-procedure", "mlir::ModuleOp"> {
- let constructor = "::fir::createBoxedProcedurePass()";
let options = [
Option<"useThunks", "use-thunks",
"bool", /*default=*/"true",
diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGen.h b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
index 4d2b191b46d08..b2773abbd8411 100644
--- a/flang/include/flang/Optimizer/CodeGen/CodeGen.h
+++ b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
@@ -78,11 +78,6 @@ std::unique_ptr<mlir::Pass> createLLVMDialectToLLVMPass(
LLVMIRLoweringPrinter printer =
[](llvm::Module &m, llvm::raw_ostream &out) { m.print(out, nullptr); });
-/// Convert boxproc values to a lower level representation. The default is to
-/// use function pointers and thunks.
-std::unique_ptr<mlir::Pass> createBoxedProcedurePass();
-std::unique_ptr<mlir::Pass> createBoxedProcedurePass(bool useThunks);
-
/// Populate the given list with patterns that convert from FIR to LLVM.
void populateFIRToLLVMConversionPatterns(fir::LLVMTypeConverter &converter,
mlir::RewritePatternSet &patterns,
diff --git a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
index 5229d40f2250d..c536fd19fcc69 100644
--- a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
+++ b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
@@ -211,8 +211,7 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
class BoxedProcedurePass
: public fir::impl::BoxedProcedurePassBase<BoxedProcedurePass> {
public:
- BoxedProcedurePass() { options = {true}; }
- BoxedProcedurePass(bool useThunks) { options = {useThunks}; }
+ using BoxedProcedurePassBase<BoxedProcedurePass>::BoxedProcedurePassBase;
inline mlir::ModuleOp getModule() { return getOperation(); }
@@ -397,11 +396,3 @@ class BoxedProcedurePass
BoxedProcedureOptions options;
};
} // namespace
-
-std::unique_ptr<mlir::Pass> fir::createBoxedProcedurePass() {
- return std::make_unique<BoxedProcedurePass>();
-}
-
-std::unique_ptr<mlir::Pass> fir::createBoxedProcedurePass(bool useThunks) {
- return std::make_unique<BoxedProcedurePass>(useThunks);
-}
More information about the flang-commits
mailing list