There's a data type of nested diamonds in the ASLp frontend. This represents control flow branches, but at the moment it's printed as an Ocaml record which makes the control flow structure hard to see.
For debugging and expect tests, it would be nice to have a visual representation of the CFG, something like this:
2
/ \
2 2
\ /
1
/ \
/ 2
/ / \
1 2 2
\ \ /
\ 1
\ /
0
Because the structure is just diamonds of diamonds, it should be possible (easy?) to write a recursive algorithm to do this. It just needs to calculate the size of outer diamonds based on the size of inner diamonds.
I would be happy to advise and talk about this task if anyone wants a small fun job :)
For comparison, this is the current printed representation of the diamonds:
|
Diamond { |
|
pred = (Leaf { Aslp_state.assume = true; stmts = []; pc_assign = None }); |
|
left = |
|
(Leaf |
|
{ Aslp_state.assume = eq($PSTATE_Z, 0x1:bv1); |
|
stmts = [var BranchTaken:bool := true; $PC:bv64 := 0x2400:bv64]; |
|
pc_assign = (Some 0x2400:bv64) }); |
|
right = |
|
(Leaf |
|
{ Aslp_state.assume = boolnot(eq($PSTATE_Z, 0x1:bv1)); |
|
stmts = [(var BranchTaken:bool := false, $PC:bv64 := 0x2004:bv64)]; |
|
pc_assign = (Some 0x2004:bv64) }); |
|
value = |
|
{ Aslp_state.assume = true; stmts = []; |
|
pc_assign = |
|
(Some if eq($PSTATE_Z, 0x1:bv1) then 0x2400:bv64 else 0x2004:bv64) }} |
There's a data type of nested diamonds in the ASLp frontend. This represents control flow branches, but at the moment it's printed as an Ocaml record which makes the control flow structure hard to see.
For debugging and expect tests, it would be nice to have a visual representation of the CFG, something like this:
Because the structure is just diamonds of diamonds, it should be possible (easy?) to write a recursive algorithm to do this. It just needs to calculate the size of outer diamonds based on the size of inner diamonds.
I would be happy to advise and talk about this task if anyone wants a small fun job :)
For comparison, this is the current printed representation of the diamonds:
bincaml/test/transforms/test_aslp.ml
Lines 74 to 89 in 495be8e