LLVM: lib/CodeGen/AtomicExpandPass.cpp File Reference (original) (raw)

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
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 Value * extractMaskedValue (IRBuilderBase &Builder, Value *WideWord, const PartwordMaskValues &PMV)
static Value * insertMaskedValue (IRBuilderBase &Builder, Value *WideWord, Value *Updated, const PartwordMaskValues &PMV)
static Value * performMaskedAtomicOp (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

DEBUG_TYPE

#define DEBUG_TYPE "atomic-expand"

atomicSizeSupported()

canUseSizedAtomicCall()

copyMetadataForAtomic()

createCmpXchgInstFun()

createMaskInstrs()

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 819 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()

getAtomicOpSize() [1/4]

getAtomicOpSize() [2/4]

getAtomicOpSize() [3/4]

getAtomicOpSize() [4/4]

GetRMWLibcall()

Definition at line 1810 of file AtomicExpandPass.cpp.

References llvm::AtomicRMWInst::Add, llvm::AtomicRMWInst::And, llvm::ArrayRef(), llvm::AtomicRMWInst::BAD_BINOP, llvm::AtomicRMWInst::FAdd, llvm::AtomicRMWInst::FMax, llvm::AtomicRMWInst::FMaximum, llvm::AtomicRMWInst::FMin, llvm::AtomicRMWInst::FMinimum, llvm::AtomicRMWInst::FSub, llvm_unreachable, llvm::AtomicRMWInst::Max, llvm::AtomicRMWInst::Min, llvm::AtomicRMWInst::Nand, llvm::AtomicRMWInst::Or, llvm::AtomicRMWInst::Sub, llvm::AtomicRMWInst::UDecWrap, llvm::AtomicRMWInst::UIncWrap, llvm::AtomicRMWInst::UMax, llvm::AtomicRMWInst::UMin, llvm::AtomicRMWInst::USubCond, llvm::AtomicRMWInst::USubSat, llvm::AtomicRMWInst::Xchg, and llvm::AtomicRMWInst::Xor.

INITIALIZE_PASS_BEGIN()

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

insertMaskedValue()

performMaskedAtomicOp()

Emit IR to implement a masked version of a given atomicrmw operation.

(That is, only the bits under the Mask should be affected by the operation)

Definition at line 917 of file AtomicExpandPass.cpp.

References llvm::AtomicRMWInst::Add, llvm::AtomicRMWInst::And, llvm::buildAtomicRMWValue(), extractMaskedValue(), llvm::AtomicRMWInst::FAdd, llvm::AtomicRMWInst::FMax, llvm::AtomicRMWInst::FMaximum, llvm::AtomicRMWInst::FMin, llvm::AtomicRMWInst::FMinimum, llvm::AtomicRMWInst::FSub, insertMaskedValue(), llvm_unreachable, llvm::AtomicRMWInst::Max, llvm::AtomicRMWInst::Min, llvm::AtomicRMWInst::Nand, llvm::AtomicRMWInst::Or, llvm::AtomicRMWInst::Sub, llvm::AtomicRMWInst::UDecWrap, llvm::AtomicRMWInst::UIncWrap, llvm::AtomicRMWInst::UMax, llvm::AtomicRMWInst::UMin, llvm::AtomicRMWInst::USubCond, llvm::AtomicRMWInst::USubSat, llvm::AtomicRMWInst::Xchg, and llvm::AtomicRMWInst::Xor.

DEBUG_TYPE

false

instructions

Expand Atomic instructions

Definition at line 184 of file AtomicExpandPass.cpp.

Referenced by addBoundsChecking(), llvm::SystemZTTIImpl::adjustInliningThreshold(), llvm::coro::Shape::analyze(), llvm::X86TTIImpl::areInlineCompatible(), bitTrackingDCE(), canTRE(), checkFunctionMemoryAccess(), collectDbgVariableRecords(), collectDebugInfoFromInstructions(), collectMemAccessInfo(), collectPreserveStaticOffsetCalls(), llvm::coro::collectSpillsAndAllocasFromInsts(), convertAnnotation2Metadata(), llvm::coro::doRematerializations(), dumpExampleDependence(), 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(), runNVVMIntrRange(), llvm::RewriteStatepointsForGC::runOnFunction(), runPass(), runUniformIntrinsicCombine(), sinkLifetimeStartMarkers(), stripDeadDebugInfoImpl(), stripGCRelocates(), stripNonValidDataFromBody(), stripTBAA(), tagInvariantLoads(), updateCGAndAnalysisManagerForPass(), and usesMSVCFloatingPoint().