[PTR-PLUS] Fix mipstx39-elf and mips64vr-elf target (subtargets of MIPS)
Andrew Pinski
pinskia@gmail.com
Wed Jun 13 06:53:00 GMT 2007
Hi,
This fixes mipstx39-elf and mips64vr for the pointer plus branch.
These are a subtarget of mips and are the only mips targets where
EABI_FLOAT_VARARGS_P can be true (as they are the only ones were
ABI_EABI is the abi).
Committed to the branch after a test of using va_args with a cross compiler.
Note there are a huge amount of warnings while compiling
mipstx39-elf's cc1 (this is unrelated to my branch but I thought I
would let someone know) so I really doubt anyone have been using this
target lately anyways :).
Thanks,
Andrew Pinski
ChangeLog:
* config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR
for pointers.
(mips_gimplify_va_arg_expr): Likewise.
Don't create BIT_AND_EXPR in a pointer type.
-------------- next part --------------
Index: config/mips/mips.c
===================================================================
*** config/mips/mips.c (revision 125667)
--- config/mips/mips.c (working copy)
*************** mips_va_start (tree valist, rtx nextarg)
*** 4366,4374 ****
words used by named arguments. */
t = make_tree (TREE_TYPE (ovfl), virtual_incoming_args_rtx);
if (cum->stack_words > 0)
! t = build2 (PLUS_EXPR, TREE_TYPE (ovfl), t,
! build_int_cst (NULL_TREE,
! cum->stack_words * UNITS_PER_WORD));
t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
--- 4366,4373 ----
words used by named arguments. */
t = make_tree (TREE_TYPE (ovfl), virtual_incoming_args_rtx);
if (cum->stack_words > 0)
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl), t,
! size_int (cum->stack_words * UNITS_PER_WORD));
t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
*************** mips_va_start (tree valist, rtx nextarg)
*** 4384,4391 ****
fpr_offset = gpr_save_area_size + UNITS_PER_FPVALUE - 1;
fpr_offset &= ~(UNITS_PER_FPVALUE - 1);
if (fpr_offset)
! t = build2 (PLUS_EXPR, TREE_TYPE (ftop), t,
! build_int_cst (NULL_TREE, -fpr_offset));
t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ftop), ftop, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
--- 4383,4390 ----
fpr_offset = gpr_save_area_size + UNITS_PER_FPVALUE - 1;
fpr_offset &= ~(UNITS_PER_FPVALUE - 1);
if (fpr_offset)
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ftop), t,
! size_int (-fpr_offset));
t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ftop), ftop, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
*************** mips_gimplify_va_arg_expr (tree valist,
*** 4535,4562 ****
t = fold_convert (TREE_TYPE (off), build_int_cst (NULL_TREE, rsize));
t = build2 (POSTDECREMENT_EXPR, TREE_TYPE (off), off, t);
t = fold_convert (sizetype, t);
! t = fold_convert (TREE_TYPE (top), t);
/* [4] Emit code for: addr_rtx = top - off. On big endian machines,
the argument has RSIZE - SIZE bytes of leading padding. */
! t = build2 (MINUS_EXPR, TREE_TYPE (top), top, t);
if (BYTES_BIG_ENDIAN && rsize > size)
{
! u = fold_convert (TREE_TYPE (t), build_int_cst (NULL_TREE,
! rsize - size));
! t = build2 (PLUS_EXPR, TREE_TYPE (t), t, u);
}
COND_EXPR_THEN (addr) = t;
if (osize > UNITS_PER_WORD)
{
/* [9] Emit: ovfl += ((intptr_t) ovfl + osize - 1) & -osize. */
! u = fold_convert (TREE_TYPE (ovfl),
! build_int_cst (NULL_TREE, osize - 1));
! t = build2 (PLUS_EXPR, TREE_TYPE (ovfl), ovfl, u);
! u = fold_convert (TREE_TYPE (ovfl),
! build_int_cst (NULL_TREE, -osize));
! t = build2 (BIT_AND_EXPR, TREE_TYPE (ovfl), t, u);
align = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
}
else
--- 4534,4560 ----
t = fold_convert (TREE_TYPE (off), build_int_cst (NULL_TREE, rsize));
t = build2 (POSTDECREMENT_EXPR, TREE_TYPE (off), off, t);
t = fold_convert (sizetype, t);
! t = fold_build1 (NEGATE_EXPR, sizetype, t);
/* [4] Emit code for: addr_rtx = top - off. On big endian machines,
the argument has RSIZE - SIZE bytes of leading padding. */
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (top), top, t);
if (BYTES_BIG_ENDIAN && rsize > size)
{
! u = size_int (rsize - size);
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, u);
}
COND_EXPR_THEN (addr) = t;
if (osize > UNITS_PER_WORD)
{
/* [9] Emit: ovfl += ((intptr_t) ovfl + osize - 1) & -osize. */
! u = size_int (osize - 1);
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl), ovfl, u);
! t = fold_convert (sizetype, t);
! u = size_int (-osize);
! t = build2 (BIT_AND_EXPR, sizetype, t, u);
! t = fold_convert (TREE_TYPE (ovfl), t);
align = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (ovfl), ovfl, t);
}
else
*************** mips_gimplify_va_arg_expr (tree valist,
*** 4570,4578 ****
t = build2 (POSTINCREMENT_EXPR, TREE_TYPE (ovfl), ovfl, u);
if (BYTES_BIG_ENDIAN && osize > size)
{
! u = fold_convert (TREE_TYPE (t),
! build_int_cst (NULL_TREE, osize - size));
! t = build2 (PLUS_EXPR, TREE_TYPE (t), t, u);
}
/* String [9] and [10,11] together. */
--- 4568,4575 ----
t = build2 (POSTINCREMENT_EXPR, TREE_TYPE (ovfl), ovfl, u);
if (BYTES_BIG_ENDIAN && osize > size)
{
! u = size_int (osize - size);
! t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (t), t, u);
}
/* String [9] and [10,11] together. */
More information about the Gcc-patches
mailing list