Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
e543cc35
Commit
e543cc35
authored
May 09, 2016
by
qining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove double underscore
parent
bb0ac546
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
propagateNoContraction.cpp
glslang/MachineIndependent/propagateNoContraction.cpp
+21
-21
No files found.
glslang/MachineIndependent/propagateNoContraction.cpp
View file @
e543cc35
...
@@ -253,7 +253,7 @@ protected:
...
@@ -253,7 +253,7 @@ protected:
ReturnBranchNodeSet
&
precise_return_nodes_
;
ReturnBranchNodeSet
&
precise_return_nodes_
;
// A temporary cache of the symbol node whose defining node is to be found
// A temporary cache of the symbol node whose defining node is to be found
// currently along traversing the AST.
// currently along traversing the AST.
ObjectAccessChain
current_object_
_
;
ObjectAccessChain
current_object_
;
// A map from object node to its accesschain. This traverser stores
// A map from object node to its accesschain. This traverser stores
// the built accesschains into this map for each object node it has
// the built accesschains into this map for each object node it has
// visited.
// visited.
...
@@ -269,18 +269,18 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser(
...
@@ -269,18 +269,18 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser(
ObjectAccesschainSet
*
precise_objects
,
ObjectAccesschainSet
*
precise_objects
,
std
::
unordered_set
<
glslang
::
TIntermBranch
*>*
precise_return_nodes
)
std
::
unordered_set
<
glslang
::
TIntermBranch
*>*
precise_return_nodes
)
:
TIntermTraverser
(
true
,
false
,
false
),
symbol_definition_mapping_
(
*
symbol_definition_mapping
),
:
TIntermTraverser
(
true
,
false
,
false
),
symbol_definition_mapping_
(
*
symbol_definition_mapping
),
precise_objects_
(
*
precise_objects
),
current_object_
_
(),
precise_objects_
(
*
precise_objects
),
current_object_
(),
accesschain_mapping_
(
*
accesschain_mapping
),
current_function_definition_node_
(
nullptr
),
accesschain_mapping_
(
*
accesschain_mapping
),
current_function_definition_node_
(
nullptr
),
precise_return_nodes_
(
*
precise_return_nodes
)
{}
precise_return_nodes_
(
*
precise_return_nodes
)
{}
// Visits a symbol node, set the current_object_
_
to the
// Visits a symbol node, set the current_object_ to the
// current node symbol ID, and record a mapping from this node to the current
// current node symbol ID, and record a mapping from this node to the current
// current_object_
_
, which is the just obtained symbol
// current_object_, which is the just obtained symbol
// ID.
// ID.
void
TSymbolDefinitionCollectingTraverser
::
visitSymbol
(
glslang
::
TIntermSymbol
*
node
)
void
TSymbolDefinitionCollectingTraverser
::
visitSymbol
(
glslang
::
TIntermSymbol
*
node
)
{
{
current_object_
_
=
generateSymbolLabel
(
node
);
current_object_
=
generateSymbolLabel
(
node
);
accesschain_mapping_
[
node
]
=
current_object_
_
;
accesschain_mapping_
[
node
]
=
current_object_
;
}
}
// Visits an aggregate node, traverses all of its children.
// Visits an aggregate node, traverses all of its children.
...
@@ -300,7 +300,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit,
...
@@ -300,7 +300,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit,
// Traverse the items in the sequence.
// Traverse the items in the sequence.
glslang
::
TIntermSequence
&
seq
=
node
->
getSequence
();
glslang
::
TIntermSequence
&
seq
=
node
->
getSequence
();
for
(
int
i
=
0
;
i
<
(
int
)
seq
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
(
int
)
seq
.
size
();
++
i
)
{
current_object_
_
.
clear
();
current_object_
.
clear
();
seq
[
i
]
->
traverse
(
this
);
seq
[
i
]
->
traverse
(
this
);
}
}
return
false
;
return
false
;
...
@@ -325,11 +325,11 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit,
...
@@ -325,11 +325,11 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit,
bool
TSymbolDefinitionCollectingTraverser
::
visitUnary
(
glslang
::
TVisit
/* visit */
,
bool
TSymbolDefinitionCollectingTraverser
::
visitUnary
(
glslang
::
TVisit
/* visit */
,
glslang
::
TIntermUnary
*
node
)
glslang
::
TIntermUnary
*
node
)
{
{
current_object_
_
.
clear
();
current_object_
.
clear
();
node
->
getOperand
()
->
traverse
(
this
);
node
->
getOperand
()
->
traverse
(
this
);
if
(
isAssignOperation
(
node
->
getOp
()))
{
if
(
isAssignOperation
(
node
->
getOp
()))
{
// We should always be able to get an accesschain of the operand node.
// We should always be able to get an accesschain of the operand node.
assert
(
!
current_object_
_
.
empty
());
assert
(
!
current_object_
.
empty
());
// If the operand node object is 'precise', we collect its accesschain
// If the operand node object is 'precise', we collect its accesschain
// for the initial set of 'precise' objects.
// for the initial set of 'precise' objects.
...
@@ -337,16 +337,16 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit *
...
@@ -337,16 +337,16 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit *
// The operand node is an 'precise' object node, add its
// The operand node is an 'precise' object node, add its
// accesschain to the set of 'precise' objects. This is to collect
// accesschain to the set of 'precise' objects. This is to collect
// the initial set of 'precise' objects.
// the initial set of 'precise' objects.
precise_objects_
.
insert
(
current_object_
_
);
precise_objects_
.
insert
(
current_object_
);
}
}
// Gets the symbol ID from the object's accesschain.
// Gets the symbol ID from the object's accesschain.
ObjectAccessChain
id_symbol
=
getFrontElement
(
current_object_
_
);
ObjectAccessChain
id_symbol
=
getFrontElement
(
current_object_
);
// Add a mapping from the symbol ID to this assignment operation node.
// Add a mapping from the symbol ID to this assignment operation node.
symbol_definition_mapping_
.
insert
(
std
::
make_pair
(
id_symbol
,
node
));
symbol_definition_mapping_
.
insert
(
std
::
make_pair
(
id_symbol
,
node
));
}
}
// Unary node is not a dereference node, so we clear the accesschain which
// Unary node is not a dereference node, so we clear the accesschain which
// is under construction.
// is under construction.
current_object_
_
.
clear
();
current_object_
.
clear
();
return
false
;
return
false
;
}
}
...
@@ -356,12 +356,12 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
...
@@ -356,12 +356,12 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
glslang
::
TIntermBinary
*
node
)
glslang
::
TIntermBinary
*
node
)
{
{
// Traverses the left node to build the accesschain info for the object.
// Traverses the left node to build the accesschain info for the object.
current_object_
_
.
clear
();
current_object_
.
clear
();
node
->
getLeft
()
->
traverse
(
this
);
node
->
getLeft
()
->
traverse
(
this
);
if
(
isAssignOperation
(
node
->
getOp
()))
{
if
(
isAssignOperation
(
node
->
getOp
()))
{
// We should always be able to get an accesschain for the left node.
// We should always be able to get an accesschain for the left node.
assert
(
!
current_object_
_
.
empty
());
assert
(
!
current_object_
.
empty
());
// If the left node object is 'precise', it is an initial precise object
// If the left node object is 'precise', it is an initial precise object
// specified in the shader source. Adds it to the initial worklist to
// specified in the shader source. Adds it to the initial worklist to
...
@@ -370,17 +370,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
...
@@ -370,17 +370,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
// The left node is an 'precise' object node, add its accesschain to
// The left node is an 'precise' object node, add its accesschain to
// the set of 'precise' objects. This is to collect the initial set
// the set of 'precise' objects. This is to collect the initial set
// of 'precise' objects.
// of 'precise' objects.
precise_objects_
.
insert
(
current_object_
_
);
precise_objects_
.
insert
(
current_object_
);
}
}
// Gets the symbol ID from the object accesschain, which should be the
// Gets the symbol ID from the object accesschain, which should be the
// first element recorded in the accesschain.
// first element recorded in the accesschain.
ObjectAccessChain
id_symbol
=
getFrontElement
(
current_object_
_
);
ObjectAccessChain
id_symbol
=
getFrontElement
(
current_object_
);
// Adds a mapping from the symbol ID to this assignment operation node.
// Adds a mapping from the symbol ID to this assignment operation node.
symbol_definition_mapping_
.
insert
(
std
::
make_pair
(
id_symbol
,
node
));
symbol_definition_mapping_
.
insert
(
std
::
make_pair
(
id_symbol
,
node
));
// Traverses the right node, there may be other 'assignment'
// Traverses the right node, there may be other 'assignment'
// operatrions in the right.
// operatrions in the right.
current_object_
_
.
clear
();
current_object_
.
clear
();
node
->
getRight
()
->
traverse
(
this
);
node
->
getRight
()
->
traverse
(
this
);
}
else
if
(
isDereferenceOperation
(
node
->
getOp
()))
{
}
else
if
(
isDereferenceOperation
(
node
->
getOp
()))
{
...
@@ -389,17 +389,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
...
@@ -389,17 +389,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
// object id.
// object id.
if
(
node
->
getOp
()
==
glslang
::
EOpIndexDirectStruct
)
{
if
(
node
->
getOp
()
==
glslang
::
EOpIndexDirectStruct
)
{
unsigned
struct_dereference_index
=
getStructIndexFromConstantUnion
(
node
->
getRight
());
unsigned
struct_dereference_index
=
getStructIndexFromConstantUnion
(
node
->
getRight
());
current_object_
_
.
push_back
(
ObjectAccesschainDelimiter
);
current_object_
.
push_back
(
ObjectAccesschainDelimiter
);
current_object_
_
.
append
(
std
::
to_string
(
struct_dereference_index
));
current_object_
.
append
(
std
::
to_string
(
struct_dereference_index
));
}
}
accesschain_mapping_
[
node
]
=
current_object_
_
;
accesschain_mapping_
[
node
]
=
current_object_
;
// For dereference node, there is no need to traverse the right child
// For dereference node, there is no need to traverse the right child
// node as the right node should always be an integer type object.
// node as the right node should always be an integer type object.
}
else
{
}
else
{
// For other binary nodes, still traverse the right node.
// For other binary nodes, still traverse the right node.
current_object_
_
.
clear
();
current_object_
.
clear
();
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment