34 unwrap(rewriter)->clearInsertionPoint();
49 unwrap(rewriter)->setInsertionPointAfterValue(
unwrap(value));
54 unwrap(rewriter)->setInsertionPointToStart(
unwrap(block));
63 return wrap(
unwrap(rewriter)->getInsertionBlock());
74 MlirBlock insertBefore,
76 MlirType
const *argTypes,
77 MlirLocation
const *locations) {
104 MlirRegion region, MlirBlock before) {
114 MlirRegion region, MlirBlock before) {
119 MlirOperation op, intptr_t nValues,
120 MlirValue
const *values) {
128 MlirOperation newOp) {
141 MlirBlock source, MlirOperation op,
143 MlirValue
const *argValues) {
152 MlirBlock dest, intptr_t nArgValues,
153 MlirValue
const *argValues) {
160 MlirOperation existingOp) {
165 MlirOperation existingOp) {
170 MlirBlock existingBlock) {
190 MlirValue from, MlirValue to) {
196 MlirValue
const *from,
197 MlirValue
const *to) {
202 unwrap(rewriter)->replaceAllUsesWith(unwrappedFromVals, unwrappedToVals);
208 MlirValue
const *to) {
211 unwrap(rewriter)->replaceAllOpUsesWith(
unwrap(from), unwrappedToVals);
223 MlirValue
const *newValues,
227 unwrap(rewriter)->replaceOpUsesWithinBlock(
unwrap(op), unwrappedVals,
232 MlirValue from, MlirValue to,
233 MlirOperation exceptedUser) {
259 assert(module.ptr &&
"unexpected null module");
268 unwrap(MlirFrozenRewritePatternSet module) {
269 assert(module.ptr &&
"unexpected null module");
290 MlirFrozenRewritePatternSet patterns,
291 MlirGreedyRewriteDriverConfig) {
300 #if MLIR_ENABLE_PDL_IN_PATTERNMATCH
301 inline mlir::PDLPatternModule *
unwrap(MlirPDLPatternModule module) {
302 assert(module.ptr &&
"unexpected null module");
303 return static_cast<mlir::PDLPatternModule *
>(module.ptr);
306 inline MlirPDLPatternModule
wrap(mlir::PDLPatternModule *module) {
311 return wrap(
new mlir::PDLPatternModule(
320 MlirRewritePatternSet
static MlirBlock createBlock(const py::sequence &pyArgTypes, const std::optional< py::sequence > &pyArgLocs)
Create a block, using the current location context if no locations are specified.
static MLIRContext * getContext(OpFoldResult val)
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
This class represents a frozen set of patterns that can be processed by a pattern applicator.
This class coordinates rewriting a piece of IR outside of a pattern rewrite, providing a way to keep ...
This class acts as an owning reference to an op, and will automatically destroy the held op on destru...
MLIR_CAPI_EXPORTED void mlirPDLPatternModuleDestroy(MlirPDLPatternModule op)
MLIR_CAPI_EXPORTED MlirPDLPatternModule mlirPDLPatternModuleFromModule(MlirModule op)
MLIR_CAPI_EXPORTED MlirRewritePatternSet mlirRewritePatternSetFromPDLPatternModule(MlirPDLPatternModule op)
Include the generated interface declarations.
Operation * cloneWithoutRegions(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
LogicalResult applyPatternsAndFoldGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...
Operation * clone(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
A logical result value, essentially a boolean with named states.