tfm-report/img/multiplysdg.dot
2019-10-18 08:54:33 +00:00

52 lines
No EOL
1.8 KiB
Text

digraph g {
"main()" [shape=box];
"main()" -> "multiply(3, 2)" [style=bold];
{ rank = same; "x"; "y"; "out" }
"x" -> "y" [style=invis];
"y" -> "out" [style=invis];
"multiply(3, 2)" -> "multiply()" [style=dotted];
"multiply(3, 2)" -> "x";
"multiply(3, 2)" -> "y";
"multiply(3, 2)" -> "out";
"x" -> "x_in" [style=dotted];
"y" -> "y_in" [style=dotted];
"output" -> "out" [style=dotted];
"x" -> "out" [style=bold, color=blue];
"y" -> "out" [style=bold, color=blue];
"multiply()" [shape=box];
// Rank adjustment
{ rank = same; "x_in"; "y_in"; "output" }
{ rank = same; "int result = 0"; "while (x > 0)"; "System.out.println(result)"; "return result"; }
{ rank = same; "result += y"; "x--"; }
// Input/output
"multiply()" -> "x_in";
"multiply()" -> "y_in";
"multiply()" -> "output"
"x_in" -> "while (x > 0)" [color=red];
"x_in" -> "x--" [color=red];
"y_in" -> "result += y" [color=red];
"return result" -> "output" [color=red];
// 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
"int result = 0" -> "result += y" [color=red];
"int result = 0" -> "System.out.println(result)" [color=red];
"int result = 0" -> "return result" [color=red];
"result += y" -> "result += y" [color=red];
"result += y" -> "System.out.println(result)" [color=red];
"result += y" -> "return result" [color=red];
"x--" -> "x--" [color=red];
"x--" -> "while (x > 0)" [color=red];
// Order adjustment
"int result = 0" -> "while (x > 0)" [style=invis];
"while (x > 0)" -> "System.out.println(result)" [style=invis];
"System.out.println(result)" -> "return result" [style=invis];
"result += y" -> "x--" [style=invis];
"x_in" -> "y_in" [style=invis];
}