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
c48c8e76
Commit
c48c8e76
authored
May 12, 2017
by
John Kessenich
Committed by
GitHub
May 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #886 from antiagainst/unordered-set
Use unordered_set in ReadableOrderTraverser.
parents
d9b08d5c
2840f63f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
InReadableOrder.cpp
SPIRV/InReadableOrder.cpp
+8
-8
No files found.
SPIRV/InReadableOrder.cpp
View file @
c48c8e76
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
#include "spvIR.h"
#include "spvIR.h"
#include <cassert>
#include <cassert>
#include <unordered_
map
>
#include <unordered_
set
>
using
spv
::
Block
;
using
spv
::
Block
;
using
spv
::
Id
;
using
spv
::
Id
;
...
@@ -69,33 +69,33 @@ public:
...
@@ -69,33 +69,33 @@ public:
void
visit
(
Block
*
block
)
void
visit
(
Block
*
block
)
{
{
assert
(
block
);
assert
(
block
);
if
(
visited_
[
block
]
||
delayed_
[
block
]
)
if
(
visited_
.
count
(
block
)
||
delayed_
.
count
(
block
)
)
return
;
return
;
callback_
(
block
);
callback_
(
block
);
visited_
[
block
]
=
true
;
visited_
.
insert
(
block
)
;
Block
*
mergeBlock
=
nullptr
;
Block
*
mergeBlock
=
nullptr
;
Block
*
continueBlock
=
nullptr
;
Block
*
continueBlock
=
nullptr
;
auto
mergeInst
=
block
->
getMergeInstruction
();
auto
mergeInst
=
block
->
getMergeInstruction
();
if
(
mergeInst
)
{
if
(
mergeInst
)
{
Id
mergeId
=
mergeInst
->
getIdOperand
(
0
);
Id
mergeId
=
mergeInst
->
getIdOperand
(
0
);
mergeBlock
=
block
->
getParent
().
getParent
().
getInstruction
(
mergeId
)
->
getBlock
();
mergeBlock
=
block
->
getParent
().
getParent
().
getInstruction
(
mergeId
)
->
getBlock
();
delayed_
[
mergeBlock
]
=
true
;
delayed_
.
insert
(
mergeBlock
)
;
if
(
mergeInst
->
getOpCode
()
==
spv
::
OpLoopMerge
)
{
if
(
mergeInst
->
getOpCode
()
==
spv
::
OpLoopMerge
)
{
Id
continueId
=
mergeInst
->
getIdOperand
(
1
);
Id
continueId
=
mergeInst
->
getIdOperand
(
1
);
continueBlock
=
continueBlock
=
block
->
getParent
().
getParent
().
getInstruction
(
continueId
)
->
getBlock
();
block
->
getParent
().
getParent
().
getInstruction
(
continueId
)
->
getBlock
();
delayed_
[
continueBlock
]
=
true
;
delayed_
.
insert
(
continueBlock
)
;
}
}
}
}
const
auto
successors
=
block
->
getSuccessors
();
const
auto
successors
=
block
->
getSuccessors
();
for
(
auto
it
=
successors
.
cbegin
();
it
!=
successors
.
cend
();
++
it
)
for
(
auto
it
=
successors
.
cbegin
();
it
!=
successors
.
cend
();
++
it
)
visit
(
*
it
);
visit
(
*
it
);
if
(
continueBlock
)
{
if
(
continueBlock
)
{
delayed_
[
continueBlock
]
=
false
;
delayed_
.
erase
(
continueBlock
)
;
visit
(
continueBlock
);
visit
(
continueBlock
);
}
}
if
(
mergeBlock
)
{
if
(
mergeBlock
)
{
delayed_
[
mergeBlock
]
=
false
;
delayed_
.
erase
(
mergeBlock
)
;
visit
(
mergeBlock
);
visit
(
mergeBlock
);
}
}
}
}
...
@@ -103,7 +103,7 @@ public:
...
@@ -103,7 +103,7 @@ public:
private
:
private
:
std
::
function
<
void
(
Block
*
)
>
callback_
;
std
::
function
<
void
(
Block
*
)
>
callback_
;
// Whether a block has already been visited or is being delayed.
// Whether a block has already been visited or is being delayed.
std
::
unordered_
map
<
Block
*
,
bool
>
visited_
,
delayed_
;
std
::
unordered_
set
<
Block
*
>
visited_
,
delayed_
;
};
};
}
}
...
...
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