summaryrefslogtreecommitdiff
path: root/lib/CodeGen/IntrinsicLowering.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-09-07 04:06:50 +0000
committerOwen Anderson <resistor@mac.com>2007-09-07 04:06:50 +0000
commit718cb665ca6ce2bc4d8e8479f46a45db91b49f86 (patch)
tree51ddca6b6eead9bf38aafd5507e6c3c06048f0ad /lib/CodeGen/IntrinsicLowering.cpp
parentaf992f782fb2cac8d00b352c3dd73f6e782b5758 (diff)
downloadllvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.tar.gz
llvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.tar.bz2
llvm-718cb665ca6ce2bc4d8e8479f46a45db91b49f86.tar.xz
Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IntrinsicLowering.cpp')
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index da6a876e83..ab55710b6e 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -20,6 +20,7 @@
#include "llvm/Support/Streams.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/STLExtras.h"
using namespace llvm;
template <class ArgIt>
@@ -421,7 +422,7 @@ static Instruction *LowerPartSelect(CallInst *CI) {
CI->getOperand(2),
CI->getOperand(3)
};
- return new CallInst(F, Args, Args+sizeof(Args)/sizeof(Args[0]), CI->getName(), CI);
+ return new CallInst(F, Args, array_endof(Args), CI->getName(), CI);
}
/// Convert the llvm.part.set.iX.iY.iZ intrinsic. This intrinsic takes
@@ -587,7 +588,7 @@ static Instruction *LowerPartSet(CallInst *CI) {
CI->getOperand(3),
CI->getOperand(4)
};
- return new CallInst(F, Args, Args+sizeof(Args)/sizeof(Args[0]), CI->getName(), CI);
+ return new CallInst(F, Args, array_endof(Args), CI->getName(), CI);
}