xtensa.c: Include "df.h".
* config/xtensa/xtensa.c: Include "df.h". (xtensa_builtin_saveregs): Use adjust_address instead of change_address. (xtensa_va_start): Invoke make_tree with sizetype for expand_builtin_saveregs and then convert the result to a pointer. Use POINTER_PLUS_EXPR. Use size_int instead of build_int_cst. (xtensa_gimplify_va_arg_expr): Use size_int instead of build_int_cst. Subtract argument size from index value as integers and then use POINTER_PLUS_EXPR to add the result to the array address. From-SVN: r125854
This commit is contained in:
parent
fa9fd28acf
commit
e70312d499
@ -1,3 +1,14 @@
|
||||
2007-06-19 Bob Wilson <bob.wilson@acm.org>
|
||||
|
||||
* config/xtensa/xtensa.c: Include "df.h".
|
||||
(xtensa_builtin_saveregs): Use adjust_address instead of change_address.
|
||||
(xtensa_va_start): Invoke make_tree with sizetype for
|
||||
expand_builtin_saveregs and then convert the result to a pointer.
|
||||
Use POINTER_PLUS_EXPR. Use size_int instead of build_int_cst.
|
||||
(xtensa_gimplify_va_arg_expr): Use size_int instead of build_int_cst.
|
||||
Subtract argument size from index value as integers and then use
|
||||
POINTER_PLUS_EXPR to add the result to the array address.
|
||||
|
||||
2007-06-19 Rask Ingemann Lambertsen <rask@sygehus.dk>
|
||||
|
||||
PR target/32335
|
||||
|
@ -50,6 +50,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
#include "target-def.h"
|
||||
#include "langhooks.h"
|
||||
#include "tree-gimple.h"
|
||||
#include "df.h"
|
||||
|
||||
|
||||
/* Enumeration for all of the relational tests, so that we can build
|
||||
@ -2178,7 +2179,7 @@ xtensa_build_builtin_va_list (void)
|
||||
static rtx
|
||||
xtensa_builtin_saveregs (void)
|
||||
{
|
||||
rtx gp_regs, dest;
|
||||
rtx gp_regs;
|
||||
int arg_words = current_function_args_info.arg_words;
|
||||
int gp_left = MAX_ARGS_IN_REGISTERS - arg_words;
|
||||
|
||||
@ -2191,12 +2192,12 @@ xtensa_builtin_saveregs (void)
|
||||
set_mem_alias_set (gp_regs, get_varargs_alias_set ());
|
||||
|
||||
/* Now store the incoming registers. */
|
||||
dest = change_address (gp_regs, SImode,
|
||||
plus_constant (XEXP (gp_regs, 0),
|
||||
arg_words * UNITS_PER_WORD));
|
||||
cfun->machine->need_a7_copy = true;
|
||||
cfun->machine->vararg_a7 = true;
|
||||
move_block_from_reg (GP_ARG_FIRST + arg_words, dest, gp_left);
|
||||
move_block_from_reg (GP_ARG_FIRST + arg_words,
|
||||
adjust_address (gp_regs, BLKmode,
|
||||
arg_words * UNITS_PER_WORD),
|
||||
gp_left);
|
||||
|
||||
return XEXP (gp_regs, 0);
|
||||
}
|
||||
@ -2225,15 +2226,15 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
|
||||
ndx = build3 (COMPONENT_REF, TREE_TYPE (f_ndx), valist, f_ndx, NULL_TREE);
|
||||
|
||||
/* Call __builtin_saveregs; save the result in __va_reg */
|
||||
u = make_tree (ptr_type_node, expand_builtin_saveregs ());
|
||||
u = make_tree (sizetype, expand_builtin_saveregs ());
|
||||
u = fold_convert (ptr_type_node, u);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, reg, u);
|
||||
TREE_SIDE_EFFECTS (t) = 1;
|
||||
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
|
||||
|
||||
/* Set the __va_stk member to ($arg_ptr - 32). */
|
||||
u = make_tree (ptr_type_node, virtual_incoming_args_rtx);
|
||||
u = fold_build2 (PLUS_EXPR, ptr_type_node, u,
|
||||
build_int_cst (NULL_TREE, -32));
|
||||
u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u, size_int (-32));
|
||||
t = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, stk, u);
|
||||
TREE_SIDE_EFFECTS (t) = 1;
|
||||
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
|
||||
@ -2243,8 +2244,8 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
|
||||
alignment offset for __va_stk. */
|
||||
if (arg_words >= MAX_ARGS_IN_REGISTERS)
|
||||
arg_words += 2;
|
||||
u = build_int_cst (NULL_TREE, arg_words * UNITS_PER_WORD);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx, u);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, ndx,
|
||||
size_int (arg_words * UNITS_PER_WORD));
|
||||
TREE_SIDE_EFFECTS (t) = 1;
|
||||
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
|
||||
}
|
||||
@ -2309,10 +2310,8 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
|
||||
{
|
||||
int align = MIN (TYPE_ALIGN (type), STACK_BOUNDARY) / BITS_PER_UNIT;
|
||||
|
||||
t = build2 (PLUS_EXPR, integer_type_node, orig_ndx,
|
||||
build_int_cst (NULL_TREE, align - 1));
|
||||
t = build2 (BIT_AND_EXPR, integer_type_node, t,
|
||||
build_int_cst (NULL_TREE, -align));
|
||||
t = build2 (PLUS_EXPR, integer_type_node, orig_ndx, size_int (align - 1));
|
||||
t = build2 (BIT_AND_EXPR, integer_type_node, t, size_int (-align));
|
||||
t = build2 (GIMPLE_MODIFY_STMT, integer_type_node, orig_ndx, t);
|
||||
gimplify_and_add (t, pre_p);
|
||||
}
|
||||
@ -2342,8 +2341,8 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
|
||||
lab_false = create_artificial_label ();
|
||||
lab_over = create_artificial_label ();
|
||||
|
||||
t = build_int_cst (NULL_TREE, MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD);
|
||||
t = build2 (GT_EXPR, boolean_type_node, ndx, t);
|
||||
t = build2 (GT_EXPR, boolean_type_node, ndx,
|
||||
size_int (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD));
|
||||
t = build3 (COND_EXPR, void_type_node, t,
|
||||
build1 (GOTO_EXPR, void_type_node, lab_false),
|
||||
NULL_TREE);
|
||||
@ -2372,8 +2371,8 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
|
||||
|
||||
lab_false2 = create_artificial_label ();
|
||||
|
||||
t = build_int_cst (NULL_TREE, MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD);
|
||||
t = build2 (GT_EXPR, boolean_type_node, orig_ndx, t);
|
||||
t = build2 (GT_EXPR, boolean_type_node, orig_ndx,
|
||||
size_int (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD));
|
||||
t = build3 (COND_EXPR, void_type_node, t,
|
||||
build1 (GOTO_EXPR, void_type_node, lab_false2),
|
||||
NULL_TREE);
|
||||
@ -2410,18 +2409,16 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
|
||||
|
||||
if (BYTES_BIG_ENDIAN && TREE_CODE (type_size) == INTEGER_CST)
|
||||
{
|
||||
t = size_int (PARM_BOUNDARY / BITS_PER_UNIT);
|
||||
t = fold_build2 (GE_EXPR, boolean_type_node, type_size, t);
|
||||
t = fold_build2 (GE_EXPR, boolean_type_node, type_size,
|
||||
size_int (PARM_BOUNDARY / BITS_PER_UNIT));
|
||||
t = fold_build3 (COND_EXPR, sizetype, t, va_size, type_size);
|
||||
size = t;
|
||||
}
|
||||
else
|
||||
size = va_size;
|
||||
|
||||
t = fold_convert (ptr_type_node, ndx);
|
||||
addr = build2 (PLUS_EXPR, ptr_type_node, array, t);
|
||||
t = fold_convert (ptr_type_node, size);
|
||||
addr = build2 (MINUS_EXPR, ptr_type_node, addr, t);
|
||||
t = build2 (MINUS_EXPR, sizetype, ndx, size);
|
||||
addr = build2 (POINTER_PLUS_EXPR, ptr_type_node, array, t);
|
||||
|
||||
addr = fold_convert (build_pointer_type (type), addr);
|
||||
if (indirect)
|
||||
|
Loading…
Reference in New Issue
Block a user