m32r.c (m32r_setup_incoming_varargs): Use get_varargs_alias_set for the register spill block.

* m32r.c (m32r_setup_incoming_varargs): Use get_varargs_alias_set
        for the register spill block.
        (m32r_va_arg): New.
        * m32r.h (EXPAND_BUILTIN_VA_ARG): New.
        (EXPAND_BUILTIN_SAVEREGS): Delete #if 0 code.

        * m32r.h (INT8_P): Don't short-cut test with (unsigned).
        (INT16_P, CMP_INT16_P, UINT16_P): Likewise.
        (UPPER16_P, UINT24_P, INT32_P, UINT5_P): Likewise.

From-SVN: r28417
This commit is contained in:
Richard Henderson 1999-08-02 16:08:49 -07:00 committed by Richard Henderson
parent 247cfc5c36
commit 40cae311f5
3 changed files with 92 additions and 25 deletions

View File

@ -1,3 +1,15 @@
1999-08-02 Richard Henderson <rth@cygnus.com>
* m32r.c (m32r_setup_incoming_varargs): Use get_varargs_alias_set
for the register spill block.
(m32r_va_arg): New.
* m32r.h (EXPAND_BUILTIN_VA_ARG): New.
(EXPAND_BUILTIN_SAVEREGS): Delete #if 0 code.
* m32r.h (INT8_P): Don't short-cut test with (unsigned).
(INT16_P, CMP_INT16_P, UINT16_P): Likewise.
(UPPER16_P, UINT24_P, INT32_P, UINT5_P): Likewise.
1999-08-02 Jakub Jelinek <jj@ultra.linux.cz>
* config/sparc/linux.h: Define WCHAR_TYPE as "int" and undef

View File

@ -1338,12 +1338,75 @@ m32r_setup_incoming_varargs (cum, int_mode, type, pretend_size, no_rtl)
regblock = gen_rtx (MEM, BLKmode,
plus_constant (arg_pointer_rtx,
FIRST_PARM_OFFSET (0)));
MEM_ALIAS_SET (regblock) = get_varargs_alias_set ();
move_block_from_reg (first_reg_offset, regblock,
size, size * UNITS_PER_WORD);
*pretend_size = (size * UNITS_PER_WORD);
}
}
/* Implement `va_arg'. */
rtx
m32r_va_arg (valist, type)
tree valist, type;
{
HOST_WIDE_INT size, rsize;
tree t;
rtx addr_rtx;
size = int_size_in_bytes (type);
rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
if (size > 8)
{
tree type_ptr, type_ptr_ptr;
/* Pass by reference. */
type_ptr = build_pointer_type (type);
type_ptr_ptr = build_pointer_type (type_ptr);
t = build (POSTINCREMENT_EXPR, va_list_type_node, valist,
build_int_2 (UNITS_PER_WORD, 0));
TREE_SIDE_EFFECTS (t) = 1;
t = build1 (NOP_EXPR, type_ptr_ptr, t);
TREE_SIDE_EFFECTS (t) = 1;
t = build1 (INDIRECT_REF, type_ptr, t);
addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
}
else
{
/* Pass by value. */
if (size < UNITS_PER_WORD)
{
/* Care for bigendian correction on the aligned address. */
t = build (PLUS_EXPR, ptr_type_node, valist,
build_int_2 (rsize - size, 0));
addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
addr_rtx = copy_to_reg (addr_rtx);
/* Increment AP. */
t = build (PLUS_EXPR, va_list_type_node, valist,
build_int_2 (rsize, 0));
t = build (MODIFY_EXPR, va_list_type_node, valist, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
else
{
t = build (POSTINCREMENT_EXPR, va_list_type_node, valist,
build_int_2 (rsize, 0));
TREE_SIDE_EFFECTS (t) = 1;
addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
}
}
return addr_rtx;
}
/* Cost functions. */

View File

@ -597,15 +597,18 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
(values in the range -32767 to +32768). */
/* local to this file */
#define INT8_P(X) ((unsigned) ((X) + 0x80) < 0x100)
#define INT16_P(X) ((unsigned) ((X) + 0x8000) < 0x10000)
#define CMP_INT16_P(X) ((unsigned) ((X) - 1 + 0x8000) < 0x10000)
#define UINT16_P(X) ((unsigned) (X) < 0x10000)
#define UPPER16_P(X) (((X) & ~0xffff0000) == 0)
#define UINT24_P(X) ((unsigned) (X) < 0x1000000)
#define INT32_P(X) ((X) >= (-(HOST_WIDE_INT) 0x7fffffff - 1) \
&& (X) <= (unsigned HOST_WIDE_INT) 0xffffffff)
#define UINT5_P(X) ((unsigned) (X) < 32)
#define INT8_P(X) ((X) >= -0x80 && (X) <= 0x7f)
#define INT16_P(X) ((X) >= -0x8000 && (X) <= 0x7fff)
#define CMP_INT16_P(X) ((X) >= -0x7fff && (X) <= 0x8000)
#define UINT16_P(X) ((X) >= 0 && (X) <= 0xffff)
#define UPPER16_P(X) (((X) & 0xffff) == 0 \
&& ((X) >> 16) >= -0x8000 \
&& ((X) >> 16) <= 0x7fff)
#define UINT24_P(X) ((X) >= 0 && (X) < 0x1000000)
#define INT32_P(X) (((X) >= -(HOST_WIDE_INT) 0x80000000 \
&& (X) <= (HOST_WIDE_INT) 0x7fffffff) \
|| (unsigned HOST_WIDE_INT) (X) <= 0xffffffff)
#define UINT5_P(X) ((X) >= 0 && (X) < 32)
#define INVERTED_SIGNED_8BIT(VAL) ((VAL) >= -127 && (VAL) <= 128)
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
@ -968,22 +971,6 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size)
: 2 * PARM_BOUNDARY)
#endif
#if 0
/* If defined, is a C expression that produces the machine-specific
code for a call to `__builtin_saveregs'. This code will be moved
to the very beginning of the function, before any parameter access
are made. The return value of this function should be an RTX that
contains the value to use as the return of `__builtin_saveregs'.
The argument ARGS is a `tree_list' containing the arguments that
were passed to `__builtin_saveregs'.
If this macro is not defined, the compiler will output an ordinary
call to the library function `__builtin_saveregs'. */
extern struct rtx *m32r_expand_builtin_savergs ();
#define EXPAND_BUILTIN_SAVEREGS() m32r_expand_builtin_saveregs ()
#endif
/* This macro offers an alternative
to using `__builtin_saveregs' and defining the macro
`EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
@ -1013,6 +1000,10 @@ extern struct rtx *m32r_expand_builtin_savergs ();
#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
m32r_setup_incoming_varargs (&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
/* Implement `va_arg'. */
#define EXPAND_BUILTIN_VA_ARG(valist, type) \
m32r_va_arg (valist, type)
/* Function results. */
@ -2059,6 +2050,7 @@ extern int function_arg_partial_nregs PROTO((CUMULATIVE_ARGS *,
extern void m32r_setup_incoming_varargs PROTO((CUMULATIVE_ARGS *,
int, Tree, int *,
int));
extern struct rtx_def *m32r_va_arg PROTO((Tree, Tree));
extern int m32r_address_code PROTO((Rtx));
extern enum m32r_function_type m32r_compute_function_type
PROTO((Tree));