MLIR  14.0.0git
Classes | Functions
mlir::LLVM::detail Namespace Reference

Classes

class  DebugTranslation
 
struct  LLVMFunctionTypeStorage
 Type storage for LLVM dialect function types. More...
 
struct  LLVMPointerTypeStorage
 Storage type for LLVM dialect pointer types. More...
 
struct  LLVMStructTypeStorage
 Type storage for LLVM structure types. More...
 
struct  LLVMTypeAndSizeStorage
 Common storage used for LLVM dialect types that need an element type and a number: arrays, fixed and scalable vectors. More...
 
struct  NDVectorTypeInfo
 
class  TypeFromLLVMIRTranslatorImpl
 Support for translating LLVM IR types to MLIR LLVM dialect types. More...
 
class  TypeToLLVMIRTranslatorImpl
 Support for translating MLIR LLVM dialect types to LLVM IR. More...
 

Functions

LogicalResult oneToOneRewrite (Operation *op, StringRef targetOp, ValueRange operands, LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter)
 Replaces the given operation "op" with a new operation of type "targetOp" and given operands. More...
 
NDVectorTypeInfo extractNDVectorTypeInfo (VectorType vectorType, LLVMTypeConverter &converter)
 
SmallVector< int64_t, 4 > getCoordinates (ArrayRef< int64_t > basis, unsigned linearIndex)
 
void nDVectorIterate (const NDVectorTypeInfo &info, OpBuilder &builder, function_ref< void(ArrayAttr)> fun)
 
LogicalResult handleMultidimensionalVectors (Operation *op, ValueRange operands, LLVMTypeConverter &typeConverter, std::function< Value(Type, ValueRange)> createOperand, ConversionPatternRewriter &rewriter)
 
LogicalResult vectorOneToOneRewrite (Operation *op, StringRef targetOp, ValueRange operands, LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter)
 
Type parseType (DialectAsmParser &parser)
 Parses an LLVM dialect type. More...
 
void printType (Type type, AsmPrinter &printer)
 Prints an LLVM Dialect type. More...
 
void connectPHINodes (Region &region, const ModuleTranslation &state)
 For all blocks in the region that were converted to LLVM IR using the given ModuleTranslation, connect the PHI nodes of the corresponding LLVM IR blocks to the results of preceding blocks. More...
 
SetVector< Block * > getTopologicallySortedBlocks (Region &region)
 Get a topologically sorted list of blocks of the given region. More...
 
llvm::ConstantgetLLVMConstant (llvm::Type *llvmType, Attribute attr, Location loc, const ModuleTranslation &moduleTranslation, bool isTopLevel=true)
 Create an LLVM IR constant of llvmType from the MLIR attribute attr. More...
 
llvm::Value * createIntrinsicCall (llvm::IRBuilderBase &builder, llvm::Intrinsic::ID intrinsic, ArrayRef< llvm::Value *> args={}, ArrayRef< llvm::Type *> tys={})
 Creates a call to an LLVM IR intrinsic function with the given arguments. More...
 

Function Documentation

◆ connectPHINodes()

void mlir::LLVM::detail::connectPHINodes ( Region region,
const ModuleTranslation state 
)

For all blocks in the region that were converted to LLVM IR using the given ModuleTranslation, connect the PHI nodes of the corresponding LLVM IR blocks to the results of preceding blocks.

Connect the PHI nodes to the results of preceding blocks.

Definition at line 411 of file ModuleTranslation.cpp.

References mlir::Region::begin(), mlir::Region::end(), mlir::detail::enumerate(), mlir::Block::getNumArguments(), getPHISourceValue(), mlir::Block::getPredecessors(), mlir::LLVM::ModuleTranslation::lookupBlock(), mlir::LLVM::ModuleTranslation::lookupBranch(), and mlir::LLVM::ModuleTranslation::lookupValue().

Referenced by convertOmpOpRegions(), forwardPassthroughAttributes(), and mlir::LLVM::ModuleTranslation::SaveStack< T >::~SaveStack().

◆ createIntrinsicCall()

llvm::Value * mlir::LLVM::detail::createIntrinsicCall ( llvm::IRBuilderBase &  builder,
llvm::Intrinsic::ID  intrinsic,
ArrayRef< llvm::Value *>  args = {},
ArrayRef< llvm::Type *>  tys = {} 
)

◆ extractNDVectorTypeInfo()

LLVM::detail::NDVectorTypeInfo mlir::LLVM::detail::extractNDVectorTypeInfo ( VectorType  vectorType,
LLVMTypeConverter converter 
)

◆ getCoordinates()

SmallVector< int64_t, 4 > mlir::LLVM::detail::getCoordinates ( ArrayRef< int64_t >  basis,
unsigned  linearIndex 
)

Definition at line 48 of file VectorPattern.cpp.

Referenced by nDVectorIterate().

◆ getLLVMConstant()

llvm::Constant * mlir::LLVM::detail::getLLVMConstant ( llvm::Type *  llvmType,
Attribute  attr,
Location  loc,
const ModuleTranslation moduleTranslation,
bool  isTopLevel = true 
)

Create an LLVM IR constant of llvmType from the MLIR attribute attr.

This currently supports integer, floating point, splat and dense element attributes and combinations thereof. Also, an array attribute with two elements is supported to represent a complex constant. In case of error, report it to loc and return nullptr.

Definition at line 199 of file ModuleTranslation.cpp.

References buildSequentialConstant(), mlir::Attribute::cast(), mlir::Constant, convertDenseElementsAttr(), mlir::Attribute::dyn_cast(), mlir::emitError(), mlir::Operation::getContext(), getInnermostElementType(), mlir::LLVM::ModuleTranslation::getLLVMContext(), mlir::LLVM::ModuleTranslation::lookupFunction(), and mlir::LLVM::satisfiesLLVMModule().

Referenced by addRuntimePreemptionSpecifier(), convertDenseElementsAttr(), forwardPassthroughAttributes(), and mlir::LLVM::ModuleTranslation::SaveStack< T >::~SaveStack().

◆ getTopologicallySortedBlocks()

SetVector< Block * > mlir::LLVM::detail::getTopologicallySortedBlocks ( Region region)

Get a topologically sorted list of blocks of the given region.

Sort function blocks topologically.

Definition at line 444 of file ModuleTranslation.cpp.

Referenced by convertDataOp(), convertOmpOpRegions(), forwardPassthroughAttributes(), and mlir::LLVM::ModuleTranslation::SaveStack< T >::~SaveStack().

◆ handleMultidimensionalVectors()

LogicalResult mlir::LLVM::detail::handleMultidimensionalVectors ( Operation op,
ValueRange  operands,
LLVMTypeConverter typeConverter,
std::function< Value(Type, ValueRange)>  createOperand,
ConversionPatternRewriter rewriter 
)

◆ nDVectorIterate()

void mlir::LLVM::detail::nDVectorIterate ( const NDVectorTypeInfo info,
OpBuilder builder,
function_ref< void(ArrayAttr)>  fun 
)

◆ oneToOneRewrite()

LogicalResult mlir::LLVM::detail::oneToOneRewrite ( Operation op,
StringRef  targetOp,
ValueRange  operands,
LLVMTypeConverter typeConverter,
ConversionPatternRewriter rewriter 
)

◆ parseType()

Type mlir::LLVM::detail::parseType ( DialectAsmParser parser)

Parses an LLVM dialect type.

Parses one of the LLVM dialect types.

Definition at line 466 of file LLVMTypeSyntax.cpp.

Referenced by eachHasOnlyOneOfTypes(), parseCalibratedType(), and parseStructType().

◆ printType()

void mlir::LLVM::detail::printType ( Type  type,
AsmPrinter printer 
)

Prints an LLVM Dialect type.

Prints the given LLVM dialect type recursively.

This leverages closedness of the LLVM dialect type system to avoid printing the dialect prefix repeatedly. For recursive structures, only prints the name of the structure when printing a self-reference. Note that this does not apply to sibling references. For example, struct<"a", (ptr<struct<"a">>)> struct<"c", (ptr<struct<"b", (ptr<struct<"c">>)>>, ptr<struct<"b", (ptr<struct<"c">>)>>)> note that "b" is printed twice.

Definition at line 135 of file LLVMTypeSyntax.cpp.

Referenced by dispatchPrint(), eachHasOnlyOneOfTypes(), mlir::Block::getSublistAccess(), print(), mlir::AsmPrinter::Impl::printAttribute(), printCalibratedQuantizedType(), mlir::AsmPrinter::Impl::printIntegerSet(), mlir::AsmPrinter::Impl::printType(), and shouldPrintElementsAttrWithHex().

◆ vectorOneToOneRewrite()

LogicalResult mlir::LLVM::detail::vectorOneToOneRewrite ( Operation op,
StringRef  targetOp,
ValueRange  operands,
LLVMTypeConverter typeConverter,
ConversionPatternRewriter rewriter 
)