|
MLIR 24.0.0git
|
#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"#include "mlir/Dialect/LLVMIR/LLVMDialect.h"#include "mlir/IR/Operation.h"#include "mlir/Interfaces/CallInterfaces.h"#include "mlir/Support/LLVM.h"#include "mlir/Target/LLVMIR/ModuleTranslation.h"#include "llvm/ADT/TypeSwitch.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DIBuilder.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InlineAsm.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/MatrixBuilder.h"#include "llvm/IR/MemoryModelRelaxationAnnotations.h"#include "llvm/Support/LogicalResult.h"#include "mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc"#include "mlir/Dialect/LLVMIR/LLVMConversions.inc"#include "mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc"Go to the source code of this file.
Functions | |
| static llvm::FastMathFlags | getFastmathFlags (FastmathFlagsInterface &op) |
| static SmallVector< unsigned > | extractPosition (ArrayRef< int64_t > indices) |
| Convert the value of a DenseI64ArrayAttr to a vector of unsigned indices. | |
| static std::string | diagStr (const llvm::Type *type) |
| Convert an LLVM type to a string for printing in diagnostics. | |
| static FailureOr< llvm::Function * > | getOverloadedDeclaration (CallIntrinsicOp op, llvm::Intrinsic::ID id, llvm::Module *module, LLVM::ModuleTranslation &moduleTranslation) |
| Get the declaration of an overloaded llvm intrinsic. | |
| static llvm::OperandBundleDef | convertOperandBundle (OperandRange bundleOperands, StringRef bundleTag, LLVM::ModuleTranslation &moduleTranslation) |
| static SmallVector< llvm::OperandBundleDef > | convertOperandBundles (OperandRangeRange bundleOperands, ArrayAttr bundleTags, LLVM::ModuleTranslation &moduleTranslation) |
| static SmallVector< llvm::OperandBundleDef > | convertOperandBundles (OperandRangeRange bundleOperands, std::optional< ArrayAttr > bundleTags, LLVM::ModuleTranslation &moduleTranslation) |
| static LogicalResult | convertCallLLVMIntrinsicOp (CallIntrinsicOp op, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| Builder for LLVM_CallIntrinsicOp. | |
| static LogicalResult | convertNamedMetadataOp (NamedMetadataOp op, LLVM::ModuleTranslation &moduleTranslation) |
| static LogicalResult | convertGEPOp (GEPOp op, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| Translate llvm.getelementptr. | |
| static void | convertLinkerOptionsOp (ArrayAttr options, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| static llvm::Metadata * | convertModuleFlagValue (StringRef key, ArrayAttr arrayAttr, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| static llvm::Metadata * | convertModuleFlagProfileSummaryAttr (StringRef key, ModuleFlagProfileSummaryAttr summaryAttr, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| static void | convertModuleFlagsOp (ArrayAttr flags, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| static std::pair< llvm::GlobalValue *, llvm::FunctionType * > | lookupNonFunctionSymbolCallee (FlatSymbolRefAttr attr, mlir::Type calleeFuncType, Operation &opInst, LLVM::ModuleTranslation &moduleTranslation) |
| Looks up the GlobalValue and FunctionType for a callee symbol that is not a regular LLVM function (i.e. | |
| static llvm::DILocalScope * | getLocalScopeFromLoc (llvm::IRBuilderBase &builder, Location loc, LLVM::ModuleTranslation &moduleTranslation) |
| static LogicalResult | convertOperationImpl (Operation &opInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) |
| static LogicalResult | amendOperationImpl (Operation &op, ArrayRef< llvm::Instruction * > instructions, NamedAttribute attribute, LLVM::ModuleTranslation &moduleTranslation) |
| 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. | |
|
static |
Definition at line 922 of file LLVMToLLVMIRTranslation.cpp.
References mlir::Operation::emitOpError(), mlir::LLVM::ModuleTranslation::getLLVMContext(), mlir::NamedAttribute::getName(), mlir::NamedAttribute::getValue(), and success().
|
static |
Builder for LLVM_CallIntrinsicOp.
Definition at line 143 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::convertArgAndResultAttrs(), convertOperandBundles(), mlir::LLVM::ModuleTranslation::convertType(), diagStr(), mlir::emitError(), getFastmathFlags(), getOverloadedDeclaration(), mlir::LLVM::ModuleTranslation::lookupValues(), mlir::LLVM::ModuleTranslation::mapValue(), and success().
|
static |
Translate llvm.getelementptr.
inrange is only representable on LLVM constant GEP expressions.
Definition at line 242 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::convertType(), mlir::LLVM::ModuleTranslation::getLLVMModule(), indices, mlir::LLVM::ModuleTranslation::lookupValue(), mlir::LLVM::ModuleTranslation::mapValue(), and success().
|
static |
Definition at line 296 of file LLVMToLLVMIRTranslation.cpp.
References ArrayAttr(), mlir::LLVM::ModuleTranslation::getLLVMModule(), and options.
|
static |
Definition at line 355 of file LLVMToLLVMIRTranslation.cpp.
Referenced by convertModuleFlagsOp().
|
static |
Definition at line 417 of file LLVMToLLVMIRTranslation.cpp.
References ArrayAttr(), convertIntegerAttr(), convertModuleFlagProfileSummaryAttr(), convertModuleFlagValue(), and mlir::LLVM::ModuleTranslation::getLLVMModule().
|
static |
Definition at line 315 of file LLVMToLLVMIRTranslation.cpp.
References ArrayAttr(), and mlir::LLVM::ModuleTranslation::lookupFunction().
Referenced by convertModuleFlagsOp().
|
static |
Definition at line 217 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::convertMetadataAttr(), mlir::LLVM::ModuleTranslation::getLLVMModule(), and success().
|
static |
Definition at line 110 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::lookupValue().
Referenced by convertOperandBundles().
|
static |
Definition at line 120 of file LLVMToLLVMIRTranslation.cpp.
References ArrayAttr(), and convertOperandBundle().
Referenced by convertCallLLVMIntrinsicOp(), convertOperandBundles(), and convertOperationImpl().
|
static |
Definition at line 133 of file LLVMToLLVMIRTranslation.cpp.
References convertOperandBundles().
|
static |
Definition at line 489 of file LLVMToLLVMIRTranslation.cpp.
References ArrayAttr(), b, mlir::LLVM::ModuleTranslation::convertAllocsizeAttr(), mlir::LLVM::ModuleTranslation::convertArgAndResultAttrs(), mlir::LLVM::ModuleTranslation::convertDefaultFuncAttr(), mlir::LLVM::ModuleTranslation::convertFunctionAttrCollection(), mlir::LLVM::ModuleTranslation::convertNoBuiltin(), convertOperandBundles(), mlir::LLVM::ModuleTranslation::convertType(), mlir::FlatSymbolRefAttr::get(), mlir::LLVM::ModuleTranslation::getContext(), getFastmathFlags(), mlir::LLVM::ModuleTranslation::getLLVMContext(), mlir::LLVM::ModuleTranslation::getLLVMModule(), mlir::Operation::getNumResults(), mlir::Operation::getResult(), mlir::LLVM::ModuleTranslation::lookupAlias(), mlir::LLVM::ModuleTranslation::lookupBlock(), mlir::LLVM::ModuleTranslation::lookupBlockAddress(), mlir::LLVM::ModuleTranslation::lookupFunction(), mlir::LLVM::ModuleTranslation::lookupGlobal(), mlir::LLVM::ModuleTranslation::lookupIFunc(), lookupNonFunctionSymbolCallee(), mlir::LLVM::ModuleTranslation::lookupValue(), mlir::LLVM::ModuleTranslation::lookupValues(), mlir::LLVM::ModuleTranslation::mapBlockAddress(), mlir::LLVM::ModuleTranslation::mapBranch(), mlir::LLVM::ModuleTranslation::mapCall(), mlir::LLVM::ModuleTranslation::mapUnresolvedBlockAddress(), mlir::LLVM::ModuleTranslation::mapValue(), result, mlir::LLVM::ModuleTranslation::setAccessGroupsMetadata(), mlir::LLVM::ModuleTranslation::setAliasScopeMetadata(), mlir::LLVM::ModuleTranslation::setLoopMetadata(), mlir::LLVM::ModuleTranslation::setTBAAMetadata(), success(), and mlir::LLVM::ModuleTranslation::symbolTable().
|
static |
Convert an LLVM type to a string for printing in diagnostics.
Definition at line 70 of file LLVMToLLVMIRTranslation.cpp.
Referenced by convertCallLLVMIntrinsicOp(), and getOverloadedDeclaration().
|
static |
Convert the value of a DenseI64ArrayAttr to a vector of unsigned indices.
Definition at line 63 of file LLVMToLLVMIRTranslation.cpp.
References indices.
|
static |
Definition at line 40 of file LLVMToLLVMIRTranslation.cpp.
Referenced by convertCallLLVMIntrinsicOp(), and convertOperationImpl().
| 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 588 of file ModuleTranslation.cpp.
|
static |
Definition at line 478 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LocationAttr::findInstanceOf(), and mlir::LLVM::ModuleTranslation::translateDebugInfo().
|
static |
Get the declaration of an overloaded llvm intrinsic.
First we get the overloaded argument types and/or result type from the CallIntrinsicOp, and then use those to get the correct declaration of the overloaded intrinsic.
Definition at line 81 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::convertType(), diagStr(), and mlir::emitError().
Referenced by convertCallLLVMIntrinsicOp().
|
static |
Looks up the GlobalValue and FunctionType for a callee symbol that is not a regular LLVM function (i.e.
an alias or ifunc). Returns the lowered GlobalValue and FunctionType derived from calleeFuncType.
Definition at line 461 of file LLVMToLLVMIRTranslation.cpp.
References mlir::LLVM::ModuleTranslation::convertType(), mlir::LLVM::ModuleTranslation::lookupAlias(), mlir::LLVM::ModuleTranslation::lookupIFunc(), mlir::SymbolTableCollection::lookupSymbolIn(), mlir::LLVM::parentLLVMModule(), and mlir::LLVM::ModuleTranslation::symbolTable().
Referenced by convertOperationImpl().