20#define DEBUG_TYPE "loweratomic"
34 Res =
Builder.CreateInsertValue(Res, Equal, 1);
49 return Builder.CreateAdd(Loaded, Val,
"new");
51 return Builder.CreateSub(Loaded, Val,
"new");
53 return Builder.CreateAnd(Loaded, Val,
"new");
57 return Builder.CreateOr(Loaded, Val,
"new");
59 return Builder.CreateXor(Loaded, Val,
"new");
61 NewVal =
Builder.CreateICmpSGT(Loaded, Val);
62 return Builder.CreateSelect(NewVal, Loaded, Val,
"new");
64 NewVal =
Builder.CreateICmpSLE(Loaded, Val);
65 return Builder.CreateSelect(NewVal, Loaded, Val,
"new");
67 NewVal =
Builder.CreateICmpUGT(Loaded, Val);
68 return Builder.CreateSelect(NewVal, Loaded, Val,
"new");
70 NewVal =
Builder.CreateICmpULE(Loaded, Val);
71 return Builder.CreateSelect(NewVal, Loaded, Val,
"new");
73 return Builder.CreateFAdd(Loaded, Val,
"new");
75 return Builder.CreateFSub(Loaded, Val,
"new");
77 return Builder.CreateMaxNum(Loaded, Val);
79 return Builder.CreateMinNum(Loaded, Val);
85 return Builder.CreateSelect(Cmp, Zero, Inc,
"new");
95 return Builder.CreateSelect(
Or, Val, Dec,
"new");
An instruction that atomically checks whether a specified value is in a memory location,...
Value * getNewValOperand()
Value * getCompareOperand()
Value * getPointerOperand()
an instruction that atomically reads a memory location, combines it with another value,...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
@ Min
*p = old <signed v ? old : v
@ UIncWrap
Increment one up to a maximum value.
@ Max
*p = old >signed v ? old : v
@ UMin
*p = old <unsigned v ? old : v
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
@ UMax
*p = old >unsigned v ? old : v
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
@ UDecWrap
Decrement one until a minimum value or zero.
Value * getPointerOperand()
BinOp getOperation() const
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Common base class shared among various IRBuilders.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const Function * getFunction() const
Return the function this instruction belongs to.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
An instruction for reading from memory.
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Value * buildAtomicRMWValue(AtomicRMWInst::BinOp Op, IRBuilderBase &Builder, Value *Loaded, Value *Val)
Emit IR to implement the given atomicrmw operation on values in registers, returning the new value.
@ Or
Bitwise or logical OR of integers.
bool lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI)
Convert the given Cmpxchg into primitive load and compare.
bool lowerAtomicRMWInst(AtomicRMWInst *RMWI)
Convert the given RMWI into primitive load and stores, assuming that doing so is legal.