MLIR
22.0.0git
|
Go to the source code of this file.
Classes | |
struct | MlirRewritePatternCallbacks |
RewritePattern API. More... | |
Macros | |
#define | DEFINE_C_API_STRUCT(name, storage) |
Opaque type declarations (see mlir-c/IR.h for more details). More... | |
Typedefs | |
typedef MlirLogicalResult(* | MlirPDLRewriteFunction) (MlirPatternRewriter rewriter, MlirPDLResultList results, size_t nValues, MlirPDLValue *values, void *userData) |
This function type is used as callbacks for PDL native rewrite functions. More... | |
typedef MlirLogicalResult(* | MlirPDLConstraintFunction) (MlirPatternRewriter rewriter, MlirPDLResultList results, size_t nValues, MlirPDLValue *values, void *userData) |
This function type is used as callbacks for PDL native constraint functions. More... | |
Functions | |
DEFINE_C_API_STRUCT (MlirRewriterBase, void) | |
DEFINE_C_API_STRUCT (MlirFrozenRewritePatternSet, void) | |
DEFINE_C_API_STRUCT (MlirGreedyRewriteDriverConfig, void) | |
DEFINE_C_API_STRUCT (MlirRewritePatternSet, void) | |
DEFINE_C_API_STRUCT (MlirPatternRewriter, void) | |
DEFINE_C_API_STRUCT (MlirRewritePattern, const void) | |
MLIR_CAPI_EXPORTED MlirContext | mlirRewriterBaseGetContext (MlirRewriterBase rewriter) |
RewriterBase API inherited from OpBuilder. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseClearInsertionPoint (MlirRewriterBase rewriter) |
Insertion points methods. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseSetInsertionPointBefore (MlirRewriterBase rewriter, MlirOperation op) |
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseSetInsertionPointAfter (MlirRewriterBase rewriter, MlirOperation op) |
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseSetInsertionPointAfterValue (MlirRewriterBase rewriter, MlirValue value) |
Sets the insertion point to the node after the specified value. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseSetInsertionPointToStart (MlirRewriterBase rewriter, MlirBlock block) |
Sets the insertion point to the start of the specified block. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseSetInsertionPointToEnd (MlirRewriterBase rewriter, MlirBlock block) |
Sets the insertion point to the end of the specified block. More... | |
MLIR_CAPI_EXPORTED MlirBlock | mlirRewriterBaseGetInsertionBlock (MlirRewriterBase rewriter) |
Return the block the current insertion point belongs to. More... | |
MLIR_CAPI_EXPORTED MlirBlock | mlirRewriterBaseGetBlock (MlirRewriterBase rewriter) |
Returns the current block of the rewriter. More... | |
MLIR_CAPI_EXPORTED MlirOperation | mlirRewriterBaseGetOperationAfterInsertion (MlirRewriterBase rewriter) |
Returns the operation right after the current insertion point of the rewriter. More... | |
MLIR_CAPI_EXPORTED MlirBlock | mlirRewriterBaseCreateBlockBefore (MlirRewriterBase rewriter, MlirBlock insertBefore, intptr_t nArgTypes, MlirType const *argTypes, MlirLocation const *locations) |
Block and operation creation/insertion/cloning. More... | |
MLIR_CAPI_EXPORTED MlirOperation | mlirRewriterBaseInsert (MlirRewriterBase rewriter, MlirOperation op) |
Insert the given operation at the current insertion point and return it. More... | |
MLIR_CAPI_EXPORTED MlirOperation | mlirRewriterBaseClone (MlirRewriterBase rewriter, MlirOperation op) |
Creates a deep copy of the specified operation. More... | |
MLIR_CAPI_EXPORTED MlirOperation | mlirRewriterBaseCloneWithoutRegions (MlirRewriterBase rewriter, MlirOperation op) |
Creates a deep copy of this operation but keep the operation regions empty. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseCloneRegionBefore (MlirRewriterBase rewriter, MlirRegion region, MlirBlock before) |
Clone the blocks that belong to "region" before the given position in another region "parent". More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseInlineRegionBefore (MlirRewriterBase rewriter, MlirRegion region, MlirBlock before) |
RewriterBase API. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceOpWithValues (MlirRewriterBase rewriter, MlirOperation op, intptr_t nValues, MlirValue const *values) |
Replace the results of the given (original) operation with the specified list of values (replacements). More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceOpWithOperation (MlirRewriterBase rewriter, MlirOperation op, MlirOperation newOp) |
Replace the results of the given (original) operation with the specified new op (replacement). More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseEraseOp (MlirRewriterBase rewriter, MlirOperation op) |
Erases an operation that is known to have no uses. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseEraseBlock (MlirRewriterBase rewriter, MlirBlock block) |
Erases a block along with all operations inside it. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseInlineBlockBefore (MlirRewriterBase rewriter, MlirBlock source, MlirOperation op, intptr_t nArgValues, MlirValue const *argValues) |
Inline the operations of block 'source' before the operation 'op'. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseMergeBlocks (MlirRewriterBase rewriter, MlirBlock source, MlirBlock dest, intptr_t nArgValues, MlirValue const *argValues) |
Inline the operations of block 'source' into the end of block 'dest'. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseMoveOpBefore (MlirRewriterBase rewriter, MlirOperation op, MlirOperation existingOp) |
Unlink this operation from its current block and insert it right before existingOp which may be in the same or another block in the same function. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseMoveOpAfter (MlirRewriterBase rewriter, MlirOperation op, MlirOperation existingOp) |
Unlink this operation from its current block and insert it right after existingOp which may be in the same or another block in the same function. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseMoveBlockBefore (MlirRewriterBase rewriter, MlirBlock block, MlirBlock existingBlock) |
Unlink this block and insert it right before existingBlock . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseStartOpModification (MlirRewriterBase rewriter, MlirOperation op) |
This method is used to notify the rewriter that an in-place operation modification is about to happen. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseFinalizeOpModification (MlirRewriterBase rewriter, MlirOperation op) |
This method is used to signal the end of an in-place modification of the given operation. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseCancelOpModification (MlirRewriterBase rewriter, MlirOperation op) |
This method cancels a pending in-place modification. More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceAllUsesWith (MlirRewriterBase rewriter, MlirValue from, MlirValue to) |
Find uses of from and replace them with to . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceAllValueRangeUsesWith (MlirRewriterBase rewriter, intptr_t nValues, MlirValue const *from, MlirValue const *to) |
Find uses of from and replace them with to . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceAllOpUsesWithValueRange (MlirRewriterBase rewriter, MlirOperation from, intptr_t nTo, MlirValue const *to) |
Find uses of from and replace them with to . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceAllOpUsesWithOperation (MlirRewriterBase rewriter, MlirOperation from, MlirOperation to) |
Find uses of from and replace them with to . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceOpUsesWithinBlock (MlirRewriterBase rewriter, MlirOperation op, intptr_t nNewValues, MlirValue const *newValues, MlirBlock block) |
Find uses of from within block and replace them with to . More... | |
MLIR_CAPI_EXPORTED void | mlirRewriterBaseReplaceAllUsesExcept (MlirRewriterBase rewriter, MlirValue from, MlirValue to, MlirOperation exceptedUser) |
Find uses of from and replace them with to except if the user is exceptedUser . More... | |
MLIR_CAPI_EXPORTED MlirRewriterBase | mlirIRRewriterCreate (MlirContext context) |
IRRewriter API. More... | |
MLIR_CAPI_EXPORTED MlirRewriterBase | mlirIRRewriterCreateFromOp (MlirOperation op) |
Create an IRRewriter and transfer ownership to the caller. More... | |
MLIR_CAPI_EXPORTED void | mlirIRRewriterDestroy (MlirRewriterBase rewriter) |
Takes an IRRewriter owned by the caller and destroys it. More... | |
MLIR_CAPI_EXPORTED MlirFrozenRewritePatternSet | mlirFreezeRewritePattern (MlirRewritePatternSet set) |
FrozenRewritePatternSet API. More... | |
MLIR_CAPI_EXPORTED void | mlirFrozenRewritePatternSetDestroy (MlirFrozenRewritePatternSet set) |
Destroy the given MlirFrozenRewritePatternSet. More... | |
MLIR_CAPI_EXPORTED MlirLogicalResult | mlirApplyPatternsAndFoldGreedilyWithOp (MlirOperation op, MlirFrozenRewritePatternSet patterns, MlirGreedyRewriteDriverConfig) |
MLIR_CAPI_EXPORTED MlirLogicalResult | mlirApplyPatternsAndFoldGreedily (MlirModule op, MlirFrozenRewritePatternSet patterns, MlirGreedyRewriteDriverConfig) |
MLIR_CAPI_EXPORTED MlirRewriterBase | mlirPatternRewriterAsBase (MlirPatternRewriter rewriter) |
PatternRewriter API. More... | |
MLIR_CAPI_EXPORTED MlirRewritePattern | mlirOpRewritePatternCreate (MlirStringRef rootName, unsigned benefit, MlirContext context, MlirRewritePatternCallbacks callbacks, void *userData, size_t nGeneratedNames, MlirStringRef *generatedNames) |
Create a rewrite pattern that matches the operation with the given rootName, corresponding to mlir::OpRewritePattern. More... | |
MLIR_CAPI_EXPORTED MlirRewritePatternSet | mlirRewritePatternSetCreate (MlirContext context) |
RewritePatternSet API. More... | |
MLIR_CAPI_EXPORTED void | mlirRewritePatternSetDestroy (MlirRewritePatternSet set) |
Destruct the given MlirRewritePatternSet. More... | |
MLIR_CAPI_EXPORTED void | mlirRewritePatternSetAdd (MlirRewritePatternSet set, MlirRewritePattern pattern) |
Add the given MlirRewritePattern into a MlirRewritePatternSet. More... | |
DEFINE_C_API_STRUCT (MlirPDLPatternModule, void) | |
PDLPatternModule API. More... | |
DEFINE_C_API_STRUCT (MlirPDLValue, const void) | |
DEFINE_C_API_STRUCT (MlirPDLResultList, void) | |
MLIR_CAPI_EXPORTED MlirPDLPatternModule | mlirPDLPatternModuleFromModule (MlirModule op) |
MLIR_CAPI_EXPORTED void | mlirPDLPatternModuleDestroy (MlirPDLPatternModule op) |
MLIR_CAPI_EXPORTED MlirRewritePatternSet | mlirRewritePatternSetFromPDLPatternModule (MlirPDLPatternModule op) |
MLIR_CAPI_EXPORTED MlirValue | mlirPDLValueAsValue (MlirPDLValue value) |
Cast the MlirPDLValue to an MlirValue. More... | |
MLIR_CAPI_EXPORTED MlirType | mlirPDLValueAsType (MlirPDLValue value) |
Cast the MlirPDLValue to an MlirType. More... | |
MLIR_CAPI_EXPORTED MlirOperation | mlirPDLValueAsOperation (MlirPDLValue value) |
Cast the MlirPDLValue to an MlirOperation. More... | |
MLIR_CAPI_EXPORTED MlirAttribute | mlirPDLValueAsAttribute (MlirPDLValue value) |
Cast the MlirPDLValue to an MlirAttribute. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLResultListPushBackValue (MlirPDLResultList results, MlirValue value) |
Push the MlirValue into the given MlirPDLResultList. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLResultListPushBackType (MlirPDLResultList results, MlirType value) |
Push the MlirType into the given MlirPDLResultList. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLResultListPushBackOperation (MlirPDLResultList results, MlirOperation value) |
Push the MlirOperation into the given MlirPDLResultList. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLResultListPushBackAttribute (MlirPDLResultList results, MlirAttribute value) |
Push the MlirAttribute into the given MlirPDLResultList. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLPatternModuleRegisterRewriteFunction (MlirPDLPatternModule pdlModule, MlirStringRef name, MlirPDLRewriteFunction rewriteFn, void *userData) |
Register a rewrite function into the given PDL pattern module. More... | |
MLIR_CAPI_EXPORTED void | mlirPDLPatternModuleRegisterConstraintFunction (MlirPDLPatternModule pdlModule, MlirStringRef name, MlirPDLConstraintFunction constraintFn, void *userData) |
Register a constraint function into the given PDL pattern module. More... | |
#define DEFINE_C_API_STRUCT | ( | name, | |
storage | |||
) |
Opaque type declarations (see mlir-c/IR.h for more details).
typedef MlirLogicalResult(* MlirPDLConstraintFunction) (MlirPatternRewriter rewriter, MlirPDLResultList results, size_t nValues, MlirPDLValue *values, void *userData) |
This function type is used as callbacks for PDL native constraint functions.
Input values can be accessed by values
with its size nValues
; output values can be added into results
by mlirPDLResultListPushBack*
APIs. And the return value indicates whether the constraint holds.
typedef MlirLogicalResult(* MlirPDLRewriteFunction) (MlirPatternRewriter rewriter, MlirPDLResultList results, size_t nValues, MlirPDLValue *values, void *userData) |
This function type is used as callbacks for PDL native rewrite functions.
Input values can be accessed by values
with its size nValues
; output values can be added into results
by mlirPDLResultListPushBack*
APIs. And the return value indicates whether the rewrite succeeds.
DEFINE_C_API_STRUCT | ( | MlirFrozenRewritePatternSet | , |
void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirGreedyRewriteDriverConfig | , |
void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirPatternRewriter | , |
void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirPDLPatternModule | , |
void | |||
) |
PDLPatternModule API.
DEFINE_C_API_STRUCT | ( | MlirPDLResultList | , |
void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirPDLValue | , |
const void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirRewritePattern | , |
const void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirRewritePatternSet | , |
void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirRewriterBase | , |
void | |||
) |
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedily | ( | MlirModule | op, |
MlirFrozenRewritePatternSet | patterns, | ||
MlirGreedyRewriteDriverConfig | |||
) |
Definition at line 286 of file Rewrite.cpp.
References mlir::applyPatternsGreedily(), mlir::patterns, unwrap(), and wrap().
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedilyWithOp | ( | MlirOperation | op, |
MlirFrozenRewritePatternSet | patterns, | ||
MlirGreedyRewriteDriverConfig | |||
) |
Definition at line 293 of file Rewrite.cpp.
References mlir::applyPatternsGreedily(), mlir::patterns, unwrap(), and wrap().
MLIR_CAPI_EXPORTED MlirFrozenRewritePatternSet mlirFreezeRewritePattern | ( | MlirRewritePatternSet | set | ) |
FrozenRewritePatternSet API.
Freeze the given MlirRewritePatternSet to a MlirFrozenRewritePatternSet. Note that the ownership of the input set is transferred into the frozen set after this call.
FrozenRewritePatternSet API.
Definition at line 274 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED void mlirFrozenRewritePatternSetDestroy | ( | MlirFrozenRewritePatternSet | set | ) |
Destroy the given MlirFrozenRewritePatternSet.
Definition at line 280 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirRewriterBase mlirIRRewriterCreate | ( | MlirContext | context | ) |
IRRewriter API.
Create an IRRewriter and transfer ownership to the caller.
Definition at line 257 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED MlirRewriterBase mlirIRRewriterCreateFromOp | ( | MlirOperation | op | ) |
Create an IRRewriter and transfer ownership to the caller.
Additionally set the insertion point before the operation.
Definition at line 261 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED void mlirIRRewriterDestroy | ( | MlirRewriterBase | rewriter | ) |
Takes an IRRewriter owned by the caller and destroys it.
It is the responsibility of the user to only pass an IRRewriter class.
Definition at line 265 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirRewritePattern mlirOpRewritePatternCreate | ( | MlirStringRef | rootName, |
unsigned | benefit, | ||
MlirContext | context, | ||
MlirRewritePatternCallbacks | callbacks, | ||
void * | userData, | ||
size_t | nGeneratedNames, | ||
MlirStringRef * | generatedNames | ||
) |
Create a rewrite pattern that matches the operation with the given rootName, corresponding to mlir::OpRewritePattern.
Definition at line 344 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED MlirRewriterBase mlirPatternRewriterAsBase | ( | MlirPatternRewriter | rewriter | ) |
PatternRewriter API.
Cast the PatternRewriter to a RewriterBase
Definition at line 303 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED void mlirPDLPatternModuleDestroy | ( | MlirPDLPatternModule | op | ) |
MLIR_CAPI_EXPORTED MlirPDLPatternModule mlirPDLPatternModuleFromModule | ( | MlirModule | op | ) |
MLIR_CAPI_EXPORTED void mlirPDLPatternModuleRegisterConstraintFunction | ( | MlirPDLPatternModule | pdlModule, |
MlirStringRef | name, | ||
MlirPDLConstraintFunction | constraintFn, | ||
void * | userData | ||
) |
Register a constraint function into the given PDL pattern module.
userData
will be provided as an argument to the constraint function.
MLIR_CAPI_EXPORTED void mlirPDLPatternModuleRegisterRewriteFunction | ( | MlirPDLPatternModule | pdlModule, |
MlirStringRef | name, | ||
MlirPDLRewriteFunction | rewriteFn, | ||
void * | userData | ||
) |
Register a rewrite function into the given PDL pattern module.
userData
will be provided as an argument to the rewrite function.
MLIR_CAPI_EXPORTED void mlirPDLResultListPushBackAttribute | ( | MlirPDLResultList | results, |
MlirAttribute | value | ||
) |
Push the MlirAttribute into the given MlirPDLResultList.
MLIR_CAPI_EXPORTED void mlirPDLResultListPushBackOperation | ( | MlirPDLResultList | results, |
MlirOperation | value | ||
) |
Push the MlirOperation into the given MlirPDLResultList.
MLIR_CAPI_EXPORTED void mlirPDLResultListPushBackType | ( | MlirPDLResultList | results, |
MlirType | value | ||
) |
Push the MlirType into the given MlirPDLResultList.
MLIR_CAPI_EXPORTED void mlirPDLResultListPushBackValue | ( | MlirPDLResultList | results, |
MlirValue | value | ||
) |
Push the MlirValue into the given MlirPDLResultList.
MLIR_CAPI_EXPORTED MlirAttribute mlirPDLValueAsAttribute | ( | MlirPDLValue | value | ) |
Cast the MlirPDLValue to an MlirAttribute.
Return a null value if the cast fails, just like llvm::dyn_cast.
MLIR_CAPI_EXPORTED MlirOperation mlirPDLValueAsOperation | ( | MlirPDLValue | value | ) |
Cast the MlirPDLValue to an MlirOperation.
Return a null value if the cast fails, just like llvm::dyn_cast.
MLIR_CAPI_EXPORTED MlirType mlirPDLValueAsType | ( | MlirPDLValue | value | ) |
Cast the MlirPDLValue to an MlirType.
Return a null value if the cast fails, just like llvm::dyn_cast.
MLIR_CAPI_EXPORTED MlirValue mlirPDLValueAsValue | ( | MlirPDLValue | value | ) |
Cast the MlirPDLValue to an MlirValue.
Return a null value if the cast fails, just like llvm::dyn_cast.
MLIR_CAPI_EXPORTED void mlirRewritePatternSetAdd | ( | MlirRewritePatternSet | set, |
MlirRewritePattern | pattern | ||
) |
Add the given MlirRewritePattern into a MlirRewritePatternSet.
Note that the ownership of the pattern is transferred to the set after this call.
Definition at line 370 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirRewritePatternSet mlirRewritePatternSetCreate | ( | MlirContext | context | ) |
RewritePatternSet API.
Create an empty MlirRewritePatternSet.
Definition at line 362 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED void mlirRewritePatternSetDestroy | ( | MlirRewritePatternSet | set | ) |
Destruct the given MlirRewritePatternSet.
Definition at line 366 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirRewritePatternSet mlirRewritePatternSetFromPDLPatternModule | ( | MlirPDLPatternModule | op | ) |
MLIR_CAPI_EXPORTED void mlirRewriterBaseCancelOpModification | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
This method cancels a pending in-place modification.
This can only be called on operations that were provided to a call to startOpModification
.
Definition at line 199 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseClearInsertionPoint | ( | MlirRewriterBase | rewriter | ) |
Insertion points methods.
Reset the insertion point to no location. Creating an operation without a set insertion point is an error, but this can still be useful when the current insertion point a builder refers to is being removed.
Definition at line 36 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseClone | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Creates a deep copy of the specified operation.
Definition at line 108 of file Rewrite.cpp.
References mlir::clone(), unwrap(), and wrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseCloneRegionBefore | ( | MlirRewriterBase | rewriter, |
MlirRegion | region, | ||
MlirBlock | before | ||
) |
Clone the blocks that belong to "region" before the given position in another region "parent".
Definition at line 118 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseCloneWithoutRegions | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Creates a deep copy of this operation but keep the operation regions empty.
Definition at line 113 of file Rewrite.cpp.
References mlir::cloneWithoutRegions(), unwrap(), and wrap().
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseCreateBlockBefore | ( | MlirRewriterBase | rewriter, |
MlirBlock | insertBefore, | ||
intptr_t | nArgTypes, | ||
MlirType const * | argTypes, | ||
MlirLocation const * | locations | ||
) |
Block and operation creation/insertion/cloning.
Add new block with 'argTypes' arguments and set the insertion point to the end of it. The block is placed before 'insertBefore'. locs
contains the locations of the inserted arguments, and should match the size of argTypes
.
Definition at line 88 of file Rewrite.cpp.
References createBlock(), unwrap(), unwrapList(), and wrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseBlock | ( | MlirRewriterBase | rewriter, |
MlirBlock | block | ||
) |
Erases a block along with all operations inside it.
Definition at line 151 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseOp | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Erases an operation that is known to have no uses.
Definition at line 147 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseFinalizeOpModification | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
This method is used to signal the end of an in-place modification of the given operation.
This can only be called on operations that were provided to a call to startOpModification
.
Definition at line 194 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseGetBlock | ( | MlirRewriterBase | rewriter | ) |
Returns the current block of the rewriter.
Definition at line 69 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED MlirContext mlirRewriterBaseGetContext | ( | MlirRewriterBase | rewriter | ) |
RewriterBase API inherited from OpBuilder.
Get the MLIR context referenced by the rewriter.
Definition at line 28 of file Rewrite.cpp.
References getContext(), unwrap(), and wrap().
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseGetInsertionBlock | ( | MlirRewriterBase | rewriter | ) |
Return the block the current insertion point belongs to.
Note that the insertion point is not necessarily the end of the block.
Definition at line 65 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseGetOperationAfterInsertion | ( | MlirRewriterBase | rewriter | ) |
Returns the operation right after the current insertion point of the rewriter.
A null MlirOperation will be returned
Definition at line 74 of file Rewrite.cpp.
References mlir::Block::end(), mlir::OpBuilder::getInsertionBlock(), mlir::OpBuilder::getInsertionPoint(), unwrap(), and wrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseInlineBlockBefore | ( | MlirRewriterBase | rewriter, |
MlirBlock | source, | ||
MlirOperation | op, | ||
intptr_t | nArgValues, | ||
MlirValue const * | argValues | ||
) |
Inline the operations of block 'source' before the operation 'op'.
The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source'
The source block must have no successors. Otherwise, the resulting IR would have unreachable operations.
Definition at line 155 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseInlineRegionBefore | ( | MlirRewriterBase | rewriter, |
MlirRegion | region, | ||
MlirBlock | before | ||
) |
RewriterBase API.
Move the blocks that belong to "region" before the given position in another region "parent". The two regions must be different. The caller is responsible for creating or updating the operation transferring flow of control to the region and passing it the correct block arguments.
Definition at line 128 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseInsert | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Insert the given operation at the current insertion point and return it.
Definition at line 101 of file Rewrite.cpp.
MLIR_CAPI_EXPORTED void mlirRewriterBaseMergeBlocks | ( | MlirRewriterBase | rewriter, |
MlirBlock | source, | ||
MlirBlock | dest, | ||
intptr_t | nArgValues, | ||
MlirValue const * | argValues | ||
) |
Inline the operations of block 'source' into the end of block 'dest'.
The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source'
The dest block must have no successors. Otherwise, the resulting IR would have unreachable operation.
Definition at line 166 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseMoveBlockBefore | ( | MlirRewriterBase | rewriter, |
MlirBlock | block, | ||
MlirBlock | existingBlock | ||
) |
Unlink this block and insert it right before existingBlock
.
Definition at line 184 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseMoveOpAfter | ( | MlirRewriterBase | rewriter, |
MlirOperation | op, | ||
MlirOperation | existingOp | ||
) |
Unlink this operation from its current block and insert it right after existingOp
which may be in the same or another block in the same function.
Definition at line 179 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseMoveOpBefore | ( | MlirRewriterBase | rewriter, |
MlirOperation | op, | ||
MlirOperation | existingOp | ||
) |
Unlink this operation from its current block and insert it right before existingOp
which may be in the same or another block in the same function.
Definition at line 174 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllOpUsesWithOperation | ( | MlirRewriterBase | rewriter, |
MlirOperation | from, | ||
MlirOperation | to | ||
) |
Find uses of from
and replace them with to
.
Also notify the listener about every in-place op modification (for every use that was replaced) and that the from
operation is about to be replaced.
Definition at line 229 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllOpUsesWithValueRange | ( | MlirRewriterBase | rewriter, |
MlirOperation | from, | ||
intptr_t | nTo, | ||
MlirValue const * | to | ||
) |
Find uses of from
and replace them with to
.
Also notify the listener about every in-place op modification (for every use that was replaced) and that the from
operation is about to be replaced.
Definition at line 220 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllUsesExcept | ( | MlirRewriterBase | rewriter, |
MlirValue | from, | ||
MlirValue | to, | ||
MlirOperation | exceptedUser | ||
) |
Find uses of from
and replace them with to
except if the user is exceptedUser
.
Also notify the listener about every in-place op modification (for every use that was replaced).
Definition at line 246 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllUsesWith | ( | MlirRewriterBase | rewriter, |
MlirValue | from, | ||
MlirValue | to | ||
) |
Find uses of from
and replace them with to
.
Also notify the listener about every in-place op modification (for every use that was replaced).
Definition at line 204 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllValueRangeUsesWith | ( | MlirRewriterBase | rewriter, |
intptr_t | nValues, | ||
MlirValue const * | from, | ||
MlirValue const * | to | ||
) |
Find uses of from
and replace them with to
.
Also notify the listener about every in-place op modification (for every use that was replaced).
Definition at line 209 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceOpUsesWithinBlock | ( | MlirRewriterBase | rewriter, |
MlirOperation | op, | ||
intptr_t | nNewValues, | ||
MlirValue const * | newValues, | ||
MlirBlock | block | ||
) |
Find uses of from
within block
and replace them with to
.
Also notify the listener about every in-place op modification (for every use that was replaced). The optional allUsesReplaced
flag is set to "true" if all uses were replaced.
Definition at line 235 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceOpWithOperation | ( | MlirRewriterBase | rewriter, |
MlirOperation | op, | ||
MlirOperation | newOp | ||
) |
Replace the results of the given (original) operation with the specified new op (replacement).
The result types of the two ops must match. The original op is erased.
Definition at line 141 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceOpWithValues | ( | MlirRewriterBase | rewriter, |
MlirOperation | op, | ||
intptr_t | nValues, | ||
MlirValue const * | values | ||
) |
Replace the results of the given (original) operation with the specified list of values (replacements).
The result types of the given op and the replacements must match. The original op is erased.
Definition at line 133 of file Rewrite.cpp.
References unwrap(), and unwrapList().
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointAfter | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it.
Definition at line 45 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointAfterValue | ( | MlirRewriterBase | rewriter, |
MlirValue | value | ||
) |
Sets the insertion point to the node after the specified value.
If value has a defining operation, sets the insertion point to the node after such defining operation. This will cause subsequent insertions to go right after it. Otherwise, value is a BlockArgument. Sets the insertion point to the start of its block.
Definition at line 50 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointBefore | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it.
Definition at line 40 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToEnd | ( | MlirRewriterBase | rewriter, |
MlirBlock | block | ||
) |
Sets the insertion point to the end of the specified block.
Definition at line 60 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToStart | ( | MlirRewriterBase | rewriter, |
MlirBlock | block | ||
) |
Sets the insertion point to the start of the specified block.
Definition at line 55 of file Rewrite.cpp.
References unwrap().
MLIR_CAPI_EXPORTED void mlirRewriterBaseStartOpModification | ( | MlirRewriterBase | rewriter, |
MlirOperation | op | ||
) |
This method is used to notify the rewriter that an in-place operation modification is about to happen.
A call to this function must be followed by a call to either finalizeOpModification
or cancelOpModification
. This is a minor efficiency win (it avoids creating a new operation and removing the old one) but also often allows simpler code in the client.
Definition at line 189 of file Rewrite.cpp.
References unwrap().