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  GlobalInitAttrRewriter
struct  LLVMBlockAddressInfo
class  OpenCLFunctionMetadataLowering

Functions

std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, llvm::LLVMContext &llvmCtx, bool enableOpenMP, llvm::StringRef mlirSaveTempsOutFile={}, llvm::vfs::FileSystem *fs=nullptr)
std::unique_ptr< mlir::Pass > createConvertCIRToLLVMPass ()
 Create a pass that fully lowers CIR to the LLVMIR dialect.
void populateCIRToLLVMPasses (mlir::OpPassManager &pm, bool enableOpenMP)
 Adds passes that fully lower CIR to the LLVMIR dialect.
static uint64_t getMemoryFallbackAlignment (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::Value getLLVMIntCast (mlir::ConversionPatternRewriter &rewriter, mlir::Value llvmSrc, mlir::Type llvmDstIntTy, bool isUnsigned, uint64_t cirSrcWidth, uint64_t cirDstIntWidth)
mlir::Value lowerCirAttrAsValue (mlir::Operation *parentOp, const mlir::Attribute attr, mlir::ConversionPatternRewriter &rewriter, mlir::SymbolTableCollection &symbolTables, const mlir::TypeConverter *converter, LLVMBlockAddressInfo *blockInfoAddr)
 Switches on the type of attribute and calls the appropriate conversion.
void convertSideEffectForCall (mlir::Operation *callOp, bool isNothrow, cir::SideEffect sideEffect, 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)
template<typename LLVMOp>
mlir::LogicalResult lowerConstrainableFPOp (mlir::Operation *op, mlir::ValueRange operands, cir::FenvAttr fenv, const mlir::TypeConverter &typeConverter, mlir::ConversionPatternRewriter &rewriter, llvm::StringRef constrainedMnemonic, bool hasRoundingMode)
static mlir::LLVM::AtomicOrdering getLLVMMemOrder (std::optional< cir::MemOrder > memorder)
static llvm::StringRef getLLVMSyncScope (cir::SyncScopeKind syncScope)
static std::optional< llvm::StringRef > getLLVMSyncScope (std::optional< cir::SyncScopeKind > syncScope)
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 mlir::ArrayAttr convertTypedArgAttrs (mlir::ArrayAttr argAttrs, const mlir::TypeConverter &converter, mlir::MLIRContext *ctx)
 The llvm.byval, llvm.sret, and llvm.byref argument attributes carry the pointee type as a TypeAttr.
static void lowerCallAttributes (cir::CIRCallOpInterface op, const mlir::TypeConverter &converter, SmallVectorImpl< mlir::NamedAttribute > &result)
static mlir::LogicalResult rewriteCallOrInvoke (mlir::Operation *op, mlir::ValueRange callOperands, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter, 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 getTypeSize (mlir::Type type, mlir::Operation &op)
static bool shouldDropFuncAttribute (cir::FuncOp func, mlir::NamedAttribute attr, mlir::StringRef linkageAttrName)
 Return true for attributes constructed by LLVMFuncOp::build.
static mlir::LLVM::ThreadLocalMode convertTlsModelAttrToLLVM (TLSModelAttr attr)
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)
template<typename BinOp>
static mlir::LLVM::IntegerOverflowFlags intOverflowFlag (BinOp op)
template<typename UIntSatOp, typename SIntSatOp, typename IntOp, typename CIROp>
static mlir::LogicalResult lowerSaturatableArithOp (CIROp op, mlir::Value lhs, mlir::Value rhs, mlir::ConversionPatternRewriter &rewriter)
 Lower an arithmetic op that supports saturation, overflow flags, and an FP Lower an integer Add/Sub op that may use saturating-arithmetic semantics.
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 Div/Rem 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 llvm::StringRef convertCmpKindToConstrainedFCmpPredicate (cir::CmpOpKind kind)
static bool isSignalingConstrainedFCmp (cir::CmpOpKind kind)
static mlir::LLVM::CallIntrinsicOp createConstrainedFCmpCall (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value lhs, mlir::Value rhs, cir::CmpOpKind kind, 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< std::pair< StringRef, int >(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)
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, mlir::FlatSymbolRefAttr nameAttr, mlir::Type &eltType)
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)
void registerCIRDialectTranslation (mlir::DialectRegistry &registry)
static void convertOpenCLKernelArgMetadata (cir::OpenCLKernelArgMetadataAttr clArgMetadata, llvm::SmallVectorImpl< mlir::Attribute > &entries)

Function Documentation

◆ buildCtorDtorList()

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

Definition at line 3989 of file LowerToLLVM.cpp.

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

◆ 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 117 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 5673 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 5216 of file LowerToLLVM.cpp.

References computeBitfieldIntType().

Referenced by computeBitfieldIntType().

◆ convertCallingConv()

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

Definition at line 262 of file LowerToLLVM.cpp.

◆ convertCmpKindToConstrainedFCmpPredicate()

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

Definition at line 3445 of file LowerToLLVM.cpp.

References kind.

Referenced by createConstrainedFCmpCall().

◆ convertCmpKindToFCmpPredicate()

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 3420 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 3394 of file LowerToLLVM.cpp.

References kind.

◆ convertLinkage()

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

Definition at line 231 of file LowerToLLVM.cpp.

◆ convertOpenCLKernelArgMetadata()

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

Definition at line 109 of file LowerToLLVMOpenCLMetadata.cpp.

◆ convertSideEffectForCall()

void cir::direct::convertSideEffectForCall ( mlir::Operation * callOp,
bool isNothrow,
cir::SideEffect sideEffect,
mlir::LLVM::MemoryEffectsAttr & memoryEffect,
bool & noUnwind,
bool & willReturn,
bool & noReturn )

Definition at line 423 of file LowerToLLVM.cpp.

Referenced by rewriteCallOrInvoke().

◆ convertTlsModelAttrToLLVM()

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

Definition at line 2887 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 1852 of file LowerToLLVM.cpp.

References getLLVMIntCast(), and isUnsigned().

◆ convertTypedArgAttrs()

mlir::ArrayAttr cir::direct::convertTypedArgAttrs ( mlir::ArrayAttr argAttrs,
const mlir::TypeConverter & converter,
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 record; remap it to the lowered LLVM type so translation to LLVM IR does not encounter a CIR type in an attribute. Returns the input unchanged when there is nothing to convert.

Definition at line 2107 of file LowerToLLVM.cpp.

Referenced by lowerCallAttributes().

◆ 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 466 of file LowerToLLVM.cpp.

Referenced by createConstrainedFCmpCall().

◆ createConstrainedFCmpCall()

mlir::LLVM::CallIntrinsicOp cir::direct::createConstrainedFCmpCall ( mlir::ConversionPatternRewriter & rewriter,
mlir::Location loc,
mlir::Value lhs,
mlir::Value rhs,
cir::CmpOpKind kind,
cir::FenvAttr fenv,
mlir::Type llvmResTy )
static

◆ createConvertCIRToLLVMPass()

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

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

Definition at line 5786 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 527 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

Definition at line 92 of file LowerToLLVM.cpp.

Referenced by castBitIntMemoryStorage(), emitFromMemory(), and emitToMemory().

◆ createLLVMFuncOpIfNotExist()

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

Definition at line 4505 of file LowerToLLVM.cpp.

References createLLVMFuncOpIfNotExist().

Referenced by createLLVMFuncOpIfNotExist().

◆ emitBoolVecConversion()

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

Definition at line 141 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 161 of file LowerToLLVM.cpp.

References castBitIntMemoryStorage(), createIntCast(), and emitBoolVecConversion().

◆ 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 199 of file LowerToLLVM.cpp.

References castBitIntMemoryStorage(), createIntCast(), and emitBoolVecConversion().

◆ getConstArrayBaseElementType()

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

Definition at line 2420 of file LowerToLLVM.cpp.

◆ getConstrainedExceptMetadata()

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

Definition at line 516 of file LowerToLLVM.cpp.

Referenced by createConstrainedFCmpCall(), and lowerToConstrainedFPIntrinsic().

◆ getConstrainedRoundingMetadata()

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

Definition at line 494 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 1316 of file LowerToLLVM.cpp.

◆ getLLVMBinopForPostAtomic()

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

Definition at line 1358 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 356 of file LowerToLLVM.cpp.

References isUnsigned().

Referenced by convertToIndexTy().

◆ getLLVMLandingPadStructTy()

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

Definition at line 4600 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 1187 of file LowerToLLVM.cpp.

◆ getLLVMSyncScope() [1/2]

llvm::StringRef cir::direct::getLLVMSyncScope ( cir::SyncScopeKind syncScope)
static

Definition at line 1206 of file LowerToLLVM.cpp.

Referenced by getLLVMSyncScope().

◆ getLLVMSyncScope() [2/2]

std::optional< llvm::StringRef > cir::direct::getLLVMSyncScope ( std::optional< cir::SyncScopeKind > syncScope)
static

Definition at line 1218 of file LowerToLLVM.cpp.

References getLLVMSyncScope().

◆ getMemoryFallbackAlignment()

uint64_t cir::direct::getMemoryFallbackAlignment ( 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 CIR _BitInt ABI alignment (e.g. 8).

Definition at line 83 of file LowerToLLVM.cpp.

◆ getTypeSize()

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

Definition at line 2577 of file LowerToLLVM.cpp.

◆ getValueForVTableSymbol()

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

Definition at line 4742 of file LowerToLLVM.cpp.

References getValueForVTableSymbol().

Referenced by getValueForVTableSymbol().

◆ intOverflowFlag()

template<typename BinOp>
mlir::LLVM::IntegerOverflowFlags cir::direct::intOverflowFlag ( BinOp op)
static

Definition at line 3281 of file LowerToLLVM.cpp.

Referenced by lowerSaturatableArithOp().

◆ isBulkLowerableConstArrayBaseElement()

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

Definition at line 2426 of file LowerToLLVM.cpp.

◆ isIntTypeUnsigned()

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

Definition at line 3269 of file LowerToLLVM.cpp.

Referenced by lowerIntBinaryOp(), lowerMinMaxOp(), and lowerSaturatableArithOp().

◆ isSignalingConstrainedFCmp()

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

Definition at line 3468 of file LowerToLLVM.cpp.

References kind.

Referenced by createConstrainedFCmpCall().

◆ 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 3609 of file LowerToLLVM.cpp.

References sign().

◆ lowerCallAttributes()

void cir::direct::lowerCallAttributes ( cir::CIRCallOpInterface op,
const mlir::TypeConverter & converter,
SmallVectorImpl< mlir::NamedAttribute > & result )
static

◆ lowerCirAttrAsValue()

mlir::Value cir::direct::lowerCirAttrAsValue ( mlir::Operation * parentOp,
mlir::Attribute attr,
mlir::ConversionPatternRewriter & rewriter,
mlir::SymbolTableCollection & symbolTables,
const mlir::TypeConverter * converter,
LLVMBlockAddressInfo * blockInfoAddr = nullptr )

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

Convert a CIR attribute to an LLVM attribute.

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 409 of file LowerToLLVM.cpp.

◆ lowerCIRVisibilityToLLVMVisibility()

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

Definition at line 129 of file LowerToLLVM.cpp.

◆ lowerConstrainableFPOp()

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

Definition at line 554 of file LowerToLLVM.cpp.

References lowerToConstrainedFPIntrinsic().

◆ 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 )

◆ lowerDirectlyFromCIRToLLVMIR() [2/2]

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

◆ lowerIncDecOp()

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

Definition at line 3175 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 Div/Rem op to its signed or unsigned LLVM counterpart.

Definition at line 3339 of file LowerToLLVM.cpp.

References isIntTypeUnsigned().

◆ 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 3367 of file LowerToLLVM.cpp.

References isIntTypeUnsigned().

◆ lowerSaturatableArithOp()

template<typename UIntSatOp, typename SIntSatOp, typename IntOp, typename CIROp>
mlir::LogicalResult cir::direct::lowerSaturatableArithOp ( CIROp op,
mlir::Value lhs,
mlir::Value rhs,
mlir::ConversionPatternRewriter & rewriter )
static

Lower an arithmetic op that supports saturation, overflow flags, and an FP Lower an integer Add/Sub op that may use saturating-arithmetic semantics.

Definition at line 3294 of file LowerToLLVM.cpp.

References intOverflowFlag(), and isIntTypeUnsigned().

◆ 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 3168 of file LowerToLLVM.cpp.

Referenced by lowerIncDecOp().

◆ populateCIRToLLVMPasses()

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

Adds passes that fully lower CIR to the LLVMIR dialect.

When enableOpenMP is set (-fopenmp), the OpenMP lowering passes are also added.

Definition at line 5790 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 154 of file LowerToLLVMIR.cpp.

Referenced by mlir::registerCIRDialectTranslation().

◆ 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 484 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,
mlir::SymbolTableCollection & symbolTables,
mlir::FlatSymbolRefAttr calleeAttr,
mlir::Block * continueBlock = nullptr,
mlir::Block * landingPadBlock = nullptr )
static

◆ shouldDropFuncAttribute()

bool cir::direct::shouldDropFuncAttribute ( cir::FuncOp func,
mlir::NamedAttribute attr,
mlir::StringRef linkageAttrName )
static

Return true for attributes constructed by LLVMFuncOp::build.

Definition at line 2662 of file LowerToLLVM.cpp.