va_list: c4x
Richard Henderson
rth@cygnus.com
Sun Jul 25 23:43:00 GMT 1999
This has got to be the simplest va_arg implementation in existance.
Unsurprisingly, on simple tests it produces identical output as va-c4x.h.
r~
* c4x.h (EXPAND_BUILTIN_VA_ARG): New.
* c4x.c (c4x_va_arg): New.
Index: c4x/c4x.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/c4x/c4x.c,v
retrieving revision 1.28
diff -c -p -d -r1.28 c4x.c
*** c4x.c 1999/06/09 03:47:21 1.28
--- c4x.c 1999/07/26 06:39:02
*************** c4x_function_arg (cum, mode, type, named
*** 572,577 ****
--- 572,592 ----
return NULL_RTX;
}
+ /* C[34]x arguments grow in weird ways (downwards) that the standard
+ varargs stuff can't handle. */
+
+ rtx
+ c4x_va_arg (valist, type)
+ tree valist, type;
+ {
+ tree t;
+
+ t = build (PREDECREMENT_EXPR, TREE_TYPE (valist), valist,
+ build_int_2 (int_size_in_bytes (type), 0));
+ TREE_SIDE_EFFECTS (t) = 1;
+
+ return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
+ }
static int
c4x_isr_reg_used_p (regno)
Index: c4x/c4x.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/c4x/c4x.h,v
retrieving revision 1.21
diff -c -p -d -r1.21 c4x.h
*** c4x.h 1999/06/09 03:47:22 1.21
--- c4x.h 1999/07/26 06:39:02
*************** extern struct rtx_def *c4x_function_arg(
*** 1157,1162 ****
--- 1157,1166 ----
#define DEFAULT_PCC_STRUCT_RETURN 0
#define STRUCT_VALUE_REGNUM AR0_REGNO /* AR0 */
+ /* Varargs handling. */
+
+ #define EXPAND_BUILTIN_VA_ARG(valist, type) \
+ c4x_va_arg (valist, type)
/* Function Entry and Exit */
More information about the Gcc-patches
mailing list