1 /* GNU C varargs and stdargs support for the DEC Alpha. */
3 /* Note: We must use the name __builtin_savregs. GCC attaches special
4 significance to that name. In particular, regardless of where in a
5 function __builtin_saveregs is called, GCC moves the call up to the
6 very start of the function. */
8 /* Define __gnuc_va_list. */
10 #ifndef __GNUC_VA_LIST
11 #define __GNUC_VA_LIST
14 /* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */
17 typedef char *__gnuc_va_list
;
21 char *__base
; /* Pointer to first integer register. */
22 int __offset
; /* Byte offset of args so far. */
26 #endif /* not __GNUC_VA_LIST */
28 /* If this is for internal libc use, don't define anything but
30 #if defined (_STDARG_H) || defined (_VARARGS_H)
32 #define va_list __gnuc_va_list
36 #if !defined(_STDARG_H)
39 #define va_alist __builtin_va_alist
40 #define va_dcl int __builtin_va_alist;...
42 #define va_start(pvar) ((pvar) = __builtin_saveregs ())
44 #define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
49 /* ANSI alternative. */
51 /* Call __builtin_next_arg even though we aren't using its value, so that
52 we can verify that firstarg is correct. */
55 #define va_start(pvar, firstarg) \
56 (__builtin_next_arg (firstarg), \
57 (pvar) = __builtin_saveregs ())
59 #define va_start(pvar, firstarg) \
60 (__builtin_next_arg (firstarg), \
61 (pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
64 #endif /* _STDARG_H */
68 #define va_end(__va) ((void) 0)
70 /* Values returned by __builtin_classify_type. */
77 __enumeral_type_class
,
80 __reference_type_class
,
84 __function_type_class
,
97 /* Note that parameters are always aligned at least to a word boundary
98 (when passed) regardless of what GCC's __alignof__ operator says. */
100 /* Avoid errors if compiling GCC v2 with GCC v1. */
102 #define __extension__
105 /* Get the size of a type in bytes, rounded up to an integral number
108 #define __va_tsize(__type) \
109 (((sizeof (__type) + __extension__ sizeof (long long) - 1) \
110 / __extension__ sizeof (long long)) * __extension__ sizeof (long long))
113 #define va_arg(__va, __type) \
114 (*(((__va) += __va_tsize (__type)), \
115 (__type *)(void *)((__va) - __va_tsize (__type))))
119 #define va_arg(__va, __type) \
120 (*(((__va).__offset += __va_tsize (__type)), \
121 (__type *)(void *)((__va).__base + (__va).__offset \
122 - (((__builtin_classify_type (* (__type *) 0) \
123 == __real_type_class) && (__va).__offset <= (6 * 8)) \
124 ? (6 * 8) + 8 : __va_tsize (__type)))))
127 /* Copy __gnuc_va_list into another variable of this type. */
128 #define __va_copy(dest, src) (dest) = (src)
130 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */