MLIR 22.0.0git
AffineExpr.h File Reference
#include "mlir-c/IR.h"

Go to the source code of this file.

Macros

#define DEFINE_C_API_STRUCT(name, storage)

Functions

 DEFINE_C_API_STRUCT (MlirAffineExpr, const void)
MLIR_CAPI_EXPORTED MlirContext mlirAffineExprGetContext (MlirAffineExpr affineExpr)
 Gets the context that owns the affine expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprEqual (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Returns true if the two affine expressions are equal.
static bool mlirAffineExprIsNull (MlirAffineExpr affineExpr)
 Returns true if the given affine expression is a null expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirSimplifyAffineExpr (MlirAffineExpr expr, uint32_t numDims, uint32_t numSymbols)
 Prints an affine expression by sending chunks of the string representation and forwarding userData to callback`.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsADim (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a dimension expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineDimExprGet (MlirContext ctx, intptr_t position)
 Creates an affine dimension expression with 'position' in the context.
MLIR_CAPI_EXPORTED intptr_t mlirAffineDimExprGetPosition (MlirAffineExpr affineExpr)
 Returns the position of the given affine dimension expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsASymbol (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a symbol expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineSymbolExprGet (MlirContext ctx, intptr_t position)
 Creates an affine symbol expression with 'position' in the context.
MLIR_CAPI_EXPORTED intptr_t mlirAffineSymbolExprGetPosition (MlirAffineExpr affineExpr)
 Returns the position of the given affine symbol expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAConstant (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a constant expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineConstantExprGet (MlirContext ctx, int64_t constant)
 Creates an affine constant expression with 'constant' in the context.
MLIR_CAPI_EXPORTED int64_t mlirAffineConstantExprGetValue (MlirAffineExpr affineExpr)
 Returns the value of the given affine constant expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAAdd (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an add expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineAddExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine add expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMul (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an mul expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineMulExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine mul expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMod (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an mod expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineModExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine mod expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAFloorDiv (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an floordiv expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineFloorDivExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine floordiv expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsACeilDiv (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an ceildiv expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineCeilDivExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine ceildiv expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsABinary (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is binary.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetLHS (MlirAffineExpr affineExpr)
 Returns the left hand side affine expression of the given affine binary operation expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetRHS (MlirAffineExpr affineExpr)
 Returns the right hand side affine expression of the given affine binary operation expression.

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

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

Definition at line 32 of file AffineExpr.h.

Function Documentation

◆ DEFINE_C_API_STRUCT()

DEFINE_C_API_STRUCT ( MlirAffineExpr ,
const void  )

References lhs, MLIR_CAPI_EXPORTED, and rhs.

◆ mlirAffineAddExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineAddExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Creates an affine add expression with 'lhs' and 'rhs'.

Definition at line 137 of file AffineExpr.cpp.

References mlir::Add, mlir::getAffineBinaryOpExpr(), lhs, rhs, unwrap(), and wrap().

◆ mlirAffineBinaryOpExprGetLHS()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetLHS ( MlirAffineExpr affineExpr)

Returns the left hand side affine expression of the given affine binary operation expression.

Definition at line 204 of file AffineExpr.cpp.

References unwrap(), and wrap().

◆ mlirAffineBinaryOpExprGetRHS()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetRHS ( MlirAffineExpr affineExpr)

Returns the right hand side affine expression of the given affine binary operation expression.

Definition at line 208 of file AffineExpr.cpp.

References unwrap(), and wrap().

◆ mlirAffineCeilDivExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineCeilDivExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Creates an affine ceildiv expression with 'lhs' and 'rhs'.

Definition at line 190 of file AffineExpr.cpp.

References mlir::CeilDiv, mlir::getAffineBinaryOpExpr(), lhs, rhs, unwrap(), and wrap().

◆ mlirAffineConstantExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineConstantExprGet ( MlirContext ctx,
int64_t constant )

Creates an affine constant expression with 'constant' in the context.

Definition at line 121 of file AffineExpr.cpp.

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

◆ mlirAffineConstantExprGetValue()

MLIR_CAPI_EXPORTED int64_t mlirAffineConstantExprGetValue ( MlirAffineExpr affineExpr)

Returns the value of the given affine constant expression.

Definition at line 125 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineDimExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineDimExprGet ( MlirContext ctx,
intptr_t position )

Creates an affine dimension expression with 'position' in the context.

Definition at line 89 of file AffineExpr.cpp.

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

◆ mlirAffineDimExprGetPosition()

MLIR_CAPI_EXPORTED intptr_t mlirAffineDimExprGetPosition ( MlirAffineExpr affineExpr)

Returns the position of the given affine dimension expression.

Definition at line 93 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprEqual()

MLIR_CAPI_EXPORTED bool mlirAffineExprEqual ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Returns true if the two affine expressions are equal.

Definition at line 24 of file AffineExpr.cpp.

References lhs, rhs, and unwrap().

Referenced by mlir::python::PyAffineExpr::operator==().

◆ mlirAffineExprGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirAffineExprGetContext ( MlirAffineExpr affineExpr)

Gets the context that owns the affine expression.

Definition at line 20 of file AffineExpr.cpp.

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

Referenced by mlir::python::PyAffineExpr::createFromCapsule().

◆ mlirAffineExprIsAAdd()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsAAdd ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an add expression.

Definition at line 133 of file AffineExpr.cpp.

References mlir::Add, and unwrap().

◆ mlirAffineExprIsABinary()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsABinary ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is binary.

Definition at line 200 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsACeilDiv()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsACeilDiv ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an ceildiv expression.

Definition at line 186 of file AffineExpr.cpp.

References mlir::CeilDiv, and unwrap().

◆ mlirAffineExprIsAConstant()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsAConstant ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a constant expression.

Definition at line 117 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsADim()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsADim ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a dimension expression.

Definition at line 85 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsAFloorDiv()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsAFloorDiv ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an floordiv expression.

Definition at line 172 of file AffineExpr.cpp.

References mlir::FloorDiv, and unwrap().

◆ mlirAffineExprIsAMod()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMod ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an mod expression.

Definition at line 159 of file AffineExpr.cpp.

References mlir::Mod, and unwrap().

◆ mlirAffineExprIsAMul()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMul ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an mul expression.

Definition at line 146 of file AffineExpr.cpp.

References mlir::Mul, and unwrap().

◆ mlirAffineExprIsASymbol()

MLIR_CAPI_EXPORTED bool mlirAffineExprIsASymbol ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a symbol expression.

Definition at line 101 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsNull()

bool mlirAffineExprIsNull ( MlirAffineExpr affineExpr)
inlinestatic

Returns true if the given affine expression is a null expression.

Note constant zero is not a null expression.

Definition at line 54 of file AffineExpr.h.

Referenced by mlir::python::PyAffineExpr::createFromCapsule().

◆ mlirAffineFloorDivExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineFloorDivExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Creates an affine floordiv expression with 'lhs' and 'rhs'.

Definition at line 176 of file AffineExpr.cpp.

References mlir::FloorDiv, mlir::getAffineBinaryOpExpr(), lhs, rhs, unwrap(), and wrap().

◆ mlirAffineModExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineModExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Creates an affine mod expression with 'lhs' and 'rhs'.

Definition at line 163 of file AffineExpr.cpp.

References mlir::getAffineBinaryOpExpr(), lhs, mlir::Mod, rhs, unwrap(), and wrap().

◆ mlirAffineMulExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineMulExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Creates an affine mul expression with 'lhs' and 'rhs'.

Definition at line 150 of file AffineExpr.cpp.

References mlir::getAffineBinaryOpExpr(), lhs, mlir::Mul, rhs, unwrap(), and wrap().

◆ mlirAffineSymbolExprGet()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineSymbolExprGet ( MlirContext ctx,
intptr_t position )

Creates an affine symbol expression with 'position' in the context.

Definition at line 105 of file AffineExpr.cpp.

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

◆ mlirAffineSymbolExprGetPosition()

MLIR_CAPI_EXPORTED intptr_t mlirAffineSymbolExprGetPosition ( MlirAffineExpr affineExpr)

Returns the position of the given affine symbol expression.

Definition at line 109 of file AffineExpr.cpp.

References unwrap().

◆ mlirSimplifyAffineExpr()

MLIR_CAPI_EXPORTED MlirAffineExpr mlirSimplifyAffineExpr ( MlirAffineExpr expr,
uint32_t numDims,
uint32_t numSymbols )

Prints an affine expression by sending chunks of the string representation and forwarding userData to callback`.

Note that the callback may be called / several times with consecutive chunks of the string. MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr affineExpr, MlirStringCallback callback, void *userData);

/ Prints the affine expression to the standard error stream. MLIR_CAPI_EXPORTED void mlirAffineExprDump(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is made out of only symbols and / constants. MLIR_CAPI_EXPORTED bool mlirAffineExprIsSymbolicOrConstant(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is a pure affine expression, i.e. / mul, floordiv, ceildic, and mod is only allowed w.r.t constants. MLIR_CAPI_EXPORTED bool mlirAffineExprIsPureAffine(MlirAffineExpr affineExpr);

/ Returns the greatest known integral divisor of this affine expression. The / result is always positive. MLIR_CAPI_EXPORTED int64_t mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is a multiple of 'factor'. MLIR_CAPI_EXPORTED bool mlirAffineExprIsMultipleOf(MlirAffineExpr affineExpr, int64_t factor);

/ Checks whether the given affine expression involves AffineDimExpr / 'position'. MLIR_CAPI_EXPORTED bool mlirAffineExprIsFunctionOfDim(MlirAffineExpr affineExpr, intptr_t position);

/ Composes the given map with the given expression. MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprCompose( MlirAffineExpr affineExpr, struct MlirAffineMap affineMap);

/ Replace dims[offset ... numDims) / by dims[offset + shift ... shift + numDims). MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprShiftDims(MlirAffineExpr affineExpr, uint32_t numDims, uint32_t shift, uint32_t offset);

/ Replace symbols[offset ... numSymbols) / by symbols[offset + shift ... shift + numSymbols). MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprShiftSymbols(MlirAffineExpr affineExpr, uint32_t numSymbols, uint32_t shift, uint32_t offset);

/ Simplify an affine expression by flattening and some amount of simple / analysis. This has complexity linear in the number of nodes in 'expr'. / Returns the simplified expression, which is the same as the input expression / if it can't be simplified. When expr is semi-affine, a simplified semi-affine expression is constructed in the sorted order of dimension and symbol positions.

Definition at line 76 of file AffineExpr.cpp.

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