tfm-report/img/multiplypdg.dot

32 lines
1.1 KiB
Text
Raw Permalink Normal View History

2019-12-09 03:28:35 +01:00
digraph g {
"main()" [shape=box, rank=min]
"main()" -> "multiply(2, 3)" -> {"x_in = 2" "y_in = 3"};
"multiply()" [shape=box, rank=min];
"multiply()" ->
2019-10-18 10:54:33 +02:00
// Rank adjustment
2019-12-09 03:28:35 +01:00
{ rank = same; "x = x_in" "y = y_in" }
2019-10-18 10:54:33 +02:00
{ rank = same; "int result = 0"; "while (x > 0)"; "System.out.println(result)"; "return result"; }
{ rank = same; "result += y"; "x--"; }
// Control flow
"multiply()" -> "int result = 0" [style=bold];
"multiply()" -> "while (x > 0)" [style=bold];
"multiply()" -> "System.out.println(result)" [style=bold];
"multiply()" -> "return result" [style=bold];
"while (x > 0)" -> "result += y" [style=bold];
"while (x > 0)" -> "x--" [style=bold];
// Data flow
2019-12-09 03:28:35 +01:00
{ edge [color = red]
{"int result = 0" "result += y"} -> {"result += y" "System.out.println(result)" "return result"};
{"x--" "x = x_in"} -> {"x--" "while (x > 0)"};
"y = y_in" -> "result += y";
}
2019-10-18 10:54:33 +02:00
// Order adjustment
2019-12-09 03:28:35 +01:00
{ edge [style = invis];
"int result = 0" -> "while (x > 0)";
"while (x > 0)" -> "System.out.println(result)";
"System.out.println(result)" -> "return result";
"result += y" -> "x--";
"x = x_in" -> "int result = 0";
}
2019-10-18 10:54:33 +02:00
}