[llvm-branch-commits] [llvm-branch] r201955 - define template newInitTags that is parametrized on
Gabor Greif
ggreif at gmail.com
Sat Feb 22 14:28:29 PST 2014
Author: ggreif
Date: Sat Feb 22 16:28:29 2014
New Revision: 201955
URL: http://llvm.org/viewvc/llvm-project?rev=201955&view=rev
Log:
define template newInitTags that is parametrized on
the size of pointers, and define Use::initTags in terms of
newInitTags<sizeof(Use*)>
(for now this will only compile on 64-bit archs)
Modified:
llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp
Modified: llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp?rev=201955&r1=201954&r2=201955&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp (original)
+++ llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp Sat Feb 22 16:28:29 2014
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#define private public
#include "llvm/IR/Value.h"
#include <new>
@@ -86,12 +87,16 @@ const Use *Use::getImpliedUser() const {
// Use initTags Implementation
//===----------------------------------------------------------------------===//
-Use *Use::initTags(Use * const Start, Use *Stop) {
+template <size_t>
+Use *newInitTags(Use * const Start, Use *Stop);
+
+template <>
+Use *newInitTags<8>(Use * const Start, Use *Stop) {
ptrdiff_t Done = 0;
while (Done < 32) {
if (Start == Stop--)
return Start;
-# define TAG_AT(N, TAG) ((unsigned long)(TAG ## Tag) << ((N) * 2))
+# define TAG_AT(N, TAG) ((unsigned long)(Use::TAG ## Tag) << ((N) * 2))
static const unsigned long tags =
TAG_AT(0, fullStop) | TAG_AT(1, oneDigit) | TAG_AT(2, stop) |
TAG_AT(3, oneDigit) | TAG_AT(4, oneDigit) | TAG_AT(5, stop) |
@@ -105,18 +110,18 @@ Use *Use::initTags(Use * const Start, Us
TAG_AT(26, zeroDigit) | TAG_AT(27, oneDigit) | TAG_AT(28, zeroDigit) |
TAG_AT(29, oneDigit) | TAG_AT(30, oneDigit) | TAG_AT(31, stop);
# undef TAG_AT
- new(Stop) Use(PrevPtrTag((tags >> Done++ * 2) & 0x3));
+ new(Stop) Use(Use::PrevPtrTag((tags >> Done++ * 2) & 0x3));
}
ptrdiff_t Count = Done;
while (Start != Stop) {
--Stop;
if (!Count) {
- new(Stop) Use(stopTag);
+ new(Stop) Use(Use::stopTag);
++Done;
Count = Done;
} else {
- new(Stop) Use(PrevPtrTag(Count & 1));
+ new(Stop) Use(Use::PrevPtrTag(Count & 1));
Count >>= 1;
++Done;
}
@@ -125,6 +130,10 @@ Use *Use::initTags(Use * const Start, Us
return Start;
}
+Use *Use::initTags(Use * const Start, Use *Stop) {
+ return newInitTags<sizeof(Use*)>(Start, Stop);
+}
+
//===----------------------------------------------------------------------===//
// Use zap Implementation
//===----------------------------------------------------------------------===//
More information about the llvm-branch-commits
mailing list