MLIR  17.0.0git
Functions
LLVMToLLVMIRTranslation.cpp File Reference
#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/MatrixBuilder.h"
#include "llvm/IR/Operator.h"
#include "mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc"
#include "mlir/Dialect/LLVMIR/LLVMConversions.inc"
#include "mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc"
+ Include dependency graph for LLVMToLLVMIRTranslation.cpp:

Go to the source code of this file.

Functions

static llvm::CmpInst::Predicate getLLVMCmpPredicate (ICmpPredicate p)
 Convert MLIR integer comparison predicate to LLVM IR comparison predicate. More...
 
static llvm::CmpInst::Predicate getLLVMCmpPredicate (FCmpPredicate p)
 
static llvm::AtomicRMWInst::BinOp getLLVMAtomicBinOp (AtomicBinOp op)
 
static llvm::AtomicOrdering getLLVMAtomicOrdering (AtomicOrdering ordering)
 
static llvm::FastMathFlags getFastmathFlags (FastmathFlagsInterface &op)
 
static llvm::MDNode * getLoopOptionMetadata (llvm::LLVMContext &ctx, LoopOptionCase option, int64_t value)
 Returns an LLVM metadata node corresponding to a loop option. More...
 
static void setLoopMetadata (Operation &opInst, llvm::Instruction &llvmInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation)
 
static SmallVector< unsigned > extractPosition (ArrayRef< int64_t > indices)
 Convert the value of a DenseI64ArrayAttr to a vector of unsigned indices. More...
 
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. More...
 
static LogicalResult convertCallLLVMIntrinsicOp (CallIntrinsicOp &op, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation)
 Builder for LLVM_CallIntrinsicOp. More...
 
static llvm::MDNode * convertBranchWeights (std::optional< ElementsAttr > weights, LLVM::ModuleTranslation &moduleTranslation)
 Constructs branch weights metadata if the provided weights hold a value, otherwise returns nullptr. More...
 
static LogicalResult convertOperationImpl (Operation &opInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation)
 

Function Documentation

◆ convertBranchWeights()

static llvm::MDNode* convertBranchWeights ( std::optional< ElementsAttr >  weights,
LLVM::ModuleTranslation moduleTranslation 
)
static

Constructs branch weights metadata if the provided weights hold a value, otherwise returns nullptr.

Definition at line 328 of file LLVMToLLVMIRTranslation.cpp.

References mlir::LLVM::ModuleTranslation::getLLVMContext().

Referenced by convertOperationImpl().

◆ convertCallLLVMIntrinsicOp()

static LogicalResult convertCallLLVMIntrinsicOp ( CallIntrinsicOp &  op,
llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation 
)
static

◆ convertOperationImpl()

static LogicalResult convertOperationImpl ( Operation opInst,
llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation 
)
static

◆ extractPosition()

static SmallVector<unsigned> extractPosition ( ArrayRef< int64_t >  indices)
static

Convert the value of a DenseI64ArrayAttr to a vector of unsigned indices.

Definition at line 255 of file LLVMToLLVMIRTranslation.cpp.

◆ getFastmathFlags()

static llvm::FastMathFlags getFastmathFlags ( FastmathFlagsInterface &  op)
static

Definition at line 148 of file LLVMToLLVMIRTranslation.cpp.

References contract().

Referenced by convertOperationImpl().

◆ getLLVMAtomicBinOp()

static llvm::AtomicRMWInst::BinOp getLLVMAtomicBinOp ( AtomicBinOp  op)
static

Definition at line 96 of file LLVMToLLVMIRTranslation.cpp.

References max(), and min().

◆ getLLVMAtomicOrdering()

static llvm::AtomicOrdering getLLVMAtomicOrdering ( AtomicOrdering  ordering)
static

Definition at line 128 of file LLVMToLLVMIRTranslation.cpp.

◆ getLLVMCmpPredicate() [1/2]

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

Definition at line 58 of file LLVMToLLVMIRTranslation.cpp.

◆ getLLVMCmpPredicate() [2/2]

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

Convert MLIR integer comparison predicate to LLVM IR comparison predicate.

Definition at line 32 of file LLVMToLLVMIRTranslation.cpp.

◆ getLoopOptionMetadata()

static llvm::MDNode* getLoopOptionMetadata ( llvm::LLVMContext &  ctx,
LoopOptionCase  option,
int64_t  value 
)
static

Returns an LLVM metadata node corresponding to a loop option.

This metadata is attached to an llvm.loop node.

Definition at line 172 of file LLVMToLLVMIRTranslation.cpp.

Referenced by setLoopMetadata().

◆ getOverloadedDeclaration()

static FailureOr<llvm::Function *> getOverloadedDeclaration ( CallIntrinsicOp &  op,
llvm::Intrinsic::ID  id,
llvm::Module *  module,
LLVM::ModuleTranslation moduleTranslation 
)
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 265 of file LLVMToLLVMIRTranslation.cpp.

References mlir::LLVM::ModuleTranslation::convertType().

Referenced by convertCallLLVMIntrinsicOp().

◆ setLoopMetadata()

static void setLoopMetadata ( Operation opInst,
llvm::Instruction &  llvmInst,
llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation 
)
static