Initial revision
[official-gcc.git] / gcc / ginclude / va-i960.h
blobba0d08ba893622548dfd9d1ac58cf477ccf99443
1 /* GNU C varargs support for the Intel 80960. */
3 /* Define __gnuc_va_list. */
5 #ifndef __GNUC_VA_LIST
6 #define __GNUC_VA_LIST
7 /* The first element is the address of the first argument.
8 The second element is the number of bytes skipped past so far. */
9 typedef unsigned __gnuc_va_list[2];
10 #endif /* not __GNUC_VA_LIST */
12 /* If this is for internal libc use, don't define anything but
13 __gnuc_va_list. */
14 #if defined (_STDARG_H) || defined (_VARARGS_H)
16 /* In GCC version 2, we want an ellipsis at the end of the declaration
17 of the argument list. GCC version 1 can't parse it. */
19 #if __GNUC__ > 1
20 #define __va_ellipsis ...
21 #else
22 #define __va_ellipsis
23 #endif
25 /* The stack size of the type t. */
26 #define __vsiz(T) (((sizeof (T) + 3) / 4) * 4)
27 /* The stack alignment of the type t. */
28 #define __vali(T) (__alignof__ (T) >= 4 ? __alignof__ (T) : 4)
29 /* The offset of the next stack argument after one of type t at offset i. */
30 #define __vpad(I, T) ((((I) + __vali (T) - 1) / __vali (T)) \
31 * __vali (T) + __vsiz (T))
33 /* Avoid errors if compiling GCC v2 with GCC v1. */
34 #if __GNUC__ == 1
35 #define __extension__
36 #endif
38 #ifdef _STDARG_H
39 /* Call __builtin_next_arg even though we aren't using its value, so that
40 we can verify that firstarg is correct. */
41 #define va_start(AP, LASTARG) \
42 __extension__ \
43 ({ __builtin_next_arg (LASTARG); \
44 __asm__ ("st g14,%0" : "=m" (*(AP))); \
45 (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
47 #else
49 #define va_alist __builtin_va_alist
50 #define va_dcl char *__builtin_va_alist; __va_ellipsis
51 #define va_start(AP) \
52 __extension__ \
53 ({ __asm__ ("st g14,%0" : "=m" (*(AP))); \
54 (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
55 #endif
57 /* We cast to void * and then to TYPE * because this avoids
58 a warning about increasing the alignment requirement. */
59 #define va_arg(AP, T) \
60 ( \
61 ( \
62 ((AP)[1] <= 48 && (__vpad ((AP)[1], T) > 48 || __vsiz (T) > 16)) \
63 ? ((AP)[1] = 48 + __vsiz (T)) \
64 : ((AP)[1] = __vpad ((AP)[1], T)) \
65 ), \
67 *((T *) (void *) ((char *) *(AP) + (AP)[1] - __vsiz (T))) \
70 #ifndef va_end
71 void va_end (__gnuc_va_list); /* Defined in libgcc.a */
72 #endif
73 #define va_end(AP) ((void *)0)
75 /* Copy __gnuc_va_list into another variable of this type. */
76 #define __va_copy(dest, src) (dest) = (src)
78 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */