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
9c591487
Commit
9c591487
authored
Jan 18, 2016
by
Dejan Mircevski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spv.branch-return.vert.
parent
baa55a15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
InReadableOrder.cpp
SPIRV/InReadableOrder.cpp
+10
-6
No files found.
SPIRV/InReadableOrder.cpp
View file @
9c591487
...
@@ -39,7 +39,7 @@ void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) {
...
@@ -39,7 +39,7 @@ void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) {
// Prerequisites for a merge block; must be completed prior to visiting the
// Prerequisites for a merge block; must be completed prior to visiting the
// merge block.
// merge block.
std
::
unordered_map
<
Id
,
BlockSet
>
prereqs
;
std
::
unordered_map
<
Id
,
BlockSet
>
prereqs
;
IdToBool
visited
;
// Whether a block has already been visited.
IdToBool
visited
;
// Whether a block has already been visited.
std
::
deque
<
Block
*>
worklist
;
// DFS worklist
std
::
deque
<
Block
*>
worklist
;
// DFS worklist
worklist
.
push_back
(
root
);
worklist
.
push_back
(
root
);
while
(
!
worklist
.
empty
())
{
while
(
!
worklist
.
empty
())
{
...
@@ -48,18 +48,22 @@ void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) {
...
@@ -48,18 +48,22 @@ void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) {
// Nodes may be pushed repeadetly (before they're first visited) if they
// Nodes may be pushed repeadetly (before they're first visited) if they
// have multiple predecessors. Skip the already-visited ones.
// have multiple predecessors. Skip the already-visited ones.
if
(
visited
[
current
->
getId
()])
continue
;
if
(
visited
[
current
->
getId
()])
continue
;
if
(
delay
(
prereqs
[
current
->
getId
()],
visited
))
{
// Not every prerequisite has been visited -- push it off for later.
worklist
.
push_back
(
current
);
continue
;
}
callback
(
current
);
callback
(
current
);
visited
[
current
->
getId
()]
=
true
;
visited
[
current
->
getId
()]
=
true
;
if
(
auto
merge
=
current
->
getMergeInstruction
())
{
if
(
auto
merge
=
current
->
getMergeInstruction
())
{
auto
&
mergePrereqs
=
prereqs
[
merge
->
getIdOperand
(
0
)];
Id
mergeId
=
merge
->
getIdOperand
(
0
);
auto
&
mergePrereqs
=
prereqs
[
mergeId
];
// Delay visiting merge blocks until all branches are visited.
// Delay visiting merge blocks until all branches are visited.
for
(
const
auto
succ
:
current
->
getSuccessors
())
for
(
const
auto
succ
:
current
->
getSuccessors
())
mergePrereqs
.
insert
(
succ
->
getId
());
if
(
succ
->
getId
()
!=
mergeId
)
mergePrereqs
.
insert
(
succ
->
getId
());
}
}
for
(
auto
succ
:
current
->
getSuccessors
())
{
for
(
auto
succ
:
current
->
getSuccessors
())
{
if
(
!
visited
[
succ
->
getId
()]
&&
!
delay
(
prereqs
[
succ
->
getId
()],
visited
))
{
if
(
!
visited
[
succ
->
getId
()])
worklist
.
push_back
(
succ
);
worklist
.
push_back
(
succ
);
}
}
}
}
}
}
}
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