This commit was generated by cvs2svn to compensate for changes in r52143,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
David E. O'Brien 1999-10-12 00:47:56 +00:00
commit f04184a54b
19 changed files with 1071 additions and 115 deletions

View File

@ -0,0 +1,170 @@
/* PowerPC asm definitions for GNU C. */
/* Under winnt, 1) gas supports the following as names and 2) in particular
defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */
#if !defined(__WINNT__)
#define r0 0
#define sp 1
#define toc 2
#define r3 3
#define r4 4
#define r5 5
#define r6 6
#define r7 7
#define r8 8
#define r9 9
#define r10 10
#define r11 11
#define r12 12
#define r13 13
#define r14 14
#define r15 15
#define r16 16
#define r17 17
#define r18 18
#define r19 19
#define r20 20
#define r21 21
#define r22 22
#define r23 23
#define r24 24
#define r25 25
#define r26 26
#define r27 27
#define r28 28
#define r29 29
#define r30 30
#define r31 31
#define cr0 0
#define cr1 1
#define cr2 2
#define cr3 3
#define cr4 4
#define cr5 5
#define cr6 6
#define cr7 7
#define f0 0
#define f1 1
#define f2 2
#define f3 3
#define f4 4
#define f5 5
#define f6 6
#define f7 7
#define f8 8
#define f9 9
#define f10 10
#define f11 11
#define f12 12
#define f13 13
#define f14 14
#define f15 15
#define f16 16
#define f17 17
#define f18 18
#define f19 19
#define f20 20
#define f21 21
#define f22 22
#define f23 23
#define f24 24
#define f25 25
#define f26 26
#define f27 27
#define f28 28
#define f29 29
#define f30 30
#define f31 31
#endif
/*
* Macros to glue together two tokens.
*/
#ifdef __STDC__
#define XGLUE(a,b) a##b
#else
#define XGLUE(a,b) a/**/b
#endif
#define GLUE(a,b) XGLUE(a,b)
/*
* Macros to begin and end a function written in assembler. If -mcall-aixdesc
* or -mcall-nt, create a function descriptor with the given name, and create
* the real function with one or two leading periods respectively.
*/
#ifdef _RELOCATABLE
#define DESC_SECTION ".got2"
#else
#define DESC_SECTION ".got1"
#endif
#if defined(_CALL_AIXDESC)
#define FUNC_NAME(name) GLUE(.,name)
#define FUNC_START(name) \
.section DESC_SECTION,"aw"; \
name: \
.long GLUE(.,name); \
.long _GLOBAL_OFFSET_TABLE_; \
.long 0; \
.previous; \
.type GLUE(.,name),@function; \
.globl name; \
.globl GLUE(.,name); \
GLUE(.,name):
#define FUNC_END(name) \
GLUE(.L,name): \
.size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
#elif defined(__WINNT__)
#define FUNC_NAME(name) GLUE(..,name)
#define FUNC_START(name) \
.pdata; \
.align 2; \
.ualong GLUE(..,name),GLUE(name,.e),0,0,GLUE(..,name); \
.reldata; \
name: \
.ualong GLUE(..,name),.toc; \
.section .text; \
.globl name; \
.globl GLUE(..,name); \
GLUE(..,name):
#define FUNC_END(name) \
GLUE(name,.e): ; \
GLUE(FE_MOT_RESVD..,name):
#elif defined(_CALL_NT)
#define FUNC_NAME(name) GLUE(..,name)
#define FUNC_START(name) \
.section DESC_SECTION,"aw"; \
name: \
.long GLUE(..,name); \
.long _GLOBAL_OFFSET_TABLE_; \
.previous; \
.type GLUE(..,name),@function; \
.globl name; \
.globl GLUE(..,name); \
GLUE(..,name):
#define FUNC_END(name) \
GLUE(.L,name): \
.size GLUE(..,name),GLUE(.L,name)-GLUE(..,name)
#else
#define FUNC_NAME(name) name
#define FUNC_START(name) \
.type name,@function; \
.globl name; \
name:
#define FUNC_END(name) \
GLUE(.L,name): \
.size name,GLUE(.L,name)-name
#endif

View File

@ -0,0 +1,20 @@
/* stdbool.h for GNU. */
#ifndef __STDBOOL_H__
#define __STDBOOL_H__ 1
/* The type `bool' must promote to `int' or `unsigned int'. The constants
`true' and `false' must have the value 0 and 1 respectively. */
typedef enum
{
false = 0,
true = 1
} bool;
/* The names `true' and `false' must also be made available as macros. */
#define false false
#define true true
/* Signal that all the definitions are present. */
#define __bool_true_false_are_defined 1
#endif /* stdbool.h */

View File

@ -10,26 +10,41 @@
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
/* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */
#ifdef __VMS__
typedef char *__gnuc_va_list;
#else
typedef struct {
char *__base; /* Pointer to first integer register. */
int __offset; /* Byte offset of args so far. */
} __gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
#endif
#endif /* __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define va_list __gnuc_va_list
#if !defined(__GNUC_VA_LIST_1) && (defined (_STDARG_H) || defined (_VARARGS_H))
#define __GNUC_VA_LIST_1
#define _VA_LIST
#define _VA_LIST_
typedef __gnuc_va_list va_list;
#if !defined(_STDARG_H)
/* varargs support */
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist;...
#ifdef __VMS__
#define va_start(pvar) ((pvar) = __builtin_saveregs ())
#else
#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
#endif
#else /* STDARG.H */
@ -37,14 +52,19 @@ typedef struct {
/* Call __builtin_next_arg even though we aren't using its value, so that
we can verify that firstarg is correct. */
#ifdef __VMS__
#define va_start(pvar, firstarg) \
(__builtin_next_arg (firstarg), \
(pvar) = __builtin_saveregs ())
#else
#define va_start(pvar, firstarg) \
(__builtin_next_arg (firstarg), \
(pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
#endif
#endif /* _STDARG_H */
#ifndef va_end
#define va_end(__va) ((void) 0)
/* Values returned by __builtin_classify_type. */
@ -72,8 +92,6 @@ enum {
__lang_type_class
};
#endif
/* Note that parameters are always aligned at least to a word boundary
(when passed) regardless of what GCC's __alignof__ operator says. */
@ -89,12 +107,22 @@ enum {
(((sizeof (__type) + __extension__ sizeof (long long) - 1) \
/ __extension__ sizeof (long long)) * __extension__ sizeof (long long))
#ifdef __VMS__
#define va_arg(__va, __type) \
(*(((__va) += __va_tsize (__type)), \
(__type *)(void *)((__va) - __va_tsize (__type))))
#else
#define va_arg(__va, __type) \
(*(((__va).__offset += __va_tsize (__type)), \
(__type *)(void *)((__va).__base + (__va).__offset \
- (((__builtin_classify_type (* (__type *) 0) \
== __real_type_class) && (__va).__offset <= (6 * 8)) \
? (6 * 8) + 8 : __va_tsize (__type)))))
#endif
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* __GNUC_VA_LIST_1 */

View File

@ -0,0 +1,111 @@
/* stdarg/varargs support for the ARC */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void * __gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
/* In GCC version 2, we want an ellipsis at the end of the declaration
of the argument list. GCC version 1 can't parse it. */
#if __GNUC__ > 1
#define __va_ellipsis ...
#else
#define __va_ellipsis
#endif
/* See arc_setup_incoming_varargs for reasons for the oddity in va_start. */
#ifdef _STDARG_H
#define va_start(AP, LASTARG) \
(AP = (__gnuc_va_list) ((int *) __builtin_next_arg (LASTARG) \
+ (__builtin_args_info (0) < 8 \
? (__builtin_args_info (0) & 1) \
: 0)))
#else
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; __va_ellipsis
#define va_start(AP) \
(AP = (__gnuc_va_list) ((int *) &__builtin_va_alist \
+ (__builtin_args_info (0) < 8 \
? (__builtin_args_info (0) & 1) \
: 0)))
#endif
#ifndef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
/* Values returned by __builtin_classify_type. */
enum __va_type_classes {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
#endif
#define va_end(AP) ((void)0)
/* Avoid errors if compiling GCC v2 with GCC v1. */
#if __GNUC__ == 1
#define __extension__
#endif
/* All aggregates are passed by reference. All scalar types larger than 8
bytes are passed by reference. */
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement.
The casts to char * avoid warnings about invalid pointer arithmetic. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#ifdef __big_endian__
#define va_arg(AP,TYPE) \
__extension__ \
(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
|| __va_rounded_size (TYPE) > 8) \
? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \
*(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \
: ((TYPE *) (void *) \
(AP = (void *) ((__alignof__ (TYPE) > 4 \
? ((int) AP + 8 - 1) & -8 \
: (int) AP) \
+ __va_rounded_size (TYPE))) - 1));}))
#else
#define va_arg(AP,TYPE) \
__extension__ \
(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
|| __va_rounded_size (TYPE) > 8) \
? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \
*(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \
: ((AP = (void *) ((__alignof__ (TYPE) > 4 \
? ((int) AP + 8 - 1) & -8 \
: (int) AP) \
+ __va_rounded_size (TYPE))), \
(TYPE *) (void *) (AP - __va_rounded_size (TYPE))));}))
#endif
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -54,4 +54,7 @@ typedef struct
#define va_end(AP) ((void) 0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -44,10 +44,13 @@ typedef void *__gnuc_va_list;
#define va_arg(AP, TYPE) \
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \
? sizeof (TYPE) \
: __va_rounded_size (TYPE))))))
*((TYPE *) (void *) ((char *) (AP) \
- ((sizeof (TYPE) < __va_rounded_size (int) \
? sizeof (TYPE) : __va_rounded_size (TYPE))))))
#define va_end(AP) ((void) 0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -207,5 +207,8 @@ __extension__ \
__rv; \
}))
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -70,7 +70,10 @@ __extension__ \
#ifndef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(AP) ((void *)0)
#define va_end(AP) ((void) 0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -0,0 +1,86 @@
/* GNU C stdarg/varargs support for the M32R */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
/* Common code for va_start for both varargs and stdarg. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#ifdef _STDARG_H /* stdarg.h support */
/* Calling __builtin_next_arg gives the proper error message if LASTARG is
not indeed the last argument. */
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#else /* varargs.h support */
#define va_alist __builtin_va_alist
/* The ... causes current_function_varargs to be set in cc1. */
#define va_dcl int __builtin_va_alist; ...
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif /* _STDARG_H */
/* Nothing needs to be done to end varargs/stdarg processing */
#define va_end(AP) ((void) 0)
/* Values returned by __builtin_classify_type. */
enum __type_class
{
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
/* Return whether a type is passed by reference. */
#define __va_by_reference_p(TYPE) (sizeof (TYPE) > 8)
#define va_arg(AP,TYPE) \
__extension__ (*({ \
register TYPE *__ptr; \
\
if (__va_by_reference_p (TYPE)) \
{ \
__ptr = *(TYPE **)(void *) (AP); \
(AP) = (__gnuc_va_list) ((char *) (AP) + sizeof (void *)); \
} \
else \
{ \
__ptr = (TYPE *)(void *) \
((char *) (AP) + (sizeof (TYPE) < __va_rounded_size (char) \
? __va_rounded_size (TYPE) - sizeof (TYPE) \
: 0)); \
(AP) = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)); \
} \
\
__ptr; \
}))
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -81,4 +81,7 @@ typedef struct
#define va_end(AP) ((void)0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -13,13 +13,54 @@
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)
typedef struct {
/* Pointer to FP regs. */
char *__fp_regs;
/* Number of FP regs remaining. */
int __fp_left;
/* Pointer to GP regs followed by stack parameters. */
char *__gp_regs;
} __gnuc_va_list;
#else /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
typedef char * __gnuc_va_list;
#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#ifndef _VA_MIPS_H_ENUM
#define _VA_MIPS_H_ENUM
enum {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
#endif
/* In GCC version 2, we want an ellipsis at the end of the declaration
of the argument list. GCC version 1 can't parse it. */
@ -37,16 +78,49 @@ typedef char * __gnuc_va_list;
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif
#ifdef __mips64
#define __va_reg_size 8
#else
#define __va_reg_size 4
#endif
/* Get definitions for _MIPS_SIM_ABI64 etc. */
#ifdef _MIPS_SIM
#include <sgidefs.h>
#endif
#ifdef _STDARG_H
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define va_start(__AP, __LASTARG) \
(__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: 0)), \
__AP.__fp_left = 8 - __builtin_args_info (3), \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
#else /* ! defined (__mips64) */
#define va_start(__AP, __LASTARG) \
(__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: 0)), \
__AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
__AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
#endif /* ! defined (__mips64) */
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
#define va_start(__AP, __LASTARG) \
(__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \
- (__builtin_args_info (2) >= 8 ? 0 \
: (8 - __builtin_args_info (2)) * __va_reg_size)))
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
#else /* ! defined (__mips_eabi) */
#define va_start(__AP, __LASTARG) \
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
#else
#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#else /* ! _STDARG_H */
#define va_alist __builtin_va_alist
#ifdef __mips64
/* This assumes that `long long int' is always a 64 bit type. */
@ -54,21 +128,109 @@ typedef char * __gnuc_va_list;
#else
#define va_dcl int __builtin_va_alist; __va_ellipsis
#endif
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define va_start(__AP) \
(__AP.__gp_regs = ((char *) __builtin_next_arg () \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: __va_reg_size)), \
__AP.__fp_left = 8 - __builtin_args_info (3), \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
#else /* ! defined (__mips64) */
#define va_start(__AP) \
(__AP.__gp_regs = ((char *) __builtin_next_arg () \
- (__builtin_args_info (2) < 8 \
? (8 - __builtin_args_info (2)) * __va_reg_size \
: __va_reg_size)), \
__AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
__AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
__AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
#endif /* ! defined (__mips64) */
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#define va_start(__AP) \
(__AP = ((__gnuc_va_list) __builtin_next_arg () \
- (__builtin_args_info (2) >= 8 ? __va_reg_size \
: (8 - __builtin_args_info (2)) * __va_reg_size)))
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
/* Need alternate code for _MIPS_SIM_ABI64. */
#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64)
#elif defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
#define va_start(__AP) \
(__AP = (__gnuc_va_list) __builtin_next_arg () \
+ (__builtin_args_info (2) >= 8 ? -8 : 0))
#else
#define va_start(__AP) __AP = (char *) &__builtin_va_alist
#endif
#endif
#endif /* ! _STDARG_H */
#ifndef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(__AP) ((void)0)
#if defined (__mips_eabi)
#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
#ifdef __mips64
#define __va_next_addr(__AP, __type) \
((__builtin_classify_type (*(__type *) 0) == __real_type_class \
&& __AP.__fp_left > 0) \
? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
: (__AP.__gp_regs += __va_reg_size) - __va_reg_size)
#else
#define __va_next_addr(__AP, __type) \
((__builtin_classify_type (*(__type *) 0) == __real_type_class \
&& __AP.__fp_left > 0) \
? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
: (((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
? __AP.__gp_regs = (char *) (((int) __AP.__gp_regs + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \
: ((__AP.__gp_regs += __va_rounded_size (__type)) \
- __va_rounded_size (__type)))))
#endif
#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#ifdef __mips64
#define __va_next_addr(__AP, __type) \
((__AP += __va_reg_size) - __va_reg_size)
#else
#define __va_next_addr(__AP, __type) \
(((__builtin_classify_type (* (__type *) 0) < __record_type_class \
&& __alignof__ (__type) > 4) \
? __AP = (char *) (((__PTRDIFF_TYPE__) __AP + 8 - 1) & -8) \
: (char *) 0), \
(__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? (__AP += __va_reg_size) - __va_reg_size \
: ((__AP += __va_rounded_size (__type)) \
- __va_rounded_size (__type))))
#endif
#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
((__va_rounded_size (__type) <= __va_reg_size) \
? *(__type *) (void *) (__va_next_addr (__AP, __type) \
+ __va_reg_size \
- sizeof (__type)) \
: (__builtin_classify_type (*(__type *) 0) >= __record_type_class \
? **(__type **) (void *) (__va_next_addr (__AP, __type) \
+ __va_reg_size \
- sizeof (char *)) \
: *(__type *) (void *) __va_next_addr (__AP, __type)))
#else
#define va_arg(__AP, __type) \
((__va_rounded_size (__type) <= __va_reg_size) \
? *(__type *) (void *) __va_next_addr (__AP, __type) \
: (__builtin_classify_type (* (__type *) 0) >= __record_type_class \
? **(__type **) (void *) __va_next_addr (__AP, __type) \
: *(__type *) (void *) __va_next_addr (__AP, __type)))
#endif
#else /* ! defined (__mips_eabi) */
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
/* The __mips64 cases are reversed from the 32 bit cases, because the standard
@ -78,8 +240,9 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#ifdef __mips64
#ifdef __MIPSEB__
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))))[-1]
((__type *) (void *) (__AP = (char *) \
((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ __va_rounded_size (__type))))[-1]
#else
#define va_arg(__AP, __type) \
((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
@ -93,18 +256,22 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
/* For big-endian machines. */
#define va_arg(__AP, __type) \
((__AP = (char *) ((__alignof__ (__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
#else
/* For little-endian machines. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
? ((int)__AP + 8 - 1) & -8 \
: ((int)__AP + 4 - 1) & -4) \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
#endif
#endif
#endif /* ! defined (__mips_eabi) */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -0,0 +1,37 @@
/* CYGNUS LOCAL entire file/law */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs())
#define __va_ellipsis ...
#ifdef _STDARG_H
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#else
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; __va_ellipsis
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif
/* Now stuff common to both varargs & stdarg implementations. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#undef va_end
void va_end (__gnuc_va_list);
#define va_end(AP) ((void)0)
#define va_arg(AP, TYPE) \
(sizeof (TYPE) > 8 \
? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
**((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
#endif
/* END CYGNUS LOCAL */

View File

@ -0,0 +1,35 @@
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs())
#define __va_ellipsis ...
#ifdef _STDARG_H
#define va_start(AP, LASTARG) \
(__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
#else
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; __va_ellipsis
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif
/* Now stuff common to both varargs & stdarg implementations. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#undef va_end
void va_end (__gnuc_va_list);
#define va_end(AP) ((void)0)
#define va_arg(AP, TYPE) \
(sizeof (TYPE) > 8 \
? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
**((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
#endif

View File

@ -4,7 +4,7 @@
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef double *__gnuc_va_list;
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
@ -46,4 +46,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(AP) ((void)0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -1,13 +1,22 @@
/* GNU C varargs support for the PowerPC with V.4 calling sequence */
/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */
#ifndef _WIN32
/* System V.4 support */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#ifndef _SYS_VA_LIST_H
#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */
/* Solaris decided to rename overflow_arg_area to input_arg_area,
so handle it via a macro. */
#define __va_overflow(AP) (AP)->overflow_arg_area
/* Note that the names in this structure are in the user's namespace, but
that the V.4 abi explicitly states that these names should be used. */
typedef struct {
typedef struct __va_list_tag {
char gpr; /* index into the array of 8 GPRs stored in the
register save area gpr=0 corresponds to r3,
gpr=1 to r4, etc. */
@ -17,7 +26,14 @@ typedef struct {
char *overflow_arg_area; /* location on stack that holds the next
overflow argument */
char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */
} __gnuc_va_list[1];
} __va_list[1], __gnuc_va_list[1];
#else /* _SYS_VA_LIST */
typedef __va_list __gnuc_va_list;
#define __va_overflow(AP) (AP)->input_arg_area
#endif /* not _SYS_VA_LIST */
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
@ -25,6 +41,8 @@ typedef struct {
#if defined (_STDARG_H) || defined (_VARARGS_H)
/* Register save area located below the frame pointer */
#ifndef __VA_PPC_H__
#define __VA_PPC_H__
typedef struct {
long __gp_save[8]; /* save area for GP registers */
double __fp_save[8]; /* save area for FP registers */
@ -64,9 +82,9 @@ __extension__ ({ \
(AP)->fpr = __va_fregno - 33; \
(AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \
+ __va_varargs_offset); \
(AP)->overflow_arg_area = ((char *)__builtin_saveregs () \
+ (((__words >= 8) ? __words - 8 : 0) \
* sizeof (long))); \
__va_overflow(AP) = ((char *)__builtin_saveregs () \
+ (((__words >= 8) ? __words - 8 : 0) \
* sizeof (long))); \
(void)0; \
})
@ -91,6 +109,9 @@ __extension__ ({ \
#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8)
#endif
#define __va_longlong_p(TYPE) \
((__builtin_classify_type(*(TYPE *)0) == 1) && (sizeof(TYPE) == 8))
#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12)
#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long))
@ -111,8 +132,13 @@ __extension__ (*({ \
} \
\
else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \
&& (AP)->gpr + __va_size(TYPE) <= 8) \
&& (AP)->gpr + __va_size(TYPE) <= 8 \
&& (!__va_longlong_p(TYPE) \
|| (AP)->gpr + __va_size(TYPE) <= 8)) \
{ \
if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \
(AP)->gpr++; \
\
__ptr = __VA_GP_REGSAVE (AP, TYPE); \
(AP)->gpr += __va_size (TYPE); \
} \
@ -121,19 +147,19 @@ __extension__ (*({ \
&& (AP)->gpr < 8) \
{ \
(AP)->gpr = 8; \
__ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \
(AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \
__ptr = (TYPE *) (void *) (__va_overflow(AP)); \
__va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
} \
\
else if (__va_aggregate_p (TYPE)) \
{ \
__ptr = * (TYPE **) (void *) ((AP)->overflow_arg_area); \
(AP)->overflow_arg_area += sizeof (TYPE *); \
__ptr = * (TYPE **) (void *) (__va_overflow(AP)); \
__va_overflow(AP) += sizeof (TYPE *); \
} \
else \
{ \
__ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \
(AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \
__ptr = (TYPE *) (void *) (__va_overflow(AP)); \
__va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
} \
\
__ptr; \
@ -141,4 +167,64 @@ __extension__ (*({ \
#define va_end(AP) ((void)0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) *(dest) = *(src)
#endif /* __VA_PPC_H__ */
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
#else
/* Windows NT */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef char *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define __va_start_common(AP, LASTARG, FAKE) \
((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0)
#ifdef _STDARG_H /* stdarg.h support */
/* Calling __builtin_next_arg gives the proper error message if LASTARG is
not indeed the last argument. */
#define va_start(AP,LASTARG) \
(__builtin_saveregs (), \
(AP) = __builtin_next_arg (LASTARG), \
0)
#else /* varargs.h support */
#define va_start(AP) \
(__builtin_saveregs (), \
(AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \
0)
#define va_alist __va_1st_arg
#define va_dcl register int __va_1st_arg; ...
#endif /* _STDARG_H */
#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3)
#define __va_align(AP, TYPE) \
((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \
& ~((sizeof (TYPE) >= 8) ? 7 : 3))
#define va_arg(AP,TYPE) \
( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \
+ __va_rounded_size(TYPE))) \
- __va_rounded_size(TYPE)))
#define va_end(AP) ((void)0)
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
#endif /* Windows NT */

View File

@ -0,0 +1,199 @@
/* This is just like the default gvarargs.h
except for differences described below. */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#ifdef __SH3E__
typedef long __va_greg;
typedef double __va_freg;
typedef struct {
__va_greg * __va_next_o; /* next available register */
__va_greg * __va_next_o_limit; /* past last available register */
__va_freg * __va_next_fp; /* next available fp register */
__va_freg * __va_next_fp_limit; /* last available fp register */
__va_greg * __va_next_stack; /* next extended word on stack */
} __gnuc_va_list;
#else /* ! SH3E */
typedef void *__gnuc_va_list;
#endif /* ! SH3E */
#endif /* __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#ifdef _STDARG_H
#ifdef __SH3E__
#define va_start(AP, LASTARG) \
__extension__ \
({ \
AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \
AP.__va_next_fp_limit = (AP.__va_next_fp + \
(__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \
AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \
AP.__va_next_o_limit = (AP.__va_next_o + \
(__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \
AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \
})
#else /* ! SH3E */
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#endif /* ! SH3E */
#else /* _VARARGS_H */
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist;...
#ifdef __SH3E__
#define va_start(AP) \
__extension__ \
({ \
AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \
AP.__va_next_fp_limit = (AP.__va_next_fp + \
(__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \
AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \
AP.__va_next_o_limit = (AP.__va_next_o + \
(__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \
AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \
- (__builtin_args_info (0) >= 4 || __builtin_args_info (1) >= 8 ? 1 : 0); \
})
#else /* ! SH3E */
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif /* ! SH3E */
#endif /* _STDARG */
#ifndef va_end
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
/* Values returned by __builtin_classify_type. */
enum __va_type_classes {
__no_type_class = -1,
__void_type_class,
__integer_type_class,
__char_type_class,
__enumeral_type_class,
__boolean_type_class,
__pointer_type_class,
__reference_type_class,
__offset_type_class,
__real_type_class,
__complex_type_class,
__function_type_class,
__method_type_class,
__record_type_class,
__union_type_class,
__array_type_class,
__string_type_class,
__set_type_class,
__file_type_class,
__lang_type_class
};
#endif
#define va_end(pvar) ((void)0)
#ifdef __LITTLE_ENDIAN__
#define __LITTLE_ENDIAN_P 1
#else
#define __LITTLE_ENDIAN_P 0
#endif
#define __SCALAR_TYPE(TYPE) \
((TYPE) == __integer_type_class \
|| (TYPE) == __char_type_class \
|| (TYPE) == __enumeral_type_class)
/* RECORD_TYPE args passed using the C calling convention are
passed by invisible reference. ??? RECORD_TYPE args passed
in the stack are made to be word-aligned; for an aggregate that is
not word-aligned, we advance the pointer to the first non-reg slot. */
/* When this is a smaller-than-int integer, using
auto-increment in the promoted (SImode) is fastest;
however, there is no way to express that is C. Therefore,
we use an asm.
We want the MEM_IN_STRUCT_P bit set in the emitted RTL, therefore we
use unions even when it would otherwise be unnecessary. */
#define __va_arg_sh1(AP, TYPE) __extension__ \
__extension__ \
({(sizeof (TYPE) == 1 \
? ({union {TYPE t; char c;} __t; \
__asm("" \
: "=r" (__t.c) \
: "0" ((((union { int i, j; } *) (AP))++)->i)); \
__t.t;}) \
: sizeof (TYPE) == 2 \
? ({union {TYPE t; short s;} __t; \
__asm("" \
: "=r" (__t.s) \
: "0" ((((union { int i, j; } *) (AP))++)->i)); \
__t.t;}) \
: sizeof (TYPE) >= 4 || __LITTLE_ENDIAN_P \
? (((union { TYPE t; int i;} *) (AP))++)->t \
: ((union {TYPE t;TYPE u;}*) ((char *)++(int *)(AP) - sizeof (TYPE)))->t);})
#ifdef __SH3E__
#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \
(TYPE_CLASS == __real_type_class && SIZE == 4)
#define va_arg(pvar,TYPE) \
__extension__ \
({int __type = __builtin_classify_type (* (TYPE *) 0); \
void * __result_p; \
if (__PASS_AS_FLOAT (__type, sizeof(TYPE))) \
{ \
if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \
{ \
__result_p = &pvar.__va_next_fp; \
} \
else \
__result_p = &pvar.__va_next_stack; \
} \
else \
{ \
if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \
<= pvar.__va_next_o_limit) \
__result_p = &pvar.__va_next_o; \
else \
{ \
if (sizeof (TYPE) > 4) \
pvar.__va_next_o = pvar.__va_next_o_limit; \
\
__result_p = &pvar.__va_next_stack; \
} \
} \
__va_arg_sh1(*(void **)__result_p, TYPE);})
#else /* ! SH3E */
#define va_arg(AP, TYPE) __va_arg_sh1((AP), TYPE)
#endif /* SH3E */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -5,19 +5,7 @@
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#ifdef __sparc_v9__
typedef long long __va_greg;
typedef double __va_freg;
typedef struct {
__va_greg * __va_next_o; /* next available %o* register */
__va_greg * __va_next_o_limit; /* past last available %o* register */
__va_freg * __va_next_fp; /* next available %f* register */
__va_freg * __va_next_fp_limit; /* last available %f* register */
__va_greg * __va_next_stack; /* next extended word on stack */
} __gnuc_va_list;
#else
#ifndef __svr4__
#if ! defined (__svr4__) && ! defined (__linux__) && ! defined (__arch64__)
/* This has to be a char * to be compatible with Sun.
i.e., we have to pass a `va_list' to vsprintf. */
typedef char * __gnuc_va_list;
@ -26,7 +14,6 @@ typedef char * __gnuc_va_list;
i.e., we have to pass a `va_list' to vsprintf. */
typedef void * __gnuc_va_list;
#endif
#endif /* not __sparc_v9__ */
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
@ -35,56 +22,27 @@ typedef void * __gnuc_va_list;
#ifdef _STDARG_H
#ifdef __sparc_v9__
#define va_start(AP, LASTARG) \
__extension__ \
({ \
AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \
AP.__va_next_o_limit = (AP.__va_next_o + \
(__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \
AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \
AP.__va_next_fp_limit = (AP.__va_next_fp + \
(__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \
AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \
})
#else
/* Call __builtin_next_arg even though we aren't using its value, so that
we can verify that LASTARG is correct. */
#ifdef __GCC_NEW_VARARGS__
#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__)
#define va_start(AP, LASTARG) \
(__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ())
#else
#define va_start(AP, LASTARG) \
(__builtin_saveregs (), AP = ((char *) __builtin_next_arg (LASTARG)))
#endif
#endif /* not __sparc_v9__ */
#else
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist;...
#ifdef __sparc_v9__
#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__)
#define va_start(AP) ((AP) = (char *) __builtin_saveregs ())
#else
#define va_start(AP) \
__extension__ \
({ \
AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \
AP.__va_next_o_limit = (AP.__va_next_o + \
(__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \
AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \
AP.__va_next_fp_limit = (AP.__va_next_fp + \
(__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \
AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \
- (__builtin_args_info (0) >= 6 || __builtin_args_info (1) >= 16 ? 1 : 0); \
})
#else
#ifdef __GCC_NEW_VARARGS__
#define va_start(AP) ((AP) = (char *) __builtin_saveregs ())
#else
#define va_start(AP) \
(__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist))
(__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist))
#endif
#endif /* not __sparc_v9__ */
#endif
@ -129,51 +87,51 @@ enum __va_type_classes {
in the stack are made to be word-aligned; for an aggregate that is
not word-aligned, we advance the pointer to the first non-reg slot. */
#ifdef __sparc_v9__
#ifdef __arch64__
#define va_arg(pvar,TYPE) \
typedef unsigned int __ptrint __attribute__ ((__mode__ (__DI__)));
/* ??? TODO: little endian support */
#define va_arg(pvar, TYPE) \
__extension__ \
(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
void * __result; \
char * __result; \
if (__type == __real_type_class) /* float? */ \
{ \
__va_freg *__r; \
/* see PASS_IN_REG_P in gcc's sparc.h */ \
if (pvar.__va_next_fp < pvar.__va_next_fp_limit \
&& ((__r = (__va_freg *) (((__va_greg) pvar.__va_next_fp + sizeof (TYPE) - 1) & ~(__va_greg) (sizeof (TYPE) - 1))) \
< pvar.__va_next_fp_limit)) \
{ \
pvar.__va_next_fp = __r + (sizeof (TYPE) + 7) / 8; \
} \
else \
{ \
__r = (__va_freg *) pvar.__va_next_stack; \
pvar.__va_next_stack += (sizeof (TYPE) + 7) / 8; \
} \
__result = __r; \
if (__alignof__ (TYPE) == 16) \
(pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \
__result = (pvar); \
(pvar) = (char *) (pvar) + sizeof (TYPE); \
} \
else if (__type < __record_type_class) /* integer? */ \
{ \
__va_greg *__r; \
if (pvar.__va_next_o < pvar.__va_next_o_limit) \
__r = pvar.__va_next_o++; \
else \
__r = pvar.__va_next_stack++; \
/* adjust for 4 byte ints */ \
__result = (char *) __r + 8 - sizeof (TYPE); \
(pvar) = (char *) (pvar) + 8; \
__result = (char *) (pvar) - sizeof (TYPE); \
} \
else /* aggregate object */ \
{ \
void **__r; \
if (pvar.__va_next_o < pvar.__va_next_o_limit) \
__r = (void **) pvar.__va_next_o++; \
if (sizeof (TYPE) <= 8) \
{ \
__result = (pvar); \
(pvar) = (char *) (pvar) + 8; \
} \
else if (sizeof (TYPE) <= 16) \
{ \
if (__alignof__ (TYPE) == 16) \
(pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \
__result = (pvar); \
(pvar) = (char *) (pvar) + 16; \
} \
else \
__r = (void **) pvar.__va_next_stack++; \
__result = *__r; \
{ \
__result = * (void **) (pvar); \
(pvar) = (char *) (pvar) + 8; \
} \
} \
(TYPE *) __result;}))
#else /* not __sparc_v9__ */
#else /* not __arch64__ */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
@ -198,6 +156,10 @@ __extension__ \
(TYPE *) (void *) __u.__d; }) \
: ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
#endif /* not __sparc_v9__ */
#endif /* not __arch64__ */
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

View File

@ -59,3 +59,6 @@ __extension__ \
(pvar).__pnt += (sizeof(type) + 3) & ~3; \
} \
__va_result; }))
/* Copy __gnuc_va_list into another variable of this type. */
#define __va_copy(dest, src) (dest) = (src)

View File

@ -0,0 +1,34 @@
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#ifdef _STDARG_H
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#else
#define __va_ellipsis ...
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; __va_ellipsis
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif
/* Now stuff common to both varargs & stdarg implementations. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#undef va_end
void va_end (__gnuc_va_list);
#define va_end(AP) ((void)0)
#define va_arg(AP, TYPE) \
(sizeof (TYPE) > 8 \
? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
**((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
#endif