32 Load->setVolatile(
true);
41 for (
Value *Arg : Args)
52 FunctionCallee LibcallFn = M->getOrInsertFunction(fnName, FnType, fnAttrs);
86 return std::make_pair(ExpectedVal, Result);
100 Inst->setWeak(IsWeak);
103 return std::make_pair(PreviousVal, SuccessFailureVal);
106std::pair<LoadInst *, AllocaInst *>
116 ConstantInt::get(
DL.getIntPtrType(Ctx), this->getAtomicSizeInBits() / 8));
120 Args.push_back(PtrVal);
123 const Align AllocaAlignment =
DL.getPrefTypeAlign(SizedIntTy);
125 Args.push_back(AllocaResult);
128 Args.push_back(OrderingVal);
132 for (
Value *Arg : Args)
136 M->getOrInsertFunction(
"__atomic_load", FnType, Attr);
138 Call->setAttributes(Attr);
139 return std::make_pair(
152 Failure, IsVolatile, IsWeak);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static StringRef getName(Value *V)
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
void setAlignment(Align Align)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
std::pair< Value *, Value * > EmitAtomicCompareExchange(Value *ExpectedVal, Value *DesiredVal, AtomicOrdering Success, AtomicOrdering Failure, bool IsVolatile, bool IsWeak)
virtual AllocaInst * CreateAlloca(Type *Ty, const Twine &Name) const =0
std::pair< LoadInst *, AllocaInst * > EmitAtomicLoadLibcall(AtomicOrdering AO)
std::pair< Value *, Value * > EmitAtomicCompareExchangeOp(Value *ExpectedVal, Value *DesiredVal, AtomicOrdering Success, AtomicOrdering Failure, bool IsVolatile=false, bool IsWeak=false)
uint64_t getAtomicSizeInBits() const
Value * EmitAtomicLoadOp(AtomicOrdering AO, bool IsVolatile, bool CmpXchg=false)
virtual Value * getAtomicPointer() const =0
std::pair< Value *, Value * > EmitAtomicCompareExchangeLibcall(Value *ExpectedVal, Value *DesiredVal, AtomicOrdering Success, AtomicOrdering Failure)
bool shouldCastToInt(Type *ValTy, bool CmpXchg)
uint64_t AtomicSizeInBits
LLVMContext & getLLVMContext() const
Value * getAtomicAddressAsAtomicIntPointer() const
virtual void decorateWithTBAA(Instruction *I)=0
CallInst * EmitAtomicLibcall(StringRef fnName, Type *ResultType, ArrayRef< Value * > Args)
Value * getAtomicSizeValue() const
bool shouldUseLibcall() const
Align getAtomicAlignment() const
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute > > Attrs)
Create an AttributeList with the specified parameters in it.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
This class represents a function call, abstracting a target machine's calling convention.
This is an important base class in LLVM.
static Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
A parsed version of the target data layout string in and methods for querying it.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Class to represent function types.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
AtomicCmpXchgInst * CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID=SyncScope::System)
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, MaybeAlign Align, const char *Name)
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
BasicBlock * GetInsertBlock() const
LLVMContext & getContext() const
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * CreateAddrSpaceCast(Value *V, Type *DestTy, const Twine &Name="")
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isX86_FP80Ty() const
Return true if this is x86 long double.
bool isPointerTy() const
True if this is an instance of PointerType.
static IntegerType * getInt1Ty(LLVMContext &C)
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static Type * getVoidTy(LLVMContext &C)
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
static IntegerType * getInt32Ty(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
LLVM Value Representation.
@ System
Synchronized with respect to all concurrently executing threads.
This is an optimization pass for GlobalISel generic memory operations.
AtomicOrderingCABI toCABI(AtomicOrdering AO)
AtomicOrdering
Atomic ordering for LLVM's memory model.
This struct is a compact representation of a valid (non-zero power of two) alignment.