s390.c: Include "tree-gimple.h".

* config/s390/s390.c: Include "tree-gimple.h".
	(s390_gimplify_va_arg): New function.
	(TARGET_GIMPLIFY_VA_ARG_EXPR): Define.
	(s390_va_arg): Remove.
	* config/s390/s390-protos.h (s390_va_arg): Remove.
	* config/s390/s390.h (EXPAND_BUILTIN_VA_ARG): Call abort ().

From-SVN: r83090
This commit is contained in:
Ulrich Weigand 2004-06-14 12:11:06 +00:00 committed by Ulrich Weigand
parent 623a66fa85
commit 63694b5ed2
4 changed files with 62 additions and 53 deletions

View File

@ -1,3 +1,12 @@
2004-06-14 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.c: Include "tree-gimple.h".
(s390_gimplify_va_arg): New function.
(TARGET_GIMPLIFY_VA_ARG_EXPR): Define.
(s390_va_arg): Remove.
* config/s390/s390-protos.h (s390_va_arg): Remove.
* config/s390/s390.h (EXPAND_BUILTIN_VA_ARG): Call abort ().
2004-06-14 J"orn Rennecke <joern.rennecke@superh.com> 2004-06-14 J"orn Rennecke <joern.rennecke@superh.com>
* basic-block.h (could_fall_through): Declare. * basic-block.h (could_fall_through): Declare.

View File

@ -100,6 +100,5 @@ extern void s390_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern rtx s390_function_value (tree, enum machine_mode); extern rtx s390_function_value (tree, enum machine_mode);
extern void s390_va_start (tree, rtx); extern void s390_va_start (tree, rtx);
extern rtx s390_va_arg (tree, tree);
#endif /* RTX_CODE */ #endif /* RTX_CODE */
#endif /* TREE_CODE */ #endif /* TREE_CODE */

View File

@ -50,6 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "debug.h" #include "debug.h"
#include "langhooks.h" #include "langhooks.h"
#include "optabs.h" #include "optabs.h"
#include "tree-gimple.h"
/* Machine-specific symbol_ref flags. */ /* Machine-specific symbol_ref flags. */
#define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0) #define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0)
@ -78,6 +79,7 @@ static int s390_address_cost (rtx);
static void s390_reorg (void); static void s390_reorg (void);
static bool s390_valid_pointer_mode (enum machine_mode); static bool s390_valid_pointer_mode (enum machine_mode);
static tree s390_build_builtin_va_list (void); static tree s390_build_builtin_va_list (void);
static tree s390_gimplify_va_arg (tree, tree, tree *, tree *);
static bool s390_function_ok_for_sibcall (tree, tree); static bool s390_function_ok_for_sibcall (tree, tree);
static bool s390_call_saved_register_used (tree); static bool s390_call_saved_register_used (tree);
@ -147,6 +149,8 @@ static bool s390_call_saved_register_used (tree);
#undef TARGET_BUILD_BUILTIN_VA_LIST #undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST s390_build_builtin_va_list #define TARGET_BUILD_BUILTIN_VA_LIST s390_build_builtin_va_list
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR s390_gimplify_va_arg
#undef TARGET_PROMOTE_FUNCTION_ARGS #undef TARGET_PROMOTE_FUNCTION_ARGS
#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
@ -6306,13 +6310,14 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
ret = **args.overflow_arg_area++; ret = **args.overflow_arg_area++;
} */ } */
rtx tree
s390_va_arg (tree valist, tree type) s390_gimplify_va_arg (tree valist, tree type, tree *pre_p,
tree *post_p ATTRIBUTE_UNUSED)
{ {
tree f_gpr, f_fpr, f_ovf, f_sav; tree f_gpr, f_fpr, f_ovf, f_sav;
tree gpr, fpr, ovf, sav, reg, t, u; tree gpr, fpr, ovf, sav, reg, t, u;
int indirect_p, size, n_reg, sav_ofs, sav_scale, max_reg; int indirect_p, size, n_reg, sav_ofs, sav_scale, max_reg;
rtx lab_false, lab_over, addr_rtx, r; tree lab_false, lab_over, addr;
f_gpr = TYPE_FIELDS (TREE_TYPE (va_list_type_node)); f_gpr = TYPE_FIELDS (TREE_TYPE (va_list_type_node));
f_fpr = TREE_CHAIN (f_gpr); f_fpr = TREE_CHAIN (f_gpr);
@ -6387,79 +6392,75 @@ s390_va_arg (tree valist, tree type)
/* Pull the value out of the saved registers ... */ /* Pull the value out of the saved registers ... */
lab_false = gen_label_rtx (); lab_false = create_artificial_label ();
lab_over = gen_label_rtx (); lab_over = create_artificial_label ();
addr_rtx = gen_reg_rtx (Pmode); addr = create_tmp_var (ptr_type_node, "addr");
emit_cmp_and_jump_insns (expand_expr (reg, NULL_RTX, Pmode, EXPAND_NORMAL), t = build_int_2 (max_reg, 0);
GEN_INT (max_reg), TREE_TYPE (t) = TREE_TYPE (reg);
GT, const1_rtx, Pmode, 0, lab_false); t = build2 (GT_EXPR, boolean_type_node, reg, t);
u = build1 (GOTO_EXPR, void_type_node, lab_false);
t = build3 (COND_EXPR, void_type_node, t, u, NULL_TREE);
gimplify_and_add (t, pre_p);
if (sav_ofs) if (sav_ofs)
t = build (PLUS_EXPR, ptr_type_node, sav, build_int_2 (sav_ofs, 0)); t = build2 (PLUS_EXPR, ptr_type_node, sav, build_int_2 (sav_ofs, 0));
else else
t = sav; t = sav;
u = build (MULT_EXPR, long_integer_type_node, u = build2 (MULT_EXPR, long_integer_type_node,
reg, build_int_2 (sav_scale, 0)); reg, build_int_2 (sav_scale, 0));
TREE_SIDE_EFFECTS (u) = 1; t = build2 (PLUS_EXPR, ptr_type_node, t, u);
t = build (PLUS_EXPR, ptr_type_node, t, u); t = build2 (MODIFY_EXPR, void_type_node, addr, t);
TREE_SIDE_EFFECTS (t) = 1; gimplify_and_add (t, pre_p);
r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL); t = build1 (GOTO_EXPR, void_type_node, lab_over);
if (r != addr_rtx) gimplify_and_add (t, pre_p);
emit_move_insn (addr_rtx, r);
t = build1 (LABEL_EXPR, void_type_node, lab_false);
append_to_statement_list (t, pre_p);
emit_jump_insn (gen_jump (lab_over));
emit_barrier ();
emit_label (lab_false);
/* ... Otherwise out of the overflow area. */ /* ... Otherwise out of the overflow area. */
t = save_expr (ovf); t = ovf;
/* In 64 BIT for each argument on stack, a full 64 bit slot is allocated. */
if (size < UNITS_PER_WORD) if (size < UNITS_PER_WORD)
{ t = build2 (PLUS_EXPR, TREE_TYPE (t), t,
t = build (PLUS_EXPR, TREE_TYPE (t), t, build_int_2 (UNITS_PER_WORD-size, 0)); build_int_2 (UNITS_PER_WORD - size, 0));
t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
t = save_expr (ovf); gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue);
}
r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL); u = build2 (MODIFY_EXPR, void_type_node, addr, t);
if (r != addr_rtx) gimplify_and_add (u, pre_p);
emit_move_insn (addr_rtx, r);
t = build (PLUS_EXPR, TREE_TYPE (t), t, build_int_2 (size, 0)); t = build2 (PLUS_EXPR, TREE_TYPE (t), t, build_int_2 (size, 0));
t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t);
TREE_SIDE_EFFECTS (t) = 1; gimplify_and_add (t, pre_p);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
emit_label (lab_over); t = build1 (LABEL_EXPR, void_type_node, lab_over);
append_to_statement_list (t, pre_p);
/* If less than max_regs a registers are retrieved out
of register save area, increment. */
u = build (PREINCREMENT_EXPR, TREE_TYPE (reg), reg, /* Increment register save count. */
build_int_2 (n_reg, 0));
TREE_SIDE_EFFECTS (u) = 1; u = build2 (PREINCREMENT_EXPR, TREE_TYPE (reg), reg,
expand_expr (u, const0_rtx, VOIDmode, EXPAND_NORMAL); build_int_2 (n_reg, 0));
gimplify_and_add (u, pre_p);
if (indirect_p) if (indirect_p)
{ {
r = gen_rtx_MEM (Pmode, addr_rtx); t = build_pointer_type (build_pointer_type (type));
set_mem_alias_set (r, get_varargs_alias_set ()); addr = fold_convert (t, addr);
emit_move_insn (addr_rtx, r); addr = build_fold_indirect_ref (addr);
}
else
{
t = build_pointer_type (type);
addr = fold_convert (t, addr);
} }
return build_fold_indirect_ref (addr);
return addr_rtx;
} }

View File

@ -708,7 +708,7 @@ CUMULATIVE_ARGS;
s390_va_start (valist, nextarg) s390_va_start (valist, nextarg)
#define EXPAND_BUILTIN_VA_ARG(valist, type) \ #define EXPAND_BUILTIN_VA_ARG(valist, type) \
s390_va_arg (valist, type) (abort (), NULL_RTX)
/* Trampolines for nested functions. */ /* Trampolines for nested functions. */