[llvm-branch-commits] [llvm-branch] r201956 - perform the initTags -> newInitTags redirection in the header
Gabor Greif
ggreif at gmail.com
Sat Feb 22 15:10:11 PST 2014
Author: ggreif
Date: Sat Feb 22 17:10:10 2014
New Revision: 201956
URL: http://llvm.org/viewvc/llvm-project?rev=201956&view=rev
Log:
perform the initTags -> newInitTags redirection in the header
also make newInitTags a static class method
Modified:
llvm/branches/ggreif/waymark-64-new/include/llvm/IR/Use.h
llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp
Modified: llvm/branches/ggreif/waymark-64-new/include/llvm/IR/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64-new/include/llvm/IR/Use.h?rev=201956&r1=201955&r2=201956&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64-new/include/llvm/IR/Use.h (original)
+++ llvm/branches/ggreif/waymark-64-new/include/llvm/IR/Use.h Sat Feb 22 17:10:10 2014
@@ -116,7 +116,7 @@ public:
/// initTags - initialize the waymarking tags on an array of Uses, so that
/// getUser() can find the User from any of those Uses.
- static Use *initTags(Use *Start, Use *Stop);
+ inline static Use *initTags(Use *Start, Use *Stop);
/// zap - This is used to destroy Use operands when the number of operands of
/// a User changes.
@@ -124,7 +124,9 @@ public:
private:
const Use* getImpliedUser() const;
-
+ template <size_t>
+ static Use *newInitTags(Use * const Start, Use *Stop);
+
Value *Val;
Use *Next;
PointerIntPair<Use**, 2, PrevPtrTag> Prev;
@@ -147,6 +149,16 @@ private:
friend class Value;
};
+
+// Out-of-class specializations/definitions.
+template<>
+Use * Use::newInitTags<8>(Use * const Start, Use *Stop);
+
+inline Use * Use::initTags(Use *Start, Use *Stop) {
+ return newInitTags<sizeof(Use*)>(Start, Stop);
+}
+
+
// simplify_type - Allow clients to treat uses just like values when using
// casting operators.
template<> struct simplify_type<Use> {
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=201956&r1=201955&r2=201956&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 17:10:10 2014
@@ -87,16 +87,13 @@ const Use *Use::getImpliedUser() const {
// Use initTags Implementation
//===----------------------------------------------------------------------===//
-template <size_t>
-Use *newInitTags(Use * const Start, Use *Stop);
-
template <>
-Use *newInitTags<8>(Use * const Start, Use *Stop) {
+Use * 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)(Use::TAG ## Tag) << ((N) * 2))
+# define TAG_AT(N, TAG) ((unsigned long)(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) |
@@ -110,18 +107,18 @@ Use *newInitTags<8>(Use * const Start, U
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(Use::PrevPtrTag((tags >> Done++ * 2) & 0x3));
+ new(Stop) Use(PrevPtrTag((tags >> Done++ * 2) & 0x3));
}
ptrdiff_t Count = Done;
while (Start != Stop) {
--Stop;
if (!Count) {
- new(Stop) Use(Use::stopTag);
+ new(Stop) Use(stopTag);
++Done;
Count = Done;
} else {
- new(Stop) Use(Use::PrevPtrTag(Count & 1));
+ new(Stop) Use(PrevPtrTag(Count & 1));
Count >>= 1;
++Done;
}
@@ -130,10 +127,6 @@ Use *newInitTags<8>(Use * const Start, U
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