[flang-commits] [flang] [flang][CodeGen][NFC] Reduce BoxedProcedurePass boilerplate (PR #94200)
via flang-commits
flang-commits at lists.llvm.org
Mon Jun 3 02:49:04 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-codegen
Author: Tom Eccles (tblah)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/94200.diff
3 Files Affected:
- (modified) flang/include/flang/Optimizer/CodeGen/CGPasses.td (-1)
- (modified) flang/include/flang/Optimizer/CodeGen/CodeGen.h (-5)
- (modified) flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp (+1-10)
``````````diff
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);
-}
``````````
</details>
https://github.com/llvm/llvm-project/pull/94200
More information about the flang-commits
mailing list