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
13 /* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */
16 typedef char *__gnuc_va_list;
20 char *__base; /* Pointer to first integer register. */
21 int __offset; /* Byte offset of args so far. */
25 #endif /* __GNUC_VA_LIST */
27 /* If this is for internal libc use, don't define anything but
30 #if !defined(__GNUC_VA_LIST_1) && (defined (_STDARG_H) || defined (_VARARGS_H))
31 #define __GNUC_VA_LIST_1
36 typedef __gnuc_va_list va_list;
38 #if !defined(_STDARG_H)
41 #define va_alist __builtin_va_alist
42 #define va_dcl int __builtin_va_alist;...
44 #define va_start(pvar) ((pvar) = __builtin_saveregs ())
46 #define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
51 /* ANSI alternative. */
53 /* Call __builtin_next_arg even though we aren't using its value, so that
54 we can verify that firstarg is correct. */
57 #define va_start(pvar, firstarg) \
58 (__builtin_next_arg (firstarg), \
59 (pvar) = __builtin_saveregs ())
61 #define va_start(pvar, firstarg) \
62 (__builtin_next_arg (firstarg), \
63 (pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
66 #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,
95 /* Note that parameters are always aligned at least to a word boundary
96 (when passed) regardless of what GCC's __alignof__ operator says. */
98 /* Avoid errors if compiling GCC v2 with GCC v1. */
100 #define __extension__
103 /* Get the size of a type in bytes, rounded up to an integral number
106 #define __va_tsize(__type) \
107 (((sizeof (__type) + __extension__ sizeof (long long) - 1) \
108 / __extension__ sizeof (long long)) * __extension__ sizeof (long long))
111 #define va_arg(__va, __type) \
112 (*(((__va) += __va_tsize (__type)), \
113 (__type *)(void *)((__va) - __va_tsize (__type))))
117 #define va_arg(__va, __type) \
118 (*(((__va).__offset += __va_tsize (__type)), \
119 (__type *)(void *)((__va).__base + (__va).__offset \
120 - (((__builtin_classify_type (* (__type *) 0) \
121 == __real_type_class) && (__va).__offset <= (6 * 8)) \
122 ? (6 * 8) + 8 : __va_tsize (__type)))))
125 /* Copy __gnuc_va_list into another variable of this type. */
126 #define __va_copy(dest, src) (dest) = (src)
128 #endif /* __GNUC_VA_LIST_1 */