35 unwrap(rewriter)->clearInsertionPoint();
50 unwrap(rewriter)->setInsertionPointAfterValue(
unwrap(value));
55 unwrap(rewriter)->setInsertionPointToStart(
unwrap(block));
64 return wrap(
unwrap(rewriter)->getInsertionBlock());
76 MlirBlock insertBefore,
78 MlirType
const *argTypes,
79 MlirLocation
const *locations) {
106 MlirRegion region, MlirBlock before) {
116 MlirRegion region, MlirBlock before) {
121 MlirOperation op, intptr_t nValues,
122 MlirValue
const *values) {
130 MlirOperation newOp) {
143 MlirBlock source, MlirOperation op,
145 MlirValue
const *argValues) {
154 MlirBlock dest, intptr_t nArgValues,
155 MlirValue
const *argValues) {
162 MlirOperation existingOp) {
167 MlirOperation existingOp) {
172 MlirBlock existingBlock) {
192 MlirValue from, MlirValue to) {
198 MlirValue
const *from,
199 MlirValue
const *to) {
204 unwrap(rewriter)->replaceAllUsesWith(unwrappedFromVals, unwrappedToVals);
210 MlirValue
const *to) {
213 unwrap(rewriter)->replaceAllOpUsesWith(
unwrap(from), unwrappedToVals);
225 MlirValue
const *newValues,
229 unwrap(rewriter)->replaceOpUsesWithinBlock(
unwrap(op), unwrappedVals,
234 MlirValue from, MlirValue to,
235 MlirOperation exceptedUser) {
261 assert(module.ptr &&
"unexpected null module");
270 unwrap(MlirFrozenRewritePatternSet module) {
271 assert(module.ptr &&
"unexpected null module");
292 MlirFrozenRewritePatternSet
patterns,
293 MlirGreedyRewriteDriverConfig) {
301 #if MLIR_ENABLE_PDL_IN_PATTERNMATCH
302 inline mlir::PDLPatternModule *
unwrap(MlirPDLPatternModule module) {
303 assert(module.ptr &&
"unexpected null module");
304 return static_cast<mlir::PDLPatternModule *
>(module.ptr);
307 inline MlirPDLPatternModule
wrap(mlir::PDLPatternModule *module) {
312 return wrap(
new mlir::PDLPatternModule(
321 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.