MLIR  15.0.0git
Namespaces | Macros | Functions
ConvertFromLLVMIR.cpp File Reference
#include "mlir/Target/LLVMIR/Import.h"
#include "mlir/Dialect/DLTI/DLTI.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Interfaces/DataLayoutInterfaces.h"
#include "mlir/Target/LLVMIR/TypeFromLLVM.h"
#include "mlir/Tools/mlir-translate/Translation.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/SourceMgr.h"
#include "mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc"
+ Include dependency graph for ConvertFromLLVMIR.cpp:

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define INST(llvm_n, mlir_n)   { llvm::Instruction::llvm_n, LLVM::mlir_n##Op::getOperationName() }
 

Functions

static std::string diag (llvm::Value &v)
 
static DenseIntElementsAttr parseDataLayoutAlignment (MLIRContext &ctx, StringRef spec)
 Creates an attribute containing ABI and preferred alignment numbers parsed a string. More...
 
static FloatType getDLFloatType (MLIRContext &ctx, int32_t bitwidth)
 Returns a supported MLIR floating point type of the given bit width or null if the bit width is not supported. More...
 
static StringRef lookupOperationNameFromOpcode (unsigned opcode)
 Return the MLIR OperationName for the given LLVM opcode. More...
 
static ICmpPredicate getICmpPredicate (llvm::CmpInst::Predicate p)
 
static FCmpPredicate getFCmpPredicate (llvm::CmpInst::Predicate p)
 
static AtomicOrdering getLLVMAtomicOrdering (llvm::AtomicOrdering ordering)
 
OwningOpRef< ModuleOp > translateLLVMIRToModule (llvm::SourceMgr &sourceMgr, MLIRContext *context)
 
void mlir::registerFromLLVMIRTranslation ()
 

Macro Definition Documentation

◆ INST

#define INST (   llvm_n,
  mlir_n 
)    { llvm::Instruction::llvm_n, LLVM::mlir_n##Op::getOperationName() }

Function Documentation

◆ diag()

static std::string diag ( llvm::Value &  v)
static

Definition at line 46 of file ConvertFromLLVMIR.cpp.

Referenced by adjustToDivisorsOfTripCounts(), buildUnresolvedTargetMaterialization(), mlir::linalg::LinalgTransformationFilter::checkAndNotify(), checkDoubleConsume(), mlir::Operation::create(), diagnoseInvalidOperandDominance(), mlir::detail::DiagnosticEngineImpl::emit(), mlir::DiagnosticEngine::emit(), emitDiag(), mlir::Operation::emitError(), mlir::Operation::emitRemark(), mlir::Operation::emitWarning(), mlir::detail::PassCrashReproducerGenerator::finalize(), findLiveUserOfReplaced(), mlir::transform::TransformState::getHandleForPayloadOp(), getInsertExtractValueElementType(), getLLVMAtomicOrdering(), getLspDiagnoticFromDiag(), mlir::scf::getParallelForInductionVarOwner(), legalizeUnresolvedMaterialization(), mlir::pdll::Lexer::Lexer(), mlir::ConversionPattern::matchAndRewrite(), mlir::RewriterBase::notifyMatchFailure(), mlir::detail::ConversionPatternRewriterImpl::notifyMatchFailure(), mlir::detail::Parser::parseCommaSeparatedList(), mlir::parseSourceString(), mlir::DiagnosticEngine::registerHandler(), mlir::detail::ConversionPatternRewriterImpl::remapValues(), mlir::SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler(), mlir::SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(), mlir::SourceMgrDiagnosticVerifierHandler::verify(), mlir::impl::verifyCastInterfaceOp(), mlir::detail::verifyDataLayoutOp(), verifyOpAndAdjustFlags(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), and verifyTypesAlongAllEdges().

◆ getDLFloatType()

static FloatType getDLFloatType ( MLIRContext ctx,
int32_t  bitwidth 
)
static

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

Definition at line 76 of file ConvertFromLLVMIR.cpp.

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

◆ getFCmpPredicate()

static FCmpPredicate getFCmpPredicate ( llvm::CmpInst::Predicate  p)
static

Definition at line 685 of file ConvertFromLLVMIR.cpp.

◆ getICmpPredicate()

static ICmpPredicate getICmpPredicate ( llvm::CmpInst::Predicate  p)
static

Definition at line 657 of file ConvertFromLLVMIR.cpp.

◆ getLLVMAtomicOrdering()

static AtomicOrdering getLLVMAtomicOrdering ( llvm::AtomicOrdering  ordering)
static

◆ lookupOperationNameFromOpcode()

static StringRef lookupOperationNameFromOpcode ( unsigned  opcode)
static

Return the MLIR OperationName for the given LLVM opcode.

Definition at line 577 of file ConvertFromLLVMIR.cpp.

References mlir::Add, INST, and mlir::Mul.

Referenced by getLLVMAtomicOrdering().

◆ parseDataLayoutAlignment()

static DenseIntElementsAttr parseDataLayoutAlignment ( MLIRContext ctx,
StringRef  spec 
)
static

Creates an attribute containing ABI and preferred alignment numbers parsed a string.

The string may be either "abi:preferred" or just "abi". In the latter case, the prefrred alignment is considered equal to ABI alignment.

Definition at line 56 of file ConvertFromLLVMIR.cpp.

References mlir::DenseIntElementsAttr::get().

◆ translateLLVMIRToModule()

OwningOpRef<ModuleOp> translateLLVMIRToModule ( llvm::SourceMgr &  sourceMgr,
MLIRContext context 
)