|
clang 24.0.0git
|
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 |
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 unsigned | getBitIntMemoryStorageBits (cir::IntType ty, const mlir::DataLayout &dataLayout) |
| In-memory storage width in bits for a _BitInt(N): N rounded up to the type's ABI alignment. | |
| static bool | isSplitStorageBitInt (cir::IntType ty, const mlir::DataLayout &dataLayout) |
| A _BitInt(N) whose padded storage integer iM has a larger alloc size than its M/8 store size is laid out by clang as a byte array, not a plain integer (e.g. | |
| static mlir::Type | convertTypeForMemory (const mlir::TypeConverter &converter, mlir::DataLayout const &dataLayout, mlir::Type type) |
| Given a type convertor and a data layout, convert the given type to a type that is suitable for memory operations. | |
| 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 | emitFromMemory (mlir::ConversionPatternRewriter &rewriter, 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, 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) |
| static mlir::LLVM::CallIntrinsicOp | replaceOpWithCallLLVMIntrinsicOp (mlir::ConversionPatternRewriter &rewriter, mlir::Operation *op, const llvm::Twine &intrinsicName, mlir::Type resultTy, mlir::ValueRange operands) |
| 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 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. | |
| 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::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, const mlir::TypeConverter *converter, mlir::FlatSymbolRefAttr nameAttr, mlir::Type &eltType) |
| mlir::IntegerType | computeBitfieldIntType (mlir::Type storageType, mlir::MLIRContext *context, unsigned &storageSize) |
| std::unique_ptr< llvm::Module > | lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, LLVMContext &llvmCtx, bool enableOpenMP, StringRef mlirSaveTempsOutFile, llvm::vfs::FileSystem *fs) |
| void | registerCIRDialectTranslation (mlir::DialectRegistry ®istry) |
|
static |
Definition at line 3632 of file LowerToLLVM.cpp.
Referenced by cir::direct::ConvertCIRToLLVMPass::runOnOperation().
|
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 170 of file LowerToLLVM.cpp.
References createIntCast(), and getBitIntMemoryStorageBits().
Referenced by emitFromMemory(), and emitToMemory().
| mlir::IntegerType cir::direct::computeBitfieldIntType | ( | mlir::Type | storageType, |
| mlir::MLIRContext * | context, | ||
| unsigned & | storageSize ) |
Definition at line 4831 of file LowerToLLVM.cpp.
References computeBitfieldIntType().
Referenced by computeBitfieldIntType().
|
static |
Definition at line 271 of file LowerToLLVM.cpp.
|
static |
Convert from a CIR comparison kind to an LLVM IR floating-point comparison kind.
Definition at line 3139 of file LowerToLLVM.cpp.
References kind.
|
static |
Convert from a CIR comparison kind to an LLVM IR integral comparison kind.
Definition at line 3113 of file LowerToLLVM.cpp.
References kind.
| mlir::LLVM::Linkage cir::direct::convertLinkage | ( | cir::GlobalLinkageKind | linkage | ) |
Definition at line 240 of file LowerToLLVM.cpp.
| 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 418 of file LowerToLLVM.cpp.
Referenced by rewriteCallOrInvoke().
|
static |
Definition at line 1643 of file LowerToLLVM.cpp.
References getLLVMIntCast(), and isUnsigned().
|
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 1890 of file LowerToLLVM.cpp.
Referenced by lowerCallAttributes().
|
static |
Given a type convertor and a data layout, convert the given type to a type that is suitable for memory operations.
For example, this can be used to lower cir.bool accesses to i8.
Definition at line 108 of file LowerToLLVM.cpp.
References getBitIntMemoryStorageBits(), and isSplitStorageBitInt().
Referenced by prepareTypeConverter().
|
static |
Definition at line 461 of file LowerToLLVM.cpp.
Referenced by replaceOpWithCallLLVMIntrinsicOp().
| std::unique_ptr< mlir::Pass > cir::direct::createConvertCIRToLLVMPass | ( | ) |
Create a pass that fully lowers CIR to the LLVMIR dialect.
Definition at line 5275 of file LowerToLLVM.cpp.
References createConvertCIRToLLVMPass().
Referenced by createConvertCIRToLLVMPass(), and populateCIRToLLVMPasses().
|
static |
Definition at line 145 of file LowerToLLVM.cpp.
Referenced by castBitIntMemoryStorage(), emitFromMemory(), and emitToMemory().
| void cir::direct::createLLVMFuncOpIfNotExist | ( | mlir::ConversionPatternRewriter & | rewriter, |
| mlir::Operation * | srcOp, | ||
| llvm::StringRef | fnName, | ||
| mlir::Type | fnTy, | ||
| mlir::ArrayAttr | argAttrs = nullptr, | ||
| mlir::ArrayAttr | resAttrs = nullptr ) |
Definition at line 4145 of file LowerToLLVM.cpp.
References createLLVMFuncOpIfNotExist().
Referenced by createLLVMFuncOpIfNotExist().
|
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 196 of file LowerToLLVM.cpp.
References castBitIntMemoryStorage(), and createIntCast().
|
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 219 of file LowerToLLVM.cpp.
References castBitIntMemoryStorage(), and createIntCast().
|
static |
In-memory storage width in bits for a _BitInt(N): N rounded up to the type's ABI alignment.
This equals sizeof(_BitInt(N)) * 8 on the default target (e.g. _BitInt(6) -> 8, _BitInt(17) -> 32, _BitInt(128) -> 128).
Definition at line 82 of file LowerToLLVM.cpp.
Referenced by castBitIntMemoryStorage(), convertTypeForMemory(), and isSplitStorageBitInt().
|
static |
Definition at line 2198 of file LowerToLLVM.cpp.
|
static |
Definition at line 1129 of file LowerToLLVM.cpp.
|
static |
Definition at line 1171 of file LowerToLLVM.cpp.
|
static |
Definition at line 365 of file LowerToLLVM.cpp.
References isUnsigned().
Referenced by convertToIndexTy().
|
static |
Definition at line 4236 of file LowerToLLVM.cpp.
References getLLVMLandingPadStructTy().
Referenced by getLLVMLandingPadStructTy().
|
static |
Definition at line 1000 of file LowerToLLVM.cpp.
|
static |
Definition at line 1019 of file LowerToLLVM.cpp.
Referenced by getLLVMSyncScope().
|
static |
Definition at line 1031 of file LowerToLLVM.cpp.
References getLLVMSyncScope().
|
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 136 of file LowerToLLVM.cpp.
|
static |
Definition at line 2352 of file LowerToLLVM.cpp.
|
static |
Definition at line 4378 of file LowerToLLVM.cpp.
References getValueForVTableSymbol().
Referenced by getValueForVTableSymbol().
|
static |
Definition at line 3000 of file LowerToLLVM.cpp.
Referenced by lowerSaturatableArithOp().
|
static |
Definition at line 2204 of file LowerToLLVM.cpp.
|
static |
Definition at line 2988 of file LowerToLLVM.cpp.
Referenced by lowerIntBinaryOp(), lowerMinMaxOp(), and lowerSaturatableArithOp().
|
static |
A _BitInt(N) whose padded storage integer iM has a larger alloc size than its M/8 store size is laid out by clang as a byte array, not a plain integer (e.g.
_BitInt(129) -> i192 with alloc size 32 != store size 24). That "split" storage form is not yet implemented; lowerings must detect it and report errorNYI rather than emit the wrong-sized integer.
Definition at line 93 of file LowerToLLVM.cpp.
References getBitIntMemoryStorageBits().
Referenced by convertTypeForMemory().
|
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 3261 of file LowerToLLVM.cpp.
References sign().
|
static |
Definition at line 1921 of file LowerToLLVM.cpp.
References convertTypedArgAttrs(), and cir::MissingFeatures::opFuncExtraAttrs().
Referenced by rewriteCallOrInvoke().
| mlir::Value cir::direct::lowerCirAttrAsValue | ( | mlir::Operation * | parentOp, |
| mlir::Attribute | attr, | ||
| mlir::ConversionPatternRewriter & | rewriter, | ||
| 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 406 of file LowerToLLVM.cpp.
|
static |
Definition at line 182 of file LowerToLLVM.cpp.
| std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR | ( | mlir::ModuleOp | mlirModule, |
| llvm::LLVMContext & | llvmCtx, | ||
| bool | enableOpenMP, | ||
| llvm::StringRef | mlirSaveTempsOutFile = {}, | ||
| llvm::vfs::FileSystem * | fs = nullptr ) |
Referenced by lowerDirectlyFromCIRToLLVMIR().
| std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR | ( | mlir::ModuleOp | mlirModule, |
| LLVMContext & | llvmCtx, | ||
| bool | enableOpenMP, | ||
| StringRef | mlirSaveTempsOutFile, | ||
| llvm::vfs::FileSystem * | fs ) |
Definition at line 5289 of file LowerToLLVM.cpp.
References lowerDirectlyFromCIRToLLVMIR(), populateCIRToLLVMPasses(), and mlir::registerCIRDialectTranslation().
|
static |
Definition at line 2908 of file LowerToLLVM.cpp.
References nswFlag().
|
static |
Lower an integer Div/Rem op to its signed or unsigned LLVM counterpart.
Definition at line 3058 of file LowerToLLVM.cpp.
References isIntTypeUnsigned().
|
static |
Definition at line 3086 of file LowerToLLVM.cpp.
References isIntTypeUnsigned().
|
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 3013 of file LowerToLLVM.cpp.
References intOverflowFlag(), and isIntTypeUnsigned().
|
static |
Definition at line 2901 of file LowerToLLVM.cpp.
Referenced by lowerIncDecOp().
| 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 5279 of file LowerToLLVM.cpp.
References createConvertCIRToLLVMPass(), mlir::populateCIRPreLoweringPasses(), and populateCIRToLLVMPasses().
Referenced by lowerDirectlyFromCIRToLLVMIR(), and populateCIRToLLVMPasses().
|
static |
Definition at line 3492 of file LowerToLLVM.cpp.
References cir::MissingFeatures::addressSpace(), and convertTypeForMemory().
Referenced by cir::direct::ConvertCIRToLLVMPass::runOnOperation().
| void cir::direct::registerCIRDialectTranslation | ( | mlir::DialectRegistry & | registry | ) |
Definition at line 154 of file LowerToLLVMIR.cpp.
Referenced by mlir::registerCIRDialectTranslation().
|
static |
Definition at line 474 of file LowerToLLVM.cpp.
References createCallLLVMIntrinsicOp().
|
static |
Definition at line 1946 of file LowerToLLVM.cpp.
References convertSideEffectForCall(), lowerCallAttributes(), and cir::MissingFeatures::opCallCallConv().