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"
47 #define GET_OP_CLASSES
48 #include "mlir/Dialect/Arith/IR/ArithOps.h.inc"
56 using arith::ConstantOp::ConstantOp;
57 static ::mlir::TypeID
resolveTypeID() {
return TypeID::get<ConstantOp>(); }
69 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
78 using arith::ConstantOp::ConstantOp;
79 static ::mlir::TypeID
resolveTypeID() {
return TypeID::get<ConstantOp>(); }
86 return cast<FloatAttr>(arith::ConstantOp::getValue()).getValue();
95 using arith::ConstantOp::ConstantOp;
96 static ::mlir::TypeID
resolveTypeID() {
return TypeID::get<ConstantOp>(); }
101 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
136 OpBuilder &builder, Location loc,
137 bool useOnlyFiniteValue =
false);
149 Location loc,
bool useOnlyFiniteValue =
false);
154 Value lhs, Value rhs);
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
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 void build(OpBuilder &builder, OperationState &result, const APFloat &value, FloatType type)
Build a constant float op that produces a float of the specified type.
static bool classof(Operation *op)
::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)
Specialization of arith.constant op that returns an integer value.
::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.
Include the generated interface declarations.
This represents an operation in an abstracted form, suitable for use with the builder APIs.