Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mesa
mesa
Commits
557133b6
Commit
557133b6
authored
Sep 20, 2021
by
Icecream95
Browse files
pan/mdg: Make block predecessor printing deterministic
Also clean up formatting slightly.
parent
87d7bd77
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/panfrost/midgard/midgard_print.c
View file @
557133b6
...
...
@@ -281,6 +281,12 @@ mir_print_instruction(midgard_instruction *ins)
printf
(
"
\n
"
);
}
static
int
mdg_compare_block_name
(
const
void
*
a
,
const
void
*
b
)
{
return
*
(
const
unsigned
*
)
a
-
*
(
const
unsigned
*
)
b
;
}
/* Dumps MIR for a block or entire shader respective */
void
...
...
@@ -304,15 +310,31 @@ mir_print_block(midgard_block *block)
printf
(
"}"
);
if
(
block
->
base
.
successors
[
0
])
{
printf
(
" ->
"
);
printf
(
" ->"
);
pan_foreach_successor
((
&
block
->
base
),
succ
)
printf
(
" block%u
"
,
succ
->
name
);
printf
(
" block%u"
,
succ
->
name
);
}
printf
(
" from { "
);
mir_foreach_predecessor
(
block
,
pred
)
printf
(
"block%u "
,
pred
->
base
.
name
);
printf
(
"}"
);
unsigned
num_pred
=
block
->
base
.
predecessors
->
entries
;
if
(
num_pred
)
{
printf
(
" from {"
);
unsigned
*
predecessors
=
malloc
(
num_pred
*
sizeof
(
unsigned
));
unsigned
num
=
0
;
mir_foreach_predecessor
(
block
,
pred
)
predecessors
[
num
++
]
=
pred
->
base
.
name
;
/* Iteration order is non-deterministic, so sort to be
* consistent between executions */
qsort
(
predecessors
,
num_pred
,
sizeof
(
unsigned
),
mdg_compare_block_name
);
for
(
unsigned
i
=
0
;
i
<
num_pred
;
++
i
)
printf
(
" block%u"
,
predecessors
[
i
]);
printf
(
" }"
);
}
printf
(
"
\n\n
"
);
}
...
...
Write
Preview
Supports
Markdown
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