Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
AtomicExpandPass.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "atomic-expand"

Functions

 INITIALIZE_PASS_BEGIN (AtomicExpandLegacy, DEBUG_TYPE, "Expand Atomic instructions", false, false) INITIALIZE_PASS_END(AtomicExpandLegacy
Expand Atomic static false unsigned getAtomicOpSize (LoadInst *LI)
static unsigned getAtomicOpSize (StoreInst *SI)
static unsigned getAtomicOpSize (AtomicRMWInst *RMWI)
static unsigned getAtomicOpSize (AtomicCmpXchgInst *CASI)
static void copyMetadataForAtomic (Instruction &Dest, const Instruction &Source)
 Copy metadata that's safe to preserve when widening atomics.
template<typename Inst>
static bool atomicSizeSupported (const TargetLowering *TLI, Inst *I)
static void createCmpXchgInstFun (IRBuilderBase &Builder, Value *Addr, Value *Loaded, Value *NewVal, Align AddrAlign, AtomicOrdering MemOpOrder, SyncScope::ID SSID, Value *&Success, Value *&NewLoaded, Instruction *MetadataSrc)
static PartwordMaskValues createMaskInstrs (IRBuilderBase &Builder, Instruction *I, Type *ValueType, Value *Addr, Align AddrAlign, unsigned MinWordSize)
 This is a helper function which builds instructions to provide values necessary for partword atomic operations.
static ValueextractMaskedValue (IRBuilderBase &Builder, Value *WideWord, const PartwordMaskValues &PMV)
static ValueinsertMaskedValue (IRBuilderBase &Builder, Value *WideWord, Value *Updated, const PartwordMaskValues &PMV)
static ValueperformMaskedAtomicOp (AtomicRMWInst::BinOp Op, IRBuilderBase &Builder, Value *Loaded, Value *Shifted_Inc, Value *Inc, const PartwordMaskValues &PMV)
 Emit IR to implement a masked version of a given atomicrmw operation.
static bool canUseSizedAtomicCall (unsigned Size, Align Alignment, const DataLayout &DL)
static ArrayRef< RTLIB::Libcall > GetRMWLibcall (AtomicRMWInst::BinOp Op)

Variables

 DEBUG_TYPE
Expand Atomic instructions
Expand Atomic false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "atomic-expand"

Definition at line 59 of file AtomicExpandPass.cpp.

Function Documentation

◆ atomicSizeSupported()

template<typename Inst>
bool atomicSizeSupported ( const TargetLowering * TLI,
Inst * I )
static

◆ canUseSizedAtomicCall()

bool canUseSizedAtomicCall ( unsigned Size,
Align Alignment,
const DataLayout & DL )
static

Definition at line 1743 of file AtomicExpandPass.cpp.

References DL, and Size.

◆ copyMetadataForAtomic()

void copyMetadataForAtomic ( Instruction & Dest,
const Instruction & Source )
static

Copy metadata that's safe to preserve when widening atomics.

Definition at line 207 of file AtomicExpandPass.cpp.

References llvm::Value::getContext(), N, and llvm::Instruction::setMetadata().

Referenced by createCmpXchgInstFun().

◆ createCmpXchgInstFun()

◆ createMaskInstrs()

PartwordMaskValues createMaskInstrs ( IRBuilderBase & Builder,
Instruction * I,
Type * ValueType,
Value * Addr,
Align AddrAlign,
unsigned MinWordSize )
static

This is a helper function which builds instructions to provide values necessary for partword atomic operations.

It takes an incoming address, Addr, and ValueType, and constructs the address, shift-amounts and masks needed to work with a larger value of size WordSize.

AlignedAddr: Addr rounded down to a multiple of WordSize

ShiftAmt: Number of bits to right-shift a WordSize value loaded from AlignAddr for it to have the same value as if ValueType was loaded from Addr.

Mask: Value to mask with the value loaded from AlignAddr to include only the part that would've been loaded from Addr.

Inv_Mask: The inverse of Mask.

Definition at line 818 of file AtomicExpandPass.cpp.

References assert(), llvm::cast(), DL, llvm::Type::getIntNTy(), llvm::Constant::getNullValue(), llvm::Value::getType(), I, llvm::Type::isFloatingPointTy(), and llvm::Type::isVectorTy().

◆ extractMaskedValue()

Value * extractMaskedValue ( IRBuilderBase & Builder,
Value * WideWord,
const PartwordMaskValues & PMV )
static

Definition at line 885 of file AtomicExpandPass.cpp.

References assert(), and llvm::Value::getType().

Referenced by performMaskedAtomicOp().

◆ getAtomicOpSize() [1/4]

◆ getAtomicOpSize() [2/4]

◆ getAtomicOpSize() [3/4]

Expand Atomic static false unsigned getAtomicOpSize ( LoadInst * LI)
static

Definition at line 186 of file AtomicExpandPass.cpp.

References DL, and getAtomicOpSize().

Referenced by atomicSizeSupported(), and getAtomicOpSize().

◆ getAtomicOpSize() [4/4]

unsigned getAtomicOpSize ( StoreInst * SI)
static

Definition at line 191 of file AtomicExpandPass.cpp.

References DL.

◆ GetRMWLibcall()

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AtomicExpandLegacy ,
DEBUG_TYPE ,
"Expand Atomic instructions" ,
false ,
false  )

◆ insertMaskedValue()

Value * insertMaskedValue ( IRBuilderBase & Builder,
Value * WideWord,
Value * Updated,
const PartwordMaskValues & PMV )
static

Definition at line 896 of file AtomicExpandPass.cpp.

References assert(), and llvm::Value::getType().

Referenced by performMaskedAtomicOp().

◆ performMaskedAtomicOp()

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 182 of file AtomicExpandPass.cpp.

◆ false

Expand Atomic false

Definition at line 183 of file AtomicExpandPass.cpp.

◆ instructions

Expand Atomic instructions

Definition at line 183 of file AtomicExpandPass.cpp.

Referenced by addBoundsChecking(), llvm::SystemZTTIImpl::adjustInliningThreshold(), llvm::coro::Shape::analyze(), llvm::X86TTIImpl::areInlineCompatible(), bitTrackingDCE(), canTRE(), checkFunctionMemoryAccess(), collectDbgVariableRecords(), collectMemAccessInfo(), collectPreserveStaticOffsetCalls(), llvm::coro::collectSpillsAndAllocasFromInsts(), convertAnnotation2Metadata(), llvm::coro::doRematerializations(), eliminateDeadCode(), eraseDebugIntrinsicsWithNonLocalRefs(), explicifyGuards(), FixupDebugInfoForOutlinedFunction(), fixupDebugInfoPostExtraction(), functionWillReturn(), getEdgeKind(), llvm::GenericUniformityAnalysisImpl< ContextT >::initialize(), INITIALIZE_PASS(), insertCallAtAllFunctionExitPoints(), lowerAllowChecks(), llvm::MLInlineAdvisor::MLInlineAdvisor(), llvm::InstDeleterIRStrategy::mutate(), llvm::ScalarEvolution::print(), llvm::StackSafetyGlobalInfo::print(), processDbgDeclares(), removeTailCallAttribute(), llvm::replaceCreatedSSACopys(), llvm::coro::BaseCloner::replaceEntryBlock(), rescheduleLexographically(), llvm::AliasSetsPrinterPass::run(), llvm::AMDGPULowerKernelAttributesPass::run(), llvm::AssumeBuilderPass::run(), llvm::DevirtSCCRepeatedPass::run(), llvm::DSEPass::run(), llvm::InlinerPass::run(), llvm::KCFIPass::run(), llvm::MemDerefPrinterPass::run(), llvm::ModuleInlinerPass::run(), llvm::MustBeExecutedContextPrinterPass::run(), llvm::PAEvalPass::run(), llvm::StackLifetimePrinterPass::run(), runImpl(), runImpl(), runImpl(), runImpl(), runImpl(), runNVVMIntrRange(), llvm::RewriteStatepointsForGC::runOnFunction(), runPass(), sinkLifetimeStartMarkers(), stripDeadDebugInfoImpl(), stripGCRelocates(), stripNonValidDataFromBody(), stripTBAA(), tagInvariantLoads(), updateCGAndAnalysisManagerForPass(), and usesMSVCFloatingPoint().