MLIR 23.0.0git
Rewrite.h File Reference
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/Config/mlir-config.h"

Go to the source code of this file.

Classes

struct  MlirConversionPatternCallbacks
 ConversionPattern API. More...
struct  MlirRewritePatternCallbacks
 RewritePattern API. More...

Macros

#define DEFINE_C_API_STRUCT(name, storage)
 Opaque type declarations (see mlir-c/IR.h for more details).

Typedefs

typedef MlirLogicalResult(* MlirTypeConverterConversionCallback) (MlirType type, MlirType *convertedType, void *userData)
 Callback type for type conversion functions.

Enumerations

enum  MlirGreedyRewriteStrictness { MLIR_GREEDY_REWRITE_STRICTNESS_ANY_OP , MLIR_GREEDY_REWRITE_STRICTNESS_EXISTING_AND_NEW_OPS , MLIR_GREEDY_REWRITE_STRICTNESS_EXISTING_OPS }
 Greedy rewrite strictness levels. More...
enum  MlirGreedySimplifyRegionLevel { MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_DISABLED , MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_NORMAL , MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_AGGRESSIVE }
 Greedy simplify region levels. More...
enum  MlirDialectConversionFoldingMode { MLIR_DIALECT_CONVERSION_FOLDING_MODE_NEVER , MLIR_DIALECT_CONVERSION_FOLDING_MODE_BEFORE_PATTERNS , MLIR_DIALECT_CONVERSION_FOLDING_MODE_AFTER_PATTERNS }

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)
 DEFINE_C_API_STRUCT (MlirConversionTarget, void)
 DEFINE_C_API_STRUCT (MlirConversionPattern, const void)
 DEFINE_C_API_STRUCT (MlirTypeConverter, void)
 DEFINE_C_API_STRUCT (MlirConversionPatternRewriter, void)
 DEFINE_C_API_STRUCT (MlirConversionConfig, void)
MLIR_CAPI_EXPORTED MlirContext mlirRewriterBaseGetContext (MlirRewriterBase rewriter)
 RewriterBase API inherited from OpBuilder.
MLIR_CAPI_EXPORTED void mlirRewriterBaseClearInsertionPoint (MlirRewriterBase rewriter)
 Insertion points methods.
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.
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.
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointAfterValue (MlirRewriterBase rewriter, MlirValue value)
 Sets the insertion point to the node after the specified value.
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToStart (MlirRewriterBase rewriter, MlirBlock block)
 Sets the insertion point to the start of the specified block.
MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToEnd (MlirRewriterBase rewriter, MlirBlock block)
 Sets the insertion point to the end of the specified block.
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseGetInsertionBlock (MlirRewriterBase rewriter)
 Return the block the current insertion point belongs to.
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseGetBlock (MlirRewriterBase rewriter)
 Returns the current block of the rewriter.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseGetOperationAfterInsertion (MlirRewriterBase rewriter)
 Returns the operation right after the current insertion point of the rewriter.
MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseCreateBlockBefore (MlirRewriterBase rewriter, MlirBlock insertBefore, intptr_t nArgTypes, MlirType const *argTypes, MlirLocation const *locations)
 Block and operation creation/insertion/cloning.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseInsert (MlirRewriterBase rewriter, MlirOperation op)
 Insert the given operation at the current insertion point and return it.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseClone (MlirRewriterBase rewriter, MlirOperation op)
 Creates a deep copy of the specified operation.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseCloneWithoutRegions (MlirRewriterBase rewriter, MlirOperation op)
 Creates a deep copy of this operation but keep the operation regions empty.
MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseCloneWithMapping (MlirRewriterBase rewriter, MlirOperation op, MlirIRMapping mapping)
 Clones the given operation using the rewriter and the provided IRMapping.
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".
MLIR_CAPI_EXPORTED void mlirRewriterBaseInlineRegionBefore (MlirRewriterBase rewriter, MlirRegion region, MlirBlock before)
 RewriterBase API.
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).
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).
MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseOp (MlirRewriterBase rewriter, MlirOperation op)
 Erases an operation that is known to have no uses.
MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseBlock (MlirRewriterBase rewriter, MlirBlock block)
 Erases a block along with all operations inside it.
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'.
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'.
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.
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.
MLIR_CAPI_EXPORTED void mlirRewriterBaseMoveBlockBefore (MlirRewriterBase rewriter, MlirBlock block, MlirBlock existingBlock)
 Unlink this block and insert it right before existingBlock.
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.
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.
MLIR_CAPI_EXPORTED void mlirRewriterBaseCancelOpModification (MlirRewriterBase rewriter, MlirOperation op)
 This method cancels a pending in-place modification.
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllUsesWith (MlirRewriterBase rewriter, MlirValue from, MlirValue to)
 Find uses of from and replace them with to.
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.
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllOpUsesWithValueRange (MlirRewriterBase rewriter, MlirOperation from, intptr_t nTo, MlirValue const *to)
 Find uses of from and replace them with to.
MLIR_CAPI_EXPORTED void mlirRewriterBaseReplaceAllOpUsesWithOperation (MlirRewriterBase rewriter, MlirOperation from, MlirOperation to)
 Find uses of from and replace them with to.
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.
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.
MLIR_CAPI_EXPORTED MlirRewriterBase mlirIRRewriterCreate (MlirContext context)
 IRRewriter API.
MLIR_CAPI_EXPORTED MlirRewriterBase mlirIRRewriterCreateFromOp (MlirOperation op)
 Create an IRRewriter and transfer ownership to the caller.
MLIR_CAPI_EXPORTED void mlirIRRewriterDestroy (MlirRewriterBase rewriter)
 Takes an IRRewriter owned by the caller and destroys it.
MLIR_CAPI_EXPORTED MlirFrozenRewritePatternSet mlirFreezeRewritePattern (MlirRewritePatternSet set)
 FrozenRewritePatternSet API.
MLIR_CAPI_EXPORTED void mlirFrozenRewritePatternSetDestroy (MlirFrozenRewritePatternSet set)
 Destroy the given MlirFrozenRewritePatternSet.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedilyWithOp (MlirOperation op, MlirFrozenRewritePatternSet patterns, MlirGreedyRewriteDriverConfig)
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedily (MlirModule op, MlirFrozenRewritePatternSet patterns, MlirGreedyRewriteDriverConfig config)
MLIR_CAPI_EXPORTED MlirGreedyRewriteDriverConfig mlirGreedyRewriteDriverConfigCreate (void)
 GreedyRewriteDriverConfig API.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigDestroy (MlirGreedyRewriteDriverConfig config)
 Destroys a greedy rewrite driver configuration.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetMaxIterations (MlirGreedyRewriteDriverConfig config, int64_t maxIterations)
 Sets the maximum number of iterations for the greedy rewrite driver.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetMaxNumRewrites (MlirGreedyRewriteDriverConfig config, int64_t maxNumRewrites)
 Sets the maximum number of rewrites within an iteration.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetUseTopDownTraversal (MlirGreedyRewriteDriverConfig config, bool useTopDownTraversal)
 Sets whether to use top-down traversal for the initial population of the worklist.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigEnableFolding (MlirGreedyRewriteDriverConfig config, bool enable)
 Enables or disables folding during greedy rewriting.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetStrictness (MlirGreedyRewriteDriverConfig config, MlirGreedyRewriteStrictness strictness)
 Sets the strictness level for the greedy rewrite driver.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetRegionSimplificationLevel (MlirGreedyRewriteDriverConfig config, MlirGreedySimplifyRegionLevel level)
 Sets the region simplification level.
MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigEnableConstantCSE (MlirGreedyRewriteDriverConfig config, bool enable)
 Enables or disables constant CSE.
MLIR_CAPI_EXPORTED int64_t mlirGreedyRewriteDriverConfigGetMaxIterations (MlirGreedyRewriteDriverConfig config)
 Gets the maximum number of iterations for the greedy rewrite driver.
MLIR_CAPI_EXPORTED int64_t mlirGreedyRewriteDriverConfigGetMaxNumRewrites (MlirGreedyRewriteDriverConfig config)
 Gets the maximum number of rewrites within an iteration.
MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigGetUseTopDownTraversal (MlirGreedyRewriteDriverConfig config)
 Gets whether top-down traversal is used for initial worklist population.
MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigIsFoldingEnabled (MlirGreedyRewriteDriverConfig config)
 Gets whether folding is enabled during greedy rewriting.
MLIR_CAPI_EXPORTED MlirGreedyRewriteStrictness mlirGreedyRewriteDriverConfigGetStrictness (MlirGreedyRewriteDriverConfig config)
 Gets the strictness level for the greedy rewrite driver.
MLIR_CAPI_EXPORTED MlirGreedySimplifyRegionLevel mlirGreedyRewriteDriverConfigGetRegionSimplificationLevel (MlirGreedyRewriteDriverConfig config)
 Gets the region simplification level.
MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigIsConstantCSEEnabled (MlirGreedyRewriteDriverConfig config)
 Gets whether constant CSE is enabled.
MLIR_CAPI_EXPORTED void mlirWalkAndApplyPatterns (MlirOperation op, MlirFrozenRewritePatternSet patterns)
 Applies the given patterns to the given op by a fast walk-based pattern rewrite driver.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPartialConversion (MlirOperation op, MlirConversionTarget target, MlirFrozenRewritePatternSet patterns, MlirConversionConfig config)
 Apply a partial conversion on the given operation.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyFullConversion (MlirOperation op, MlirConversionTarget target, MlirFrozenRewritePatternSet patterns, MlirConversionConfig config)
 Apply a full conversion on the given operation.
MLIR_CAPI_EXPORTED MlirConversionConfig mlirConversionConfigCreate (void)
 ConversionConfig API.
MLIR_CAPI_EXPORTED void mlirConversionConfigDestroy (MlirConversionConfig config)
 Destroy the given ConversionConfig.
MLIR_CAPI_EXPORTED void mlirConversionConfigSetFoldingMode (MlirConversionConfig config, MlirDialectConversionFoldingMode mode)
 Set the folding mode for the given ConversionConfig.
MLIR_CAPI_EXPORTED MlirDialectConversionFoldingMode mlirConversionConfigGetFoldingMode (MlirConversionConfig config)
 Get the folding mode for the given ConversionConfig.
MLIR_CAPI_EXPORTED void mlirConversionConfigEnableBuildMaterializations (MlirConversionConfig config, bool enable)
 Enable or disable building materializations during conversion.
MLIR_CAPI_EXPORTED bool mlirConversionConfigIsBuildMaterializationsEnabled (MlirConversionConfig config)
 Check if building materializations during conversion is enabled.
MLIR_CAPI_EXPORTED MlirRewriterBase mlirPatternRewriterAsBase (MlirPatternRewriter rewriter)
 PatternRewriter API.
MLIR_CAPI_EXPORTED MlirPatternRewriter mlirConversionPatternRewriterAsPatternRewriter (MlirConversionPatternRewriter rewriter)
 ConversionPatternRewriter API.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirConversionPatternRewriterConvertRegionTypes (MlirConversionPatternRewriter rewriter, MlirRegion region, MlirTypeConverter typeConverter)
 Apply a signature conversion to each block in the given region.
MLIR_CAPI_EXPORTED MlirConversionTarget mlirConversionTargetCreate (MlirContext context)
 ConversionTarget API.
MLIR_CAPI_EXPORTED void mlirConversionTargetDestroy (MlirConversionTarget target)
 Destroy the given ConversionTarget.
MLIR_CAPI_EXPORTED void mlirConversionTargetAddLegalOp (MlirConversionTarget target, MlirStringRef opName)
 Register the given operations as legal.
MLIR_CAPI_EXPORTED void mlirConversionTargetAddIllegalOp (MlirConversionTarget target, MlirStringRef opName)
 Register the given operations as illegal.
MLIR_CAPI_EXPORTED void mlirConversionTargetAddLegalDialect (MlirConversionTarget target, MlirStringRef dialectName)
 Register the operations of the given dialect as legal.
MLIR_CAPI_EXPORTED void mlirConversionTargetAddIllegalDialect (MlirConversionTarget target, MlirStringRef dialectName)
 Register the operations of the given dialect as illegal.
MLIR_CAPI_EXPORTED MlirTypeConverter mlirTypeConverterCreate (void)
 TypeConverter API.
MLIR_CAPI_EXPORTED void mlirTypeConverterDestroy (MlirTypeConverter typeConverter)
 Destroy the given TypeConverter.
MLIR_CAPI_EXPORTED void mlirTypeConverterAddConversion (MlirTypeConverter typeConverter, MlirTypeConverterConversionCallback convertType, void *userData)
 Add a type conversion function to the given TypeConverter.
MLIR_CAPI_EXPORTED MlirType mlirTypeConverterConvertType (MlirTypeConverter typeConverter, MlirType type)
 Convert the given type using the given TypeConverter.
MLIR_CAPI_EXPORTED MlirConversionPattern mlirOpConversionPatternCreate (MlirStringRef rootName, unsigned benefit, MlirContext context, MlirTypeConverter typeConverter, MlirConversionPatternCallbacks callbacks, void *userData, size_t nGeneratedNames, MlirStringRef *generatedNames)
 Create a conversion pattern that matches the operation with the given rootName, corresponding to mlir::OpConversionPattern.
MLIR_CAPI_EXPORTED MlirTypeConverter mlirConversionPatternGetTypeConverter (MlirConversionPattern pattern)
 Get the type converter used by this conversion pattern.
MLIR_CAPI_EXPORTED MlirRewritePattern mlirConversionPatternAsRewritePattern (MlirConversionPattern pattern)
 Cast the ConversionPattern to a RewritePattern.
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.
MLIR_CAPI_EXPORTED MlirRewritePatternSet mlirRewritePatternSetCreate (MlirContext context)
 RewritePatternSet API.
MLIR_CAPI_EXPORTED MlirContext mlirRewritePatternSetGetContext (MlirRewritePatternSet set)
 Get the context associated with a MlirRewritePatternSet.
MLIR_CAPI_EXPORTED void mlirRewritePatternSetDestroy (MlirRewritePatternSet set)
 Destruct the given MlirRewritePatternSet.
MLIR_CAPI_EXPORTED void mlirRewritePatternSetAdd (MlirRewritePatternSet set, MlirRewritePattern pattern)
 Add the given MlirRewritePattern into a MlirRewritePatternSet.

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

#define DEFINE_C_API_STRUCT ( name,
storage )
Value:
struct name { \
storage *ptr; \
}; \
typedef struct name name

Opaque type declarations (see mlir-c/IR.h for more details).

Definition at line 30 of file Rewrite.h.

Typedef Documentation

◆ MlirTypeConverterConversionCallback

typedef MlirLogicalResult(* MlirTypeConverterConversionCallback) (MlirType type, MlirType *convertedType, void *userData)

Callback type for type conversion functions.

Returns failure or sets convertedType to MlirType{NULL} to indicate failure. If failure is returned, the converter is allowed to try another conversion function to perform the conversion.

Definition at line 551 of file Rewrite.h.

Enumeration Type Documentation

◆ MlirDialectConversionFoldingMode

Enumerator
MLIR_DIALECT_CONVERSION_FOLDING_MODE_NEVER 
MLIR_DIALECT_CONVERSION_FOLDING_MODE_BEFORE_PATTERNS 
MLIR_DIALECT_CONVERSION_FOLDING_MODE_AFTER_PATTERNS 

Definition at line 457 of file Rewrite.h.

◆ MlirGreedyRewriteStrictness

Greedy rewrite strictness levels.

Enumerator
MLIR_GREEDY_REWRITE_STRICTNESS_ANY_OP 

No restrictions wrt. which ops are processed.

MLIR_GREEDY_REWRITE_STRICTNESS_EXISTING_AND_NEW_OPS 

Only pre-existing and newly created ops are processed.

MLIR_GREEDY_REWRITE_STRICTNESS_EXISTING_OPS 

Only pre-existing ops are processed.

Definition at line 41 of file Rewrite.h.

◆ MlirGreedySimplifyRegionLevel

Greedy simplify region levels.

Enumerator
MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_DISABLED 

Disable region control-flow simplification.

MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_NORMAL 

Run the normal simplification (e.g. dead args elimination).

MLIR_GREEDY_SIMPLIFY_REGION_LEVEL_AGGRESSIVE 

Run extra simplifications (e.g. block merging).

Definition at line 51 of file Rewrite.h.

Function Documentation

◆ DEFINE_C_API_STRUCT() [1/11]

DEFINE_C_API_STRUCT ( MlirConversionConfig ,
void  )

References MLIR_CAPI_EXPORTED, and target.

◆ DEFINE_C_API_STRUCT() [2/11]

DEFINE_C_API_STRUCT ( MlirConversionPattern ,
const void  )

◆ DEFINE_C_API_STRUCT() [3/11]

DEFINE_C_API_STRUCT ( MlirConversionPatternRewriter ,
void  )

◆ DEFINE_C_API_STRUCT() [4/11]

DEFINE_C_API_STRUCT ( MlirConversionTarget ,
void  )

◆ DEFINE_C_API_STRUCT() [5/11]

DEFINE_C_API_STRUCT ( MlirFrozenRewritePatternSet ,
void  )

◆ DEFINE_C_API_STRUCT() [6/11]

DEFINE_C_API_STRUCT ( MlirGreedyRewriteDriverConfig ,
void  )

◆ DEFINE_C_API_STRUCT() [7/11]

DEFINE_C_API_STRUCT ( MlirPatternRewriter ,
void  )

◆ DEFINE_C_API_STRUCT() [8/11]

DEFINE_C_API_STRUCT ( MlirRewritePattern ,
const void  )

◆ DEFINE_C_API_STRUCT() [9/11]

DEFINE_C_API_STRUCT ( MlirRewritePatternSet ,
void  )

◆ DEFINE_C_API_STRUCT() [10/11]

DEFINE_C_API_STRUCT ( MlirRewriterBase ,
void  )

◆ DEFINE_C_API_STRUCT() [11/11]

DEFINE_C_API_STRUCT ( MlirTypeConverter ,
void  )

◆ mlirApplyFullConversion()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyFullConversion ( MlirOperation op,
MlirConversionTarget target,
MlirFrozenRewritePatternSet patterns,
MlirConversionConfig config )

Apply a full conversion on the given operation.

Definition at line 461 of file Rewrite.cpp.

References target, unwrap(), and wrap().

◆ mlirApplyPartialConversion()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPartialConversion ( MlirOperation op,
MlirConversionTarget target,
MlirFrozenRewritePatternSet patterns,
MlirConversionConfig config )

Apply a partial conversion on the given operation.

Definition at line 454 of file Rewrite.cpp.

References target, unwrap(), and wrap().

◆ mlirApplyPatternsAndFoldGreedily()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedily ( MlirModule op,
MlirFrozenRewritePatternSet patterns,
MlirGreedyRewriteDriverConfig config )

Definition at line 433 of file Rewrite.cpp.

References mlir::applyPatternsGreedily(), unwrap(), and wrap().

◆ mlirApplyPatternsAndFoldGreedilyWithOp()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedilyWithOp ( MlirOperation op,
MlirFrozenRewritePatternSet patterns,
MlirGreedyRewriteDriverConfig config )

Definition at line 441 of file Rewrite.cpp.

References mlir::applyPatternsGreedily(), unwrap(), and wrap().

◆ mlirConversionConfigCreate()

MLIR_CAPI_EXPORTED MlirConversionConfig mlirConversionConfigCreate ( void )

ConversionConfig API.

Create a default ConversionConfig.

Definition at line 473 of file Rewrite.cpp.

References wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionConfig::isBuildMaterializationsEnabled().

◆ mlirConversionConfigDestroy()

MLIR_CAPI_EXPORTED void mlirConversionConfigDestroy ( MlirConversionConfig config)

Destroy the given ConversionConfig.

Definition at line 477 of file Rewrite.cpp.

References unwrap().

◆ mlirConversionConfigEnableBuildMaterializations()

MLIR_CAPI_EXPORTED void mlirConversionConfigEnableBuildMaterializations ( MlirConversionConfig config,
bool enable )

Enable or disable building materializations during conversion.

Definition at line 510 of file Rewrite.cpp.

References unwrap().

◆ mlirConversionConfigGetFoldingMode()

MLIR_CAPI_EXPORTED MlirDialectConversionFoldingMode mlirConversionConfigGetFoldingMode ( MlirConversionConfig config)

◆ mlirConversionConfigIsBuildMaterializationsEnabled()

MLIR_CAPI_EXPORTED bool mlirConversionConfigIsBuildMaterializationsEnabled ( MlirConversionConfig config)

Check if building materializations during conversion is enabled.

Definition at line 515 of file Rewrite.cpp.

References unwrap().

◆ mlirConversionConfigSetFoldingMode()

◆ mlirConversionPatternAsRewritePattern()

MLIR_CAPI_EXPORTED MlirRewritePattern mlirConversionPatternAsRewritePattern ( MlirConversionPattern pattern)

Cast the ConversionPattern to a RewritePattern.

Definition at line 675 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::addConversion().

◆ mlirConversionPatternGetTypeConverter()

MLIR_CAPI_EXPORTED MlirTypeConverter mlirConversionPatternGetTypeConverter ( MlirConversionPattern pattern)

Get the type converter used by this conversion pattern.

Definition at line 670 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionPattern::getTypeConverter().

◆ mlirConversionPatternRewriterAsPatternRewriter()

MLIR_CAPI_EXPORTED MlirPatternRewriter mlirConversionPatternRewriterAsPatternRewriter ( MlirConversionPatternRewriter rewriter)

ConversionPatternRewriter API.

Cast the ConversionPatternRewriter to a PatternRewriter

Definition at line 532 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionPatternRewriter::PyConversionPatternRewriter().

◆ mlirConversionPatternRewriterConvertRegionTypes()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirConversionPatternRewriterConvertRegionTypes ( MlirConversionPatternRewriter rewriter,
MlirRegion region,
MlirTypeConverter typeConverter )

Apply a signature conversion to each block in the given region.

Definition at line 537 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirConversionTargetAddIllegalDialect()

MLIR_CAPI_EXPORTED void mlirConversionTargetAddIllegalDialect ( MlirConversionTarget target,
MlirStringRef dialectName )

Register the operations of the given dialect as illegal.

Definition at line 573 of file Rewrite.cpp.

References target, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionTarget::addIllegalDialect().

◆ mlirConversionTargetAddIllegalOp()

MLIR_CAPI_EXPORTED void mlirConversionTargetAddIllegalOp ( MlirConversionTarget target,
MlirStringRef opName )

Register the given operations as illegal.

Definition at line 562 of file Rewrite.cpp.

References getContext(), target, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionTarget::addIllegalOp().

◆ mlirConversionTargetAddLegalDialect()

MLIR_CAPI_EXPORTED void mlirConversionTargetAddLegalDialect ( MlirConversionTarget target,
MlirStringRef dialectName )

Register the operations of the given dialect as legal.

Definition at line 568 of file Rewrite.cpp.

References target, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionTarget::addLegalDialect().

◆ mlirConversionTargetAddLegalOp()

MLIR_CAPI_EXPORTED void mlirConversionTargetAddLegalOp ( MlirConversionTarget target,
MlirStringRef opName )

Register the given operations as legal.

Definition at line 556 of file Rewrite.cpp.

References getContext(), target, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionTarget::addLegalOp().

◆ mlirConversionTargetCreate()

MLIR_CAPI_EXPORTED MlirConversionTarget mlirConversionTargetCreate ( MlirContext context)

◆ mlirConversionTargetDestroy()

MLIR_CAPI_EXPORTED void mlirConversionTargetDestroy ( MlirConversionTarget target)

Destroy the given ConversionTarget.

Definition at line 552 of file Rewrite.cpp.

References target, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionTarget::~PyConversionTarget().

◆ mlirFreezeRewritePattern()

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 284 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirFrozenRewritePatternSetDestroy()

MLIR_CAPI_EXPORTED void mlirFrozenRewritePatternSetDestroy ( MlirFrozenRewritePatternSet set)

Destroy the given MlirFrozenRewritePatternSet.

Definition at line 290 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyFrozenRewritePatternSet::~PyFrozenRewritePatternSet().

◆ mlirGreedyRewriteDriverConfigCreate()

MLIR_CAPI_EXPORTED MlirGreedyRewriteDriverConfig mlirGreedyRewriteDriverConfigCreate ( void )

GreedyRewriteDriverConfig API.

Creates a greedy rewrite driver configuration with default settings.

Definition at line 308 of file Rewrite.cpp.

References wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::setUseTopDownTraversal().

◆ mlirGreedyRewriteDriverConfigDestroy()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigDestroy ( MlirGreedyRewriteDriverConfig config)

Destroys a greedy rewrite driver configuration.

Definition at line 312 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConversionConfig::setFoldingMode().

◆ mlirGreedyRewriteDriverConfigEnableConstantCSE()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigEnableConstantCSE ( MlirGreedyRewriteDriverConfig config,
bool enable )

Enables or disables constant CSE.

Definition at line 372 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::enableConstantCSE(), and unwrap().

◆ mlirGreedyRewriteDriverConfigEnableFolding()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigEnableFolding ( MlirGreedyRewriteDriverConfig config,
bool enable )

Enables or disables folding during greedy rewriting.

Definition at line 332 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::enableFolding(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::getMaxNumRewrites().

◆ mlirGreedyRewriteDriverConfigGetMaxIterations()

MLIR_CAPI_EXPORTED int64_t mlirGreedyRewriteDriverConfigGetMaxIterations ( MlirGreedyRewriteDriverConfig config)

Gets the maximum number of iterations for the greedy rewrite driver.

Definition at line 377 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::getMaxIterations(), and unwrap().

◆ mlirGreedyRewriteDriverConfigGetMaxNumRewrites()

MLIR_CAPI_EXPORTED int64_t mlirGreedyRewriteDriverConfigGetMaxNumRewrites ( MlirGreedyRewriteDriverConfig config)

Gets the maximum number of rewrites within an iteration.

Definition at line 382 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::getMaxNumRewrites(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::isConstantCSEEnabled().

◆ mlirGreedyRewriteDriverConfigGetRegionSimplificationLevel()

MLIR_CAPI_EXPORTED MlirGreedySimplifyRegionLevel mlirGreedyRewriteDriverConfigGetRegionSimplificationLevel ( MlirGreedyRewriteDriverConfig config)

◆ mlirGreedyRewriteDriverConfigGetStrictness()

MLIR_CAPI_EXPORTED MlirGreedyRewriteStrictness mlirGreedyRewriteDriverConfigGetStrictness ( MlirGreedyRewriteDriverConfig config)

◆ mlirGreedyRewriteDriverConfigGetUseTopDownTraversal()

MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigGetUseTopDownTraversal ( MlirGreedyRewriteDriverConfig config)

Gets whether top-down traversal is used for initial worklist population.

Definition at line 387 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::getUseTopDownTraversal(), and unwrap().

◆ mlirGreedyRewriteDriverConfigIsConstantCSEEnabled()

MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigIsConstantCSEEnabled ( MlirGreedyRewriteDriverConfig config)

Gets whether constant CSE is enabled.

Definition at line 427 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::isConstantCSEEnabled(), and unwrap().

◆ mlirGreedyRewriteDriverConfigIsFoldingEnabled()

MLIR_CAPI_EXPORTED bool mlirGreedyRewriteDriverConfigIsFoldingEnabled ( MlirGreedyRewriteDriverConfig config)

Gets whether folding is enabled during greedy rewriting.

Definition at line 392 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::isFoldingEnabled(), and unwrap().

◆ mlirGreedyRewriteDriverConfigSetMaxIterations()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetMaxIterations ( MlirGreedyRewriteDriverConfig config,
int64_t maxIterations )

Sets the maximum number of iterations for the greedy rewrite driver.

Use -1 for no limit.

Definition at line 317 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::setMaxIterations(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::setRegionSimplificationLevel().

◆ mlirGreedyRewriteDriverConfigSetMaxNumRewrites()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetMaxNumRewrites ( MlirGreedyRewriteDriverConfig config,
int64_t maxNumRewrites )

Sets the maximum number of rewrites within an iteration.

Use -1 for no limit.

Definition at line 322 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::setMaxNumRewrites(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::enableConstantCSE().

◆ mlirGreedyRewriteDriverConfigSetRegionSimplificationLevel()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetRegionSimplificationLevel ( MlirGreedyRewriteDriverConfig config,
MlirGreedySimplifyRegionLevel level )

◆ mlirGreedyRewriteDriverConfigSetStrictness()

◆ mlirGreedyRewriteDriverConfigSetUseTopDownTraversal()

MLIR_CAPI_EXPORTED void mlirGreedyRewriteDriverConfigSetUseTopDownTraversal ( MlirGreedyRewriteDriverConfig config,
bool useTopDownTraversal )

Sets whether to use top-down traversal for the initial population of the worklist.

Definition at line 327 of file Rewrite.cpp.

References mlir::GreedyRewriteConfig::setUseTopDownTraversal(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGreedyRewriteConfig::getMaxIterations().

◆ mlirIRRewriterCreate()

MLIR_CAPI_EXPORTED MlirRewriterBase mlirIRRewriterCreate ( MlirContext context)

IRRewriter API.

Create an IRRewriter and transfer ownership to the caller.

Definition at line 267 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirIRRewriterCreateFromOp()

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 271 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirIRRewriterDestroy()

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 275 of file Rewrite.cpp.

References unwrap().

◆ mlirOpConversionPatternCreate()

MLIR_CAPI_EXPORTED MlirConversionPattern mlirOpConversionPatternCreate ( MlirStringRef rootName,
unsigned benefit,
MlirContext context,
MlirTypeConverter typeConverter,
MlirConversionPatternCallbacks callbacks,
void * userData,
size_t nGeneratedNames,
MlirStringRef * generatedNames )

Create a conversion pattern that matches the operation with the given rootName, corresponding to mlir::OpConversionPattern.

Definition at line 656 of file Rewrite.cpp.

References unwrap(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::addConversion().

◆ mlirOpRewritePatternCreate()

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 716 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::add().

◆ mlirPatternRewriterAsBase()

MLIR_CAPI_EXPORTED MlirRewriterBase mlirPatternRewriterAsBase ( MlirPatternRewriter rewriter)

PatternRewriter API.

Cast the PatternRewriter to a RewriterBase

Definition at line 524 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyPatternRewriter::PyPatternRewriter().

◆ mlirRewritePatternSetAdd()

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 746 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::add(), and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::addConversion().

◆ mlirRewritePatternSetCreate()

MLIR_CAPI_EXPORTED MlirRewritePatternSet mlirRewritePatternSetCreate ( MlirContext context)

RewritePatternSet API.

Create an empty MlirRewritePatternSet.

Definition at line 734 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::PyRewritePatternSet().

◆ mlirRewritePatternSetDestroy()

MLIR_CAPI_EXPORTED void mlirRewritePatternSetDestroy ( MlirRewritePatternSet set)

Destruct the given MlirRewritePatternSet.

Definition at line 742 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::~PyRewritePatternSet().

◆ mlirRewritePatternSetGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirRewritePatternSetGetContext ( MlirRewritePatternSet set)

Get the context associated with a MlirRewritePatternSet.

Definition at line 738 of file Rewrite.cpp.

References getContext(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::add(), and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::addConversion().

◆ mlirRewriterBaseCancelOpModification()

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 209 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseClearInsertionPoint()

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 40 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseClone()

MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseClone ( MlirRewriterBase rewriter,
MlirOperation op )

Creates a deep copy of the specified operation.

Definition at line 112 of file Rewrite.cpp.

References mlir::clone(), unwrap(), and wrap().

◆ mlirRewriterBaseCloneRegionBefore()

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 128 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseCloneWithMapping()

MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseCloneWithMapping ( MlirRewriterBase rewriter,
MlirOperation op,
MlirIRMapping mapping )

Clones the given operation using the rewriter and the provided IRMapping.

The mapping is updated with the results of the cloned operation.

Definition at line 122 of file Rewrite.cpp.

References mlir::clone(), unwrap(), and wrap().

◆ mlirRewriterBaseCloneWithoutRegions()

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 117 of file Rewrite.cpp.

References mlir::cloneWithoutRegions(), unwrap(), and wrap().

◆ mlirRewriterBaseCreateBlockBefore()

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 92 of file Rewrite.cpp.

References unwrap(), unwrapList(), and wrap().

◆ mlirRewriterBaseEraseBlock()

MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseBlock ( MlirRewriterBase rewriter,
MlirBlock block )

Erases a block along with all operations inside it.

Definition at line 161 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseEraseOp()

MLIR_CAPI_EXPORTED void mlirRewriterBaseEraseOp ( MlirRewriterBase rewriter,
MlirOperation op )

Erases an operation that is known to have no uses.

Definition at line 157 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::bind().

◆ mlirRewriterBaseFinalizeOpModification()

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 204 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseGetBlock()

MLIR_CAPI_EXPORTED MlirBlock mlirRewriterBaseGetBlock ( MlirRewriterBase rewriter)

Returns the current block of the rewriter.

Definition at line 73 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirRewriterBaseGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirRewriterBaseGetContext ( MlirRewriterBase rewriter)

RewriterBase API inherited from OpBuilder.

Get the MLIR context referenced by the rewriter.

Definition at line 32 of file Rewrite.cpp.

References getContext(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::PyRewriterBase().

◆ mlirRewriterBaseGetInsertionBlock()

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 69 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::getInsertionPoint().

◆ mlirRewriterBaseGetOperationAfterInsertion()

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 78 of file Rewrite.cpp.

References mlir::Block::end(), mlir::OpBuilder::getInsertionBlock(), mlir::OpBuilder::getInsertionPoint(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::getInsertionPoint().

◆ mlirRewriterBaseInlineBlockBefore()

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 165 of file Rewrite.cpp.

References unwrap(), and unwrapList().

◆ mlirRewriterBaseInlineRegionBefore()

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 138 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseInsert()

MLIR_CAPI_EXPORTED MlirOperation mlirRewriterBaseInsert ( MlirRewriterBase rewriter,
MlirOperation op )

Insert the given operation at the current insertion point and return it.

Definition at line 105 of file Rewrite.cpp.

References unwrap(), and wrap().

◆ mlirRewriterBaseMergeBlocks()

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 176 of file Rewrite.cpp.

References unwrap(), and unwrapList().

◆ mlirRewriterBaseMoveBlockBefore()

MLIR_CAPI_EXPORTED void mlirRewriterBaseMoveBlockBefore ( MlirRewriterBase rewriter,
MlirBlock block,
MlirBlock existingBlock )

Unlink this block and insert it right before existingBlock.

Definition at line 194 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseMoveOpAfter()

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 189 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseMoveOpBefore()

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 184 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseReplaceAllOpUsesWithOperation()

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 239 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseReplaceAllOpUsesWithValueRange()

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 230 of file Rewrite.cpp.

References unwrap(), and unwrapList().

◆ mlirRewriterBaseReplaceAllUsesExcept()

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 256 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseReplaceAllUsesWith()

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 214 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseReplaceAllValueRangeUsesWith()

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 219 of file Rewrite.cpp.

References unwrap(), and unwrapList().

◆ mlirRewriterBaseReplaceOpUsesWithinBlock()

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 245 of file Rewrite.cpp.

References unwrap(), and unwrapList().

◆ mlirRewriterBaseReplaceOpWithOperation()

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 151 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::bind().

◆ mlirRewriterBaseReplaceOpWithValues()

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 143 of file Rewrite.cpp.

References unwrap(), and unwrapList().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewriterBase< DerivedTy >::bind().

◆ mlirRewriterBaseSetInsertionPointAfter()

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 49 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseSetInsertionPointAfterValue()

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 54 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseSetInsertionPointBefore()

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 44 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseSetInsertionPointToEnd()

MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToEnd ( MlirRewriterBase rewriter,
MlirBlock block )

Sets the insertion point to the end of the specified block.

Definition at line 64 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseSetInsertionPointToStart()

MLIR_CAPI_EXPORTED void mlirRewriterBaseSetInsertionPointToStart ( MlirRewriterBase rewriter,
MlirBlock block )

Sets the insertion point to the start of the specified block.

Definition at line 59 of file Rewrite.cpp.

References unwrap().

◆ mlirRewriterBaseStartOpModification()

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 199 of file Rewrite.cpp.

References unwrap().

◆ mlirTypeConverterAddConversion()

MLIR_CAPI_EXPORTED void mlirTypeConverterAddConversion ( MlirTypeConverter typeConverter,
MlirTypeConverterConversionCallback convertType,
void * userData )

Add a type conversion function to the given TypeConverter.

Definition at line 590 of file Rewrite.cpp.

References mlirLogicalResultIsFailure(), mlirTypeIsNull(), result, unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyTypeConverter::addConversion().

◆ mlirTypeConverterConvertType()

MLIR_CAPI_EXPORTED MlirType mlirTypeConverterConvertType ( MlirTypeConverter typeConverter,
MlirType type )

Convert the given type using the given TypeConverter.

Definition at line 607 of file Rewrite.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyTypeConverter::convertType().

◆ mlirTypeConverterCreate()

MLIR_CAPI_EXPORTED MlirTypeConverter mlirTypeConverterCreate ( void )

◆ mlirTypeConverterDestroy()

MLIR_CAPI_EXPORTED void mlirTypeConverterDestroy ( MlirTypeConverter typeConverter)

Destroy the given TypeConverter.

Definition at line 586 of file Rewrite.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyTypeConverter::~PyTypeConverter().

◆ mlirWalkAndApplyPatterns()

MLIR_CAPI_EXPORTED void mlirWalkAndApplyPatterns ( MlirOperation op,
MlirFrozenRewritePatternSet patterns )

Applies the given patterns to the given op by a fast walk-based pattern rewrite driver.

Definition at line 448 of file Rewrite.cpp.

References unwrap(), and mlir::walkAndApplyPatterns().