Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
5d5a7170
Commit
5d5a7170
authored
5 years ago
by
Akash Kothari
Browse files
Options
Downloads
Patches
Plain Diff
Using concise module iterators for functions
parent
0d8677bc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+43
-49
43 additions, 49 deletions
llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
with
43 additions
and
49 deletions
llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+
43
−
49
View file @
5d5a7170
...
@@ -29,11 +29,11 @@ bool BuildDFG::runOnModule(Module &M) {
...
@@ -29,11 +29,11 @@ bool BuildDFG::runOnModule(Module &M) {
IntrinsicInst
*
II
;
IntrinsicInst
*
II
;
// Iterate over all functions in the module
// Iterate over all functions in the module
for
(
Module
::
iterator
mi
=
M
.
begin
(),
me
=
M
.
end
();
mi
!=
me
;
++
mi
)
{
for
(
auto
&
Func
:
M
)
{
Function
*
f
=
&
*
mi
;
Function
*
F
=
&
Func
;
DEBUG
(
errs
()
<<
"Function: "
<<
f
->
getName
()
<<
"
\n
"
);
DEBUG
(
errs
()
<<
"Function: "
<<
F
->
getName
()
<<
"
\n
"
);
for
(
inst_iterator
i
=
inst_begin
(
f
),
e
=
inst_end
(
f
);
i
!=
e
;
++
i
)
{
for
(
inst_iterator
i
=
inst_begin
(
F
),
e
=
inst_end
(
F
);
i
!=
e
;
++
i
)
{
Instruction
*
I
=
&*
i
;
// Grab pointer to Instruction
Instruction
*
I
=
&*
i
;
// Grab pointer to Instruction
if
(
isViscLaunchIntrinsic
(
I
))
{
if
(
isViscLaunchIntrinsic
(
I
))
{
DEBUG
(
errs
()
<<
"------------ Found launch site --------------
\n
"
);
DEBUG
(
errs
()
<<
"------------ Found launch site --------------
\n
"
);
...
@@ -344,51 +344,45 @@ void BuildDFG::BuildGraph (DFInternalNode* N, Function *F) {
...
@@ -344,51 +344,45 @@ void BuildDFG::BuildGraph (DFInternalNode* N, Function *F) {
// Iterate over all the instructions of a function and look for visc
// Iterate over all the instructions of a function and look for visc
// intrinsics.
// intrinsics.
for
(
auto
&
BB
:
*
F
)
{
for
(
inst_iterator
i
=
inst_begin
(
F
),
e
=
inst_end
(
F
);
i
!=
e
;
++
i
)
{
for
(
auto
&
Inst
:
BB
)
{
Instruction
*
I
=
&*
i
;
// Grab pointer to Instruction
Instruction
*
I
=
&
Inst
;
DEBUG
(
errs
()
<<
*
I
<<
"
\n
"
);
DEBUG
(
errs
()
<<
*
I
<<
"
\n
"
);
if
(
IntrinsicInst
*
II
=
dyn_cast
<
IntrinsicInst
>
(
I
))
{
if
(
IntrinsicInst
*
II
=
dyn_cast
<
IntrinsicInst
>
(
I
))
{
DEBUG
(
errs
()
<<
"IntrinsicID = "
<<
II
->
getIntrinsicID
()
<<
": "
<<
II
->
getCalledFunction
()
->
getName
()
<<
"
\n
"
);
DEBUG
(
errs
()
<<
"IntrinsicID = "
<<
II
->
getIntrinsicID
()
<<
": "
<<
II
->
getCalledFunction
()
->
getName
()
<<
"
\n
"
);
switch
(
II
->
getIntrinsicID
())
{
switch
(
II
->
getIntrinsicID
())
{
case
Intrinsic
::
visc_createNode
:
case
Intrinsic
::
visc_createNode1D
:
case
Intrinsic
::
visc_createNode
:
case
Intrinsic
::
visc_createNode2D
:
case
Intrinsic
::
visc_createNode1D
:
case
Intrinsic
::
visc_createNode3D
:
case
Intrinsic
::
visc_createNode2D
:
handleCreateNode
(
N
,
II
);
case
Intrinsic
::
visc_createNode3D
:
break
;
handleCreateNode
(
N
,
II
);
case
Intrinsic
::
visc_createEdge
:
break
;
handleCreateEdge
(
N
,
II
);
break
;
case
Intrinsic
::
visc_createEdge
:
case
Intrinsic
::
visc_bind_input
:
handleCreateEdge
(
N
,
II
);
handleBindInput
(
N
,
II
);
break
;
break
;
case
Intrinsic
::
visc_bind_input
:
case
Intrinsic
::
visc_bind_output
:
handleBindInput
(
N
,
II
);
handleBindOutput
(
N
,
II
);
break
;
break
;
case
Intrinsic
::
visc_bind_output
:
handleBindOutput
(
N
,
II
);
//TODO: Reconsider launch within a dataflow graph (recursion?)
break
;
case
Intrinsic
::
visc_wait
:
case
Intrinsic
::
visc_launch
:
//TODO: Reconsider launch within a dataflow graph (recursion?)
errs
()
<<
"Error: Launch/wait intrinsic used within a dataflow graph
\n\t
"
<<
*
II
<<
"
\n
"
;
case
Intrinsic
::
visc_wait
:
break
;
case
Intrinsic
::
visc_launch
:
errs
()
<<
"Error: Launch/wait intrinsic used within a dataflow graph
\n\t
"
<<
*
II
<<
"
\n
"
;
default:
break
;
errs
()
<<
"Error: Invalid VISC Intrinsic inside Internal node!
\n\t
"
<<
*
II
<<
"
\n
"
;
break
;
default:
}
errs
()
<<
"Error: Invalid VISC Intrinsic inside Internal node!
\n\t
"
<<
*
II
<<
"
\n
"
;
continue
;
break
;
}
}
if
(
!
isa
<
ReturnInst
>
(
I
)
&&
!
isa
<
CastInst
>
(
I
))
{
continue
;
errs
()
<<
"Non-intrinsic instruction: "
<<
*
I
<<
"
\n
"
;
}
llvm_unreachable
(
"Found non-intrinsic instruction inside an internal node. Only return instruction is allowed!"
);
if
(
!
isa
<
ReturnInst
>
(
I
)
&&
!
isa
<
CastInst
>
(
I
))
{
}
errs
()
<<
"Non-intrinsic instruction: "
<<
*
I
<<
"
\n
"
;
}
llvm_unreachable
(
"Found non-intrinsic instruction inside an internal node. Only return instruction is allowed!"
);
}
}
}
}
}
char
BuildDFG
::
ID
=
0
;
char
BuildDFG
::
ID
=
0
;
...
...
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