This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: MIPS16 -mentry pseudo instruction definitions
- To: gcc@gcc.gnu.org
- Subject: Re: MIPS16 -mentry pseudo instruction definitions
- From: Andre McCurdy <armccurdy@yahoo.co.uk>
- Date: Fri, 10 Sep 1999 16:21:31 +0100 (BST)
- Cc: law@cygnus.com, rth@cygnus.com
The mips16 ISA makes no mention of the entry/exit
pseudo instructions. (Thanks to Richard Henderson for
the reference).
I guess I'll have to jump straight in with my real
question...
As I understand from the comments in the 'mips.c'
source, it seems that the compiler expects the
implementation of the entry instruction (ie a trap
handler), to grow the stack by the fixed amount of
32bytes (exit does the same in reverse on the way back
out). ie:
+-----------------------+
| ra if required |
| s0 if required |
| s1 if required |
| (always wasted) |
+-----------------------+
| 4 words to save |
| arguments passed |
| in registers, even |
| if not passed. | <- sp after 'entry'
+-----------------------+
(any of the a0..a3 registers that require stacking are
put in space reserved in the caller's stack frame as
normal).
Assuming a 32bit target where the stack pointer can be
aligned on any 4byte boundary, it seems that between 4
and 24 bytes of stack space are wasted (or upto 32 if
used on a leaf function where ra doesn't need saving)
by having this simple 'always grow by 32bytes'
algorithm.
Does anyone know why this is the case ? Is there any
reason why 'compute_frame_size()' can't calculate the
exact value depending on which of ra, s0 and s1 need
stacking on a function by function basis ?
(I'd like to be able to try and fix this myself but as
I've never tried hacking gcc before, I'd like to get
as much background as possible on why its been done
the way it is :-).
Andre
--
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie