Skip to content
Snippets Groups Projects
Commit 1de6ecb2 authored by Richard Linden's avatar Richard Linden
Browse files

SH-3405 WIP convert existing stats to lltrace system

converted "int" to "S32"
parent 28179ab0
No related branches found
No related tags found
No related merge requests found
...@@ -31,10 +31,10 @@ namespace LLPredicate ...@@ -31,10 +31,10 @@ namespace LLPredicate
{ {
EmptyRule make_rule() { return EmptyRule(); } EmptyRule make_rule() { return EmptyRule(); }
int predicateFlagsFromValue(int value) S32 predicateFlagsFromValue(S32 value)
{ {
llassert(value < 5); llassert(value < 5);
static const int predicates[5] = static const S32 predicates[5] =
{ {
0xAAAAaaaa, // 10101010101010101010101010101010 0xAAAAaaaa, // 10101010101010101010101010101010
0xCCCCcccc, // 11001100110011001100110011001100 0xCCCCcccc, // 11001100110011001100110011001100
......
...@@ -33,7 +33,7 @@ namespace LLPredicate ...@@ -33,7 +33,7 @@ namespace LLPredicate
{ {
template<typename ENUM> class Rule; template<typename ENUM> class Rule;
int predicateFlagsFromValue(int value); S32 predicateFlagsFromValue(S32 value);
template<typename ENUM> template<typename ENUM>
struct Value struct Value
...@@ -41,31 +41,35 @@ namespace LLPredicate ...@@ -41,31 +41,35 @@ namespace LLPredicate
friend Rule<ENUM>; friend Rule<ENUM>;
public: public:
Value(ENUM e) Value(ENUM e)
: mPredicateCombinationFlags(0x1) : mPredicateCombinationFlags(0xFFFFffff)
{ {
add(e); add(e);
} }
Value() Value()
: mPredicateCombinationFlags(0x1) : mPredicateCombinationFlags(0xFFFFffff)
{} {}
void add(ENUM predicate) void add(ENUM predicate)
{ {
llassert(predicate < 5); llassert(predicate < 5);
if (!has(predicate)) S32 predicate_shift = 0x1 << (S32)predicate;
{ S32 flag_mask = predicateFlagsFromValue(predicate);
int predicate_shift = 0x1 << (int)predicate; S32 flags_to_modify = mPredicateCombinationFlags & ~flag_mask;
mPredicateCombinationFlags <<= predicate_shift; // clear flags containing predicate to be removed
} mPredicateCombinationFlags &= ~flag_mask;
// shift flags, in effect removing predicate
flags_to_modify <<= predicate_shift;
// put modified flags back
mPredicateCombinationFlags |= flags_to_modify;
} }
void remove(ENUM predicate) void remove(ENUM predicate)
{ {
llassert(predicate < 5); llassert(predicate < 5);
int predicate_shift = 0x1 << (int)predicate; S32 predicate_shift = 0x1 << (S32)predicate;
int flag_mask = predicateFlagsFromValue(predicate); S32 flag_mask = predicateFlagsFromValue(predicate);
int flags_to_modify = mPredicateCombinationFlags & flag_mask; S32 flags_to_modify = mPredicateCombinationFlags & flag_mask;
// clear flags containing predicate to be removed // clear flags containing predicate to be removed
mPredicateCombinationFlags &= ~flag_mask; mPredicateCombinationFlags &= ~flag_mask;
// shift flags, in effect removing predicate // shift flags, in effect removing predicate
...@@ -77,7 +81,7 @@ namespace LLPredicate ...@@ -77,7 +81,7 @@ namespace LLPredicate
void unknown(ENUM predicate) void unknown(ENUM predicate)
{ {
add(predicate); add(predicate);
int flags_with_predicate = mPredicateCombinationFlags; S32 flags_with_predicate = mPredicateCombinationFlags;
remove(predicate); remove(predicate);
// unknown is result of adding and removing predicate at the same time! // unknown is result of adding and removing predicate at the same time!
mPredicateCombinationFlags |= flags_with_predicate; mPredicateCombinationFlags |= flags_with_predicate;
...@@ -85,12 +89,12 @@ namespace LLPredicate ...@@ -85,12 +89,12 @@ namespace LLPredicate
bool has(ENUM predicate) bool has(ENUM predicate)
{ {
int flag_mask = predicateFlagsFromValue(predicate); S32 flag_mask = predicateFlagsFromValue(predicate);
return (mPredicateCombinationFlags & flag_mask) != 0; return (mPredicateCombinationFlags & flag_mask) != 0;
} }
private: private:
int mPredicateCombinationFlags; S32 mPredicateCombinationFlags;
}; };
struct EmptyRule {}; struct EmptyRule {};
...@@ -144,7 +148,7 @@ namespace LLPredicate ...@@ -144,7 +148,7 @@ namespace LLPredicate
} }
private: private:
int mPredicateRequirements; S32 mPredicateRequirements;
}; };
template<typename ENUM> template<typename ENUM>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment