tfm-report/img/multiplypdg.dot

32 lines
1.1 KiB
Plaintext

digraph g {
"main()" [shape=box, rank=min]
"main()" -> "multiply(2, 3)" -> {"x_in = 2" "y_in = 3"};
"multiply()" [shape=box, rank=min];
"multiply()" ->
// Rank adjustment
{ rank = same; "x = x_in" "y = y_in" }
{ 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
{ 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";
}
// Order adjustment
{ 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";
}
}