MLIR  16.0.0git
Classes | Functions
mlir::arith Namespace Reference

Classes

class  ConstantFloatOp
 Specialization of arith.constant op that returns a floating point value. More...
 
class  ConstantIndexOp
 Specialization of arith.constant op that returns an integer of index type. More...
 
class  ConstantIntOp
 Specialization of arith.constant op that returns an integer value. More...
 
class  WideIntEmulationConverter
 Converts integer types that are too wide for the target by splitting them in two halves and thus turning into supported ones, i.e., i2*N –> iN, where N is the widest integer bitwidth supported by the target. More...
 

Functions

void populateArithmeticToLLVMConversionPatterns (LLVMTypeConverter &converter, RewritePatternSet &patterns)
 
std::unique_ptr< PasscreateConvertArithmeticToLLVMPass ()
 
void populateArithmeticToSPIRVPatterns (SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns)
 
std::unique_ptr< OperationPass<> > createConvertArithmeticToSPIRVPass ()
 
bool applyCmpPredicate (arith::CmpIPredicate predicate, const APInt &lhs, const APInt &rhs)
 Compute lhs pred rhs, where pred is one of the known integer comparison predicates. More...
 
bool applyCmpPredicate (arith::CmpFPredicate predicate, const APFloat &lhs, const APFloat &rhs)
 Compute lhs pred rhs, where pred is one of the known floating point comparison predicates. More...
 
Attribute getIdentityValueAttr (AtomicRMWKind kind, Type resultType, OpBuilder &builder, Location loc)
 Returns the identity value attribute associated with an AtomicRMWKind op. More...
 
Value getIdentityValue (AtomicRMWKind op, Type resultType, OpBuilder &builder, Location loc)
 Returns the identity value associated with an AtomicRMWKind op. More...
 
Value getReductionOp (AtomicRMWKind op, OpBuilder &builder, Location loc, Value lhs, Value rhs)
 Returns the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs. More...
 
arith::CmpIPredicate invertPredicate (arith::CmpIPredicate pred)
 Invert an integer comparison predicate. More...
 
void registerBufferizableOpInterfaceExternalModels (DialectRegistry &registry)
 
std::unique_ptr< PasscreateArithmeticBufferizePass ()
 Create a pass to bufferize Arithmetic ops. More...
 
std::unique_ptr< PasscreateConstantBufferizePass (uint64_t alignment=0)
 Create a pass to bufferize arith.constant ops. More...
 
void populateWideIntEmulationPatterns (WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns)
 Adds patterns to emulate wide Arithmetic and Function ops over integer types into supported ones. More...
 
void populateArithmeticExpandOpsPatterns (RewritePatternSet &patterns)
 Add patterns to expand Arithmetic ops for LLVM lowering. More...
 
std::unique_ptr< PasscreateArithmeticExpandOpsPass ()
 Create a pass to legalize Arithmetic ops for LLVM lowering. More...
 
std::unique_ptr< PasscreateArithmeticUnsignedWhenEquivalentPass ()
 Create a pass to replace signed ops with unsigned ones where they are proven equivalent. More...
 

Function Documentation

◆ applyCmpPredicate() [1/2]

bool mlir::arith::applyCmpPredicate ( arith::CmpIPredicate  predicate,
const APInt &  lhs,
const APInt &  rhs 
)

Compute lhs pred rhs, where pred is one of the known integer comparison predicates.

Definition at line 1365 of file ArithmeticOps.cpp.

Referenced by mlir::arith::ConstantIndexOp::value().

◆ applyCmpPredicate() [2/2]

bool mlir::arith::applyCmpPredicate ( arith::CmpFPredicate  predicate,
const APFloat &  lhs,
const APFloat &  rhs 
)

Compute lhs pred rhs, where pred is one of the known floating point comparison predicates.

Definition at line 1490 of file ArithmeticOps.cpp.

◆ createArithmeticBufferizePass()

std::unique_ptr< Pass > mlir::arith::createArithmeticBufferizePass ( )

Create a pass to bufferize Arithmetic ops.

Definition at line 61 of file Bufferize.cpp.

◆ createArithmeticExpandOpsPass()

std::unique_ptr< Pass > mlir::arith::createArithmeticExpandOpsPass ( )

Create a pass to legalize Arithmetic ops for LLVM lowering.

Definition at line 245 of file ExpandOps.cpp.

Referenced by mlir::sparse_tensor::buildSparseCompiler().

◆ createArithmeticUnsignedWhenEquivalentPass()

std::unique_ptr< Pass > mlir::arith::createArithmeticUnsignedWhenEquivalentPass ( )

Create a pass to replace signed ops with unsigned ones where they are proven equivalent.

Definition at line 157 of file UnsignedWhenEquivalent.cpp.

◆ createConstantBufferizePass()

std::unique_ptr< Pass > mlir::arith::createConstantBufferizePass ( uint64_t  alignment = 0)

Create a pass to bufferize arith.constant ops.

Definition at line 66 of file Bufferize.cpp.

◆ createConvertArithmeticToLLVMPass()

std::unique_ptr< Pass > mlir::arith::createConvertArithmeticToLLVMPass ( )

Definition at line 399 of file ArithmeticToLLVM.cpp.

◆ createConvertArithmeticToSPIRVPass()

std::unique_ptr< OperationPass<> > mlir::arith::createConvertArithmeticToSPIRVPass ( )

Definition at line 1058 of file ArithmeticToSPIRV.cpp.

◆ getIdentityValue()

Value mlir::arith::getIdentityValue ( AtomicRMWKind  op,
Type  resultType,
OpBuilder builder,
Location  loc 
)

Returns the identity value associated with an AtomicRMWKind op.

Definition at line 2108 of file ArithmeticOps.cpp.

References mlir::OpBuilder::create(), and getIdentityValueAttr().

Referenced by mlir::lowerAffineLowerBound().

◆ getIdentityValueAttr()

Attribute mlir::arith::getIdentityValueAttr ( AtomicRMWKind  kind,
Type  resultType,
OpBuilder builder,
Location  loc 
)

Returns the identity value attribute associated with an AtomicRMWKind op.

Definition at line 2061 of file ArithmeticOps.cpp.

Referenced by createInitialVector(), getIdentityValue(), and isNeutralElementConst().

◆ getReductionOp()

Value mlir::arith::getReductionOp ( AtomicRMWKind  op,
OpBuilder builder,
Location  loc,
Value  lhs,
Value  rhs 
)

Returns the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs.

Return the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op to lhs and rhs.

Definition at line 2116 of file ArithmeticOps.cpp.

Referenced by mlir::lowerAffineLowerBound().

◆ invertPredicate()

arith::CmpIPredicate mlir::arith::invertPredicate ( arith::CmpIPredicate  pred)

Invert an integer comparison predicate.

Definition at line 45 of file ArithmeticOps.cpp.

Referenced by mlir::scf::getParallelForInductionVarOwner(), and invertPredicate().

◆ populateArithmeticExpandOpsPatterns()

void mlir::arith::populateArithmeticExpandOpsPatterns ( RewritePatternSet patterns)

Add patterns to expand Arithmetic ops for LLVM lowering.

Definition at line 228 of file ExpandOps.cpp.

References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().

◆ populateArithmeticToLLVMConversionPatterns()

void mlir::arith::populateArithmeticToLLVMConversionPatterns ( LLVMTypeConverter converter,
RewritePatternSet patterns 
)

◆ populateArithmeticToSPIRVPatterns()

void mlir::arith::populateArithmeticToSPIRVPatterns ( SPIRVTypeConverter typeConverter,
RewritePatternSet patterns 
)

◆ populateWideIntEmulationPatterns()

void mlir::arith::populateWideIntEmulationPatterns ( WideIntEmulationConverter typeConverter,
RewritePatternSet patterns 
)

Adds patterns to emulate wide Arithmetic and Function ops over integer types into supported ones.

This is done by splitting original power-of-two i2N integer types into two iN halves.

Definition at line 679 of file EmulateWideInt.cpp.

References mlir::populateCallOpTypeConversionPattern(), and mlir::populateReturnOpTypeConversionPattern().

Referenced by constructResultVector().

◆ registerBufferizableOpInterfaceExternalModels()

void mlir::arith::registerBufferizableOpInterfaceExternalModels ( DialectRegistry registry)