MLIR 23.0.0git
Utils.h
Go to the documentation of this file.
1//===- Utils.h - Utils for APFloat Conversion - C++ -----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
10#define MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
11
14
15namespace mlir {
16class Value;
17class OpBuilder;
18class Location;
19class FloatType;
20
21Value getAPFloatSemanticsValue(OpBuilder &b, Location loc, FloatType floatTy);
22
23/// Given two operands of vector type and vector result type (with the same
24/// shape), call the given function for each pair of scalar operands and
25/// package the result into a vector. If the given operands and result type are
26/// not vectors, call the function directly. The second operand is optional.
27Value forEachScalarValue(mlir::RewriterBase &rewriter, Location loc,
28 Value operand1, Value operand2, Type resultType,
29 llvm::function_ref<Value(Value, Value, Type)> fn);
30
31/// Check preconditions for the conversion:
32/// 1. All operands / results must be integers or floats (or vectors thereof).
33/// 2. The bitwidth of the operands / results must be <= 64.
34LogicalResult checkPreconditions(RewriterBase &rewriter, Operation *op);
35
36} // namespace mlir
37
38#endif // MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
b
Return true if permutation is a valid permutation of the outer_dims_perm (case OuterOrInnerPerm::Oute...
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition Location.h:76
This class helps build Operations.
Definition Builders.h:209
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition Value.h:96
Include the generated interface declarations.
LogicalResult checkPreconditions(RewriterBase &rewriter, Operation *op)
Check preconditions for the conversion:
Definition Utils.cpp:70
Value getAPFloatSemanticsValue(OpBuilder &b, Location loc, FloatType floatTy)
Definition Utils.cpp:21
Value forEachScalarValue(mlir::RewriterBase &rewriter, Location loc, Value operand1, Value operand2, Type resultType, llvm::function_ref< Value(Value, Value, Type)> fn)
Given two operands of vector type and vector result type (with the same shape), call the given functi...
Definition Utils.cpp:28