1 /* Special varargs support for i860.
2 Copyright
(C
) 2001, 2003 Free Software Foundation
, Inc.
4 This file is part of GCC.
6 GCC is free software
; you can redistribute it and/or modify
7 it under the terms of the GNU General
Public License as published by
8 the Free Software Foundation
; either version 2, or (at your option)
11 In addition to the permissions
in the GNU General
Public License
, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of
this file
into combinations with other programs
,
14 and to distribute those combinations without any restriction coming
15 from the use of
this file.
(The General
Public License restrictions
16 do apply
in other respects
; for example, they cover modification of
17 the file
, and distribution when
not linked
into a combine
20 GCC is distributed
in the hope that it will be useful
,
21 but WITHOUT ANY WARRANTY
; without even the implied warranty of
22 MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General
Public License for more details.
25 You should have received a copy of the GNU General
Public License
26 along with GCC
; see the file COPYING. If not, write to
27 the Free Software Foundation
, 59 Temple Place
- Suite
330,
28 Boston
, MA
02111-1307, USA.
*/
30 #if defined
(__svr4__
) || defined
(__alliant__
)
34 /* The Alliant needs the added underscore.
*/
35 .globl __builtin_saveregs
37 .globl ___builtin_saveregs
40 andnot
0x0f,%sp,%sp /* round down to
16-byte boundary
*/
42 adds
-96,%sp,%sp /* allocate stack space for reg save
43 area
and also for a new va_list
46 adds
-80,%sp,%sp /* allocate stack space for reg save area
*/
48 /* Save all argument registers
in the arg reg save area. The
49 arg reg save area must have the following layout
(according
61 fst.q
%f8
, 0(%sp) /* save floating regs
(f8
-f15
) */
64 st.l
%r16
,32(%sp) /* save integer regs
(r16
-r27
) */
78 adds
80,%sp,%r16
/* compute the address of the new
79 va_list structure. Put
in into
80 r16 so that it will be returned
84 /* Initialize all fields of the new va_list structure.
This
88 unsigned long ireg_used;
89 unsigned long freg_used;
96 st.l
%r0
, 0(%r16
) /* nfixed
*/
97 st.l
%r0
, 4(%r16
) /* nfloating
*/
98 st.l
%sp, 8(%r16
) /* __va_ctl points to __va_struct.
*/
99 bri
%r1
/* delayed return
*/
100 st.l
%r28
,12(%r16
) /* pointer to overflow args
*/
102 bri
%r1
/* delayed return
*/
103 or %sp,%r0
,%r16
/* Return the address of the reg save area.
*/
106 #else
/* not __svr4__
*/
107 #if defined
(__PARAGON__
)
109 * we
'll use SVR4-ish varargs but need SVR3.2 assembler syntax,
110 * and we stand a better chance of hooking into libraries
111 * compiled by PGI. [andyp@ssd.intel.com]
115 .globl __builtin_saveregs
117 .globl ___builtin_saveregs
120 andnot 0x0f,sp,sp /* round down to 16-byte boundary */
121 adds -96,sp,sp /* allocate stack space for reg save
122 area and also for a new va_list
124 /* Save all argument registers in the arg reg save area. The
125 arg reg save area must have the following layout (according
152 adds 80,sp,r16 /* compute the address of the new
153 va_list structure. Put in into
154 r16 so that it will be returned
157 /* Initialize all fields of the new va_list structure. This
158 structure looks like:
161 unsigned long ireg_used;
162 unsigned long freg_used;
168 st.l r0, 0(r16) /* nfixed */
169 st.l r0, 4(r16) /* nfloating */
170 st.l sp, 8(r16) /* __va_ctl points to __va_struct. */
171 bri r1 /* delayed return */
172 st.l r28,12(r16) /* pointer to overflow args */
173 #else /* not __PARAGON__ */
177 .globl ___builtin_saveregs
181 adds -96,sp,sp /* allocate sufficient space on the stack */
183 /* Fill in the __va_struct. */
184 st.l r16, 0(sp) /* save integer regs (r16-r27) */
185 st.l r17, 4(sp) /* int fixed[12] */
197 fst.q f8, 48(sp) /* save floating regs (f8-f15) */
198 fst.q f12,64(sp) /* int floating[8] */
200 /* Fill in the __va_ctl. */
201 st.l sp, 80(sp) /* __va_ctl points to __va_struct. */
202 st.l r28,84(sp) /* pointer to more args */
203 st.l r0, 88(sp) /* nfixed */
204 st.l r0, 92(sp) /* nfloating */
206 adds 80,sp,r16 /* return address of the __va_ctl. */
209 /* recover stack and pass address to start
211 #endif /* not __PARAGON__ */
212 #endif /* not __svr4__ */