GCC with patches for Dreamcast
修订版 | f451fe61fcc580b320fcdcdd054bab0bb1cd2dc3 (tree) |
---|---|
时间 | 1991-12-24 12:42:25 |
作者 | Richard Stallman <rms@gnu....> |
Commiter | Richard Stallman |
Initial revision
From-SVN: r133
@@ -0,0 +1,59 @@ | ||
1 | +/* This file contains changes made by Data General, December 1989. */ | |
2 | +/* GNU C varargs support for the Motorola 88100 */ | |
3 | + | |
4 | +#ifndef __INT_VARARGS_H /* Prevent multiple inclusions of this file */ | |
5 | +#define __INT_VARARGS_H /* and _int_varargs.h under DG/UX */ | |
6 | + | |
7 | +typedef struct | |
8 | +{ | |
9 | + int __va_arg; /* argument number */ | |
10 | + int *__va_stk; /* start of args passed on stack */ | |
11 | + int *__va_reg; /* start of args passed in regs */ | |
12 | +} va_list; | |
13 | + | |
14 | +#else | |
15 | +#undef __va_size | |
16 | +#undef __va_reg_p | |
17 | +#endif /* __INT_VARARGS_H */ | |
18 | + | |
19 | +#ifdef _STDARG_H /* stdarg.h support */ | |
20 | + | |
21 | +#if __GNUC__ > 1 /* GCC 2.0 and beyond */ | |
22 | +#define va_start(AP,LASTARG) ((AP) = *(va_list *)__builtin_saveregs()) | |
23 | +#else | |
24 | +#define va_start(AP,LASTARG) \ | |
25 | + ( (AP).__va_reg = (int *) __builtin_saveregs2(0), \ | |
26 | + (AP).__va_stk = (int *) __builtin_argptr(), \ | |
27 | + (AP).__va_arg = (int) (__builtin_argsize() + 3) / 4 ) | |
28 | +#endif | |
29 | + | |
30 | +#else /* varargs.h support */ | |
31 | + | |
32 | +#if __GNUC__ > 1 /* GCC 2.0 and beyond */ | |
33 | +#define va_start(AP) ((AP) = *(va_list *)__builtin_saveregs()) | |
34 | +#else | |
35 | +#define va_start(AP) \ | |
36 | + ( (AP).__va_reg = (int *) __builtin_saveregs2(1), \ | |
37 | + (AP).__va_stk = (int *) __builtin_argptr(), \ | |
38 | + (AP).__va_arg = (int) (__builtin_argsize() - 4 + 3) / 4 ) | |
39 | +#endif | |
40 | +#define va_alist __va_1st_arg | |
41 | +#define va_dcl register int va_alist; | |
42 | + | |
43 | +#endif /* _STDARG_H */ | |
44 | + | |
45 | +#define __va_reg_p(TYPE) \ | |
46 | + (__builtin_classify_type(*(TYPE *)0) < 12 \ | |
47 | + ? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4) | |
48 | + | |
49 | +#define __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2) | |
50 | + | |
51 | +#define va_arg(AP,TYPE) \ | |
52 | + ( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(TYPE) >> 3)) - 1) \ | |
53 | + & ~((1 << (__alignof__(TYPE) >> 3)) - 1)) \ | |
54 | + + __va_size(TYPE), \ | |
55 | + *((TYPE *) ((__va_reg_p(TYPE) && (AP).__va_arg < 8 + __va_size(TYPE) \ | |
56 | + ? (AP).__va_reg : (AP).__va_stk) \ | |
57 | + + ((AP).__va_arg - __va_size(TYPE))))) | |
58 | + | |
59 | +#define va_end(AP) |