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

Classes

struct  NDVectorTypeInfo
 
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...
 
class  DataLayoutImporter
 Helper class that translates an LLVM data layout to an MLIR data layout specification. More...
 
class  DebugImporter
 
class  DebugTranslation
 
class  LoopAnnotationImporter
 A helper class that converts llvm.loop metadata nodes into corresponding LoopAnnotationAttrs and llvm.access.group nodes into AccessGroupAttrs. More...
 
class  LoopAnnotationTranslation
 A helper class that converts LoopAnnotationAttrs and AccessGroupAttrs into corresponding llvm::MDNodes. More...
 
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

void setNativeProperties (Operation *op, IntegerOverflowFlags overflowFlags)
 Handle generically setting flags as native properties on LLVM operations. More...
 
LogicalResult oneToOneRewrite (Operation *op, StringRef targetOp, ValueRange operands, ArrayRef< NamedAttribute > targetAttrs, const LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter, IntegerOverflowFlags overflowFlags=IntegerOverflowFlags::none)
 Replaces the given operation "op" with a new operation of type "targetOp" and given operands. More...
 
NDVectorTypeInfo extractNDVectorTypeInfo (VectorType vectorType, const LLVMTypeConverter &converter)
 
SmallVector< int64_t, 4 > getCoordinates (ArrayRef< int64_t > basis, unsigned linearIndex)
 
void nDVectorIterate (const NDVectorTypeInfo &info, OpBuilder &builder, function_ref< void(ArrayRef< int64_t >)> fun)
 
LogicalResult handleMultidimensionalVectors (Operation *op, ValueRange operands, const LLVMTypeConverter &typeConverter, std::function< Value(Type, ValueRange)> createOperand, ConversionPatternRewriter &rewriter)
 
LogicalResult vectorOneToOneRewrite (Operation *op, StringRef targetOp, ValueRange operands, ArrayRef< NamedAttribute > targetAttrs, const LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter, IntegerOverflowFlags overflowFlags=IntegerOverflowFlags::none)
 
LogicalResult verifyAccessGroupOpInterface (Operation *op)
 Verifies the access groups attribute of memory operations that implement the access group interface. More...
 
LogicalResult verifyAliasAnalysisOpInterface (Operation *op)
 Verifies the alias analysis attributes of memory operations that implement the alias analysis interface. More...
 
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...
 
llvm::Constant * getLLVMConstant (llvm::Type *llvmType, Attribute attr, Location loc, const ModuleTranslation &moduleTranslation)
 Create an LLVM IR constant of llvmType from the MLIR attribute attr. More...
 
llvm::CallInst * 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...
 
llvm::CallInst * createIntrinsicCall (llvm::IRBuilderBase &builder, ModuleTranslation &moduleTranslation, Operation *intrOp, llvm::Intrinsic::ID intrinsic, unsigned numResults, ArrayRef< unsigned > overloadedResults, ArrayRef< unsigned > overloadedOperands, ArrayRef< unsigned > immArgPositions, ArrayRef< StringLiteral > immArgAttrNames)
 Creates a call to a LLVM IR intrinsic defined by LLVM_IntrOpBase. More...
 
static llvm::ArrayRef< std::pair< llvm::Attribute::AttrKind, llvm::StringRef > > getAttrKindToNameMapping ()
 Returns a list of pairs that each hold a mapping from LLVM attribute kinds to their corresponding string name in LLVM IR dialect. More...
 
static llvm::DenseMap< llvm::StringRef, llvm::Attribute::AttrKind > getAttrNameToKindMapping ()
 Returns a dense map from LLVM attribute name to their kind in LLVM IR dialect. More...
 
FloatType getFloatType (MLIRContext *context, unsigned width)
 Returns a supported MLIR floating point type of the given bit width or null if the bit width is not supported. 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 812 of file ModuleTranslation.cpp.

Referenced by convertOmpOpRegions().

◆ createIntrinsicCall() [1/2]

llvm::CallInst * mlir::LLVM::detail::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.

Definition at line 839 of file ModuleTranslation.cpp.

◆ createIntrinsicCall() [2/2]

llvm::CallInst * mlir::LLVM::detail::createIntrinsicCall ( llvm::IRBuilderBase &  builder,
ModuleTranslation moduleTranslation,
Operation intrOp,
llvm::Intrinsic::ID  intrinsic,
unsigned  numResults,
ArrayRef< unsigned >  overloadedResults,
ArrayRef< unsigned >  overloadedOperands,
ArrayRef< unsigned >  immArgPositions,
ArrayRef< StringLiteral >  immArgAttrNames 
)

Creates a call to a LLVM IR intrinsic defined by LLVM_IntrOpBase.

This resolves the overloads, and maps mixed MLIR value and attribute arguments to LLVM values.

Definition at line 848 of file ModuleTranslation.cpp.

References mlir::LLVM::ModuleTranslation::convertType(), mlir::Operation::getAttr(), getLLVMConstant(), mlir::Operation::getLoc(), mlir::Operation::getOperands(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::getType(), and mlir::LLVM::ModuleTranslation::lookupValues().

◆ extractNDVectorTypeInfo()

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

◆ getAttrKindToNameMapping()

static llvm::ArrayRef<std::pair<llvm::Attribute::AttrKind, llvm::StringRef> > mlir::LLVM::detail::getAttrKindToNameMapping ( )
static

Returns a list of pairs that each hold a mapping from LLVM attribute kinds to their corresponding string name in LLVM IR dialect.

Definition at line 22 of file AttrKindDetail.h.

Referenced by getAttrNameToKindMapping().

◆ getAttrNameToKindMapping()

static llvm::DenseMap<llvm::StringRef, llvm::Attribute::AttrKind> mlir::LLVM::detail::getAttrNameToKindMapping ( )
static

Returns a dense map from LLVM attribute name to their kind in LLVM IR dialect.

Definition at line 66 of file AttrKindDetail.h.

References getAttrKindToNameMapping().

◆ 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().

◆ getFloatType()

FloatType mlir::LLVM::detail::getFloatType ( MLIRContext context,
unsigned  width 
)

Returns a supported MLIR floating point type of the given bit width or null if the bit width is not supported.

Definition at line 28 of file DataLayoutImporter.cpp.

References mlir::FloatType::getF128(), mlir::FloatType::getF16(), mlir::FloatType::getF32(), mlir::FloatType::getF64(), and mlir::FloatType::getF80().

Referenced by getScalarConstantAsAttr().

◆ getLLVMConstant()

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

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 548 of file ModuleTranslation.cpp.

References buildSequentialConstant(), convertDenseElementsAttr(), convertDenseResourceElementsAttr(), mlir::emitError(), mlir::get(), getInnermostElementType(), mlir::LLVM::ModuleTranslation::getLLVMContext(), and mlir::LLVM::ModuleTranslation::lookupFunction().

Referenced by convertDenseElementsAttr(), createIntrinsicCall(), and createVL().

◆ handleMultidimensionalVectors()

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

◆ nDVectorIterate()

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

◆ oneToOneRewrite()

LogicalResult mlir::LLVM::detail::oneToOneRewrite ( Operation op,
StringRef  targetOp,
ValueRange  operands,
ArrayRef< NamedAttribute targetAttrs,
const LLVMTypeConverter typeConverter,
ConversionPatternRewriter rewriter,
IntegerOverflowFlags  overflowFlags = IntegerOverflowFlags::none 
)

◆ parseType()

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

Parses an LLVM dialect type.

Parses one of the LLVM dialect types.

Definition at line 335 of file LLVMTypeSyntax.cpp.

◆ 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 98 of file LLVMTypeSyntax.cpp.

Referenced by dispatchPrint().

◆ setNativeProperties()

void mlir::LLVM::detail::setNativeProperties ( Operation op,
IntegerOverflowFlags  overflowFlags 
)

Handle generically setting flags as native properties on LLVM operations.

Definition at line 330 of file Pattern.cpp.

Referenced by oneToOneRewrite(), and vectorOneToOneRewrite().

◆ vectorOneToOneRewrite()

LogicalResult mlir::LLVM::detail::vectorOneToOneRewrite ( Operation op,
StringRef  targetOp,
ValueRange  operands,
ArrayRef< NamedAttribute targetAttrs,
const LLVMTypeConverter typeConverter,
ConversionPatternRewriter rewriter,
IntegerOverflowFlags  overflowFlags = IntegerOverflowFlags::none 
)

◆ verifyAccessGroupOpInterface()

LogicalResult mlir::LLVM::detail::verifyAccessGroupOpInterface ( Operation op)

Verifies the access groups attribute of memory operations that implement the access group interface.

Definition at line 33 of file LLVMInterfaces.cpp.

◆ verifyAliasAnalysisOpInterface()

LogicalResult mlir::LLVM::detail::verifyAliasAnalysisOpInterface ( Operation op)

Verifies the alias analysis attributes of memory operations that implement the alias analysis interface.

Definition at line 47 of file LLVMInterfaces.cpp.