Skip to content

Commit c0e6dd1

Browse files
authored
[flang][CodeGen][NFC] Reduce BoxedProcedurePass boilerplate (#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.
1 parent f98be87 commit c0e6dd1

File tree

3 files changed

+1
-16
lines changed

3 files changed

+1
-16
lines changed

flang/include/flang/Optimizer/CodeGen/CGPasses.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def TargetRewritePass : Pass<"target-rewrite", "mlir::ModuleOp"> {
8585
}
8686

8787
def BoxedProcedurePass : Pass<"boxed-procedure", "mlir::ModuleOp"> {
88-
let constructor = "::fir::createBoxedProcedurePass()";
8988
let options = [
9089
Option<"useThunks", "use-thunks",
9190
"bool", /*default=*/"true",

flang/include/flang/Optimizer/CodeGen/CodeGen.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ std::unique_ptr<mlir::Pass> createLLVMDialectToLLVMPass(
7878
LLVMIRLoweringPrinter printer =
7979
[](llvm::Module &m, llvm::raw_ostream &out) { m.print(out, nullptr); });
8080

81-
/// Convert boxproc values to a lower level representation. The default is to
82-
/// use function pointers and thunks.
83-
std::unique_ptr<mlir::Pass> createBoxedProcedurePass();
84-
std::unique_ptr<mlir::Pass> createBoxedProcedurePass(bool useThunks);
85-
8681
/// Populate the given list with patterns that convert from FIR to LLVM.
8782
void populateFIRToLLVMConversionPatterns(fir::LLVMTypeConverter &converter,
8883
mlir::RewritePatternSet &patterns,

flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
211211
class BoxedProcedurePass
212212
: public fir::impl::BoxedProcedurePassBase<BoxedProcedurePass> {
213213
public:
214-
BoxedProcedurePass() { options = {true}; }
215-
BoxedProcedurePass(bool useThunks) { options = {useThunks}; }
214+
using BoxedProcedurePassBase<BoxedProcedurePass>::BoxedProcedurePassBase;
216215

217216
inline mlir::ModuleOp getModule() { return getOperation(); }
218217

@@ -397,11 +396,3 @@ class BoxedProcedurePass
397396
BoxedProcedureOptions options;
398397
};
399398
} // namespace
400-
401-
std::unique_ptr<mlir::Pass> fir::createBoxedProcedurePass() {
402-
return std::make_unique<BoxedProcedurePass>();
403-
}
404-
405-
std::unique_ptr<mlir::Pass> fir::createBoxedProcedurePass(bool useThunks) {
406-
return std::make_unique<BoxedProcedurePass>(useThunks);
407-
}

0 commit comments

Comments
 (0)