Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Hercules
Commits
925648e2
Commit
925648e2
authored
2 months ago
by
rarbore2
Browse files
Options
Downloads
Plain Diff
Merge branch 'xdot_show_bbs' into 'main'
Show basic blocks in Xdot See merge request
!120
parents
f7b53408
ba5468cc
No related branches found
No related tags found
1 merge request
!120
Show basic blocks in Xdot
Pipeline
#201140
passed
2 months ago
Stage: test
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hercules_cg/src/lib.rs
+0
-12
0 additions, 12 deletions
hercules_cg/src/lib.rs
hercules_ir/src/dot.rs
+23
-0
23 additions, 0 deletions
hercules_ir/src/dot.rs
hercules_ir/src/ir.rs
+12
-0
12 additions, 0 deletions
hercules_ir/src/ir.rs
juno_scheduler/src/pm.rs
+9
-4
9 additions, 4 deletions
juno_scheduler/src/pm.rs
with
44 additions
and
16 deletions
hercules_cg/src/lib.rs
+
0
−
12
View file @
925648e2
...
...
@@ -10,18 +10,6 @@ pub use crate::rt::*;
use
hercules_ir
::
*
;
/*
* Basic block info consists of two things:
*
* 1. A map from node to block (named by control nodes).
* 2. For each node, which nodes are in its own block.
*
* Note that for #2, the structure is Vec<NodeID>, meaning the nodes are ordered
* inside the block. This order corresponds to the traversal order of the nodes
* in the block needed by the backend code generators.
*/
pub
type
BasicBlocks
=
(
Vec
<
NodeID
>
,
Vec
<
Vec
<
NodeID
>>
);
/*
* The alignment of a type does not depend on dynamic constants.
*/
...
...
This diff is collapsed.
Click to expand it.
hercules_ir/src/dot.rs
+
23
−
0
View file @
925648e2
...
...
@@ -18,6 +18,7 @@ pub fn xdot_module(
reverse_postorders
:
&
Vec
<
Vec
<
NodeID
>>
,
doms
:
Option
<&
Vec
<
DomTree
>>
,
fork_join_maps
:
Option
<&
Vec
<
HashMap
<
NodeID
,
NodeID
>>>
,
bbs
:
Option
<&
Vec
<
BasicBlocks
>>
,
)
{
let
mut
tmp_path
=
temp_dir
();
let
mut
rng
=
rand
::
thread_rng
();
...
...
@@ -30,6 +31,7 @@ pub fn xdot_module(
&
reverse_postorders
,
doms
,
fork_join_maps
,
bbs
,
&
mut
contents
,
)
.expect
(
"PANIC: Unable to generate output file contents."
);
...
...
@@ -51,6 +53,7 @@ pub fn write_dot<W: Write>(
reverse_postorders
:
&
Vec
<
Vec
<
NodeID
>>
,
doms
:
Option
<&
Vec
<
DomTree
>>
,
fork_join_maps
:
Option
<&
Vec
<
HashMap
<
NodeID
,
NodeID
>>>
,
bbs
:
Option
<&
Vec
<
BasicBlocks
>>
,
w
:
&
mut
W
,
)
->
std
::
fmt
::
Result
{
write_digraph_header
(
w
)
?
;
...
...
@@ -165,6 +168,26 @@ pub fn write_dot<W: Write>(
}
}
// Step 4: draw basic block edges in indigo.
if
let
Some
(
bbs
)
=
bbs
{
let
bbs
=
&
bbs
[
function_id
.idx
()]
.0
;
for
(
idx
,
bb
)
in
bbs
.into_iter
()
.enumerate
()
{
if
idx
!=
bb
.idx
()
{
write_edge
(
NodeID
::
new
(
idx
),
function_id
,
*
bb
,
function_id
,
true
,
"indigo"
,
"dotted"
,
&
module
,
w
,
)
?
;
}
}
}
write_graph_footer
(
w
)
?
;
}
...
...
This diff is collapsed.
Click to expand it.
hercules_ir/src/ir.rs
+
12
−
0
View file @
925648e2
...
...
@@ -351,6 +351,18 @@ pub type FunctionSchedules = Vec<Vec<Schedule>>;
*/
pub
type
FunctionLabels
=
Vec
<
HashSet
<
LabelID
>>
;
/*
* Basic block info consists of two things:
*
* 1. A map from node to block (named by control nodes).
* 2. For each node, which nodes are in its own block.
*
* Note that for #2, the structure is Vec<NodeID>, meaning the nodes are ordered
* inside the block. This order corresponds to the traversal order of the nodes
* in the block needed by the backend code generators.
*/
pub
type
BasicBlocks
=
(
Vec
<
NodeID
>
,
Vec
<
Vec
<
NodeID
>>
);
impl
Module
{
/*
* Printing out types, constants, and dynamic constants fully requires a
...
...
This diff is collapsed.
Click to expand it.
juno_scheduler/src/pm.rs
+
9
−
4
View file @
925648e2
...
...
@@ -1529,15 +1529,15 @@ fn run_pass(
pm
.fork_join_maps
=
Some
(
fork_join_maps
);
}
Pass
::
Xdot
=>
{
assert!
(
args
.len
()
==
1
);
let
force_analyses
=
match
args
[
0
]
{
Value
::
Boolean
{
val
}
=>
val
,
_
=>
{
let
force_analyses
=
match
args
.get
(
0
)
{
Some
(
Value
::
Boolean
{
val
})
=>
*
val
,
Some
(
_
)
=>
{
return
Err
(
SchedulerError
::
PassError
{
pass
:
"xdot"
.to_string
(),
error
:
"expected boolean argument"
.to_string
(),
});
}
None
=>
true
,
};
pm
.make_reverse_postorders
();
...
...
@@ -1549,14 +1549,19 @@ fn run_pass(
let
reverse_postorders
=
pm
.reverse_postorders
.take
()
.unwrap
();
let
doms
=
pm
.doms
.take
();
let
fork_join_maps
=
pm
.fork_join_maps
.take
();
let
bbs
=
pm
.bbs
.take
();
pm
.with_mod
(|
module
|
{
xdot_module
(
module
,
&
reverse_postorders
,
doms
.as_ref
(),
fork_join_maps
.as_ref
(),
bbs
.as_ref
(),
)
});
// Put BasicBlocks back, since it's needed for Codegen.
pm
.bbs
=
bbs
;
}
}
...
...
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