Compiler
Operation
-
Code
Generator
Description
When you
don't
use
the
-a
option, the compiler:
• Remembers that a register contains a constant or the value
of
a named
variable,
so
it
does not regenerate code to load that value into a register,
and
• Assumes that
an
assignment
of
the form
*ptr
=
.••
does
not
assign
a value to a named variable.
Under normal circumstances, the compiler cannot
know
which
named variable
an
assignment
will
affect. Thus, when the compiler encounters such
an
as-
signment,
it
must forget the contents
of
all the registers that it assumed con-
tained the values
of
named variables. When you
use
the -a option, the
compiler generates
less
efficient code because it forgets these registers' con-
tents and
has
to regenerate the code; thus, you should
use
this option spar-
ingly.
3.3.3
Small
Code
Model
(-s
Option)
The compiler normally generates CALLA instructions;
if
you
use
-s, the com-
piler generates CALLR instructions. CALLR instructions
are
shorter and faster
than CALLA instructions, but they limit the CALL range
to
±32K
words
of
the
current
PC.
Be sure that
if
you
use
the small code model, you
don't
generate calls outside
of
the 32K-word range; otherwise, your code
won't
run. You
can
verify that
you conform
to
this limit by checking the link map (32K words translates
to
Ox80000
in
bit addresses).
You
can
mix small-model code
with
other code
as
long
as
the small-model
code conforms to the CALL restrictions. For example,
if
a module contains a
group
of
functions that only call each other, and the size
of
this compiled
module
is
32K words or
less,
you
can
compile it
with
the -s option. You can
then link this module
with
modules that weren't compiled
with
-s,
as
long
as
the small-code module doesn't call any code that
is
more than 32K words
away. Small-model code
can
call functions outside the small-code module,
as
long
as
the called function
is
within the 32K-word limit.
3.3.4
Checking
for
Stack
Overflow
(-x
option)
3-10
When you
use
-x, the code generator checks for stack overflow at the begin-
ning
of
each function (after allocating the local frame). It does this by calling
another function, s$check, that compares the
two
stack pointers.
•
If
the stacks
don't
overlap, s$check simply returns.
• If the stacks collide, s$check takes a TRAP 29. You
can
modify s$check
to perform some other type
of
action; the source module for s$check
is
scheck.
aSIn,
which
is
a member
of
rts.
src.
Note that there
is
usually no way
to
recover from a stack overflow.
If
the stack
overflows, you can't
use
it, and thus you can't
use
C code
for
the abort proc-
ess.