TMS34010
C
Run-Time
Environment
Note:
The codegen constantly keeps track
of
the contents
of
the registers and
will
attempt
to
reuse register data
if
it
is
at all possible. Therefore, it
is
inadvisable to
modify
with
an
in-line
assembly construct
(or
with
a
mod-
ification
of
codegen
output)
any register already used in a function. Use
the
-r
option
of
the codegen
to
produce the compiler's information about
use
of
registers and to place
it
in the
output
file.
5.2.3
Register
Variables
The codegen provides
up
to
four
active register variables at a time
for
each
function. These
are
requested via the register storage class. (Refer to Storage
Class Specifiers
in
Declarations, page
4-5,
and K&R for more information.)
The codegen
allocates these variables from registers
A9
through
A12 in as-
cending order; thus, the first variable declared
register
is
placed
in
A9, the
second in
A10, and so on. A register variable can contain any integer type, a
pointer
to
any type,
or
a float (doubles or structures
are
not
allowed).
If
more
than four register variables are declared, the excess
are
treated
as
normal vari-
ables.
Register variables declared
as
short
or
char
are
treated
as
long.
Note:
Using register variables
vastly
increases the efficiency
of
code generated
for
some statements, sometimes by a factor
of
two
or
more. Because the
codegen makes
no
attempt
to
keep track
of
operations involving register
variables, you
are
free
to
manipulate them
by
using
in-line
assembly lan-
guage.
5.3
Integer
Expression Analysis
All integer expression analysis is performed in A file registers using the GSP
32-bit
math instructions. Moreover, all multiplicative operations
are
performed
into
odd registers. For this reason,
only
A1, A3, A5, and A7
are
used
for
gen-
eral-purpose expression registers.
TMS34010
C
follows
exactly the standard precedence rules
of
K&R
C.
Order
of
analysis, however,
for
any operator's operands is based on the relative
complexity
of
the operands: the more complex operand
is
always analyzed
first.
In this way,
thecodegen
minimizes the number
of
operations
which
must
be performed
to
fully
analyze
an
expression. (This does
not
apply to operators
which
specify order
of
analysis
of
operands, such
as
the comma,
&&,
and
II
operators.)
If
the codegen runs
out
of
registers for use, one
of
these used registers
is
se-
lected
for
reuse and its contents
are
saved on the system stack
to
be restored
later. This frees a register temporarily.
5-5