Runtime
Environment
-
Integer
Expressions/Floating-Point
Support
5.6
Integer
Expression Analysis
All integer expression analysis
is
performed in the
A-file
registers using the
TMS34010's
32-bit
math instructions. All multiplication and division oper-
ations
are
performed in odd registers; for this reason,
only
Al,
A3, A5, and A7
are
used
for
general-purpose expression registers.
Expressions
are
evaluated according
to
standard C precedence rules. When a
binary operator
is
analyzed, the order
of
analysis
is
based on the relative
complexity
of
the operands. The compiler tries
to
evaluate sUbexpressions in
a
way
that prevents saving temporary results
(which
are
calculated in regis-
ters)
off
in memory. This does
not
apply
to
those operators that specify a
particular order
of
evaluation (such
as
the comma,
&&,
and
11),
which
are
al-
ways evaluated in the correct order.
If
the compiler runs
out
of
registers
to
use,
it
selects a
u~ed
register and saves
its contents on the local frame, temporarily freeing the register for reuse.
5.7
Floating-Point
Support
The
TMS34010
C compiler supports
floating-point
functions for
both
sin-
gle-precision
(32-bit)
and double-precision
(64-bit)
values. All
floating-
point
arguments
are
passed on the stack;
floating-point
return values
are
returned on the stack. Single-precision values
are
converted
to
doubles when
they
are
passed
to
functions. Operations between
two
single-precision oper-
ands
are
performed in single-precision. Operations between a single-precision
operand and a double-precision operand
are
performed in double-precision.
A custom package
of
floating-point
routines
is
included
with
the C compiler;
these functions
do
not
follow
standard C calling conventions. The calling
conventions for these routines
follow
a classic operand stack:
• The compiler pushes the
floating-point
arguments
onto
the argument
stack, then generates a call
to
a
floating-point
function.
• The
floating-point
function pops the arguments
off
the stack, performs
the operation, and pushes the results back
onto
the stack.
Some
floating-point
functions expect integer arguments or return integer val-
ues; all integers
are
passed and returned in register A8.
Section 5.7.1 describes the
floating-point
formats used for these routines;
Section 5.7.2 through Section 5.7.5 list the
floating-point
routines.
5.7.1
Floating-Point
Formats
The compiler
is
unaware
of
the internal
floating-point
format; the
only
re-
striction the compiler places on a
floating-point
number
is
the representation
of
the number. This allows you
to
customize a
floating-point
package for your
environment. Section 5.7.1.1 and Section 5.7.2 describe the
floating-point
format used by the
floating-point
routines that
are
included
with
the C
com-
piler.
5-17