MLIR
19.0.0git
|
#include "mlir/Target/LLVMIR/ModuleImport.h"
#include "mlir/Target/LLVMIR/Import.h"
#include "AttrKindDetail.h"
#include "DataLayoutImporter.h"
#include "DebugImporter.h"
#include "LoopAnnotationImporter.h"
#include "mlir/Dialect/DLTI/DLTI.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Interfaces/DataLayoutInterfaces.h"
#include "mlir/Tools/mlir-translate/Translation.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/ModRef.h"
#include "mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc"
#include "mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc"
Go to the source code of this file.
Functions | |
static std::string | diag (const llvm::Value &value) |
static std::string | diagMD (const llvm::Metadata *node, const llvm::Module *module) |
static constexpr StringRef | getGlobalCtorsVarName () |
Returns the name of the global_ctors global variables. More... | |
static constexpr StringRef | getGlobalDtorsVarName () |
Returns the name of the global_dtors global variables. More... | |
static constexpr StringRef | getGlobalComdatOpName () |
Returns the symbol name for the module-level comdat operation. More... | |
static StringRef | getLLVMSyncScope (llvm::Instruction *inst) |
Converts the sync scope identifier of inst to the string representation necessary to build an atomic LLVM dialect operation. More... | |
static SmallVector< int64_t > | getPositionFromIndices (ArrayRef< unsigned > indices) |
Converts an array of unsigned indices to a signed integer position array. More... | |
static LogicalResult | convertInstructionImpl (OpBuilder &odsBuilder, llvm::Instruction *inst, ModuleImport &moduleImport) |
Converts the LLVM instructions that have a generated MLIR builder. More... | |
static SetVector< llvm::BasicBlock * > | getTopologicallySortedBlocks (ArrayRef< llvm::BasicBlock * > basicBlocks) |
Get a topologically sorted list of blocks for the given basic blocks. More... | |
static bool | isScalarType (Type type) |
Returns if type is a scalar integer or floating-point type. More... | |
static Type | getVectorTypeForAttr (Type type, ArrayRef< int64_t > arrayShape={}) |
Returns type if it is a builtin integer or floating-point vector type that can be used to create an attribute or nullptr otherwise. More... | |
static TypedAttr | getScalarConstantAsAttr (OpBuilder &builder, llvm::Constant *constScalar) |
Returns an integer or float attribute for the provided scalar constant constScalar or nullptr if the conversion fails. More... | |
static SmallVector< Attribute > | getSequenceConstantAsAttrs (OpBuilder &builder, llvm::ConstantDataSequential *constSequence) |
Returns an integer or float attribute array for the provided constant sequence constSequence or nullptr if the conversion fails. More... | |
static void | processMemoryEffects (llvm::Function *func, LLVMFuncOp funcOp) |
static void | processPassthroughAttrs (llvm::Function *func, LLVMFuncOp funcOp) |
static bool | isMetadataKillLocation (llvm::DbgVariableIntrinsic *dbgIntr) |
Checks if dbgIntr is a kill location that holds metadata instead of an SSA value. More... | |
Variables | |
static constexpr std::array | ExplicitAttributes |
|
static |
Converts the LLVM instructions that have a generated MLIR builder.
Using a static implementation method called from the module import ensures the builders have to use the moduleImport
argument and cannot directly call import methods. As a result, both the intrinsic and the instruction MLIR builders have to use the moduleImport
argument and none of them has direct access to the private module import methods.
Definition at line 124 of file ModuleImport.cpp.
References mlir::failure().
|
static |
Definition at line 53 of file ModuleImport.cpp.
Referenced by mlir::transform::gpu::alterGpuLaunch(), mlir::transform::detail::checkApplyToOne(), checkDoubleConsume(), checkMappingSpec(), mlir::transform::detail::checkNestedConsumption(), checkRepeatedConsumptionInOperand(), cloneAndFuseFirstUse(), mlir::lsp::MLIRServer::convertFromBytecode(), mlir::LLVM::ModuleImport::convertGlobals(), mlir::LLVM::ModuleImport::convertValue(), mlir::transform::gpu::createGpuLaunch(), mlir::DiagnosticEngine::emit(), mlir::detail::DiagnosticEngineImpl::emit(), emitDiag(), mlir::SourceMgrDiagnosticHandler::emitDiagnostic(), mlir::detail::ParallelDiagnosticHandlerImpl::emitDiagnostics(), mlir::Operation::emitError(), mlir::detail::Parser::emitError(), mlir::Operation::emitRemark(), mlir::Operation::emitWarning(), ensurePayloadIsSeparateFromTransform(), mlir::detail::PassCrashReproducerGenerator::finalize(), findTopLevelTransform(), getLspDiagnoticFromDiag(), getThreadIdBuilder(), mlir::transform::detail::interpreterBaseRunOnOperationImpl(), mlir::pdll::Lexer::Lexer(), mlir::transform::gpu::mapForallToBlocksImpl(), mlir::transform::gpu::mapNestedForallToThreadsImpl(), mlir::transform::gpu::mapOneForallToThreadsImpl(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::RewriterBase::notifyMatchFailure(), mlir::transform::TrackingListener::notifyMatchFailure(), mlir::detail::ConversionPatternRewriterImpl::notifyMatchFailure(), mlir::operator<<(), mlir::detail::ParallelDiagnosticHandlerImpl::ParallelDiagnosticHandlerImpl(), mlir::tracing::FileLineColLocBreakpoint::parseFromString(), mlir::detail::ParallelDiagnosticHandlerImpl::print(), printRegionEdgeName(), mlir::BytecodeReader::Impl::read(), mlir::DiagnosticEngine::registerHandler(), mlir::detail::ConversionPatternRewriterImpl::remapValues(), mlir::transform::TransformResults::setMappedValues(), mlir::DiagnosedSilenceableFailure::silenceableFailure(), mlir::SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler(), mlir::SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), mlir::lsp::toJSON(), mlir::irdl::RegionConstraint::verify(), and mlir::detail::ParallelDiagnosticHandlerImpl::~ParallelDiagnosticHandlerImpl().
|
static |
Definition at line 63 of file ModuleImport.cpp.
|
staticconstexpr |
Returns the symbol name for the module-level comdat operation.
It must not conflict with the user namespace.
Definition at line 83 of file ModuleImport.cpp.
|
staticconstexpr |
Returns the name of the global_ctors global variables.
Definition at line 72 of file ModuleImport.cpp.
Referenced by mlir::LLVM::ModuleImport::convertGlobals().
|
staticconstexpr |
Returns the name of the global_dtors global variables.
Definition at line 77 of file ModuleImport.cpp.
Referenced by mlir::LLVM::ModuleImport::convertGlobals().
|
static |
Converts the sync scope identifier of inst
to the string representation necessary to build an atomic LLVM dialect operation.
Returns the empty string if the operation has either no sync scope or the default system-level sync scope attached. The atomic operations only set their sync scope attribute if they have a non-default sync scope attached.
Definition at line 92 of file ModuleImport.cpp.
|
static |
Converts an array of unsigned indices to a signed integer position array.
Definition at line 112 of file ModuleImport.cpp.
|
static |
Returns an integer or float attribute for the provided scalar constant constScalar
or nullptr if the conversion fails.
Definition at line 716 of file ModuleImport.cpp.
References mlir::emitError(), mlir::get(), mlir::FloatType::getBF16(), mlir::Builder::getContext(), mlir::Builder::getFloatAttr(), mlir::LLVM::detail::getFloatType(), and mlir::Builder::getIntegerAttr().
Referenced by mlir::LLVM::ModuleImport::convertIntrinsicArguments(), and getSequenceConstantAsAttrs().
|
static |
Returns an integer or float attribute array for the provided constant sequence constSequence
or nullptr if the conversion fails.
Definition at line 747 of file ModuleImport.cpp.
References getScalarConstantAsAttr().
|
static |
Get a topologically sorted list of blocks for the given basic blocks.
Definition at line 138 of file ModuleImport.cpp.
Referenced by dominanceSort().
Returns type
if it is a builtin integer or floating-point vector type that can be used to create an attribute or nullptr otherwise.
If provided, arrayShape
is added to the shape of the vector to create an attribute that matches an array of vectors.
Definition at line 669 of file ModuleImport.cpp.
|
static |
Checks if dbgIntr
is a kill location that holds metadata instead of an SSA value.
Definition at line 1962 of file ModuleImport.cpp.
|
static |
Returns if type
is a scalar integer or floating-point type.
Definition at line 661 of file ModuleImport.cpp.
|
static |
Definition at line 1641 of file ModuleImport.cpp.
References mlir::get().
Referenced by mlir::LLVM::ModuleImport::processFunctionAttributes().
|
static |
Definition at line 1679 of file ModuleImport.cpp.
References mlir::emitWarning(), ExplicitAttributes, and mlir::get().
Referenced by mlir::LLVM::ModuleImport::processFunctionAttributes().
|
staticconstexpr |
Definition at line 1660 of file ModuleImport.cpp.
Referenced by processPassthroughAttrs().