tfm-slides/figs/parameter-passing.dot
2019-12-13 02:07:46 +01:00

57 lines
No EOL
1.5 KiB
Text

digraph G {
// p [label=<x_in = a + b<br/>y_in = c<br/>f()<br/>c = y_out>,shape=rect];
f_call [label="f()"]
x_in [label="x_in = a + 1"]
y_in [label="y_in = b"]
z_in [label="z_in = z"]
y_out [label="b = y_out"]
z_out [label="z = z_out"]
f_call -> {z_in x_in y_in y_out z_out};
f_start [label="enter f", shape = rect];
fx_in [label="x = x_in"];
fy_in [label="y = y_in"];
fz_in [label="z = z_in"];
fy_out [label="y_out = y"];
fz_out [label="z_out = z"];
f_start -> {fz_in fx_in fy_in fy_out fz_out};
f_call -> f_start [style=bold];
y_in -> f_start [style=invis];
{
edge [style = dashed];
z_in -> fz_in
x_in -> fx_in
y_in -> fy_in
fy_out -> y_out
fz_out -> z_out
}
invis [height=0.001,width=0.001,style=invis];
invis2 [height=0.001,width=0.001,style=invis];
{rank=same; x_in y_in y_out z_in z_out invis};
{rank=same; fx_in fy_in invis2 fy_out fz_in fz_out};
{edge [style=invis];
z_in -> x_in -> y_in -> invis -> y_out -> z_out;
fz_in -> fx_in -> fy_in -> invis2 -> fy_out -> fz_out;
}
{rank = max;
zplus [label = "z += x"];
yplus [label = "y++"];
}
f_start -> {zplus yplus};
{
edge [color = red];
{fz_in fx_in} -> zplus;
fy_in -> yplus;
edge [constraint = false];
zplus -> fz_out;
yplus -> fy_out;
}
{
edge [color = blue, constraint = false, style = bold];
{z_in x_in} -> z_out;
y_in -> y_out;
}
}