Made to work with troff
This commit is contained in:
@@ -139,10 +139,10 @@ procedure p (x:integer);
|
||||
begin
|
||||
x := 20;
|
||||
end;
|
||||
...
|
||||
a := 10; a := 10;
|
||||
p(a); ---> a := 20;
|
||||
write(a); write(a);
|
||||
\&...
|
||||
a := 10; \kxa := 10;
|
||||
p(a); ---> \h'|\nxu'a := 20;
|
||||
write(a); \h'|\nxu'write(a);
|
||||
.DE
|
||||
.IP 2.
|
||||
P changes any of the operands of the
|
||||
|
||||
@@ -104,18 +104,21 @@ The following model was developed empirically.
|
||||
Assume procedure P calls procedure Q.
|
||||
The call takes place in basic block B.
|
||||
.DS
|
||||
ZP = # zero parameters
|
||||
CP = # constant parameters - ZP
|
||||
LN = Loop Nesting level (0 if outside any loop)
|
||||
F = \fIif\fR # formal parameters of Q > 0 \fIthen\fR 1 \fIelse\fR 0
|
||||
FT = \fIif\fR Q falls through \fIthen\fR 1 \fIelse\fR 0
|
||||
S = size(Q) - 1 - # inline_parameters - F
|
||||
L = \fIif\fR # local variables of P > 0 \fIthen\fR 0 \fIelse\fR -1
|
||||
A = CP + 2 * ZP
|
||||
N = \fIif\fR LN=0 and P is never called from a loop \fIthen\fR 0 \fIelse\fR (LN+1)**2
|
||||
FM = \fIif\fR B is a firm block \fIthen\fR 2 \fIelse\fR 1
|
||||
.TS
|
||||
l l l.
|
||||
ZP \&= # zero parameters
|
||||
CP \&= # constant parameters - ZP
|
||||
LN \&= Loop Nesting level (0 if outside any loop)
|
||||
F \&= \fIif\fR # formal parameters of Q > 0 \fIthen\fR 1 \fIelse\fR 0
|
||||
FT \&= \fIif\fR Q falls through \fIthen\fR 1 \fIelse\fR 0
|
||||
S \&= size(Q) - 1 - # inline_parameters - F
|
||||
L \&= \fIif\fR # local variables of P > 0 \fIthen\fR 0 \fIelse\fR -1
|
||||
A \&= CP + 2 * ZP
|
||||
N \&= \fIif\fR LN=0 and P is never called from a loop \fIthen\fR 0 \fIelse\fR (LN+1)**2
|
||||
FM \&= \fIif\fR B is a firm block \fIthen\fR 2 \fIelse\fR 1
|
||||
|
||||
pay_off = (100/S + FT + F + L + A) * N * FM
|
||||
pay_off \&= (100/S + FT + F + L + A) * N * FM
|
||||
.TE
|
||||
.DE
|
||||
S stands for the size increase of the program,
|
||||
which is slightly less than the size of Q.
|
||||
|
||||
@@ -165,19 +165,25 @@ These calls are inherited from the called procedure.
|
||||
We will refer to these invocations as \fInested calls\fR
|
||||
(see Fig. 5.1).
|
||||
.DS
|
||||
.TS
|
||||
lw(2.5i) l.
|
||||
procedure p is
|
||||
begin .
|
||||
a(); .
|
||||
b(); .
|
||||
begin .
|
||||
a(); .
|
||||
b(); .
|
||||
end;
|
||||
.TE
|
||||
|
||||
procedure r is procedure r is
|
||||
begin begin
|
||||
x(); x();
|
||||
p(); -- in line a(); -- nested call
|
||||
y(); b(); -- nested call
|
||||
end; y();
|
||||
end;
|
||||
.TS
|
||||
lw(2.5i) l.
|
||||
procedure r is procedure r is
|
||||
begin begin
|
||||
x(); x();
|
||||
p(); -- in line a(); -- nested call
|
||||
y(); b(); -- nested call
|
||||
end; y();
|
||||
end;
|
||||
.TE
|
||||
|
||||
Fig. 5.1 Example of nested procedure calls
|
||||
.DE
|
||||
@@ -224,11 +230,11 @@ All list traversals look like:
|
||||
traverse(list)
|
||||
{
|
||||
for (c = first(list); c != 0; c = CDR(c)) {
|
||||
if (c is marked) {
|
||||
traverse(CAR(c));
|
||||
} else {
|
||||
do something with c
|
||||
}
|
||||
if (c is marked) {
|
||||
traverse(CAR(c));
|
||||
} else {
|
||||
do something with c
|
||||
}
|
||||
}
|
||||
}
|
||||
.DE
|
||||
|
||||
@@ -22,6 +22,6 @@ the driving routine for doing the substitution
|
||||
lower level routines that do certain modifications
|
||||
.IP 3_aux:
|
||||
implements auxiliary procedures used by subphase 3
|
||||
.IP aux
|
||||
.IP aux:
|
||||
implements auxiliary procedures used by several subphases.
|
||||
.LP
|
||||
|
||||
Reference in New Issue
Block a user