diff options
author | huderlem <huderlem@gmail.com> | 2020-02-15 09:06:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-15 09:06:38 -0600 |
commit | 74e171579e0bbefbd72b83f3764fe504464bbdbe (patch) | |
tree | 8db5aacbe963fef56eb2d9965fc87db1a6642387 /gcc_arm/ginclude/va-d30v.h | |
parent | 27176890c4a688ea7de44d3f55af32827016a9fd (diff) | |
parent | c6bcd24dfe44d58ed1b6bef6653270dbf6cd6bfa (diff) |
Merge pull request #30 from camthesaxman/arm_support
Build ARM compiler
Diffstat (limited to 'gcc_arm/ginclude/va-d30v.h')
-rwxr-xr-x | gcc_arm/ginclude/va-d30v.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/gcc_arm/ginclude/va-d30v.h b/gcc_arm/ginclude/va-d30v.h new file mode 100755 index 0000000..ccd3750 --- /dev/null +++ b/gcc_arm/ginclude/va-d30v.h @@ -0,0 +1,64 @@ +/* CYGNUS LOCAL entire file/d30v */ +/* GNU C stdarg/varargs support for the D30V */ + +/* Define __gnuc_va_list. */ +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef struct __va_list_tag { + int *__va_arg_ptr; /* start of the register save area */ + int __va_arg_num; /* argument number */ +} __va_list[1], __gnuc_va_list[1]; + +#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. This depends + on the format of the CUMULATIVE_ARGS type. On the d30v, we use just + a single word that is the register number. */ + +#define __va_start_common(AP) \ +__extension__ ({ \ + (AP)->__va_arg_ptr = (int *) __builtin_saveregs (); \ + (AP)->__va_arg_num = __builtin_args_info (0) - 2 /* first arg # */; \ + (void)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_next_arg (LASTARG), __va_start_common (AP)) + +#else /* varargs.h support */ + +#define va_start(AP) __va_start_common (AP) +#define va_alist __builtin_va_alist +#define va_dcl register int va_alist; ... + +#endif /* _STDARG_H */ + +/* Nothing needs to be done to end varargs/stdarg processing */ +#define va_end(AP) ((void)0) + +#define va_arg(AP,TYPE) \ +__extension__ (*({ \ + register TYPE *__ptr; \ + \ + if (sizeof (TYPE) > 4 && ((AP)->__va_arg_num & 1) != 0) \ + (AP)->__va_arg_num++; \ + \ + __ptr = (TYPE *)(((char *)(void *) \ + ((AP)->__va_arg_ptr + (AP)->__va_arg_num))); \ + \ + if (sizeof (TYPE) < 4) \ + __ptr = (void*)__ptr + 4 - sizeof (TYPE); \ + (AP)->__va_arg_num += (sizeof (TYPE) + 3) / 4; \ + __ptr; \ +})) + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +/* END CYGNUS LOCAL */ |