1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Add some convenience methods to IRBuilder for constructing aligned loads

and stores. These will be used in subsequnet patches to SROA to more
systematically manage the alignment on loads and stores.

llvm-svn: 164688
This commit is contained in:
Chandler Carruth 2012-09-26 10:27:40 +00:00
parent f8c0be6df4
commit 8d729fba5a

View File

@ -810,6 +810,31 @@ public:
StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) { StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) {
return Insert(new StoreInst(Val, Ptr, isVolatile)); return Insert(new StoreInst(Val, Ptr, isVolatile));
} }
// Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly,
// instead of converting the string to 'bool' for the isVolatile parameter.
LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name) {
LoadInst *LI = CreateLoad(Ptr, Name);
LI->setAlignment(Align);
return LI;
}
LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align,
const Twine &Name = "") {
LoadInst *LI = CreateLoad(Ptr, Name);
LI->setAlignment(Align);
return LI;
}
LoadInst *CreateAlignedLoad(Value *Ptr, unsigned Align, bool isVolatile,
const Twine &Name = "") {
LoadInst *LI = CreateLoad(Ptr, isVolatile, Name);
LI->setAlignment(Align);
return LI;
}
StoreInst *CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align,
bool isVolatile = false) {
StoreInst *SI = CreateStore(Val, Ptr, isVolatile);
SI->setAlignment(Align);
return SI;
}
FenceInst *CreateFence(AtomicOrdering Ordering, FenceInst *CreateFence(AtomicOrdering Ordering,
SynchronizationScope SynchScope = CrossThread) { SynchronizationScope SynchScope = CrossThread) {
return Insert(new FenceInst(Context, Ordering, SynchScope)); return Insert(new FenceInst(Context, Ordering, SynchScope));