9#ifndef MLIR_DIALECT_ARITH_IR_ARITH_H_
10#define MLIR_DIALECT_ARITH_IR_ARITH_H_
22#include "llvm/ADT/StringExtras.h"
28#include "mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc"
34#include "mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc"
35#define GET_ATTRDEF_CLASSES
36#include "mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc"
41#include "mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc"
48#include "mlir/Dialect/Arith/IR/ArithOps.h.inc"
56 using arith::ConstantOp::ConstantOp;
85 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
94 using arith::ConstantOp::ConstantOp;
99 const APFloat &
value);
101 FloatType type,
const APFloat &
value);
103 const APFloat &
value);
106 return cast<FloatAttr>(arith::ConstantOp::getValue()).getValue();
115 using arith::ConstantOp::ConstantOp;
124 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
159 OpBuilder &builder, Location loc,
160 bool useOnlyFiniteValue =
false);
171Value
getIdentityValue(AtomicRMWKind op, Type resultType, OpBuilder &builder,
172 Location loc,
bool useOnlyFiniteValue =
false);
176Value
getReductionOp(AtomicRMWKind op, OpBuilder &builder, Location loc,
ImplicitLocOpBuilder maintains a 'current location', allowing use of the create<> method without spec...
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
static TypeID get()
Construct a type info object for the given type T.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Specialization of arith.constant op that returns a floating point value.
static ConstantFloatOp create(OpBuilder &builder, Location location, FloatType type, const APFloat &value)
static bool classof(Operation *op)
static void build(OpBuilder &builder, OperationState &result, FloatType type, const APFloat &value)
Build a constant float op that produces a float of the specified type.
::mlir::TypeID resolveTypeID()
Specialization of arith.constant op that returns an integer of index type.
static void build(OpBuilder &builder, OperationState &result, int64_t value)
Build a constant int op that produces an index.
::mlir::TypeID resolveTypeID()
static bool classof(Operation *op)
static ConstantIndexOp create(OpBuilder &builder, Location location, int64_t value)
Specialization of arith.constant op that returns an integer value.
static ConstantIntOp create(OpBuilder &builder, Location location, int64_t value, unsigned width)
::mlir::TypeID resolveTypeID()
static void build(OpBuilder &builder, OperationState &result, int64_t value, unsigned width)
Build a constant int op that produces an integer of the specified width.
static bool classof(Operation *op)
std::optional< TypedAttr > getNeutralElement(Operation *op)
Return the identity numeric value associated to the give op.
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.
TypedAttr getIdentityValueAttr(AtomicRMWKind kind, Type resultType, OpBuilder &builder, Location loc, bool useOnlyFiniteValue=false)
Returns the identity value attribute associated with an AtomicRMWKind op.
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 AtomicRM...
Value getIdentityValue(AtomicRMWKind op, Type resultType, OpBuilder &builder, Location loc, bool useOnlyFiniteValue=false)
Returns the identity value associated with an AtomicRMWKind op.
arith::CmpIPredicate invertPredicate(arith::CmpIPredicate pred)
Invert an integer comparison predicate.
Value getZeroConstant(OpBuilder &builder, Location loc, Type type)
Creates an arith.constant operation with a zero value of type type.
Include the generated interface declarations.
This represents an operation in an abstracted form, suitable for use with the builder APIs.