EasyManuals Logo
Home>Texas Instruments>Computer Hardware>TMS34010

Texas Instruments TMS34010 Reference Guide

Texas Instruments TMS34010
181 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #58 background imageLoading...
Page #58 background image
Runtime
Environment
-
Function
Structure
and
Calling
Conventions
3)
It
pushes the arguments on the program stack in reverse order (pushes
the rightmost declared argument first and pushes the leftmost declared
argument last).
If
the called function does
not
have any arguments, the
canc.
iiiu~t
iivt
jJ
...
:;h
~~'i.
!f
th~
~~lIed
function
expects one or more
arguments, the
caller must push
at
least
one
argument. The caller
generates
the
following
code
when
it
pushes the arguments:
MOVE
@-arg3,
*STK+, 1
MOVE
@_arg2,
*STK+, 1
MOVE
@_argl,
*STK+, 1
All integer types that
are
passed
as
arguments
are
widened to
32-bit
in-
tegers.
All
floating-point
arguments
are
converted to double-precision
values. Structures
are
rounded up to the next
word
boundary.
4)
If
the called function returns a structure, the caller pushes the address
of
the structure
onto
the program stack. (For more information
about
functions
that
return structures,
see
Section 5.3.5.)
5)
It
calls the
function
by
generating the
following
instruction:
CALLA
-f
Note that
within
a called function,
FS1
must equal 32.
The
called
function
restores the program stack pointer (effectively
popping
the
arguments), so there
is
no need
for
the calling
function
to
perform any cleanup
after the
function
call.
5.3.2
Responsibilities
of
a
Called
Function
A called
function
must perform the
following
tasks. The steps
below
show
examples
of
the code that the compiler
might
generate
for
a particular step.
1)
If
the
function
modifies any registers,
it
saves them on the system stack.
If
it
uses the
FP,
it
must save
it
with
the other registers. If
the
called
function
must save multiple registers on the system stack,
it
can
use the
M
MTM
instruction
as
shown
below:
MMTM
SP,
AS,
A7,
FP
It
is
not
necessary
to
save register
A8
or the status register. Note
that
the C compiler doesn't use registers
80-814
so that assembly-language
functions can use them.
2)
It
executes the code for the function.
3)
If
the
function
returns
an
integer or a pointer,
it
returns the value in reg-
ister A8;
for
example,
MOVE
@result,
A8,
1
If
the
function
returns a double
or
a float, then the caller
has
allocated
space on the program stack
for
the return value;
the
called function
co-
pies the value into
that
space.
If
the
function
returns a structure, see
Section 5.3.5.
4)
It
restores the caller's environment.
a)
If
the
function
has arguments or returns a float or a double, it must
restore the
caller's stack. To
do
this,
it
moves the value
out
of
the
system stack
to
the program stack pointer (register A14). The STK
is
stored on the system stack
below
the saved registers and the old
5-9

Table of Contents

Other manuals for Texas Instruments TMS34010

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS34010 and is the answer not in the manual?

Texas Instruments TMS34010 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS34010
CategoryComputer Hardware
LanguageEnglish

Related product manuals