clang 24.0.0git
CIRGenAtomic.cpp File Reference

Go to the source code of this file.

Functions

static Address emitValToTemp (CIRGenFunction &cgf, Expr *e)
static bool isFullSizeType (CIRGenModule &cgm, mlir::Type ty, uint64_t expectedSize)
 Does a store of the given IR type modify the full expected width?
static bool shouldCastToInt (mlir::Type valueTy, bool cmpxchg)
 Return true if.
static void emitDefaultCaseLabel (CIRGenBuilderTy &builder, mlir::Location loc)
static void emitMemOrderCaseLabel (CIRGenBuilderTy &builder, mlir::Location loc, mlir::Type orderType, llvm::ArrayRef< cir::MemOrder > orders)
static void emitAtomicCmpXchg (CIRGenFunction &cgf, AtomicExpr *e, bool isWeak, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, uint64_t size, cir::MemOrder successOrder, cir::MemOrder failureOrder, cir::SyncScopeKind scope)
static void emitAtomicCmpXchgFailureSet (CIRGenFunction &cgf, AtomicExpr *e, bool isWeak, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, Expr *failureOrderExpr, uint64_t size, cir::MemOrder successOrder, cir::SyncScopeKind scope)
static void emitAtomicCmpXchgFailureSetCheckWeak (CIRGenFunction &cgf, AtomicExpr *e, Expr *isWeakExpr, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, Expr *failureOrderExpr, uint64_t size, cir::MemOrder successOrder, cir::SyncScopeKind scope)
static void setAMDGPUAtomicMetadata (CIRGenFunction &cgf, mlir::Operation *op)
 Attach the AMDGPU atomic metadata markers that the current atomic options call for.
static void emitAtomicOp (CIRGenFunction &cgf, AtomicExpr *expr, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, Expr *isWeakExpr, Expr *failureOrderExpr, int64_t size, cir::MemOrder order, cir::SyncScopeKind scope)
static cir::SyncScopeKind convertSyncScopeToCIR (CIRGenFunction &cgf, SourceRange range, clang::SyncScope scope)
static void emitAtomicOp (CIRGenFunction &cgf, AtomicExpr *expr, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, Expr *isWeakExpr, Expr *failureOrderExpr, int64_t size, cir::MemOrder order, const std::optional< Expr::EvalResult > &scopeConst, mlir::Value scopeValue)
static std::optional< cir::MemOrder > getEffectiveAtomicMemOrder (cir::MemOrder oriOrder, bool isStore, bool isLoad, bool isFence)
static void emitAtomicExprWithDynamicMemOrder (CIRGenFunction &cgf, mlir::Value order, bool isStore, bool isLoad, bool isFence, llvm::function_ref< void(cir::MemOrder)> emitAtomicOpFn)
static RValue emitAtomicLibCall (CIRGenFunction &cgf, llvm::StringRef funcName, QualType resultType, CallArgList &args)
static RValue emitLibCallForAtomicExpr (CIRGenFunction &cgf, AtomicExpr *e, Address atomicPtr, Address dest, Address val1, Address val2, uint64_t atomicTySize, QualType resultTy)

Function Documentation

◆ convertSyncScopeToCIR()

◆ emitAtomicCmpXchg()

void emitAtomicCmpXchg ( CIRGenFunction & cgf,
AtomicExpr * e,
bool isWeak,
Address dest,
Address ptr,
Address val1,
Address val2,
Address expectedResult,
uint64_t size,
cir::MemOrder successOrder,
cir::MemOrder failureOrder,
cir::SyncScopeKind scope )
static

◆ emitAtomicCmpXchgFailureSet()

◆ emitAtomicCmpXchgFailureSetCheckWeak()

void emitAtomicCmpXchgFailureSetCheckWeak ( CIRGenFunction & cgf,
AtomicExpr * e,
Expr * isWeakExpr,
Address dest,
Address ptr,
Address val1,
Address val2,
Address expectedResult,
Expr * failureOrderExpr,
uint64_t size,
cir::MemOrder successOrder,
cir::SyncScopeKind scope )
static

◆ emitAtomicExprWithDynamicMemOrder()

void emitAtomicExprWithDynamicMemOrder ( CIRGenFunction & cgf,
mlir::Value order,
bool isStore,
bool isLoad,
bool isFence,
llvm::function_ref< void(cir::MemOrder)> emitAtomicOpFn )
static

◆ emitAtomicLibCall()

◆ emitAtomicOp() [1/2]

◆ emitAtomicOp() [2/2]

void emitAtomicOp ( CIRGenFunction & cgf,
AtomicExpr * expr,
Address dest,
Address ptr,
Address val1,
Address val2,
Address expectedResult,
Expr * isWeakExpr,
Expr * failureOrderExpr,
int64_t size,
cir::MemOrder order,
const std::optional< Expr::EvalResult > & scopeConst,
mlir::Value scopeValue )
static

◆ emitDefaultCaseLabel()

void emitDefaultCaseLabel ( CIRGenBuilderTy & builder,
mlir::Location loc )
static

Definition at line 462 of file CIRGenAtomic.cpp.

Referenced by emitAtomicOp().

◆ emitLibCallForAtomicExpr()

RValue emitLibCallForAtomicExpr ( CIRGenFunction & cgf,
AtomicExpr * e,
Address atomicPtr,
Address dest,
Address val1,
Address val2,
uint64_t atomicTySize,
QualType resultTy )
static

◆ emitMemOrderCaseLabel()

void emitMemOrderCaseLabel ( CIRGenBuilderTy & builder,
mlir::Location loc,
mlir::Type orderType,
llvm::ArrayRef< cir::MemOrder > orders )
static

Definition at line 472 of file CIRGenAtomic.cpp.

Referenced by emitAtomicCmpXchgFailureSet().

◆ emitValToTemp()

◆ getEffectiveAtomicMemOrder()

std::optional< cir::MemOrder > getEffectiveAtomicMemOrder ( cir::MemOrder oriOrder,
bool isStore,
bool isLoad,
bool isFence )
static

◆ isFullSizeType()

bool isFullSizeType ( CIRGenModule & cgm,
mlir::Type ty,
uint64_t expectedSize )
static

Does a store of the given IR type modify the full expected width?

Definition at line 173 of file CIRGenAtomic.cpp.

References clang::CIRGen::CIRGenModule::getDataLayout(), and cir::CIRDataLayout::getTypeStoreSize().

◆ setAMDGPUAtomicMetadata()

void setAMDGPUAtomicMetadata ( CIRGenFunction & cgf,
mlir::Operation * op )
static

Attach the AMDGPU atomic metadata markers that the current atomic options call for.

The "no.X" metadata is emitted when the corresponding option is off, since it asserts the absence of that memory kind. The clang::atomic attribute is what turns the options on and off.

Definition at line 668 of file CIRGenAtomic.cpp.

References cir::MissingFeatures::atomicAMDGPUAvailableVisibleMMRA(), cir::MissingFeatures::atomicAMDGPUNoaliasAddrspace(), clang::CIRGen::CIRGenFunction::cgm, clang::FineGrainedMemory, clang::CIRGen::CIRGenModule::getAtomicOpts(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::AtomicOptions::getOption(), clang::IgnoreDenormalMode, and clang::RemoteMemory.

Referenced by emitAtomicOp().

◆ shouldCastToInt()

bool shouldCastToInt ( mlir::Type valueTy,
bool cmpxchg )
static

Return true if.

Parameters
valueTyis a type that should be casted to integer around the atomic memory operation. If
cmpxchgis true, then the cast of a floating point type is made as that instruction can not have floating point operands. TODO: Allow compare-and-exchange and FP - see comment in CIRGenAtomicExpandPass.cpp.

Definition at line 329 of file CIRGenAtomic.cpp.

References clang::isa().

Referenced by clang::CodeGen::CodeGenFunction::EmitAtomicExpr(), clang::CIRGen::CIRGenFunction::emitAtomicExpr(), clang::CodeGen::CodeGenFunction::EmitAtomicStore(), and clang::CIRGen::CIRGenFunction::emitAtomicStore().