clang 23.0.0git
cir Namespace Reference

Namespaces

namespace  acc
namespace  detail
namespace  direct
namespace  omp

Classes

class  ABIArgInfo
class  CIRABIRewriteContext
 CIR-specific implementation of mlir::abi::ABIRewriteContext. More...
class  CIRBaseBuilderTy
class  CIRCXXABI
class  CIRDataLayout
class  CIRGenAction
class  CIRGenConsumer
class  CIRGenerator
class  EmitAssemblyAction
class  EmitBCAction
class  EmitCIRAction
class  EmitLLVMAction
class  EmitObjAction
class  LowerModule
struct  MissingFeatures
class  TargetLoweringInfo

Enumerations

enum class  OverflowBehavior { None = 0 , NoSignedWrap = 1 << 0 , NoUnsignedWrap = 1 << 1 , Saturated = 1 << 2 }
enum  TypeEvaluationKind { TEK_Scalar , TEK_Complex , TEK_Aggregate }

Functions

mlir::LogicalResult runCIRToCIRPasses (mlir::ModuleOp theModule, mlir::MLIRContext &mlirCtx, clang::ASTContext &astCtx, bool enableVerifier, bool enableIdiomRecognizer, bool enableCIRSimplify)
constexpr OverflowBehavior operator| (OverflowBehavior a, OverflowBehavior b)
constexpr OverflowBehavior operator& (OverflowBehavior a, OverflowBehavior b)
constexpr OverflowBehavioroperator|= (OverflowBehavior &a, OverflowBehavior b)
constexpr OverflowBehavioroperator&= (OverflowBehavior &a, OverflowBehavior b)
constexpr bool testFlag (OverflowBehavior ob, OverflowBehavior flag)
void buildTerminatedBody (mlir::OpBuilder &builder, mlir::Location loc)
RecordLayoutAttr getRecordLayout (mlir::ModuleOp module, mlir::StringAttr name)
 Look up the RecordLayoutAttr for a named record in the module's cir.record_layouts dictionary.
static bool isExternalLinkage (GlobalLinkageKind linkage)
static bool isAvailableExternallyLinkage (GlobalLinkageKind linkage)
static bool isLinkOnceAnyLinkage (GlobalLinkageKind linkage)
static bool isLinkOnceODRLinkage (GlobalLinkageKind linkage)
static bool isLinkOnceLinkage (GlobalLinkageKind linkage)
static bool isWeakAnyLinkage (GlobalLinkageKind linkage)
static bool isWeakODRLinkage (GlobalLinkageKind linkage)
static bool isWeakLinkage (GlobalLinkageKind linkage)
static bool isInternalLinkage (GlobalLinkageKind linkage)
static bool isPrivateLinkage (GlobalLinkageKind linkage)
static bool isLocalLinkage (GlobalLinkageKind linkage)
static bool isExternalWeakLinkage (GlobalLinkageKind linkage)
static bool isCommonLinkage (GlobalLinkageKind linkage)
static bool isAppendingLinkage (GlobalLinkageKind linkage)
static bool isValidDeclarationLinkage (GlobalLinkageKind linkage)
static bool isInterposableLinkage (GlobalLinkageKind linkage)
 Whether the definition of this global may be replaced by something non-equivalent at link time.
static bool isDiscardableIfUnused (GlobalLinkageKind linkage)
 Whether the definition of this global may be discarded if it is not used in its compilation unit.
static bool isWeakForLinker (GlobalLinkageKind linkage)
 Whether the definition of this global may be replaced at link time.
static bool isValidLinkage (GlobalLinkageKind gl)
bool operator< (cir::MemOrder, cir::MemOrder)=delete
bool operator> (cir::MemOrder, cir::MemOrder)=delete
bool operator<= (cir::MemOrder, cir::MemOrder)=delete
bool operator>= (cir::MemOrder, cir::MemOrder)=delete
template<typename Int>
bool isValidCIRAtomicOrderingCABI (Int value)
bool isValidFundamentalIntWidth (unsigned width)
bool isSized (mlir::Type ty)
 Returns true if the type is a CIR sized type.
cir::LangAddressSpace toCIRLangAddressSpace (clang::LangAS langAS)
bool isMatchingAddressSpace (mlir::ptr::MemorySpaceAttrInterface cirAS, clang::LangAS as)
mlir::ptr::MemorySpaceAttrInterface toCIRAddressSpaceAttr (mlir::MLIRContext &ctx, clang::LangAS langAS)
 Convert an AST LangAS to the appropriate CIR address space attribute interface.
mlir::ptr::MemorySpaceAttrInterface normalizeDefaultAddressSpace (mlir::ptr::MemorySpaceAttrInterface addrSpace)
 Normalize LangAddressSpace::Default to null (empty attribute).
bool isSupportedCIRMemorySpaceAttr (mlir::ptr::MemorySpaceAttrInterface memorySpace)
mlir::Block * replaceCallWithTryCall (cir::CallOp callOp, mlir::Block *unwindDest, mlir::Location loc, mlir::RewriterBase &rewriter)
 Replace a cir::CallOp with a cir::TryCallOp whose unwind destination is unwindDest.
mlir::Block * replaceThrowWithTryThrow (cir::ThrowOp throwOp, mlir::Block *unwindDest, mlir::Location loc, mlir::RewriterBase &rewriter)
 Replace a cir::ThrowOp with a cir::TryThrowOp whose unwind destination is unwindDest.
void collectUnreachable (mlir::Operation *parent, llvm::SmallVectorImpl< mlir::Operation * > &ops)
 Collect ops in blocks that are unreachable from their region's entry, appending them to ops.
std::unique_ptr< CIRCXXABIcreateItaniumCXXABI (LowerModule &lm)
 Creates an Itanium-family ABI.
static cir::IntType getPtrDiffCIRTy (LowerModule &lm)
static mlir::Value lowerDataMemberCast (mlir::Operation *op, mlir::Value loweredSrc, std::int64_t offset, bool isDerivedToBase, mlir::OpBuilder &builder)
static mlir::Value lowerMethodCast (mlir::Operation *op, mlir::Value loweredSrc, std::int64_t offset, bool isDerivedToBase, bool useARMMethodPtrABI, LowerModule &lowerMod, mlir::OpBuilder &builder)
static void buildBadCastCall (mlir::OpBuilder &builder, mlir::Location loc, mlir::FlatSymbolRefAttr badCastFuncRef)
static mlir::Value buildDynamicCastAfterNullCheck (cir::DynamicCastOp op, mlir::OpBuilder &builder)
static mlir::Value buildDynamicCastToVoidAfterNullCheck (cir::DynamicCastOp op, cir::LowerModule &lm, mlir::OpBuilder &builder)
static std::unique_ptr< CIRCXXABIcreateCXXABI (LowerModule &lm)
static std::unique_ptr< TargetLoweringInfocreateTargetLoweringInfo (LowerModule &lm)
std::unique_ptr< LowerModulecreateLowerModule (mlir::ModuleOp module)
std::unique_ptr< TargetLoweringInfocreateAMDGPUTargetLoweringInfo ()
std::unique_ptr< TargetLoweringInfocreateNVPTXTargetLoweringInfo ()
std::unique_ptr< TargetLoweringInfocreateSPIRVTargetLoweringInfo ()
static BackendAction getBackendActionFromOutputType (CIRGenAction::OutputType Action)
static std::unique_ptr< llvm::Module > lowerFromCIRToLLVMIR (mlir::ModuleOp MLIRModule, llvm::LLVMContext &LLVMCtx, llvm::StringRef mlirSaveTempsOutFile={}, llvm::vfs::FileSystem *fs=nullptr)

Enumeration Type Documentation

◆ OverflowBehavior

enum class cir::OverflowBehavior
strong
Enumerator
None 
NoSignedWrap 
NoUnsignedWrap 
Saturated 

Definition at line 31 of file CIRBaseBuilder.h.

◆ TypeEvaluationKind

Enumerator
TEK_Scalar 
TEK_Complex 
TEK_Aggregate 

Definition at line 17 of file TypeEvaluationKind.h.

Function Documentation

◆ buildBadCastCall()

void cir::buildBadCastCall ( mlir::OpBuilder & builder,
mlir::Location loc,
mlir::FlatSymbolRefAttr badCastFuncRef )
static

Definition at line 685 of file LowerItaniumCXXABI.cpp.

Referenced by buildDynamicCastAfterNullCheck().

◆ buildDynamicCastAfterNullCheck()

mlir::Value cir::buildDynamicCastAfterNullCheck ( cir::DynamicCastOp op,
mlir::OpBuilder & builder )
static

C++ [expr.dynamic.cast]p9: A failed cast to reference type throws std::bad_cast

Definition at line 697 of file LowerItaniumCXXABI.cpp.

References cir::MissingFeatures::addressSpace(), and buildBadCastCall().

◆ buildDynamicCastToVoidAfterNullCheck()

mlir::Value cir::buildDynamicCastToVoidAfterNullCheck ( cir::DynamicCastOp op,
cir::LowerModule & lm,
mlir::OpBuilder & builder )
static

◆ buildTerminatedBody()

void cir::buildTerminatedBody ( mlir::OpBuilder & builder,
mlir::Location loc )

◆ collectUnreachable()

void cir::collectUnreachable ( mlir::Operation * parent,
llvm::SmallVectorImpl< mlir::Operation * > & ops )

Collect ops in blocks that are unreachable from their region's entry, appending them to ops.

Used by CIR passes that drive applyPartialConversion and need to feed it operations the conversion driver's dominance-order traversal would otherwise skip.

Definition at line 15 of file CIRTransformUtils.cpp.

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

◆ createAMDGPUTargetLoweringInfo()

std::unique_ptr< TargetLoweringInfo > cir::createAMDGPUTargetLoweringInfo ( )

Definition at line 43 of file AMDGPU.cpp.

Referenced by createTargetLoweringInfo().

◆ createCXXABI()

std::unique_ptr< CIRCXXABI > cir::createCXXABI ( LowerModule & lm)
static

◆ createItaniumCXXABI()

std::unique_ptr< CIRCXXABI > cir::createItaniumCXXABI ( LowerModule & lm)

Creates an Itanium-family ABI.

Definition at line 128 of file LowerItaniumCXXABI.cpp.

References cir::MissingFeatures::appleArm64CXXABI(), and cir::LowerModule::getCXXABIKind().

Referenced by createCXXABI().

◆ createLowerModule()

◆ createNVPTXTargetLoweringInfo()

std::unique_ptr< TargetLoweringInfo > cir::createNVPTXTargetLoweringInfo ( )

Definition at line 36 of file NVPTX.cpp.

Referenced by createTargetLoweringInfo().

◆ createSPIRVTargetLoweringInfo()

std::unique_ptr< TargetLoweringInfo > cir::createSPIRVTargetLoweringInfo ( )

Definition at line 39 of file SPIRV.cpp.

Referenced by createTargetLoweringInfo().

◆ createTargetLoweringInfo()

◆ getBackendActionFromOutputType()

◆ getPtrDiffCIRTy()

◆ getRecordLayout()

RecordLayoutAttr cir::getRecordLayout ( mlir::ModuleOp module,
mlir::StringAttr name )

Look up the RecordLayoutAttr for a named record in the module's cir.record_layouts dictionary.

Asserts if the entry is missing.

Definition at line 844 of file CIRAttrs.cpp.

◆ isAppendingLinkage()

bool cir::isAppendingLinkage ( GlobalLinkageKind linkage)
static

Definition at line 60 of file CIROpsEnums.h.

◆ isAvailableExternallyLinkage()

bool cir::isAvailableExternallyLinkage ( GlobalLinkageKind linkage)
static

Definition at line 24 of file CIROpsEnums.h.

Referenced by isDiscardableIfUnused().

◆ isCommonLinkage()

bool cir::isCommonLinkage ( GlobalLinkageKind linkage)
static

Definition at line 57 of file CIROpsEnums.h.

◆ isDiscardableIfUnused()

bool cir::isDiscardableIfUnused ( GlobalLinkageKind linkage)
static

Whether the definition of this global may be discarded if it is not used in its compilation unit.

Definition at line 95 of file CIROpsEnums.h.

References isAvailableExternallyLinkage(), isLinkOnceLinkage(), and isLocalLinkage().

Referenced by getCIRGenToUse().

◆ isExternalLinkage()

bool cir::isExternalLinkage ( GlobalLinkageKind linkage)
static

Definition at line 21 of file CIROpsEnums.h.

Referenced by isValidDeclarationLinkage(), and isValidLinkage().

◆ isExternalWeakLinkage()

bool cir::isExternalWeakLinkage ( GlobalLinkageKind linkage)
static

Definition at line 54 of file CIROpsEnums.h.

Referenced by isValidDeclarationLinkage().

◆ isInternalLinkage()

bool cir::isInternalLinkage ( GlobalLinkageKind linkage)
static

Definition at line 45 of file CIROpsEnums.h.

Referenced by isLocalLinkage().

◆ isInterposableLinkage()

bool cir::isInterposableLinkage ( GlobalLinkageKind linkage)
static

Whether the definition of this global may be replaced by something non-equivalent at link time.

For example, if a function has weak linkage then the code defining it may be replaced by different code.

Definition at line 71 of file CIROpsEnums.h.

◆ isLinkOnceAnyLinkage()

bool cir::isLinkOnceAnyLinkage ( GlobalLinkageKind linkage)
static

Definition at line 27 of file CIROpsEnums.h.

Referenced by isLinkOnceLinkage().

◆ isLinkOnceLinkage()

bool cir::isLinkOnceLinkage ( GlobalLinkageKind linkage)
static

◆ isLinkOnceODRLinkage()

bool cir::isLinkOnceODRLinkage ( GlobalLinkageKind linkage)
static

Definition at line 30 of file CIROpsEnums.h.

Referenced by isLinkOnceLinkage().

◆ isLocalLinkage()

bool cir::isLocalLinkage ( GlobalLinkageKind linkage)
static

◆ isMatchingAddressSpace()

bool cir::isMatchingAddressSpace ( mlir::ptr::MemorySpaceAttrInterface cirAS,
clang::LangAS as )

Definition at line 1196 of file CIRTypes.cpp.

References clang::Default, normalizeDefaultAddressSpace(), and toCIRAddressSpaceAttr().

Referenced by emitBuiltinAlloca().

◆ isPrivateLinkage()

bool cir::isPrivateLinkage ( GlobalLinkageKind linkage)
static

Definition at line 48 of file CIROpsEnums.h.

Referenced by isLocalLinkage().

◆ isSized()

bool cir::isSized ( mlir::Type ty)

Returns true if the type is a CIR sized type.

Types are sized if they implement SizedTypeInterface and return true from its method isSized.

Unsized types are those that do not have a size, such as void, or abstract types.

Definition at line 34 of file CIRTypes.cpp.

References cir::MissingFeatures::unsizedTypes().

Referenced by clang::CIRGen::CIRGenTypes::convertType(), determineNoUndef(), and cir::CIRDataLayout::getTypeSizeInBits().

◆ isSupportedCIRMemorySpaceAttr()

bool cir::isSupportedCIRMemorySpaceAttr ( mlir::ptr::MemorySpaceAttrInterface memorySpace)

Definition at line 1044 of file CIRTypes.cpp.

◆ isValidCIRAtomicOrderingCABI()

template<typename Int>
bool cir::isValidCIRAtomicOrderingCABI ( Int value)
inline

◆ isValidDeclarationLinkage()

bool cir::isValidDeclarationLinkage ( GlobalLinkageKind linkage)
static

Definition at line 64 of file CIROpsEnums.h.

References isExternalLinkage(), and isExternalWeakLinkage().

◆ isValidFundamentalIntWidth()

bool cir::isValidFundamentalIntWidth ( unsigned width)

Definition at line 630 of file CIRTypes.cpp.

Referenced by clang::CIRGen::CIRGenBuilderTy::getArrayElement().

◆ isValidLinkage()

bool cir::isValidLinkage ( GlobalLinkageKind gl)
static

Definition at line 113 of file CIROpsEnums.h.

References isExternalLinkage(), isLinkOnceLinkage(), isLocalLinkage(), and isWeakLinkage().

Referenced by getCIRGenToUse().

◆ isWeakAnyLinkage()

bool cir::isWeakAnyLinkage ( GlobalLinkageKind linkage)
static

Definition at line 36 of file CIROpsEnums.h.

Referenced by isWeakLinkage().

◆ isWeakForLinker()

bool cir::isWeakForLinker ( GlobalLinkageKind linkage)
static

Whether the definition of this global may be replaced at link time.

NB: Using this method outside of the code generators is almost always a mistake: when working at the IR level use isInterposable instead as it knows about ODR semantics.

Definition at line 104 of file CIROpsEnums.h.

Referenced by clang::CIRGen::CIRGenModule::createOrReplaceCXXRuntimeVariable(), and getCIRGenToUse().

◆ isWeakLinkage()

bool cir::isWeakLinkage ( GlobalLinkageKind linkage)
static

Definition at line 42 of file CIROpsEnums.h.

References isWeakAnyLinkage(), and isWeakODRLinkage().

Referenced by isValidLinkage().

◆ isWeakODRLinkage()

bool cir::isWeakODRLinkage ( GlobalLinkageKind linkage)
static

Definition at line 39 of file CIROpsEnums.h.

Referenced by getThreadLocalWrapperLinkage(), and isWeakLinkage().

◆ lowerDataMemberCast()

mlir::Value cir::lowerDataMemberCast ( mlir::Operation * op,
mlir::Value loweredSrc,
std::int64_t offset,
bool isDerivedToBase,
mlir::OpBuilder & builder )
static

Definition at line 430 of file LowerItaniumCXXABI.cpp.

◆ lowerFromCIRToLLVMIR()

std::unique_ptr< llvm::Module > cir::lowerFromCIRToLLVMIR ( mlir::ModuleOp MLIRModule,
llvm::LLVMContext & LLVMCtx,
llvm::StringRef mlirSaveTempsOutFile = {},
llvm::vfs::FileSystem * fs = nullptr )
static

Definition at line 59 of file CIRGenAction.cpp.

Referenced by cir::CIRGenConsumer::HandleTranslationUnit().

◆ lowerMethodCast()

mlir::Value cir::lowerMethodCast ( mlir::Operation * op,
mlir::Value loweredSrc,
std::int64_t offset,
bool isDerivedToBase,
bool useARMMethodPtrABI,
LowerModule & lowerMod,
mlir::OpBuilder & builder )
static

Definition at line 480 of file LowerItaniumCXXABI.cpp.

References getPtrDiffCIRTy().

◆ normalizeDefaultAddressSpace()

mlir::ptr::MemorySpaceAttrInterface cir::normalizeDefaultAddressSpace ( mlir::ptr::MemorySpaceAttrInterface addrSpace)

Normalize LangAddressSpace::Default to null (empty attribute).

Definition at line 1172 of file CIRTypes.cpp.

Referenced by isMatchingAddressSpace().

◆ operator&()

OverflowBehavior cir::operator& ( OverflowBehavior a,
OverflowBehavior b )
constexpr

Definition at line 43 of file CIRBaseBuilder.h.

References b.

◆ operator&=()

OverflowBehavior & cir::operator&= ( OverflowBehavior & a,
OverflowBehavior b )
constexpr

Definition at line 54 of file CIRBaseBuilder.h.

References b.

◆ operator<()

bool cir::operator< ( cir::MemOrder ,
cir::MemOrder  )
delete

◆ operator<=()

bool cir::operator<= ( cir::MemOrder ,
cir::MemOrder  )
delete

◆ operator>()

bool cir::operator> ( cir::MemOrder ,
cir::MemOrder  )
delete

◆ operator>=()

bool cir::operator>= ( cir::MemOrder ,
cir::MemOrder  )
delete

◆ operator|()

OverflowBehavior cir::operator| ( OverflowBehavior a,
OverflowBehavior b )
constexpr

Definition at line 38 of file CIRBaseBuilder.h.

References b.

◆ operator|=()

OverflowBehavior & cir::operator|= ( OverflowBehavior & a,
OverflowBehavior b )
constexpr

Definition at line 48 of file CIRBaseBuilder.h.

References b.

◆ replaceCallWithTryCall()

mlir::Block * cir::replaceCallWithTryCall ( cir::CallOp callOp,
mlir::Block * unwindDest,
mlir::Location loc,
mlir::RewriterBase & rewriter )

Replace a cir::CallOp with a cir::TryCallOp whose unwind destination is unwindDest.

The call's parent block is split immediately after the call; the resulting suffix block becomes the try_call's normal destination and is returned to the caller.

All attributes of the original call other than the callee and operand segment sizes (which TryCallOp::create sets itself) are copied onto the new try_call. Uses of the original call's result, if any, are redirected to the try_call's result, and the original call is erased.

The call must not already be marked nothrow.

Definition at line 48 of file CIRTransformUtils.cpp.

◆ replaceThrowWithTryThrow()

mlir::Block * cir::replaceThrowWithTryThrow ( cir::ThrowOp throwOp,
mlir::Block * unwindDest,
mlir::Location loc,
mlir::RewriterBase & rewriter )

Replace a cir::ThrowOp with a cir::TryThrowOp whose unwind destination is unwindDest.

The throw's parent block is split immediately after the throw; the resulting suffix block (which should contain the cir.unreachable that follows every throw) becomes the try_throw's normal destination and is returned to the caller.

All attributes of the original throw other than the operand segment sizes (which TryThrowOp::create sets itself) are copied onto the new try_throw, and the original throw is erased.

Definition at line 109 of file CIRTransformUtils.cpp.

◆ runCIRToCIRPasses()

mlir::LogicalResult cir::runCIRToCIRPasses ( mlir::ModuleOp theModule,
mlir::MLIRContext & mlirCtx,
clang::ASTContext & astCtx,
bool enableVerifier,
bool enableIdiomRecognizer,
bool enableCIRSimplify )

◆ testFlag()

bool cir::testFlag ( OverflowBehavior ob,
OverflowBehavior flag )
constexpr

◆ toCIRAddressSpaceAttr()

mlir::ptr::MemorySpaceAttrInterface cir::toCIRAddressSpaceAttr ( mlir::MLIRContext & ctx,
clang::LangAS langAS )

Convert an AST LangAS to the appropriate CIR address space attribute interface.

Definition at line 1182 of file CIRTypes.cpp.

References clang::isTargetAddressSpace(), toCIRLangAddressSpace(), and clang::toTargetAddressSpace().

Referenced by cir::CIRBaseBuilderTy::getPointerTo(), isMatchingAddressSpace(), and clang::CIRGen::CIRGenFunction::maybeCastStackAddressSpace().

◆ toCIRLangAddressSpace()

cir::LangAddressSpace cir::toCIRLangAddressSpace ( clang::LangAS langAS)

Definition at line 1050 of file CIRTypes.cpp.

Referenced by toCIRAddressSpaceAttr().