clang 24.0.0git
cir::direct Namespace Reference

Classes

class  CIRAttrToValue
class  CIRDialectLLVMIRTranslationInterface
 Implementation of the dialect interface that converts CIR attributes to LLVM IR metadata. More...
struct  ConvertCIRToLLVMPass
class  FunctionMetadataLowering
class  GlobalInitAttrRewriter
struct  LLVMAnnotationGlobals
 Annotation strings and arguments, shared by all annotations in a module. More...
struct  LLVMBlockAddressInfo
class  LLVMMetadataNodeBuilder
struct  LoweredCallAttributes

Functions

std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, llvm::LLVMContext &llvmCtx, bool enableOpenMP, llvm::StringRef mlirSaveTempsOutFile={}, llvm::vfs::FileSystem *fs=nullptr, bool enableOptimizations=false)
 Lowers mlirModule, a CIR module, to an LLVM module in llvmCtx.
std::unique_ptr< mlir::Pass > createConvertCIRToLLVMPass ()
 Create a pass that fully lowers CIR to the LLVMIR dialect.
void populateCIRToLLVMPasses (mlir::OpPassManager &pm, bool enableOpenMP, bool enableOptimizations=false)
 Adds passes that fully lower CIR to the LLVMIR dialect.
static mlir::InFlightDiagnostic emitTypeConversionError (mlir::Operation *op, mlir::Type type)
static mlir::InFlightDiagnostic emitTypeConversionError (mlir::Location loc, mlir::Type type)
static uint64_t getMemoryFallbackAlignment (mlir::Operation *op, mlir::Type cirType, mlir::Type llvmMemType, const mlir::DataLayout &dataLayout)
 Alignment to use for a memory access whose op carries no explicit alignment.
static mlir::Value createIntCast (mlir::OpBuilder &bld, mlir::Value src, mlir::IntegerType dstTy, bool isSigned=false)
static mlir::Value castBitIntMemoryStorage (mlir::ConversionPatternRewriter &rewriter, const mlir::DataLayout &dataLayout, cir::IntType intTy, mlir::Value value, bool toMemory)
 Cast a _BitInt(N) value between its literal width iN and its padded in-memory storage iM (sign/zero-extend to memory per signedness so the padding bits are well-defined, truncate back on load; matches classic CodeGen).
static mlir::LLVM::Visibility lowerCIRVisibilityToLLVMVisibility (cir::VisibilityKind visibilityKind)
static mlir::Value emitBoolVecConversion (mlir::ConversionPatternRewriter &rewriter, mlir::Value srcVec, unsigned numElementsDst)
static mlir::Value emitFromMemory (mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter &converter, mlir::DataLayout const &dataLayout, cir::LoadOp op, mlir::Value value)
 Emits the value from memory as expected by its users.
static mlir::Value emitToMemory (mlir::ConversionPatternRewriter &rewriter, mlir::DataLayout const &dataLayout, mlir::Type origType, mlir::Value value)
 Emits a value to memory with the expected scalar type.
mlir::LLVM::Linkage convertLinkage (cir::GlobalLinkageKind linkage)
static mlir::LLVM::CConv convertCallingConv (cir::CallingConv callingConv)
static mlir::LLVM::uwtable::UWTableKind convertUWTableKind (cir::UnwindTableKind kind)
static mlir::LLVM::framePointerKind::FramePointerKind convertFramePointerKind (cir::FramePointerKind kind)
static llvm::FramePointerKind convertFramePointerKindToLLVMIR (cir::FramePointerKind kind)
 The "frame-pointer" module flag holds an llvm::FramePointerKind value, as written by llvm::Module::setFramePointer.
template<typename CIROp, typename LLVMOp>
static mlir::LogicalResult lowerMemTransferOp (CIROp op, typename CIROp::Adaptor adaptor, mlir::ConversionPatternRewriter &rewriter)
static mlir::Value getLLVMIntCast (mlir::ConversionPatternRewriter &rewriter, mlir::Value llvmSrc, mlir::Type llvmDstIntTy, bool isUnsigned, uint64_t cirSrcWidth, uint64_t cirDstIntWidth)
mlir::Value lowerCirAttrAsValue (mlir::Location parentLoc, mlir::ModuleOp parentModule, const mlir::Attribute attr, mlir::ConversionPatternRewriter &rewriter, mlir::SymbolTableCollection &symbolTables, const mlir::TypeConverter *converter, const CIRPreConversionTypeMap &preConversionTypes, LLVMBlockAddressInfo *blockInfoAddr)
 Switches on the type of attribute and calls the appropriate conversion.
static mlir::LLVM::ModRefInfo convertModRefInfo (cir::ModRefInfo info)
static mlir::LLVM::MemoryEffectsAttr convertMemoryEffects (mlir::MLIRContext *ctx, cir::MemoryEffectsAttr effects)
 A null input stays null, which is how both dialects spell unknown effects.
static void convertCallEffects (mlir::Operation *callOp, bool isNothrow, cir::MemoryEffectsAttr effects, mlir::LLVM::MemoryEffectsAttr &memoryEffect, bool &noUnwind, bool &willReturn, bool &noReturn)
static mlir::LLVM::CallIntrinsicOp createCallLLVMIntrinsicOp (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, const llvm::Twine &intrinsicName, mlir::Type resultTy, mlir::ValueRange operands, mlir::LLVM::FastmathFlags fastmathFlags={})
static mlir::LLVM::CallIntrinsicOp replaceOpWithCallLLVMIntrinsicOp (mlir::ConversionPatternRewriter &rewriter, mlir::Operation *op, const llvm::Twine &intrinsicName, mlir::Type resultTy, mlir::ValueRange operands, mlir::LLVM::FastmathFlags fastmathFlags={})
static llvm::StringRef getConstrainedRoundingMetadata (cir::FenvAttr fenv)
static llvm::StringRef getConstrainedExceptMetadata (cir::FenvAttr fenv)
static mlir::Value createFenvMetadataValue (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, llvm::StringRef str)
mlir::LogicalResult lowerToConstrainedFPIntrinsic (mlir::Operation *op, mlir::ValueRange operands, cir::FenvAttr fenv, mlir::Type llvmResTy, mlir::ConversionPatternRewriter &rewriter, llvm::StringRef constrainedMnemonic, bool hasRoundingMode, mlir::LLVM::FastmathFlags fastmathFlags)
static mlir::LLVM::FastmathFlags convertFastMathFlags (cir::FastMathFlags cirFlags)
static mlir::Value createConstrainedFPIntrinsicCall (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::ValueRange operands, mlir::Type llvmResTy, cir::FenvAttr fenv, llvm::StringRef constrainedMnemonic, bool hasRoundingMode, mlir::LLVM::FastmathFlags fastmathFlags={})
template<typename LLVMOp>
mlir::LogicalResult lowerFPOp (mlir::Operation *op, mlir::ValueRange operands, cir::FastMathFlagsAttr fastmath, const mlir::TypeConverter &typeConverter, mlir::ConversionPatternRewriter &rewriter)
template<typename LLVMOp>
mlir::LogicalResult lowerConstrainableFPOp (mlir::Operation *op, mlir::ValueRange operands, cir::FenvAttr fenv, cir::FastMathFlagsAttr fastmath, const mlir::TypeConverter &typeConverter, mlir::ConversionPatternRewriter &rewriter, llvm::StringRef constrainedMnemonic, bool hasRoundingMode)
mlir::LLVM::FastmathFlagsAttr convertToLLVMProperty (mlir::MLIRContext *ctx, std::optional< cir::FastMathFlags > flags)
mlir::IntegerAttr convertToLLVMProperty (mlir::MLIRContext *ctx, cir::FPClassTest flags)
mlir::IntegerAttr convertToLLVMProperty (mlir::MLIRContext *ctx, bool flag)
static mlir::LLVM::AtomicOrdering getLLVMMemOrder (std::optional< cir::MemOrder > memorder)
static llvm::AtomicScope getAtomicScope (cir::SyncScopeKind syncScope)
static llvm::StringRef getLLVMSyncScope (cir::SyncScopeKind syncScope, mlir::ModuleOp moduleOp)
static std::optional< llvm::StringRef > getLLVMSyncScope (std::optional< cir::SyncScopeKind > syncScope, mlir::ModuleOp moduleOp)
static void forwardAMDGPUNoPrivateAddrSpace (mlir::Operation *op, mlir::Operation *llvmOp, mlir::Value llvmPtr)
static void forwardAMDGPUAtomicOptionMarkers (mlir::Operation *op, mlir::Operation *llvmOp)
static mlir::LLVM::AtomicBinOp getLLVMAtomicBinOp (cir::AtomicFetchKind k, bool isInt, bool isSignedInt)
static llvm::StringLiteral getLLVMBinopForPostAtomic (cir::AtomicFetchKind k, bool isInt)
static mlir::Value convertToIndexTy (mlir::ConversionPatternRewriter &rewriter, mlir::ModuleOp mod, mlir::Value index, mlir::Type baseTy, cir::IntType strideTy)
static std::optional< mlir::ArrayAttr > convertTypedArgAttrs (mlir::ArrayAttr argAttrs, const mlir::TypeConverter &converter, const mlir::DataLayout &dataLayout, mlir::MLIRContext *ctx)
 The llvm.byval, llvm.sret, and llvm.byref argument attributes carry the pointee type as a TypeAttr.
static mlir::LogicalResult lowerCallAttributes (cir::CIRCallOpInterface op, const mlir::TypeConverter &converter, const mlir::DataLayout &dataLayout, LoweredCallAttributes &result)
template<typename CallLikeOp>
static void setLoweredCallAttributes (CallLikeOp op, const LoweredCallAttributes &attributes)
static mlir::LogicalResult rewriteCallOrInvoke (mlir::Operation *op, mlir::ValueRange callOperands, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter, const mlir::DataLayout &dataLayout, mlir::SymbolTableCollection &symbolTables, mlir::FlatSymbolRefAttr calleeAttr, mlir::Block *continueBlock=nullptr, mlir::Block *landingPadBlock=nullptr)
static mlir::Type getConstArrayBaseElementType (mlir::Type ty)
static bool isBulkLowerableConstArrayBaseElement (mlir::Type baseElemTy)
static uint64_t getTypeAllocSize (mlir::Type type, mlir::Operation &op)
static bool isHandledDiscardableFuncAttr (mlir::NamedAttribute attr)
 Return true for discardable CIR markers handled explicitly below.
static mlir::LLVM::ThreadLocalMode convertTlsModelAttrToLLVM (TLSModelAttr attr)
static mlir::LLVM::GlobalOp replaceCirGlobal (mlir::SymbolTableCollection &symbolTables, cir::GlobalOp op, mlir::Type llvmType, bool isConst, mlir::LLVM::Linkage linkage, llvm::StringRef symbol, mlir::Attribute init, uint64_t alignment, unsigned addrSpace, bool isDsoLocal, mlir::LLVM::ThreadLocalMode threadLocalMode, mlir::SymbolRefAttr comdatAttr, llvm::ArrayRef< mlir::NamedAttribute > attributes, mlir::ConversionPatternRewriter &rewriter)
static mlir::SymbolRefAttr getComdatAttrHelper (mlir::ModuleOp modOp, mlir::OpBuilder &builder, StringRef symName, mlir::LLVM::ComdatOp &comdatOp, mlir::SymbolTableCollection &symbolTables)
static mlir::LLVM::IntegerOverflowFlags nswFlag (bool nsw)
template<typename CIROp, typename LLVMIntOp>
static mlir::LogicalResult lowerIncDecOp (CIROp op, typename CIROp::Adaptor adaptor, mlir::ConversionPatternRewriter &rewriter)
static bool isIntTypeUnsigned (mlir::Type type)
mlir::LLVM::IntegerOverflowFlags convertToLLVMProperty (mlir::MLIRContext *, cir::OverflowFlags flags)
template<typename UIntOp, typename SIntOp, typename CIROp>
static mlir::LogicalResult lowerIntBinaryOp (CIROp op, mlir::Value lhs, mlir::Value rhs, mlir::ConversionPatternRewriter &rewriter)
 Lower an integer op to its signed or unsigned LLVM counterpart.
template<typename CIROp, typename UIntOp, typename SIntOp>
static mlir::LogicalResult lowerMinMaxOp (CIROp op, typename CIROp::Adaptor adaptor, mlir::ConversionPatternRewriter &rewriter)
static mlir::LLVM::ICmpPredicate convertCmpKindToICmpPredicate (cir::CmpOpKind kind, bool isSigned)
 Convert from a CIR comparison kind to an LLVM IR integral comparison kind.
static mlir::LLVM::FCmpPredicate convertCmpKindToFCmpPredicate (cir::CmpOpKind kind)
 Convert from a CIR comparison kind to an LLVM IR floating-point comparison kind.
static mlir::LLVM::FCmpPredicate convertCmpKindToFCmpPredicate (cir::FCmpOpKind kind)
 Convert from a CIR fp comparison kind to an LLVM IR floating-point comparison kind.
static llvm::StringRef convertCmpKindToConstrainedFCmpPredicate (cir::CmpOpKind kind)
static bool isSignalingConstrainedFCmp (cir::CmpOpKind kind)
static llvm::StringRef convertCmpKindToConstrainedFCmpPredicate (cir::FCmpOpKind kind)
template<typename OpKindTy>
static mlir::LLVM::CallIntrinsicOp createConstrainedFCmpCall (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OpKindTy kind, bool isSignaling, cir::FenvAttr fenv, mlir::Type llvmResTy)
template<typename OpTy>
static mlir::LogicalResult lowerBinOpOverflow (OpTy op, typename OpTy::Adaptor adaptor, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *typeConverter, llvm::StringRef opStr)
 Shared lowering logic for checked binary arithmetic overflow operations.
static void prepareTypeConverter (mlir::LLVMTypeConverter &converter, mlir::DataLayout &dataLayout)
static void buildCtorDtorList (mlir::ModuleOp module, StringRef globalXtorName, StringRef llvmXtorName, llvm::function_ref< cir::GlobalCtorDtorEntry(mlir::Attribute)> createXtor)
void createLLVMFuncOpIfNotExist (mlir::ConversionPatternRewriter &rewriter, mlir::SymbolTableCollection &symbolTables, mlir::Operation *srcOp, llvm::StringRef fnName, mlir::Type fnTy, mlir::ArrayAttr argAttrs=nullptr, mlir::ArrayAttr resAttrs=nullptr)
 Declare fnName with type fnTy before the function enclosing srcOp, unless the module already has a symbol of that name.
static mlir::LLVM::LLVMStructType getLLVMLandingPadStructTy (mlir::ConversionPatternRewriter &rewriter)
static mlir::Value getValueForVTableSymbol (mlir::Operation *op, mlir::ConversionPatternRewriter &rewriter, mlir::SymbolTableCollection &symbolTables, const mlir::TypeConverter *converter, const CIRPreConversionTypeMap &preConversionTypes, mlir::FlatSymbolRefAttr nameAttr, mlir::Type &eltType)
static mlir::Value createVTableLoadRelative (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value vptr, mlir::Value byteOffset)
 Read the pointer that is stored in the vtable vptr as the 32-bit offset of the entry at byteOffset, relative to the address of that entry.
static mlir::Value toVectorElement (mlir::OpBuilder &builder, mlir::Location loc, mlir::Type cirTy, mlir::Value value)
 Converts value, the lowered form of a scalar of CIR type cirTy, to the LLVM vector element type for cirTy.
static mlir::Value fromVectorElement (mlir::OpBuilder &builder, mlir::Location loc, const mlir::TypeConverter &converter, mlir::Type cirTy, mlir::Value element)
 Converts element, an LLVM vector element of CIR type cirTy, to the lowered form of a scalar of that type.
static mlir::Value computeMatrixFlatIndex (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, cir::MatrixType matrixTy, mlir::Value rowIdx, mlir::Value columnIdx)
 Computes the column-major flat index (columnIdx * numRows) + rowIdx.
mlir::IntegerType computeBitfieldIntType (mlir::Type storageType, mlir::MLIRContext *context, unsigned &storageSize)
static void clearPadding (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value inputPtr, uint64_t baseAlignment, cir::OffsetPairAttr paddingAttr)
std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, LLVMContext &llvmCtx, bool enableOpenMP, StringRef mlirSaveTempsOutFile, llvm::vfs::FileSystem *fs, bool enableOptimizations)
void registerCIRDialectTranslation (mlir::DialectRegistry &registry)
mlir::LogicalResult lowerNVPTXPrintf (cir::OffloadPrintfOp op, mlir::Value format, mlir::ValueRange args, mlir::ConversionPatternRewriter &rewriter, const mlir::DataLayout &dataLayout, mlir::SymbolTableCollection &symbolTables)
 Lowers op, whose lowered format and arguments are format and args, to a call to vprintf.
mlir::LogicalResult lowerAMDGPUPrintf (cir::OffloadPrintfOp op, mlir::ValueRange operands, mlir::ConversionPatternRewriter &rewriter, const mlir::DataLayout &dataLayout, mlir::SymbolTableCollection &symbolTables, unsigned genericAddrSpace, bool isBuffered)
 Lowers op, whose lowered operands are operands, to the buffered printf runtime interface if isBuffered and to hostcall printf otherwise.
bool isAMDGPUPrintfModule (mlir::ModuleOp module)
 Whether module lowers device printf with the AMDGPU runtime interface: an AMDGCN triple, or SPIR-V with the AMD vendor.
void annotateAMDGPUPrintfStrings (mlir::ModuleOp module, mlir::SymbolTableCollection &symbolTables)
 Resolve constant format strings for AMDGPU printf ops while their producers are still CIR, recording one string per operand on each op for the lowering to read.
void lowerOpenCLKernelArgMetadata (cir::OpenCLKernelArgMetadataAttr clArgMetadata, llvm::SmallVectorImpl< mlir::Attribute > &entries)
static void createOpenCLVersionNamedMetadata (mlir::ModuleOp module, llvm::StringRef name, mlir::LLVM::MDNodeAttr node)
static void emitOpenCLVersionMetadata (mlir::ModuleOp module, llvm::StringRef metadataName, mlir::Attribute versionAttr)
void lowerOpenCLModuleMetadataAttrs (mlir::ModuleOp module)

Variables

static constexpr char kTypeConversionErrorMsg []

Function Documentation

◆ annotateAMDGPUPrintfStrings()

void cir::direct::annotateAMDGPUPrintfStrings ( mlir::ModuleOp module,
mlir::SymbolTableCollection & symbolTables )

Resolve constant format strings for AMDGPU printf ops while their producers are still CIR, recording one string per operand on each op for the lowering to read.

Must run before ConvertCIRToLLVM.

Definition at line 316 of file LowerToLLVMOffloadPrintfAMDGPU.cpp.

References isAMDGPUPrintfModule().

Referenced by cir::direct::ConvertCIRToLLVMPass::runOnOperation().

◆ buildCtorDtorList()

void cir::direct::buildCtorDtorList ( mlir::ModuleOp module,
StringRef globalXtorName,
StringRef llvmXtorName,
llvm::function_ref< cir::GlobalCtorDtorEntry(mlir::Attribute)> createXtor )
static

◆ castBitIntMemoryStorage()

mlir::Value cir::direct::castBitIntMemoryStorage ( mlir::ConversionPatternRewriter & rewriter,
const mlir::DataLayout & dataLayout,
cir::IntType intTy,
mlir::Value value,
bool toMemory )
static

Cast a _BitInt(N) value between its literal width iN and its padded in-memory storage iM (sign/zero-extend to memory per signedness so the padding bits are well-defined, truncate back on load; matches classic CodeGen).

Callers must first rule out the unsupported byte-array storage form (isSplitStorageBitInt / a null convertTypeForMemory result).

Definition at line 142 of file LowerToLLVM.cpp.

References createIntCast().

Referenced by emitFromMemory(), and emitToMemory().

◆ clearPadding()

void cir::direct::clearPadding ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
mlir::Value inputPtr,
uint64_t baseAlignment,
cir::OffsetPairAttr paddingAttr )
static

Definition at line 7095 of file LowerToLLVM.cpp.

References clearPadding().

Referenced by clearPadding().

◆ computeBitfieldIntType()

mlir::IntegerType cir::direct::computeBitfieldIntType ( mlir::Type storageType,
mlir::MLIRContext * context,
unsigned & storageSize )

Definition at line 6648 of file LowerToLLVM.cpp.

References computeBitfieldIntType().

Referenced by computeBitfieldIntType().

◆ computeMatrixFlatIndex()

mlir::Value cir::direct::computeMatrixFlatIndex ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
cir::MatrixType matrixTy,
mlir::Value rowIdx,
mlir::Value columnIdx )
static

Computes the column-major flat index (columnIdx * numRows) + rowIdx.

Definition at line 6279 of file LowerToLLVM.cpp.

References computeMatrixFlatIndex(), and createIntCast().

Referenced by computeMatrixFlatIndex().

◆ convertCallEffects()

void cir::direct::convertCallEffects ( mlir::Operation * callOp,
bool isNothrow,
cir::MemoryEffectsAttr effects,
mlir::LLVM::MemoryEffectsAttr & memoryEffect,
bool & noUnwind,
bool & willReturn,
bool & noReturn )
static

Definition at line 582 of file LowerToLLVM.cpp.

References convertMemoryEffects().

Referenced by rewriteCallOrInvoke().

◆ convertCallingConv()

mlir::LLVM::CConv cir::direct::convertCallingConv ( cir::CallingConv callingConv)
static

Definition at line 301 of file LowerToLLVM.cpp.

Referenced by rewriteCallOrInvoke().

◆ convertCmpKindToConstrainedFCmpPredicate() [1/2]

llvm::StringRef cir::direct::convertCmpKindToConstrainedFCmpPredicate ( cir::CmpOpKind kind)
static

Definition at line 4103 of file LowerToLLVM.cpp.

References kind.

Referenced by createConstrainedFCmpCall().

◆ convertCmpKindToConstrainedFCmpPredicate() [2/2]

llvm::StringRef cir::direct::convertCmpKindToConstrainedFCmpPredicate ( cir::FCmpOpKind kind)
static

Definition at line 4144 of file LowerToLLVM.cpp.

References kind.

◆ convertCmpKindToFCmpPredicate() [1/2]

mlir::LLVM::FCmpPredicate cir::direct::convertCmpKindToFCmpPredicate ( cir::CmpOpKind kind)
static

Convert from a CIR comparison kind to an LLVM IR floating-point comparison kind.

Definition at line 4035 of file LowerToLLVM.cpp.

References kind.

◆ convertCmpKindToFCmpPredicate() [2/2]

mlir::LLVM::FCmpPredicate cir::direct::convertCmpKindToFCmpPredicate ( cir::FCmpOpKind kind)
static

Convert from a CIR fp comparison kind to an LLVM IR floating-point comparison kind.

Definition at line 4062 of file LowerToLLVM.cpp.

References kind.

◆ convertCmpKindToICmpPredicate()

mlir::LLVM::ICmpPredicate cir::direct::convertCmpKindToICmpPredicate ( cir::CmpOpKind kind,
bool isSigned )
static

Convert from a CIR comparison kind to an LLVM IR integral comparison kind.

Definition at line 4009 of file LowerToLLVM.cpp.

References kind.

◆ convertFastMathFlags()

mlir::LLVM::FastmathFlags cir::direct::convertFastMathFlags ( cir::FastMathFlags cirFlags)
static

Definition at line 762 of file LowerToLLVM.cpp.

Referenced by convertToLLVMProperty(), lowerConstrainableFPOp(), and lowerFPOp().

◆ convertFramePointerKind()

mlir::LLVM::framePointerKind::FramePointerKind cir::direct::convertFramePointerKind ( cir::FramePointerKind kind)
static

Definition at line 337 of file LowerToLLVM.cpp.

References kind.

◆ convertFramePointerKindToLLVMIR()

llvm::FramePointerKind cir::direct::convertFramePointerKindToLLVMIR ( cir::FramePointerKind kind)
static

The "frame-pointer" module flag holds an llvm::FramePointerKind value, as written by llvm::Module::setFramePointer.

Definition at line 359 of file LowerToLLVM.cpp.

References kind.

Referenced by cir::direct::ConvertCIRToLLVMPass::processCIRAttrs().

◆ convertLinkage()

mlir::LLVM::Linkage cir::direct::convertLinkage ( cir::GlobalLinkageKind linkage)

Definition at line 270 of file LowerToLLVM.cpp.

◆ convertMemoryEffects()

mlir::LLVM::MemoryEffectsAttr cir::direct::convertMemoryEffects ( mlir::MLIRContext * ctx,
cir::MemoryEffectsAttr effects )
static

A null input stays null, which is how both dialects spell unknown effects.

Definition at line 569 of file LowerToLLVM.cpp.

References convertModRefInfo().

Referenced by convertCallEffects().

◆ convertModRefInfo()

mlir::LLVM::ModRefInfo cir::direct::convertModRefInfo ( cir::ModRefInfo info)
static

Definition at line 553 of file LowerToLLVM.cpp.

Referenced by convertMemoryEffects().

◆ convertTlsModelAttrToLLVM()

mlir::LLVM::ThreadLocalMode cir::direct::convertTlsModelAttrToLLVM ( TLSModelAttr attr)
static

Definition at line 3427 of file LowerToLLVM.cpp.

References CHECK_ENUM.

◆ convertToIndexTy()

mlir::Value cir::direct::convertToIndexTy ( mlir::ConversionPatternRewriter & rewriter,
mlir::ModuleOp mod,
mlir::Value index,
mlir::Type baseTy,
cir::IntType strideTy )
static

Definition at line 2219 of file LowerToLLVM.cpp.

References getLLVMIntCast(), and isUnsigned().

◆ convertToLLVMProperty() [1/4]

mlir::LLVM::IntegerOverflowFlags cir::direct::convertToLLVMProperty ( mlir::MLIRContext * ,
cir::OverflowFlags flags )

Definition at line 3927 of file LowerToLLVM.cpp.

◆ convertToLLVMProperty() [2/4]

mlir::IntegerAttr cir::direct::convertToLLVMProperty ( mlir::MLIRContext * ctx,
bool flag )

Definition at line 757 of file LowerToLLVM.cpp.

◆ convertToLLVMProperty() [3/4]

mlir::IntegerAttr cir::direct::convertToLLVMProperty ( mlir::MLIRContext * ctx,
cir::FPClassTest flags )

Definition at line 751 of file LowerToLLVM.cpp.

◆ convertToLLVMProperty() [4/4]

mlir::LLVM::FastmathFlagsAttr cir::direct::convertToLLVMProperty ( mlir::MLIRContext * ctx,
std::optional< cir::FastMathFlags > flags )

Definition at line 745 of file LowerToLLVM.cpp.

References convertFastMathFlags().

◆ convertTypedArgAttrs()

std::optional< mlir::ArrayAttr > cir::direct::convertTypedArgAttrs ( mlir::ArrayAttr argAttrs,
const mlir::TypeConverter & converter,
const mlir::DataLayout & dataLayout,
mlir::MLIRContext * ctx )
static

The llvm.byval, llvm.sret, and llvm.byref argument attributes carry the pointee type as a TypeAttr.

After the CallConvLowering pass that type is still a CIR type; remap it to the lowered LLVM type so translation to LLVM IR does not encounter a CIR type in an attribute. The pointee must name the in-memory storage type, not the value type, since it sizes the byval copy and the sret slot: a _BitInt narrower than its padded storage integer would otherwise understate both. Returns std::nullopt when a pointee has no memory representation, leaving the caller to emit the NYI error, and the input unchanged when there is nothing to convert.

Definition at line 2507 of file LowerToLLVM.cpp.

References convertTypeForMemory().

Referenced by lowerCallAttributes().

◆ convertUWTableKind()

mlir::LLVM::uwtable::UWTableKind cir::direct::convertUWTableKind ( cir::UnwindTableKind kind)
static

Definition at line 321 of file LowerToLLVM.cpp.

References kind.

◆ createCallLLVMIntrinsicOp()

mlir::LLVM::CallIntrinsicOp cir::direct::createCallLLVMIntrinsicOp ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
const llvm::Twine & intrinsicName,
mlir::Type resultTy,
mlir::ValueRange operands,
mlir::LLVM::FastmathFlags fastmathFlags = {} )
static

Definition at line 597 of file LowerToLLVM.cpp.

Referenced by createConstrainedFCmpCall(), and createVTableLoadRelative().

◆ createConstrainedFCmpCall()

template<typename OpKindTy>
mlir::LLVM::CallIntrinsicOp cir::direct::createConstrainedFCmpCall ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
mlir::Value lhs,
mlir::Value rhs,
OpKindTy kind,
bool isSignaling,
cir::FenvAttr fenv,
mlir::Type llvmResTy )
static

◆ createConstrainedFPIntrinsicCall()

mlir::Value cir::direct::createConstrainedFPIntrinsicCall ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
mlir::ValueRange operands,
mlir::Type llvmResTy,
cir::FenvAttr fenv,
llvm::StringRef constrainedMnemonic,
bool hasRoundingMode,
mlir::LLVM::FastmathFlags fastmathFlags = {} )
static

Definition at line 684 of file LowerToLLVM.cpp.

◆ createConvertCIRToLLVMPass()

std::unique_ptr< mlir::Pass > cir::direct::createConvertCIRToLLVMPass ( )

Create a pass that fully lowers CIR to the LLVMIR dialect.

Definition at line 7208 of file LowerToLLVM.cpp.

References createConvertCIRToLLVMPass().

Referenced by createConvertCIRToLLVMPass(), and populateCIRToLLVMPasses().

◆ createFenvMetadataValue()

mlir::Value cir::direct::createFenvMetadataValue ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
llvm::StringRef str )
static

Definition at line 655 of file LowerToLLVM.cpp.

Referenced by createConstrainedFCmpCall(), and lowerToConstrainedFPIntrinsic().

◆ createIntCast()

mlir::Value cir::direct::createIntCast ( mlir::OpBuilder & bld,
mlir::Value src,
mlir::IntegerType dstTy,
bool isSigned = false )
static

◆ createLLVMFuncOpIfNotExist()

void cir::direct::createLLVMFuncOpIfNotExist ( mlir::ConversionPatternRewriter & rewriter,
mlir::SymbolTableCollection & symbolTables,
mlir::Operation * srcOp,
llvm::StringRef fnName,
mlir::Type fnTy,
mlir::ArrayAttr argAttrs,
mlir::ArrayAttr resAttrs )

Declare fnName with type fnTy before the function enclosing srcOp, unless the module already has a symbol of that name.

Definition at line 5458 of file LowerToLLVM.cpp.

References createLLVMFuncOpIfNotExist().

Referenced by createLLVMFuncOpIfNotExist(), and lowerNVPTXPrintf().

◆ createOpenCLVersionNamedMetadata()

void cir::direct::createOpenCLVersionNamedMetadata ( mlir::ModuleOp module,
llvm::StringRef name,
mlir::LLVM::MDNodeAttr node )
static

Definition at line 104 of file LowerToLLVMOpenCLMetadata.cpp.

Referenced by emitOpenCLVersionMetadata().

◆ createVTableLoadRelative()

mlir::Value cir::direct::createVTableLoadRelative ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
mlir::Value vptr,
mlir::Value byteOffset )
static

Read the pointer that is stored in the vtable vptr as the 32-bit offset of the entry at byteOffset, relative to the address of that entry.

The width of the integer byteOffset selects the form of the intrinsic.

Definition at line 5807 of file LowerToLLVM.cpp.

References createCallLLVMIntrinsicOp(), and createVTableLoadRelative().

Referenced by createVTableLoadRelative().

◆ emitBoolVecConversion()

mlir::Value cir::direct::emitBoolVecConversion ( mlir::ConversionPatternRewriter & rewriter,
mlir::Value srcVec,
unsigned numElementsDst )
static

Definition at line 167 of file LowerToLLVM.cpp.

Referenced by emitFromMemory(), and emitToMemory().

◆ emitFromMemory()

mlir::Value cir::direct::emitFromMemory ( mlir::ConversionPatternRewriter & rewriter,
const mlir::TypeConverter & converter,
mlir::DataLayout const & dataLayout,
cir::LoadOp op,
mlir::Value value )
static

Emits the value from memory as expected by its users.

Should be called when the memory represetnation of a CIR type is not equal to its scalar representation.

Definition at line 187 of file LowerToLLVM.cpp.

References castBitIntMemoryStorage(), createIntCast(), emitBoolVecConversion(), and cir::isBitIntType().

◆ emitOpenCLVersionMetadata()

void cir::direct::emitOpenCLVersionMetadata ( mlir::ModuleOp module,
llvm::StringRef metadataName,
mlir::Attribute versionAttr )
static

◆ emitToMemory()

mlir::Value cir::direct::emitToMemory ( mlir::ConversionPatternRewriter & rewriter,
mlir::DataLayout const & dataLayout,
mlir::Type origType,
mlir::Value value )
static

Emits a value to memory with the expected scalar type.

Should be called when the memory represetnation of a CIR type is not equal to its scalar representation.

Definition at line 227 of file LowerToLLVM.cpp.

References castBitIntMemoryStorage(), createIntCast(), emitBoolVecConversion(), and cir::isBitIntType().

◆ emitTypeConversionError() [1/2]

mlir::InFlightDiagnostic cir::direct::emitTypeConversionError ( mlir::Location loc,
mlir::Type type )
static

Definition at line 97 of file LowerToLLVM.cpp.

References kTypeConversionErrorMsg.

◆ emitTypeConversionError() [2/2]

mlir::InFlightDiagnostic cir::direct::emitTypeConversionError ( mlir::Operation * op,
mlir::Type type )
static

Definition at line 92 of file LowerToLLVM.cpp.

References kTypeConversionErrorMsg.

Referenced by getValueForVTableSymbol().

◆ forwardAMDGPUAtomicOptionMarkers()

void cir::direct::forwardAMDGPUAtomicOptionMarkers ( mlir::Operation * op,
mlir::Operation * llvmOp )
static

Definition at line 1570 of file LowerToLLVM.cpp.

◆ forwardAMDGPUNoPrivateAddrSpace()

void cir::direct::forwardAMDGPUNoPrivateAddrSpace ( mlir::Operation * op,
mlir::Operation * llvmOp,
mlir::Value llvmPtr )
static

Definition at line 1558 of file LowerToLLVM.cpp.

◆ fromVectorElement()

mlir::Value cir::direct::fromVectorElement ( mlir::OpBuilder & builder,
mlir::Location loc,
const mlir::TypeConverter & converter,
mlir::Type cirTy,
mlir::Value element )
static

Converts element, an LLVM vector element of CIR type cirTy, to the lowered form of a scalar of that type.

An opaque float element is inserted into a one-element vector.

Definition at line 6006 of file LowerToLLVM.cpp.

References fromVectorElement().

Referenced by fromVectorElement().

◆ getAtomicScope()

llvm::AtomicScope cir::direct::getAtomicScope ( cir::SyncScopeKind syncScope)
static

Definition at line 1511 of file LowerToLLVM.cpp.

Referenced by getLLVMSyncScope().

◆ getComdatAttrHelper()

mlir::SymbolRefAttr cir::direct::getComdatAttrHelper ( mlir::ModuleOp modOp,
mlir::OpBuilder & builder,
StringRef symName,
mlir::LLVM::ComdatOp & comdatOp,
mlir::SymbolTableCollection & symbolTables )
static

Definition at line 3727 of file LowerToLLVM.cpp.

◆ getConstArrayBaseElementType()

mlir::Type cir::direct::getConstArrayBaseElementType ( mlir::Type ty)
static

Definition at line 2876 of file LowerToLLVM.cpp.

◆ getConstrainedExceptMetadata()

llvm::StringRef cir::direct::getConstrainedExceptMetadata ( cir::FenvAttr fenv)
static

Definition at line 647 of file LowerToLLVM.cpp.

Referenced by createConstrainedFCmpCall(), and lowerToConstrainedFPIntrinsic().

◆ getConstrainedRoundingMetadata()

llvm::StringRef cir::direct::getConstrainedRoundingMetadata ( cir::FenvAttr fenv)
static

Definition at line 625 of file LowerToLLVM.cpp.

Referenced by lowerToConstrainedFPIntrinsic().

◆ getLLVMAtomicBinOp()

mlir::LLVM::AtomicBinOp cir::direct::getLLVMAtomicBinOp ( cir::AtomicFetchKind k,
bool isInt,
bool isSignedInt )
static

Definition at line 1685 of file LowerToLLVM.cpp.

◆ getLLVMBinopForPostAtomic()

llvm::StringLiteral cir::direct::getLLVMBinopForPostAtomic ( cir::AtomicFetchKind k,
bool isInt )
static

Definition at line 1727 of file LowerToLLVM.cpp.

◆ getLLVMIntCast()

mlir::Value cir::direct::getLLVMIntCast ( mlir::ConversionPatternRewriter & rewriter,
mlir::Value llvmSrc,
mlir::Type llvmDstIntTy,
bool isUnsigned,
uint64_t cirSrcWidth,
uint64_t cirDstIntWidth )
static

Definition at line 482 of file LowerToLLVM.cpp.

References isUnsigned().

Referenced by convertToIndexTy().

◆ getLLVMLandingPadStructTy()

mlir::LLVM::LLVMStructType cir::direct::getLLVMLandingPadStructTy ( mlir::ConversionPatternRewriter & rewriter)
static

Definition at line 5558 of file LowerToLLVM.cpp.

References getLLVMLandingPadStructTy().

Referenced by getLLVMLandingPadStructTy().

◆ getLLVMMemOrder()

mlir::LLVM::AtomicOrdering cir::direct::getLLVMMemOrder ( std::optional< cir::MemOrder > memorder)
static

Definition at line 1492 of file LowerToLLVM.cpp.

◆ getLLVMSyncScope() [1/2]

llvm::StringRef cir::direct::getLLVMSyncScope ( cir::SyncScopeKind syncScope,
mlir::ModuleOp moduleOp )
static

Definition at line 1539 of file LowerToLLVM.cpp.

References getAtomicScope().

Referenced by getLLVMSyncScope().

◆ getLLVMSyncScope() [2/2]

std::optional< llvm::StringRef > cir::direct::getLLVMSyncScope ( std::optional< cir::SyncScopeKind > syncScope,
mlir::ModuleOp moduleOp )
static

Definition at line 1551 of file LowerToLLVM.cpp.

References getLLVMSyncScope().

◆ getMemoryFallbackAlignment()

uint64_t cir::direct::getMemoryFallbackAlignment ( mlir::Operation * op,
mlir::Type cirType,
mlir::Type llvmMemType,
const mlir::DataLayout & dataLayout )
static

Alignment to use for a memory access whose op carries no explicit alignment.

For _BitInt the storage integer iM's ABI alignment (e.g. i128's 16) over-aligns the value, so use the _BitInt language alignment (e.g. 8). An SVE count lowers to target("aarch64.svcount"), which the MLIR data layout cannot size, so it also uses its language alignment.

Definition at line 107 of file LowerToLLVM.cpp.

References cir::CIRDataLayout::getTypeLanguageAlignment(), and cir::isBitIntType().

◆ getTypeAllocSize()

uint64_t cir::direct::getTypeAllocSize ( mlir::Type type,
mlir::Operation & op )
static

Definition at line 3036 of file LowerToLLVM.cpp.

◆ getValueForVTableSymbol()

mlir::Value cir::direct::getValueForVTableSymbol ( mlir::Operation * op,
mlir::ConversionPatternRewriter & rewriter,
mlir::SymbolTableCollection & symbolTables,
const mlir::TypeConverter * converter,
const CIRPreConversionTypeMap & preConversionTypes,
mlir::FlatSymbolRefAttr nameAttr,
mlir::Type & eltType )
static

Definition at line 5727 of file LowerToLLVM.cpp.

References emitTypeConversionError(), and getValueForVTableSymbol().

Referenced by getValueForVTableSymbol().

◆ isAMDGPUPrintfModule()

bool cir::direct::isAMDGPUPrintfModule ( mlir::ModuleOp module)

Whether module lowers device printf with the AMDGPU runtime interface: an AMDGCN triple, or SPIR-V with the AMD vendor.

Definition at line 306 of file LowerToLLVMOffloadPrintfAMDGPU.cpp.

Referenced by annotateAMDGPUPrintfStrings().

◆ isBulkLowerableConstArrayBaseElement()

bool cir::direct::isBulkLowerableConstArrayBaseElement ( mlir::Type baseElemTy)
static

Definition at line 2882 of file LowerToLLVM.cpp.

◆ isHandledDiscardableFuncAttr()

bool cir::direct::isHandledDiscardableFuncAttr ( mlir::NamedAttribute attr)
static

Return true for discardable CIR markers handled explicitly below.

Definition at line 3113 of file LowerToLLVM.cpp.

◆ isIntTypeUnsigned()

bool cir::direct::isIntTypeUnsigned ( mlir::Type type)
static

Definition at line 3915 of file LowerToLLVM.cpp.

Referenced by lowerIntBinaryOp(), and lowerMinMaxOp().

◆ isSignalingConstrainedFCmp()

bool cir::direct::isSignalingConstrainedFCmp ( cir::CmpOpKind kind)
static

Definition at line 4126 of file LowerToLLVM.cpp.

References kind.

◆ lowerAMDGPUPrintf()

mlir::LogicalResult cir::direct::lowerAMDGPUPrintf ( cir::OffloadPrintfOp op,
mlir::ValueRange operands,
mlir::ConversionPatternRewriter & rewriter,
const mlir::DataLayout & dataLayout,
mlir::SymbolTableCollection & symbolTables,
unsigned genericAddrSpace,
bool isBuffered )

Lowers op, whose lowered operands are operands, to the buffered printf runtime interface if isBuffered and to hostcall printf otherwise.

Strings are passed to the runtime in genericAddrSpace.

Definition at line 846 of file LowerToLLVMOffloadPrintfAMDGPU.cpp.

◆ lowerBinOpOverflow()

template<typename OpTy>
mlir::LogicalResult cir::direct::lowerBinOpOverflow ( OpTy op,
typename OpTy::Adaptor adaptor,
mlir::ConversionPatternRewriter & rewriter,
const mlir::TypeConverter * typeConverter,
llvm::StringRef opStr )
static

Shared lowering logic for checked binary arithmetic overflow operations.

The opStr parameter specifies the arithmetic operation name used in the LLVM intrinsic (e.g., "add", "sub", "mul").

Definition at line 4330 of file LowerToLLVM.cpp.

References sign().

◆ lowerCallAttributes()

mlir::LogicalResult cir::direct::lowerCallAttributes ( cir::CIRCallOpInterface op,
const mlir::TypeConverter & converter,
const mlir::DataLayout & dataLayout,
LoweredCallAttributes & result )
static

◆ lowerCirAttrAsValue()

mlir::Value cir::direct::lowerCirAttrAsValue ( mlir::Location parentLoc,
mlir::ModuleOp parentModule,
mlir::Attribute attr,
mlir::ConversionPatternRewriter & rewriter,
mlir::SymbolTableCollection & symbolTables,
const mlir::TypeConverter * converter,
const CIRPreConversionTypeMap & preConversionTypes,
LLVMBlockAddressInfo * blockInfoAddr = nullptr )

Switches on the type of attribute and calls the appropriate conversion.

Convert a CIR attribute to an LLVM value, or return null on failure.

May use the datalayout for lowering attributes to-be-stored in memory. When the attribute may contain block address attributes, blockInfoAddr is used to resolve them.

Definition at line 541 of file LowerToLLVM.cpp.

◆ lowerCIRVisibilityToLLVMVisibility()

mlir::LLVM::Visibility cir::direct::lowerCIRVisibilityToLLVMVisibility ( cir::VisibilityKind visibilityKind)
static

Definition at line 154 of file LowerToLLVM.cpp.

◆ lowerConstrainableFPOp()

template<typename LLVMOp>
mlir::LogicalResult cir::direct::lowerConstrainableFPOp ( mlir::Operation * op,
mlir::ValueRange operands,
cir::FenvAttr fenv,
cir::FastMathFlagsAttr fastmath,
const mlir::TypeConverter & typeConverter,
mlir::ConversionPatternRewriter & rewriter,
llvm::StringRef constrainedMnemonic,
bool hasRoundingMode )

◆ lowerDirectlyFromCIRToLLVMIR() [1/2]

std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR ( mlir::ModuleOp mlirModule,
llvm::LLVMContext & llvmCtx,
bool enableOpenMP,
llvm::StringRef mlirSaveTempsOutFile = {},
llvm::vfs::FileSystem * fs = nullptr,
bool enableOptimizations = false )

Lowers mlirModule, a CIR module, to an LLVM module in llvmCtx.

Returns null if lowering fails; the error has then been reported through the MLIR diagnostic engine of mlirModule's context.

Referenced by lowerDirectlyFromCIRToLLVMIR().

◆ lowerDirectlyFromCIRToLLVMIR() [2/2]

std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR ( mlir::ModuleOp mlirModule,
LLVMContext & llvmCtx,
bool enableOpenMP,
StringRef mlirSaveTempsOutFile,
llvm::vfs::FileSystem * fs,
bool enableOptimizations )

◆ lowerFPOp()

template<typename LLVMOp>
mlir::LogicalResult cir::direct::lowerFPOp ( mlir::Operation * op,
mlir::ValueRange operands,
cir::FastMathFlagsAttr fastmath,
const mlir::TypeConverter & typeConverter,
mlir::ConversionPatternRewriter & rewriter )

Definition at line 704 of file LowerToLLVM.cpp.

References convertFastMathFlags(), and cir::getDefaultProperties().

Referenced by lowerConstrainableFPOp().

◆ lowerIncDecOp()

template<typename CIROp, typename LLVMIntOp>
mlir::LogicalResult cir::direct::lowerIncDecOp ( CIROp op,
typename CIROp::Adaptor adaptor,
mlir::ConversionPatternRewriter & rewriter )
static

Definition at line 3822 of file LowerToLLVM.cpp.

References nswFlag().

◆ lowerIntBinaryOp()

template<typename UIntOp, typename SIntOp, typename CIROp>
mlir::LogicalResult cir::direct::lowerIntBinaryOp ( CIROp op,
mlir::Value lhs,
mlir::Value rhs,
mlir::ConversionPatternRewriter & rewriter )
static

Lower an integer op to its signed or unsigned LLVM counterpart.

Definition at line 3940 of file LowerToLLVM.cpp.

References isIntTypeUnsigned().

◆ lowerMemTransferOp()

template<typename CIROp, typename LLVMOp>
mlir::LogicalResult cir::direct::lowerMemTransferOp ( CIROp op,
typename CIROp::Adaptor adaptor,
mlir::ConversionPatternRewriter & rewriter )
static

Definition at line 418 of file LowerToLLVM.cpp.

◆ lowerMinMaxOp()

template<typename CIROp, typename UIntOp, typename SIntOp>
mlir::LogicalResult cir::direct::lowerMinMaxOp ( CIROp op,
typename CIROp::Adaptor adaptor,
mlir::ConversionPatternRewriter & rewriter )
static

Definition at line 3982 of file LowerToLLVM.cpp.

References isIntTypeUnsigned().

◆ lowerNVPTXPrintf()

mlir::LogicalResult cir::direct::lowerNVPTXPrintf ( cir::OffloadPrintfOp op,
mlir::Value format,
mlir::ValueRange args,
mlir::ConversionPatternRewriter & rewriter,
const mlir::DataLayout & dataLayout,
mlir::SymbolTableCollection & symbolTables )

Lowers op, whose lowered format and arguments are format and args, to a call to vprintf.

Definition at line 105 of file LowerToLLVMOffloadPrintfNVPTX.cpp.

References createLLVMFuncOpIfNotExist().

◆ lowerOpenCLKernelArgMetadata()

void cir::direct::lowerOpenCLKernelArgMetadata ( cir::OpenCLKernelArgMetadataAttr clArgMetadata,
llvm::SmallVectorImpl< mlir::Attribute > & entries )

◆ lowerOpenCLModuleMetadataAttrs()

void cir::direct::lowerOpenCLModuleMetadataAttrs ( mlir::ModuleOp module)

◆ lowerToConstrainedFPIntrinsic()

mlir::LogicalResult cir::direct::lowerToConstrainedFPIntrinsic ( mlir::Operation * op,
mlir::ValueRange operands,
cir::FenvAttr fenv,
mlir::Type llvmResTy,
mlir::ConversionPatternRewriter & rewriter,
llvm::StringRef constrainedMnemonic,
bool hasRoundingMode,
mlir::LLVM::FastmathFlags fastmathFlags )

◆ nswFlag()

mlir::LLVM::IntegerOverflowFlags cir::direct::nswFlag ( bool nsw)
static

Definition at line 3815 of file LowerToLLVM.cpp.

Referenced by lowerIncDecOp().

◆ populateCIRToLLVMPasses()

void cir::direct::populateCIRToLLVMPasses ( mlir::OpPassManager & pm,
bool enableOpenMP,
bool enableOptimizations = false )

Adds passes that fully lower CIR to the LLVMIR dialect.

When enableOpenMP is set (-fopenmp), the OpenMP lowering passes are also added. When enableOptimizations is set, the llvm-simplify-cfg pass runs after conversion, before translation.

Definition at line 7212 of file LowerToLLVM.cpp.

References createConvertCIRToLLVMPass(), mlir::populateCIRPreLoweringPasses(), and populateCIRToLLVMPasses().

Referenced by lowerDirectlyFromCIRToLLVMIR(), and populateCIRToLLVMPasses().

◆ prepareTypeConverter()

void cir::direct::prepareTypeConverter ( mlir::LLVMTypeConverter & converter,
mlir::DataLayout & dataLayout )
static

◆ registerCIRDialectTranslation()

void cir::direct::registerCIRDialectTranslation ( mlir::DialectRegistry & registry)

Definition at line 272 of file LowerToLLVMIR.cpp.

Referenced by mlir::registerCIRDialectTranslation().

◆ replaceCirGlobal()

mlir::LLVM::GlobalOp cir::direct::replaceCirGlobal ( mlir::SymbolTableCollection & symbolTables,
cir::GlobalOp op,
mlir::Type llvmType,
bool isConst,
mlir::LLVM::Linkage linkage,
llvm::StringRef symbol,
mlir::Attribute init,
uint64_t alignment,
unsigned addrSpace,
bool isDsoLocal,
mlir::LLVM::ThreadLocalMode threadLocalMode,
mlir::SymbolRefAttr comdatAttr,
llvm::ArrayRef< mlir::NamedAttribute > attributes,
mlir::ConversionPatternRewriter & rewriter )
static

Definition at line 3553 of file LowerToLLVM.cpp.

◆ replaceOpWithCallLLVMIntrinsicOp()

mlir::LLVM::CallIntrinsicOp cir::direct::replaceOpWithCallLLVMIntrinsicOp ( mlir::ConversionPatternRewriter & rewriter,
mlir::Operation * op,
const llvm::Twine & intrinsicName,
mlir::Type resultTy,
mlir::ValueRange operands,
mlir::LLVM::FastmathFlags fastmathFlags = {} )
static

Definition at line 615 of file LowerToLLVM.cpp.

Referenced by lowerToConstrainedFPIntrinsic().

◆ rewriteCallOrInvoke()

mlir::LogicalResult cir::direct::rewriteCallOrInvoke ( mlir::Operation * op,
mlir::ValueRange callOperands,
mlir::ConversionPatternRewriter & rewriter,
const mlir::TypeConverter * converter,
const mlir::DataLayout & dataLayout,
mlir::SymbolTableCollection & symbolTables,
mlir::FlatSymbolRefAttr calleeAttr,
mlir::Block * continueBlock = nullptr,
mlir::Block * landingPadBlock = nullptr )
static

◆ setLoweredCallAttributes()

template<typename CallLikeOp>
void cir::direct::setLoweredCallAttributes ( CallLikeOp op,
const LoweredCallAttributes & attributes )
static

◆ toVectorElement()

mlir::Value cir::direct::toVectorElement ( mlir::OpBuilder & builder,
mlir::Location loc,
mlir::Type cirTy,
mlir::Value value )
static

Converts value, the lowered form of a scalar of CIR type cirTy, to the LLVM vector element type for cirTy.

A scalar opaque float is lowered to a one-element vector, which is bitcast to its element type.

Definition at line 5994 of file LowerToLLVM.cpp.

References toVectorElement().

Referenced by toVectorElement().

Variable Documentation

◆ kTypeConversionErrorMsg

char cir::direct::kTypeConversionErrorMsg[]
staticconstexpr
Initial value:
=
"ClangIR lowering NYI: cannot convert "

Definition at line 89 of file LowerToLLVM.cpp.

Referenced by emitTypeConversionError(), and emitTypeConversionError().