MLIR  22.0.0git
Public Member Functions | List of all members
mlir::LLVM::ModuleImport Class Reference

Module import implementation class that provides methods to import globals and functions from an LLVM module into an MLIR module. More...

#include "mlir/Target/LLVMIR/ModuleImport.h"

Public Member Functions

 ModuleImport (ModuleOp mlirModule, std::unique_ptr< llvm::Module > llvmModule, bool emitExpensiveWarnings, bool importEmptyDICompositeTypes, bool preferUnregisteredIntrinsics, bool importStructsAsLiterals)
 
LogicalResult initializeImportInterface ()
 Calls the LLVMImportInterface initialization that queries the registered dialect interfaces for the supported LLVM IR intrinsics and metadata kinds and builds the dispatch tables. More...
 
LogicalResult convertFunctions ()
 Converts all functions of the LLVM module to MLIR functions. More...
 
LogicalResult convertComdats ()
 Converts all comdat selectors of the LLVM module to MLIR comdat operations. More...
 
LogicalResult convertGlobals ()
 Converts all global variables of the LLVM module to MLIR global variables. More...
 
LogicalResult convertAliases ()
 Converts all aliases of the LLVM module to MLIR variables. More...
 
LogicalResult convertIFuncs ()
 Converts all ifuncs of the LLVM module to MLIR variables. More...
 
LogicalResult convertDataLayout ()
 Converts the data layout of the LLVM module to an MLIR data layout specification. More...
 
void convertTargetTriple ()
 Converts target triple of the LLVM module to an MLIR target triple specification. More...
 
void convertModuleLevelAsm ()
 Converts the module level asm of the LLVM module to an MLIR module level asm specification. More...
 
void mapValue (llvm::Value *llvm, Value mlir)
 Stores the mapping between an LLVM value and its MLIR counterpart. More...
 
ValuemapValue (llvm::Value *value)
 Provides write-once access to store the MLIR value corresponding to the given LLVM value. More...
 
Value lookupValue (llvm::Value *value)
 Returns the MLIR value mapped to the given LLVM value. More...
 
void mapNoResultOp (llvm::Instruction *llvm, Operation *mlir)
 Stores a mapping between an LLVM instruction and the imported MLIR operation if the operation returns no result. More...
 
Operation *& mapNoResultOp (llvm::Instruction *inst)
 Provides write-once access to store the MLIR operation corresponding to the given LLVM instruction if the operation returns no result. More...
 
OperationlookupOperation (llvm::Instruction *inst)
 Returns the MLIR operation mapped to the given LLVM instruction. More...
 
void mapBlock (llvm::BasicBlock *llvm, Block *mlir)
 Stores the mapping between an LLVM block and its MLIR counterpart. More...
 
BlocklookupBlock (llvm::BasicBlock *block) const
 Returns the MLIR block mapped to the given LLVM block. More...
 
FailureOr< ValueconvertValue (llvm::Value *value)
 Converts an LLVM value to an MLIR value, or returns failure if the conversion fails. More...
 
FailureOr< ValueconvertMetadataValue (llvm::Value *value)
 Converts an LLVM metadata value to an MLIR value, or returns failure if the conversion fails. More...
 
FailureOr< SmallVector< Value > > convertValues (ArrayRef< llvm::Value * > values)
 Converts a range of LLVM values to a range of MLIR values using the convertValue method, or returns failure if the conversion fails. More...
 
IntegerAttr matchIntegerAttr (llvm::Value *value)
 Converts value to an integer attribute. Asserts if the matching fails. More...
 
FloatAttr matchFloatAttr (llvm::Value *value)
 Converts value to a float attribute. Asserts if the matching fails. More...
 
DILocalVariableAttr matchLocalVariableAttr (llvm::Value *value)
 Converts value to a local variable attribute. More...
 
DILabelAttr matchLabelAttr (llvm::Value *value)
 Converts value to a label attribute. Asserts if the matching fails. More...
 
FPExceptionBehaviorAttr matchFPExceptionBehaviorAttr (llvm::Value *value)
 Converts value to a FP exception behavior attribute. More...
 
RoundingModeAttr matchRoundingModeAttr (llvm::Value *value)
 Converts value to a rounding mode attribute. More...
 
FailureOr< SmallVector< AliasScopeAttr > > matchAliasScopeAttrs (llvm::Value *value)
 Converts value to an array of alias scopes or returns failure if the conversion fails. More...
 
Location translateLoc (llvm::DILocation *loc)
 Translates the debug location. More...
 
Type convertType (llvm::Type *type)
 Converts the type from LLVM to MLIR LLVM dialect. More...
 
LogicalResult processFunction (llvm::Function *func)
 Imports func into the current module. More...
 
void processFunctionAttributes (llvm::Function *func, LLVMFuncOp funcOp)
 Converts function attributes of LLVM Function func into LLVM dialect attributes of LLVMFuncOp funcOp. More...
 
void setIntegerOverflowFlags (llvm::Instruction *inst, Operation *op) const
 Sets the integer overflow flags (nsw/nuw) attribute for the imported operation op given the original instruction inst. More...
 
void setExactFlag (llvm::Instruction *inst, Operation *op) const
 Sets the exact flag attribute for the imported operation op given the original instruction inst. More...
 
void setDisjointFlag (llvm::Instruction *inst, Operation *op) const
 Sets the disjoint flag attribute for the imported operation op given the original instruction inst. More...
 
void setNonNegFlag (llvm::Instruction *inst, Operation *op) const
 Sets the nneg flag attribute for the imported operation op given the original instruction inst. More...
 
void setFastmathFlagsAttr (llvm::Instruction *inst, Operation *op) const
 Sets the fastmath flags attribute for the imported operation op given the original instruction inst. More...
 
LogicalResult convertLinkerOptionsMetadata ()
 Converts !llvm.linker.options metadata to the llvm.linker.options LLVM dialect operation. More...
 
LogicalResult convertModuleFlagsMetadata ()
 Converts !llvm.module.flags metadata. More...
 
LogicalResult convertIdentMetadata ()
 Converts !llvm.ident metadata to the llvm.ident LLVM ModuleOp attribute. More...
 
LogicalResult convertCommandlineMetadata ()
 Converts !llvm.commandline metadata to the llvm.commandline LLVM ModuleOp attribute. More...
 
LogicalResult convertDependentLibrariesMetadata ()
 Converts !llvm.dependent-libraries metadata to llvm.dependent_libraries LLVM ModuleOp attribute. More...
 
LogicalResult convertMetadata ()
 Converts all LLVM metadata nodes that translate to attributes such as alias analysis or access group metadata, and builds a map from the metadata nodes to the converted attributes. More...
 
Attribute lookupTBAAAttr (const llvm::MDNode *node) const
 Returns the MLIR attribute mapped to the given LLVM TBAA metadata node. More...
 
FailureOr< SmallVector< AccessGroupAttr > > lookupAccessGroupAttrs (const llvm::MDNode *node) const
 Returns the access group attributes that map to the access group nodes starting from the access group metadata node. More...
 
LoopAnnotationAttr translateLoopAnnotationAttr (const llvm::MDNode *node, Location loc) const
 Returns the loop annotation attribute that corresponds to the given LLVM loop metadata node. More...
 
FailureOr< DereferenceableAttr > translateDereferenceableAttr (const llvm::MDNode *node, unsigned kindID)
 Returns the dereferenceable attribute that corresponds to the given LLVM dereferenceable or dereferenceable_or_null metadata node. More...
 
FailureOr< SmallVector< AliasScopeAttr > > lookupAliasScopeAttrs (const llvm::MDNode *node) const
 Returns the alias scope attributes that map to the alias scope nodes starting from the metadata node. More...
 
void addDebugIntrinsic (llvm::CallInst *intrinsic)
 Adds a debug intrinsics to the list of intrinsics that should be converted after the function conversion has finished. More...
 
LogicalResult convertIntrinsicArguments (ArrayRef< llvm::Value * > values, ArrayRef< llvm::OperandBundleUse > opBundles, bool requiresOpBundles, ArrayRef< unsigned > immArgPositions, ArrayRef< StringLiteral > immArgAttrNames, SmallVectorImpl< Value > &valuesOut, SmallVectorImpl< NamedAttribute > &attrsOut)
 Converts the LLVM values for an intrinsic to mixed MLIR values and attributes for LLVM_IntrOpBase. More...
 
void convertArgAndResultAttrs (llvm::CallBase *call, ArgAndResultAttrsOpInterface attrsOp, ArrayRef< unsigned > immArgPositions={})
 Converts the argument and result attributes attached to call and adds them to attrsOp. More...
 
bool useUnregisteredIntrinsicsOnly () const
 Whether the importer should try to convert all intrinsics to llvm.call_intrinsic instead of dialect supported operations. More...
 

Detailed Description

Module import implementation class that provides methods to import globals and functions from an LLVM module into an MLIR module.

It holds mappings between the original and translated globals, basic blocks, and values used during the translation. Additionally, it keeps track of the current constant insertion point since LLVM immediate values translate to MLIR operations that are introduced at the beginning of the region.

Definition at line 48 of file ModuleImport.h.

Constructor & Destructor Documentation

◆ ModuleImport()

ModuleImport::ModuleImport ( ModuleOp  mlirModule,
std::unique_ptr< llvm::Module >  llvmModule,
bool  emitExpensiveWarnings,
bool  importEmptyDICompositeTypes,
bool  preferUnregisteredIntrinsics,
bool  importStructsAsLiterals 
)

Definition at line 164 of file ModuleImport.cpp.

References mlir::OpBuilder::setInsertionPointToStart().

Member Function Documentation

◆ addDebugIntrinsic()

void ModuleImport::addDebugIntrinsic ( llvm::CallInst *  intrinsic)

Adds a debug intrinsics to the list of intrinsics that should be converted after the function conversion has finished.

Definition at line 521 of file ModuleImport.cpp.

◆ convertAliases()

LogicalResult ModuleImport::convertAliases ( )

Converts all aliases of the LLVM module to MLIR variables.

Definition at line 1026 of file ModuleImport.cpp.

References diag(), mlir::emitError(), mlir::remark::failed(), and mlir::get().

Referenced by mlir::translateLLVMIRToModule().

◆ convertArgAndResultAttrs()

void ModuleImport::convertArgAndResultAttrs ( llvm::CallBase *  call,
ArgAndResultAttrsOpInterface  attrsOp,
ArrayRef< unsigned >  immArgPositions = {} 
)

Converts the argument and result attributes attached to call and adds them to attrsOp.

For intrinsic calls, filters out attributes corresponding to immediate arguments specified by immArgPositions.

Definition at line 2816 of file ModuleImport.cpp.

References mlir::Builder::getArrayAttr(), and mlir::Builder::getDictionaryAttr().

Referenced by processFunction().

◆ convertComdats()

LogicalResult ModuleImport::convertComdats ( )

Converts all comdat selectors of the LLVM module to MLIR comdat operations.

Definition at line 998 of file ModuleImport.cpp.

Referenced by mlir::translateLLVMIRToModule().

◆ convertCommandlineMetadata()

LogicalResult ModuleImport::convertCommandlineMetadata ( )

Converts !llvm.commandline metadata to the llvm.commandline LLVM ModuleOp attribute.

Definition at line 926 of file ModuleImport.cpp.

References mlir::Builder::getStringAttr().

Referenced by convertMetadata().

◆ convertDataLayout()

LogicalResult ModuleImport::convertDataLayout ( )

◆ convertDependentLibrariesMetadata()

LogicalResult ModuleImport::convertDependentLibrariesMetadata ( )

Converts !llvm.dependent-libraries metadata to llvm.dependent_libraries LLVM ModuleOp attribute.

Definition at line 892 of file ModuleImport.cpp.

References mlir::Builder::getStrArrayAttr().

Referenced by convertMetadata().

◆ convertFunctions()

LogicalResult ModuleImport::convertFunctions ( )

Converts all functions of the LLVM module to MLIR functions.

Definition at line 1080 of file ModuleImport.cpp.

References mlir::remark::failed(), and processFunction().

Referenced by mlir::translateLLVMIRToModule().

◆ convertGlobals()

LogicalResult ModuleImport::convertGlobals ( )

Converts all global variables of the LLVM module to MLIR global variables.

Definition at line 1008 of file ModuleImport.cpp.

References diag(), mlir::emitError(), mlir::remark::failed(), mlir::get(), getGlobalCtorsVarName(), and getGlobalDtorsVarName().

Referenced by mlir::translateLLVMIRToModule().

◆ convertIdentMetadata()

LogicalResult ModuleImport::convertIdentMetadata ( )

Converts !llvm.ident metadata to the llvm.ident LLVM ModuleOp attribute.

Definition at line 909 of file ModuleImport.cpp.

References mlir::Builder::getStringAttr().

Referenced by convertMetadata().

◆ convertIFuncs()

LogicalResult ModuleImport::convertIFuncs ( )

Converts all ifuncs of the LLVM module to MLIR variables.

Definition at line 1036 of file ModuleImport.cpp.

References diag(), mlir::emitError(), mlir::remark::failed(), and mlir::get().

Referenced by mlir::translateLLVMIRToModule().

◆ convertIntrinsicArguments()

LogicalResult ModuleImport::convertIntrinsicArguments ( ArrayRef< llvm::Value * >  values,
ArrayRef< llvm::OperandBundleUse >  opBundles,
bool  requiresOpBundles,
ArrayRef< unsigned >  immArgPositions,
ArrayRef< StringLiteral >  immArgAttrNames,
SmallVectorImpl< Value > &  valuesOut,
SmallVectorImpl< NamedAttribute > &  attrsOut 
)

Converts the LLVM values for an intrinsic to mixed MLIR values and attributes for LLVM_IntrOpBase.

Attributes correspond to LLVM immargs. The list immArgPositions contains the positions of immargs on the LLVM intrinsic, and immArgAttrNames list (of the same length) contains the corresponding MLIR attribute names.

Definition at line 1922 of file ModuleImport.cpp.

References convertValue(), mlir::remark::failed(), mlir::detail::DenseArrayAttrImpl< int32_t >::get(), mlir::get(), and getScalarConstantAsAttr().

◆ convertLinkerOptionsMetadata()

LogicalResult ModuleImport::convertLinkerOptionsMetadata ( )

Converts !llvm.linker.options metadata to the llvm.linker.options LLVM dialect operation.

Definition at line 875 of file ModuleImport.cpp.

References mlir::Builder::getStrArrayAttr(), and options.

Referenced by convertMetadata().

◆ convertMetadata()

LogicalResult ModuleImport::convertMetadata ( )

Converts all LLVM metadata nodes that translate to attributes such as alias analysis or access group metadata, and builds a map from the metadata nodes to the converted attributes.

Returns success if all conversions succeed and failure otherwise.

Definition at line 943 of file ModuleImport.cpp.

References convertCommandlineMetadata(), convertDependentLibrariesMetadata(), convertIdentMetadata(), convertLinkerOptionsMetadata(), convertModuleFlagsMetadata(), mlir::remark::failed(), and mlir::OpBuilder::setInsertionPointToEnd().

Referenced by mlir::translateLLVMIRToModule().

◆ convertMetadataValue()

FailureOr< Value > ModuleImport::convertMetadataValue ( llvm::Value *  value)

Converts an LLVM metadata value to an MLIR value, or returns failure if the conversion fails.

Uses the convertConstant method to translate constant LLVM values.

Definition at line 1887 of file ModuleImport.cpp.

◆ convertModuleFlagsMetadata()

LogicalResult ModuleImport::convertModuleFlagsMetadata ( )

◆ convertModuleLevelAsm()

void ModuleImport::convertModuleLevelAsm ( )

Converts the module level asm of the LLVM module to an MLIR module level asm specification.

Definition at line 1068 of file ModuleImport.cpp.

References mlir::Builder::getArrayAttr(), and mlir::Builder::getStringAttr().

Referenced by mlir::translateLLVMIRToModule().

◆ convertTargetTriple()

void ModuleImport::convertTargetTriple ( )

Converts target triple of the LLVM module to an MLIR target triple specification.

Definition at line 1062 of file ModuleImport.cpp.

References mlir::Builder::getStringAttr().

Referenced by mlir::translateLLVMIRToModule().

◆ convertType()

Type mlir::LLVM::ModuleImport::convertType ( llvm::Type *  type)
inline

Converts the type from LLVM to MLIR LLVM dialect.

Definition at line 190 of file ModuleImport.h.

References mlir::LLVM::TypeFromLLVMIRTranslator::translateType().

Referenced by convertVecTypeHint(), and processFunction().

◆ convertValue()

FailureOr< Value > ModuleImport::convertValue ( llvm::Value *  value)

Converts an LLVM value to an MLIR value, or returns failure if the conversion fails.

Uses the convertConstant method to translate constant LLVM values.

Definition at line 1868 of file ModuleImport.cpp.

References diag(), mlir::emitError(), mlir::get(), and translateLoc().

Referenced by convertIntrinsicArguments(), convertValues(), matchFloatAttr(), and matchIntegerAttr().

◆ convertValues()

FailureOr< SmallVector< Value > > ModuleImport::convertValues ( ArrayRef< llvm::Value * >  values)

Converts a range of LLVM values to a range of MLIR values using the convertValue method, or returns failure if the conversion fails.

Definition at line 1910 of file ModuleImport.cpp.

References convertValue(), and mlir::remark::failed().

◆ initializeImportInterface()

LogicalResult mlir::LLVM::ModuleImport::initializeImportInterface ( )
inline

Calls the LLVMImportInterface initialization that queries the registered dialect interfaces for the supported LLVM IR intrinsics and metadata kinds and builds the dispatch tables.

Returns failure if multiple dialect interfaces translate the same LLVM IR intrinsic.

Definition at line 58 of file ModuleImport.h.

References mlir::LLVMImportInterface::initializeImport().

Referenced by mlir::translateLLVMIRToModule().

◆ lookupAccessGroupAttrs()

FailureOr< SmallVector< AccessGroupAttr > > ModuleImport::lookupAccessGroupAttrs ( const llvm::MDNode *  node) const

Returns the access group attributes that map to the access group nodes starting from the access group metadata node.

Returns failure, if any of the attributes cannot be found.

Definition at line 3151 of file ModuleImport.cpp.

◆ lookupAliasScopeAttrs()

FailureOr< SmallVector< AliasScopeAttr > > ModuleImport::lookupAliasScopeAttrs ( const llvm::MDNode *  node) const

Returns the alias scope attributes that map to the alias scope nodes starting from the metadata node.

Returns failure, if any of the attributes cannot be found.

Definition at line 507 of file ModuleImport.cpp.

Referenced by matchAliasScopeAttrs().

◆ lookupBlock()

Block* mlir::LLVM::ModuleImport::lookupBlock ( llvm::BasicBlock *  block) const
inline

Returns the MLIR block mapped to the given LLVM block.

Definition at line 142 of file ModuleImport.h.

Referenced by processFunction().

◆ lookupOperation()

Operation* mlir::LLVM::ModuleImport::lookupOperation ( llvm::Instruction *  inst)
inline

Returns the MLIR operation mapped to the given LLVM instruction.

Queries valueMapping and noResultOpMapping to support operations with and without result.

Definition at line 128 of file ModuleImport.h.

References lookupValue().

◆ lookupTBAAAttr()

Attribute mlir::LLVM::ModuleImport::lookupTBAAAttr ( const llvm::MDNode *  node) const
inline

Returns the MLIR attribute mapped to the given LLVM TBAA metadata node.

Definition at line 252 of file ModuleImport.h.

◆ lookupValue()

Value mlir::LLVM::ModuleImport::lookupValue ( llvm::Value *  value)
inline

Returns the MLIR value mapped to the given LLVM value.

Definition at line 103 of file ModuleImport.h.

Referenced by lookupOperation().

◆ mapBlock()

void mlir::LLVM::ModuleImport::mapBlock ( llvm::BasicBlock *  llvm,
Block mlir 
)
inline

Stores the mapping between an LLVM block and its MLIR counterpart.

Definition at line 135 of file ModuleImport.h.

Referenced by processFunction().

◆ mapNoResultOp() [1/2]

Operation*& mlir::LLVM::ModuleImport::mapNoResultOp ( llvm::Instruction *  inst)
inline

Provides write-once access to store the MLIR operation corresponding to the given LLVM instruction if the operation returns no result.

Asserts if the operation returns a result and should be added to valueMapping instead.

Definition at line 116 of file ModuleImport.h.

◆ mapNoResultOp() [2/2]

void mlir::LLVM::ModuleImport::mapNoResultOp ( llvm::Instruction *  llvm,
Operation mlir 
)
inline

Stores a mapping between an LLVM instruction and the imported MLIR operation if the operation returns no result.

Asserts if the operation returns a result and should be added to valueMapping instead.

Definition at line 108 of file ModuleImport.h.

◆ mapValue() [1/2]

void mlir::LLVM::ModuleImport::mapValue ( llvm::Value *  llvm,
Value  mlir 
)
inline

Stores the mapping between an LLVM value and its MLIR counterpart.

Definition at line 91 of file ModuleImport.h.

References mapValue().

Referenced by mapValue(), and processFunction().

◆ mapValue() [2/2]

Value& mlir::LLVM::ModuleImport::mapValue ( llvm::Value *  value)
inline

Provides write-once access to store the MLIR value corresponding to the given LLVM value.

Definition at line 95 of file ModuleImport.h.

◆ matchAliasScopeAttrs()

FailureOr< SmallVector< AliasScopeAttr > > ModuleImport::matchAliasScopeAttrs ( llvm::Value *  value)

Converts value to an array of alias scopes or returns failure if the conversion fails.

Definition at line 2040 of file ModuleImport.cpp.

References lookupAliasScopeAttrs().

◆ matchFloatAttr()

FloatAttr ModuleImport::matchFloatAttr ( llvm::Value *  value)

Converts value to a float attribute. Asserts if the matching fails.

Definition at line 1996 of file ModuleImport.cpp.

References convertValue(), mlir::m_Constant(), and mlir::matchPattern().

◆ matchFPExceptionBehaviorAttr()

FPExceptionBehaviorAttr ModuleImport::matchFPExceptionBehaviorAttr ( llvm::Value *  value)

Converts value to a FP exception behavior attribute.

Asserts if the matching fails.

Definition at line 2019 of file ModuleImport.cpp.

References mlir::Builder::getAttr().

◆ matchIntegerAttr()

IntegerAttr ModuleImport::matchIntegerAttr ( llvm::Value *  value)

Converts value to an integer attribute. Asserts if the matching fails.

Definition at line 1986 of file ModuleImport.cpp.

References convertValue(), mlir::m_Constant(), and mlir::matchPattern().

◆ matchLabelAttr()

DILabelAttr ModuleImport::matchLabelAttr ( llvm::Value *  value)

Converts value to a label attribute. Asserts if the matching fails.

Definition at line 2012 of file ModuleImport.cpp.

◆ matchLocalVariableAttr()

DILocalVariableAttr ModuleImport::matchLocalVariableAttr ( llvm::Value *  value)

Converts value to a local variable attribute.

Asserts if the matching fails.

Definition at line 2006 of file ModuleImport.cpp.

◆ matchRoundingModeAttr()

RoundingModeAttr ModuleImport::matchRoundingModeAttr ( llvm::Value *  value)

Converts value to a rounding mode attribute.

Asserts if the matching fails.

Definition at line 2029 of file ModuleImport.cpp.

References mlir::Builder::getAttr().

◆ processFunction()

LogicalResult ModuleImport::processFunction ( llvm::Function *  func)

◆ processFunctionAttributes()

void ModuleImport::processFunctionAttributes ( llvm::Function *  func,
LLVMFuncOp  funcOp 
)

Converts function attributes of LLVM Function func into LLVM dialect attributes of LLVMFuncOp funcOp.

Definition at line 2637 of file ModuleImport.cpp.

References mlir::get(), processMemoryEffects(), and processPassthroughAttrs().

Referenced by processFunction().

◆ setDisjointFlag()

void ModuleImport::setDisjointFlag ( llvm::Instruction *  inst,
Operation op 
) const

Sets the disjoint flag attribute for the imported operation op given the original instruction inst.

Asserts if the operation does not implement the disjoint flag interface.

Definition at line 1123 of file ModuleImport.cpp.

◆ setExactFlag()

void ModuleImport::setExactFlag ( llvm::Instruction *  inst,
Operation op 
) const

Sets the exact flag attribute for the imported operation op given the original instruction inst.

Asserts if the operation does not implement the exact flag interface.

Definition at line 1117 of file ModuleImport.cpp.

◆ setFastmathFlagsAttr()

void ModuleImport::setFastmathFlagsAttr ( llvm::Instruction *  inst,
Operation op 
) const

Sets the fastmath flags attribute for the imported operation op given the original instruction inst.

Asserts if the operation does not implement the fastmath interface.

Definition at line 1137 of file ModuleImport.cpp.

References contract(), mlir::get(), and mlir::Builder::getContext().

◆ setIntegerOverflowFlags()

void ModuleImport::setIntegerOverflowFlags ( llvm::Instruction *  inst,
Operation op 
) const

Sets the integer overflow flags (nsw/nuw) attribute for the imported operation op given the original instruction inst.

Asserts if the operation does not implement the integer overflow flag interface.

Definition at line 1105 of file ModuleImport.cpp.

◆ setNonNegFlag()

void ModuleImport::setNonNegFlag ( llvm::Instruction *  inst,
Operation op 
) const

Sets the nneg flag attribute for the imported operation op given the original instruction inst.

Asserts if the operation does not implement the nneg flag interface.

Definition at line 1131 of file ModuleImport.cpp.

◆ translateDereferenceableAttr()

FailureOr< DereferenceableAttr > ModuleImport::translateDereferenceableAttr ( const llvm::MDNode *  node,
unsigned  kindID 
)

Returns the dereferenceable attribute that corresponds to the given LLVM dereferenceable or dereferenceable_or_null metadata node.

kindID specifies the kind of the metadata node (dereferenceable or dereferenceable_or_null).

Definition at line 3162 of file ModuleImport.cpp.

References diagMD(), mlir::emitError(), and mlir::Builder::getAttr().

◆ translateLoc()

Location ModuleImport::translateLoc ( llvm::DILocation *  loc)

Translates the debug location.

Definition at line 2046 of file ModuleImport.cpp.

Referenced by convertValue().

◆ translateLoopAnnotationAttr()

LoopAnnotationAttr ModuleImport::translateLoopAnnotationAttr ( const llvm::MDNode *  node,
Location  loc 
) const

Returns the loop annotation attribute that corresponds to the given LLVM loop metadata node.

Definition at line 3156 of file ModuleImport.cpp.

◆ useUnregisteredIntrinsicsOnly()

bool mlir::LLVM::ModuleImport::useUnregisteredIntrinsicsOnly ( ) const
inline

Whether the importer should try to convert all intrinsics to llvm.call_intrinsic instead of dialect supported operations.

Definition at line 307 of file ModuleImport.h.

Referenced by mlir::LLVMImportInterface::convertIntrinsic().


The documentation for this class was generated from the following files: