Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / config / m32c / m32c.abi
blob21f61f9d9548299f6c5e5e10df0a355ecf0eed89
1    Target Definitions for R8C/M16C/M32C
2    Copyright (C) 2005
3    Free Software Foundation, Inc.
4    Contributed by Red Hat.
6    This file is part of GCC.
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 2, or (at your
11    option) any later version.
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
18    You should have received a copy of the GNU General Public License
19    along with GCC; see the file COPYING.  If not, write to the Free
20    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
24 These are just some random notes I used during development of this
25 port.  Please don't consider these to be "official" specifications,
26 just additional information to help make the code easier to
27 understand.
30 Frame
31 =====
33         +--------------------
34         | incoming args
35         +--------------------
36         | return Address
37 osp ->  +--------------------
38         | saved fp
39 fp ->   +--------------------
40         | local data
41         +--------------------
42         | saved regs
43         +--------------------
44         | outgoing args (opt)
45 sp ->   +--------------------
47 Argument Passing
48 ================
50 r8c, m16c
51 ---------
53 First arg may be passed in r1l or r1 if it (1) fits (QImode or
54 HImode), (2) is named, and (3) is an integer or pointer type (no
55 structs, floats, etc).  Otherwise, it's passed on the stack.
57 Second arg may be passed in r2, same restrictions (but not QImode),
58 even if the first arg is passed on the stack.
60 Third and further args are passed on the stack.  No padding is used,
61 stack "alignment" is 8 bits.
63 m32cm, m32c
64 -----------
65 First arg may be passed in r0l or r0, same restrictions as above.
67 Second and further args are passed on the stack.  Padding is used
68 after QImode parameters (i.e. lower-addressed byte is the value,
69 higher-addressed byte is the padding), stack "alignment" is 16 bits.
72 Return Value
73 ============
75 r8c, m16c
76 ---------
78 QImode in r0l
79 HImode in r0
80 near pointer in r0
81 (desired)
82 SImode in r2r0
83 far pointer in r2r0
84 (actual)
85 Anything bigger than 16 bits is returned in memory, at mem0 (mem0
86 through mem15 are provided by libgcc.a)
88 Aggregate values (regardless of size) are returned by pushing a
89 pointer to a temporary area on the stack after the args are pushed.
90 The function fills in this area with the value.  Note that this
91 pointer on the stack does not affect how register arguments, if any,
92 are configured.
94 m32cm, m32c
95 -----------
96 Same.
99 Registers Preserved Across Calls
100 ================================
102 r8c, m16c
103 ---------
104 sb, fb, sp (i.e. nearly all registers are call clobbered)
106 m32cm, m32c
107 -----------
108 r1, r2, r3, a0, a1, sb, fb, sp
109 (except when used for return values)
112 Interrupt Handlers
113 ==================
115 The stack frame is slightly different for interrupt handlers, because
116 (1) we don't have a usable parent frame, and (2) we have to use
117 special instructions to return and thus must save/restore everything
118 differently.
120         +--------------------
121         | program state
122 osp ->  +--------------------
123         | return address
124         +--------------------
125         | saved r0..fp (pushm)
126 fp ->   +--------------------
127         | local data
128         +--------------------
129         | saved regs mem0..mem15
130         +--------------------
131         | outgoing args (opt)
132 sp ->   +--------------------