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
Merge requests
!163
Enhancements for xdot
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Enhancements for xdot
xdot_enhance
into
main
Overview
1
Commits
2
Pipelines
1
Changes
1
Merged
rarbore2
requested to merge
xdot_enhance
into
main
1 month ago
Overview
1
Commits
2
Pipelines
1
Changes
1
Expand
Partial module xdot.
Labels in xdot.
0
0
Merge request reports
Viewing commit
d9717dc7
Prev
Next
Show latest version
1 file
+
31
−
50
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
d9717dc7
Labels in xdot
· d9717dc7
Russel Arbore
authored
1 month ago
hercules_ir/src/dot.rs
+
31
−
50
Options
use
std
::
collections
::
HashMap
;
use
std
::
collections
::
{
HashMap
,
HashSet
}
;
use
std
::
env
::
temp_dir
;
use
std
::
fmt
::
Write
;
use
std
::
fs
::
File
;
@@ -93,7 +93,9 @@ pub fn write_dot<W: Write>(
color
,
module
,
typing
,
&
function
.labels
[
node_id
.idx
()],
&
function
.schedules
[
node_id
.idx
()],
&
module
.labels
,
w
,
)
?
;
}
@@ -254,7 +256,9 @@ fn write_node<W: Write>(
color
:
&
str
,
module
:
&
Module
,
typing
:
Option
<&
ModuleTyping
>
,
label_set
:
&
HashSet
<
LabelID
>
,
schedules
:
&
Vec
<
Schedule
>
,
labels
:
&
Vec
<
String
>
,
w
:
&
mut
W
,
)
->
std
::
fmt
::
Result
{
let
node
=
&
module
.functions
[
function_id
.idx
()]
.nodes
[
node_id
.idx
()];
@@ -341,62 +345,39 @@ fn write_node<W: Write>(
if
let
Some
(
ty
)
=
typing
.map
(|
typing
|
typing
[
function_id
.idx
()][
node_id
.idx
()])
{
module
.write_type
(
ty
,
&
mut
tylabel
)
?
;
}
let
mut
iter
=
label_set
.into_iter
();
let
label_set
=
if
let
Some
(
first
)
=
iter
.next
()
{
iter
.fold
(
format!
(
"{}"
,
labels
[
first
.idx
()]),
|
b
,
i
|
{
format!
(
"{}, {}"
,
b
,
labels
[
i
.idx
()])
})
}
else
{
String
::
new
()
};
let
mut
iter
=
schedules
.into_iter
();
let
schedules
=
if
let
Some
(
first
)
=
iter
.next
()
{
iter
.fold
(
format!
(
"{:?}"
,
first
),
|
b
,
i
|
format!
(
"{}, {:?}"
,
b
,
i
))
}
else
{
String
::
new
()
};
if
tylabel
.is_empty
()
&&
schedules
.is_empty
()
{
write!
(
w
,
"{}_{}_{} [xlabel={}, label=<{}>, color={}];
\n
"
,
node
.lower_case_name
(),
function_id
.idx
(),
node_id
.idx
(),
xlabel
,
label
,
color
)
?
;
}
else
if
schedules
.is_empty
()
{
write!
(
w
,
"{}_{}_{} [xlabel={}, label=<{}<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>>, color={}];
\n
"
,
node
.lower_case_name
(),
function_id
.idx
(),
node_id
.idx
(),
xlabel
,
label
,
tylabel
,
color
)
?
;
}
else
if
tylabel
.is_empty
()
{
write!
(
w
,
"{}_{}_{} [xlabel={}, label=<{}<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>>, color={}];
\n
"
,
node
.lower_case_name
(),
function_id
.idx
(),
node_id
.idx
(),
xlabel
,
label
,
schedules
,
color
)
?
;
}
else
{
write!
(
w
,
"{}_{}_{} [xlabel={}, label=<{}<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT><BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>>, color={}];
\n
"
,
node
.lower_case_name
(),
function_id
.idx
(),
node_id
.idx
(),
xlabel
,
label
,
tylabel
,
schedules
,
color
)
?
;
write!
(
w
,
"{}_{}_{} [xlabel={}, label=<{}"
,
node
.lower_case_name
(),
function_id
.idx
(),
node_id
.idx
(),
xlabel
,
label
,
)
?
;
if
!
tylabel
.is_empty
()
{
write!
(
w
,
"<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>"
,
tylabel
,)
?
;
}
if
!
label_set
.is_empty
()
{
write!
(
w
,
"<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>"
,
label_set
,)
?
;
}
if
!
schedules
.is_empty
()
{
write!
(
w
,
"<BR /><FONT POINT-SIZE=
\"
8
\"
>{}</FONT>"
,
schedules
,)
?
;
}
write!
(
w
,
">, color={}];
\n
"
,
color
)
?
;
Ok
(())
}
Loading