Change memcpy/memset/memmove to have dest and source alignments.
[oota-llvm.git] / include / llvm / IR / IntrinsicInst.h
index 169bcc021984f57cba154f85f67a633f202397d7..ba75e4ca8de27724b80020d5ce592325b7a25651 100644 (file)
@@ -150,16 +150,13 @@ namespace llvm {
     const Use &getLengthUse() const { return getArgOperandUse(2); }
     Use &getLengthUse() { return getArgOperandUse(2); }
 
-    ConstantInt *getAlignmentCst() const {
-      return cast<ConstantInt>(const_cast<Value*>(getArgOperand(3)));
-    }
-
-    unsigned getAlignment() const {
-      return getAlignmentCst()->getZExtValue();
+    unsigned getDestAlignment() const {
+      // Note, param attributes start at 1, so offset dest index from 0 to 1.
+      return getParamAlignment(1);
     }
 
     ConstantInt *getVolatileCst() const {
-      return cast<ConstantInt>(const_cast<Value*>(getArgOperand(4)));
+      return cast<ConstantInt>(const_cast<Value*>(getArgOperand(3)));
     }
     bool isVolatile() const {
       return !getVolatileCst()->isZero();
@@ -188,16 +185,13 @@ namespace llvm {
       setArgOperand(2, L);
     }
 
-    void setAlignment(Constant* A) {
-      setArgOperand(3, A);
+    void setDestAlignment(unsigned Align) {
+      // Note, param attributes start at 1, so offset dest index from 0 to 1.
+      setParamAlignment(1, Align);
     }
 
     void setVolatile(Constant* V) {
-      setArgOperand(4, V);
-    }
-
-    Type *getAlignmentType() const {
-      return getArgOperand(3)->getType();
+      setArgOperand(3, V);
     }
 
     // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -259,12 +253,22 @@ namespace llvm {
       return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
     }
 
+    unsigned getSrcAlignment() const {
+      // Note, param attributes start at 1, so offset src index from 1 to 2.
+      return getParamAlignment(2);
+    }
+
     void setSource(Value *Ptr) {
       assert(getRawSource()->getType() == Ptr->getType() &&
              "setSource called with pointer of wrong type!");
       setArgOperand(1, Ptr);
     }
 
+    void setSrcAlignment(unsigned Align) {
+      // Note, param attributes start at 1, so offset src index from 1 to 2.
+      setParamAlignment(2, Align);
+    }
+
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const IntrinsicInst *I) {
       return I->getIntrinsicID() == Intrinsic::memcpy ||