9 #ifndef MLIR_DIALECT_ARITH_IR_ARITH_H_
10 #define MLIR_DIALECT_ARITH_IR_ARITH_H_
21 #include "llvm/ADT/StringExtras.h"
27 #include "mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc"
33 #include "mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc"
34 #define GET_ATTRDEF_CLASSES
35 #include "mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc"
40 #include "mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc"
46 #define GET_OP_CLASSES
47 #include "mlir/Dialect/Arith/IR/ArithOps.h.inc"
55 using arith::ConstantOp::ConstantOp;
67 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
76 using arith::ConstantOp::ConstantOp;
83 return cast<FloatAttr>(arith::ConstantOp::getValue()).getValue();
92 using arith::ConstantOp::ConstantOp;
98 return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
126 OpBuilder &builder, Location loc);
135 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)
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.
static bool classof(Operation *op)
Specialization of arith.constant op that returns an integer value.
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)
Value getIdentityValue(AtomicRMWKind op, Type resultType, OpBuilder &builder, Location loc)
Returns the identity value associated with an AtomicRMWKind 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)
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...
arith::CmpIPredicate invertPredicate(arith::CmpIPredicate pred)
Invert an integer comparison predicate.
This header declares functions that assit transformations in the MemRef dialect.
This represents an operation in an abstracted form, suitable for use with the builder APIs.