forked from OSchip/llvm-project
[mlir] Finish removing FunctionPass
FunctionPass has been deprecated in favor of OperationPass<FuncOp> for a few weeks, and this commit finished the deprecation with deletion. The only difference between the two is that FunctionPass filters out function declarations. When updating references to FunctionPass, ensure that the pass either can handle declarations or explicitly add in filtering. See https://llvm.discourse.group/t/functionpass-deprecated-in-favor-of-operationpass-funcop Differential Revision: https://reviews.llvm.org/D118735
This commit is contained in:
parent
2418cd92c0
commit
7889ff7f00
|
@ -63,7 +63,7 @@ scf::ForOp cloneWithNewYields(OpBuilder &b, scf::ForOp loop,
|
|||
/// single block. This constraint makes it easy to determine the result.
|
||||
/// This method also clones the `arith::ConstantIndexOp` at the start of
|
||||
/// `outlinedFuncBody` to alloc simple canonicalizations.
|
||||
/// Creates a new FuncOp and thus cannot be used in a FunctionPass.
|
||||
/// Creates a new FuncOp and thus cannot be used in a FuncOp pass.
|
||||
/// The client is responsible for providing a unique `funcName` that will not
|
||||
/// collide with another FuncOp name.
|
||||
// TODO: support more than single-block regions.
|
||||
|
@ -76,7 +76,7 @@ FailureOr<FuncOp> outlineSingleBlockRegion(RewriterBase &rewriter, Location loc,
|
|||
/// region is inlined into a new FuncOp that is captured by the pointer.
|
||||
/// - if `elseFn` is not null, `elseFnName` must be specified and the `else`
|
||||
/// region is inlined into a new FuncOp that is captured by the pointer.
|
||||
/// Creates new FuncOps and thus cannot be used in a FunctionPass.
|
||||
/// Creates new FuncOps and thus cannot be used in a FuncOp pass.
|
||||
/// The client is responsible for providing a unique `thenFnName`/`elseFnName`
|
||||
/// that will not collide with another FuncOp name.
|
||||
LogicalResult outlineIfOp(RewriterBase &b, scf::IfOp ifOp, FuncOp *thenFn,
|
||||
|
|
|
@ -375,35 +375,6 @@ protected:
|
|||
OperationPass(const OperationPass &) = default;
|
||||
};
|
||||
|
||||
/// NOTICE: This class is deprecated in favor of `OperationPass<FuncOp>`
|
||||
/// and will be removed soon.
|
||||
/// A model for providing function pass specific utilities.
|
||||
///
|
||||
/// Derived function passes are expected to provide the following:
|
||||
/// - A 'void runOnFunction()' method.
|
||||
/// - A 'StringRef getName() const' method.
|
||||
/// - A 'std::unique_ptr<Pass> clonePass() const' method.
|
||||
class [[deprecated(
|
||||
"Use OperationPass<FuncOp> instead: See "
|
||||
"https://llvm.discourse.group/t/"
|
||||
"functionpass-deprecated-in-favor-of-operationpass-funcop")]] FunctionPass
|
||||
: public OperationPass<FuncOp> {
|
||||
public:
|
||||
using OperationPass<FuncOp>::OperationPass;
|
||||
|
||||
/// The polymorphic API that runs the pass over the currently held function.
|
||||
virtual void runOnFunction() = 0;
|
||||
|
||||
/// The polymorphic API that runs the pass over the currently held operation.
|
||||
void runOnOperation() final {
|
||||
if (!getFunction().isExternal())
|
||||
runOnFunction();
|
||||
}
|
||||
|
||||
/// Return the current function being transformed.
|
||||
FuncOp getFunction() { return this->getOperation(); }
|
||||
};
|
||||
|
||||
/// This class provides a CRTP wrapper around a base pass class to define
|
||||
/// several necessary utility methods. This should only be used for passes that
|
||||
/// are not suitably represented using the declarative pass specification(i.e.
|
||||
|
|
|
@ -92,9 +92,4 @@ class PassBase<string passArg, string base> {
|
|||
class Pass<string passArg, string operation = "">
|
||||
: PassBase<passArg, "::mlir::OperationPass<" # operation # ">">;
|
||||
|
||||
/// NOTICE: This class is deprecated in favor of `Pass<..., "mlir::FuncOp">`
|
||||
/// and will be removed soon.
|
||||
// This class represents an mlir::FunctionPass.
|
||||
class FunctionPass<string passArg> : PassBase<passArg, "::mlir::FunctionPass">;
|
||||
|
||||
#endif // MLIR_PASS_PASSBASE
|
||||
|
|
Loading…
Reference in New Issue