HP Pascal/iX Reference Manual (31502-90022)

12- 13
After compiling a routine, the compiler knows what it accesses and
modifies, so the optimizer can derive the appropriate assumptions.
Only exported, forward, and external routines require that you
specify LOCAL_GOTOS_ONLY, LOCAL_ACCESSES_ONLY, NO_SIDE_EFFECTS, or
NO_HEAP_CHANGES. These assumptions are valid for intrinsic functions and
procedures, but you must specify them in the routine.
Example 1
The following program skeleton demonstrates how to nest ASSUME options,
using the PUSH and POP compiler options.
$ASSUME 'PASCAL_FEATURES'$
PROGRAM prog ;
LABEL
999 ; { Possible target for nonlocal GOTO }
$PUSH$
$ASSUME 'NO_SIDE_EFFECTS'$
PROCEDURE extnl ; EXTERNAL ;
{ Optimizer assumes:
{ PASCAL_FEATURES (inherited)
{ NO_SIDE_EFFECTS (specified)
}
$POP$
$PUSH$
$ASSUME 'LOCAL_ACCESSES'$
$ASSUME 'LOCAL_GOTOS_ONLY'$
PROCEDURE intnl ;
$PUSH$
$ASSUME 'NOTHING'$
{ Optimizer assumes nothing.
{ This overrides inherited assumptions.
}
$ASSUME 'PARM_TYPES_MATCH'$
PROCEDURE nested ;
VAR
i : integer ;
$PUSH$
$ASSUME 'NO_SIDE_EFFECTS'$
$ASSUME 'NO_PARMS_OVERLAP'$
PROCEDURE furthernested ;
(Example is continued on next page)
BEGIN {furthernested}
{ Modifying i violates NO_SIDE_EFFECTS }
{ Optimizer assumes:
{ PARM_TYPES_MATCH (inherited),
{ NO_SIDE_EFFECTS (specified)
{ NO_PARMS_OVERLAP (specified)
{ LOCAL_GOTOS_ONLY (known after compilation)
}
END ; {furthernested}
$POP$
BEGIN {nested}
{ Optimizer assumes:
{ PARM_TYPES_MATCH (specified)
{ LOCAL_GOTOS_ONLY (known after compilation)
}
furthernested ;