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) {
299 #if MLIR_ENABLE_PDL_IN_PATTERNMATCH
300 inline mlir::PDLPatternModule *
unwrap(MlirPDLPatternModule module) {
301 assert(module.ptr &&
"unexpected null module");
302 return static_cast<mlir::PDLPatternModule *
>(module.ptr);
305 inline MlirPDLPatternModule
wrap(mlir::PDLPatternModule *module) {
310 return wrap(
new mlir::PDLPatternModule(
319 MlirRewritePatternSet
static MlirBlock createBlock(const nb::sequence &pyArgTypes, const std::optional< nb::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.
LogicalResult applyPatternsGreedily(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 * cloneWithoutRegions(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
const FrozenRewritePatternSet & patterns
Operation * clone(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
A logical result value, essentially a boolean with named states.