aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/IRBuilder.h
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-09-26 10:27:40 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-09-26 10:27:40 +0000
commit4d7aa6dbcedfbee7482b8473a63af5ac065380e8 (patch)
treef91d70792e41279111039a029c090bb9eeea752e /include/llvm/IRBuilder.h
parent9f4df20fe0d9d24f2ec3dc0b8e42698161e262e8 (diff)
downloadexternal_llvm-4d7aa6dbcedfbee7482b8473a63af5ac065380e8.zip
external_llvm-4d7aa6dbcedfbee7482b8473a63af5ac065380e8.tar.gz
external_llvm-4d7aa6dbcedfbee7482b8473a63af5ac065380e8.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/IRBuilder.h')
-rw-r--r--include/llvm/IRBuilder.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/llvm/IRBuilder.h b/include/llvm/IRBuilder.h
index ae82c25..ff64660 100644
--- a/include/llvm/IRBuilder.h
+++ b/include/llvm/IRBuilder.h
@@ -810,6 +810,31 @@ public:
StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) {
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,
SynchronizationScope SynchScope = CrossThread) {
return Insert(new FenceInst(Context, Ordering, SynchScope));