Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
b71e991c
Commit
b71e991c
authored
12 years ago
by
Richard Linden
Browse files
Options
Downloads
Patches
Plain Diff
SH-3405 WIP convert existing stats to lltrace system
fixed predicate update logic and reduced to 2 classes
parent
3ffd0be5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/llinitparam.cpp
+1
-1
1 addition, 1 deletion
indra/llcommon/llinitparam.cpp
indra/llcommon/llpredicate.h
+68
-44
68 additions, 44 deletions
indra/llcommon/llpredicate.h
with
69 additions
and
45 deletions
indra/llcommon/llinitparam.cpp
+
1
−
1
View file @
b71e991c
...
...
@@ -190,7 +190,7 @@ namespace LLInitParam
bool
serialized
=
false
;
if
(
!
isProvided
())
{
if
(
predicate_rule
_t
(
~
ll_predicate
(
PROVIDED
)
&&
predicate_rule
).
isTriviallyFalse
())
if
(
(
predicate_rule
&&
!
ll_predicate
(
PROVIDED
)).
isTriviallyFalse
())
{
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/llpredicate.h
+
68
−
44
View file @
b71e991c
...
...
@@ -36,43 +36,41 @@ namespace LLPredicate
extern
const
U32
cPredicateFlagsFromEnum
[
5
];
template
<
typename
ENUM
>
class
Literal
class
Value
{
friend
Rule
<
ENUM
>
;
public:
typedef
U32
predicate_flag_t
;
static
const
S32
cMaxEnum
=
5
;
Literal
(
ENUM
e
)
Value
(
ENUM
e
)
:
mPredicateFlags
(
cPredicateFlagsFromEnum
[
e
])
{
llassert
(
0
<=
e
&&
e
<
cMaxEnum
);
}
Literal
()
Value
()
:
mPredicateFlags
(
0xFFFFffff
)
{}
Literal
operator
~
()
Value
operator
!
()
const
{
Literal
new_
rul
e
;
new_
rul
e
.
mPredicateFlags
=
~
mPredicateFlags
;
return
new_
rul
e
;
Value
new_
valu
e
;
new_
valu
e
.
mPredicateFlags
=
~
mPredicateFlags
;
return
new_
valu
e
;
}
Literal
operator
&&
(
const
Literal
&
other
)
Value
operator
&&
(
const
Value
other
)
const
{
Literal
new_
rul
e
;
new_
rul
e
.
mPredicateFlags
=
mPredicateFlags
&
other
.
mPredicateFlags
;
return
new_
rul
e
;
Value
new_
valu
e
;
new_
valu
e
.
mPredicateFlags
=
mPredicateFlags
&
other
.
mPredicateFlags
;
return
new_
valu
e
;
}
Literal
operator
||
(
const
Literal
&
other
)
Value
operator
||
(
const
Value
other
)
const
{
Literal
new_
rul
e
;
new_
rul
e
.
mPredicateFlags
=
mPredicateFlags
|
other
.
mPredicateFlags
;
return
new_
rul
e
;
Value
new_
valu
e
;
new_
valu
e
.
mPredicateFlags
=
mPredicateFlags
|
other
.
mPredicateFlags
;
return
new_
valu
e
;
}
void
set
(
ENUM
e
,
bool
value
)
...
...
@@ -81,19 +79,21 @@ namespace LLPredicate
modifyPredicate
(
0x1
<<
(
S32
)
e
,
cPredicateFlagsFromEnum
[
e
],
value
);
}
void
set
(
const
Literal
&
other
,
bool
value
)
void
set
(
const
Value
other
,
bool
value
)
{
U32
predicate_flags
=
other
.
mPredicateFlags
;
while
(
predicate_flags
)
{
U32
next_flags
=
clearLSB
(
predicate_flags
);
lsb_flag
=
predicate_flags
^
next_flags
;
U32
mask
=
0
;
for
(
S32
i
=
0
;
i
<
cMaxEnum
;
i
++
)
{
if
(
cPredicateFlagsFromEnum
[
i
]
&
lsb_flag
)
{
mask
|=
cPredicateFlagsFromEnum
[
i
];
modifyPredicate
(
0x1
<<
(
0x1
<<
i
),
cPredicateFlagsFromEnum
[
i
],
!
value
);
}
}
...
...
@@ -112,15 +112,25 @@ namespace LLPredicate
mPredicateFlags
|=
flags_with_predicate
;
}
void
forget
(
const
Literal
&
literal
)
void
forget
(
const
Value
value
)
{
set
(
literal
,
true
);
set
(
value
,
true
);
U32
flags_with_predicate
=
mPredicateFlags
;
set
(
literal
,
false
);
set
(
value
,
false
);
// ambiguous value is result of adding and removing predicate at the same time!
mPredicateFlags
|=
flags_with_predicate
;
}
bool
allSet
()
const
{
return
mPredicateFlags
==
~
0
;
}
bool
noneSet
()
const
{
return
mPredicateFlags
==
0
;
}
private
:
predicate_flag_t
clearLSB
(
predicate_flag_t
value
)
...
...
@@ -156,56 +166,70 @@ namespace LLPredicate
predicate_flag_t
mPredicateFlags
;
};
template
<
typename
ENUM
>
struct
Value
:
public
Literal
<
ENUM
>
{
public:
Value
(
ENUM
e
)
:
Literal
(
e
)
{}
Value
()
{}
};
template
<
typename
ENUM
>
class
Rule
:
public
Literal
<
ENUM
>
{
public:
Rule
(
ENUM
value
)
:
Literal
(
value
)
:
mRule
(
value
)
{}
Rule
(
const
Rule
&
other
)
:
mRule
(
other
.
mRule
)
{}
Rule
(
const
Literal
other
)
:
Literal
(
other
)
Rule
(
const
Value
<
ENUM
>
other
)
:
mRule
(
other
)
{}
Rule
()
{}
bool
check
(
const
Value
<
ENUM
>
&
value
)
const
bool
check
(
const
Value
<
ENUM
>
value
)
const
{
return
(
value
.
mPredicateFlags
&
mPredicateFlags
)
!=
0
;
return
!
(
mRule
&&
value
).
noneSet
()
;
}
bool
isTriviallyTrue
()
const
{
return
m
PredicateFlags
==
0xFFFFffff
;
return
m
Rule
.
allSet
()
;
}
bool
isTriviallyFalse
()
const
{
return
mPredicateFlags
==
0
;
return
mRule
.
noneSet
();
}
Rule
operator
!
()
const
{
Rule
new_rule
;
new_rule
.
mRule
=
!
mRule
;
return
new_rule
;
}
Rule
operator
&&
(
const
Rule
other
)
const
{
Rule
new_rule
;
new_rule
.
mRule
=
mRule
&&
other
.
mRule
;
return
new_rule
;
}
Rule
operator
||
(
const
Rule
other
)
const
{
Rule
new_rule
;
new_rule
.
mRule
=
mRule
||
other
.
mRule
;
return
new_rule
;
}
private
:
Value
<
ENUM
>
mRule
;
};
}
template
<
typename
ENUM
>
LLPredicate
::
Literal
<
ENUM
>
ll_predicate
(
ENUM
e
)
LLPredicate
::
Value
<
ENUM
>
ll_predicate
(
ENUM
e
)
{
return
LLPredicate
::
Literal
<
ENUM
>
(
e
);
return
LLPredicate
::
Value
<
ENUM
>
(
e
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment