MLIR 23.0.0git
Pattern.cpp File Reference
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "llvm/Support/CheckedArithmetic.h"
#include "llvm/Support/MathExtras.h"

Go to the source code of this file.

Functions

static unsigned getBitWidth (Type type)
static bool isFixedSizeAggregate (Type type, Type dstType)
 Returns true if every leaf in type (recursing through LLVM arrays and structs) is either equal to dstType or has a fixed bit width.
static Value createI32Constant (OpBuilder &builder, Location loc, int32_t value)
static void decomposeValueImpl (OpBuilder &builder, Location loc, Value src, Type dstType, SmallVectorImpl< Value > &result)
 Recursive implementation of decomposeValue.
static Value composeValueImpl (OpBuilder &builder, Location loc, ValueRange src, size_t &offset, Type dstType)
 Recursive implementation of composeValue.
static FloatType getFloatingPointType (Type type)
 Return the given type if it's a floating point type.

Function Documentation

◆ composeValueImpl()

Value composeValueImpl ( OpBuilder & builder,
Location loc,
ValueRange src,
size_t & offset,
Type dstType )
static

Recursive implementation of composeValue.

Consumes elements from src starting at offset, advancing it past the consumed elements.

Definition at line 511 of file Pattern.cpp.

References composeValueImpl(), createI32Constant(), getBitWidth(), mlir::Builder::getIntegerType(), mlir::Value::getType(), mlir::Type::isIntOrFloat(), and result.

Referenced by mlir::LLVM::composeValue(), and composeValueImpl().

◆ createI32Constant()

Value createI32Constant ( OpBuilder & builder,
Location loc,
int32_t value )
static

Definition at line 415 of file Pattern.cpp.

References mlir::Builder::getI32Type().

◆ decomposeValueImpl()

void decomposeValueImpl ( OpBuilder & builder,
Location loc,
Value src,
Type dstType,
SmallVectorImpl< Value > & result )
static

Recursive implementation of decomposeValue.

When permitVariablySizedScalars is false, callers must ensure isFixedSizeAggregate() holds before calling this.

Definition at line 424 of file Pattern.cpp.

References createI32Constant(), decomposeValueImpl(), getBitWidth(), mlir::Builder::getIntegerType(), mlir::Value::getType(), mlir::Type::isIntOrFloat(), and result.

Referenced by mlir::LLVM::decomposeValue(), and decomposeValueImpl().

◆ getBitWidth()

◆ getFloatingPointType()

FloatType getFloatingPointType ( Type type)
static

Return the given type if it's a floating point type.

If the given type is a vector type, return its element type if it's a floating point type.

Definition at line 654 of file Pattern.cpp.

Referenced by mlir::LLVM::detail::isUnsupportedFloatingPointType().

◆ isFixedSizeAggregate()

bool isFixedSizeAggregate ( Type type,
Type dstType )
static

Returns true if every leaf in type (recursing through LLVM arrays and structs) is either equal to dstType or has a fixed bit width.

Definition at line 401 of file Pattern.cpp.

References isFixedSizeAggregate(), and mlir::Type::isIntOrFloat().

Referenced by mlir::LLVM::decomposeValue(), and isFixedSizeAggregate().