78
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual Not for Distribution
Beta Version February 2, 2001
Compiler and Flags char short int long float double
com68
2 / 4 2 / 4 4 / 4 4 / 4 10 / 10 10 / 10
com68 -Os2
2 / 4 2 / 4 4 / 4 4 / 4 10 / 10 10 / 10
com68 -Os3
2 / 4 2 / 4 4 / 4 4 / 4 10 / 10 10 / 10
com68 -Os4
4 / 4 4 / 4 4 / 4 4 / 4 10 / 10 10 / 10
com68 -Os5
4 / 4 4 / 4 4 / 4 4 / 4 10 / 10 10 / 10
com68 -XI
2 / 2 2 / 2 2 / 2 4 / 4 10 / 10 10 / 10
com68 -XI -Os2
2 / 2 2 / 2 2 / 2 4 / 4 10 / 10 10 / 10
com68 -XI -Os3
2 / 2 2 / 2 2 / 2 4 / 4 10 / 10 10 / 10
com68 -XI -Os4
2 / 2 2 / 2 2 / 2 4 / 4 10 / 10 10 / 10
com68 -XI -Os5
2 / 2 2 / 2 2 / 2 4 / 4 10 / 10 10 / 10
Note:Sizes are in bytes, with and without prototype — (with prototype) / (without prototype).
The TI-89 / TI-92 Plus requires use of the
L
XI
flag.
Table 2.4: Determination of Argument Size
Table 2.4 shows the sizes in bytes that function arguments occupy on the stack.
The sizes are shown as a function of the compiler and associated command line
flags, argument type, and whether or not a prototype is present. The numbers in
the table to the left of the slash ( / ) are sizes in bytes in the presence of a
prototype; the numbers to the right are sizes in the absence of a prototype.
2.11.3. Accessing Parameters
Inside the called function, the function parameters are accessed from the stack.
The exact mechanism for accessing the parameters is determined by the
presence or absence of the link and movem instructions.
The link instruction, if present, is the first instruction in a function; it is used to set
up a stack frame using address register a6 as the frame pointer (refer to the link
instruction in the
M68000 Family Programmer’s Reference Manual). The link
instruction is also used to leave an extra four bytes free on the top of the stack.
When the top of the stack is free, the rightmost parameter in a function call can
be moved onto the stack instead of pushed onto the stack. The default action is
to use a link instruction only when a stack variable is referenced while the stack
is temporarily displaced, or when the program is to be examined with a
source-level debugger. Its use can be forced with the
-Of1
command line flag.
When the link instruction is not used and a function parameter expects the top of
the stack to be free a subq.l #4, sp instruction is inserted at the start of the
function to free up the top of the stack.
The movem instruction (move or movea instruction if only one register is saved)
saves on the stack the registers that must remain unmodified across a function