This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Unreviewed Patch: Use of powerpc 64bit instructions in 32bit ABI
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Nov 2003 14:53:48 -0500
- Subject: Re: Unreviewed Patch: Use of powerpc 64bit instructions in 32bit ABI
- References: <200311141934.hAEJYjT29428@makai.watson.ibm.com>
Appended is the patch with the typo corrected. This is what has
been bootstrapping regularly for weeks. No regressions.
Thanks, David
2003-11-03 Fariborz Jahanian <fjahanian@apple.com>
David Edelsohn <edelsohn@gnu.org>
* calls.c (expand_call): Allocate new temp in pass1.
(store_one_arg): If PARALLEL, calculate excess using mode size of
rtvec elt.
* expr.c (emit_push_insn): If PARALLEL, calculate offset using
mode size of rtvec elt.
* function.c (assign_parms): Use parm in register, if available.
Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.305
diff -c -p -r1.305 calls.c
*** calls.c 14 Nov 2003 08:19:59 -0000 1.305
--- calls.c 14 Nov 2003 19:49:10 -0000
*************** expand_call (tree exp, rtx target, int i
*** 2123,2128 ****
--- 2123,2129 ----
#endif
int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
+ rtx temp_target = 0;
char *initial_stack_usage_map = stack_usage_map;
int old_stack_allocated;
*************** expand_call (tree exp, rtx target, int i
*** 3237,3243 ****
The Irix 6 ABI has examples of this. */
else if (GET_CODE (valreg) == PARALLEL)
{
! if (target == 0)
{
/* This will only be assigned once, so it can be readonly. */
tree nt = build_qualified_type (TREE_TYPE (exp),
--- 3238,3248 ----
The Irix 6 ABI has examples of this. */
else if (GET_CODE (valreg) == PARALLEL)
{
! /* Second condition is added because "target" is freed at the
! the end of "pass0" for -O2 when call is made to
! expand_end_target_temps (). Its "in_use" flag has been set
! to false, so allocate a new temp. */
! if (target == 0 || (pass == 1 && target == temp_target))
{
/* This will only be assigned once, so it can be readonly. */
tree nt = build_qualified_type (TREE_TYPE (exp),
*************** expand_call (tree exp, rtx target, int i
*** 3245,3250 ****
--- 3250,3256 ----
| TYPE_QUAL_CONST));
target = assign_temp (nt, 0, 1, 1);
+ temp_target = target;
preserve_temp_slots (target);
}
*************** store_one_arg (struct arg_data *arg, rtx
*** 4581,4589 ****
{
/* PUSH_ROUNDING has no effect on us, because
emit_push_insn for BLKmode is careful to avoid it. */
! excess = (arg->locate.size.constant
! - int_size_in_bytes (TREE_TYPE (pval))
! + partial * UNITS_PER_WORD);
size_rtx = expand_expr (size_in_bytes (TREE_TYPE (pval)),
NULL_RTX, TYPE_MODE (sizetype), 0);
}
--- 4587,4604 ----
{
/* PUSH_ROUNDING has no effect on us, because
emit_push_insn for BLKmode is careful to avoid it. */
! if (reg && GET_CODE (reg) == PARALLEL)
! {
! /* Use the size of the elt to compute excess. */
! rtx elt = XEXP (XVECEXP (reg, 0, 0), 0);
! excess = (arg->locate.size.constant
! - int_size_in_bytes (TREE_TYPE (pval))
! + partial * GET_MODE_SIZE (GET_MODE (elt)));
! }
! else
! excess = (arg->locate.size.constant
! - int_size_in_bytes (TREE_TYPE (pval))
! + partial * UNITS_PER_WORD);
size_rtx = expand_expr (size_in_bytes (TREE_TYPE (pval)),
NULL_RTX, TYPE_MODE (sizetype), 0);
}
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.599
diff -c -p -r1.599 expr.c
*** expr.c 13 Nov 2003 09:48:28 -0000 1.599
--- expr.c 14 Nov 2003 19:49:11 -0000
*************** emit_push_insn (rtx x, enum machine_mode
*** 3466,3473 ****
rtx temp;
int used = partial * UNITS_PER_WORD;
! int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
int skip;
if (size == 0)
abort ();
--- 3466,3483 ----
rtx temp;
int used = partial * UNITS_PER_WORD;
! int offset;
int skip;
+
+ if (reg && GET_CODE (reg) == PARALLEL)
+ {
+ /* Use the size of the elt to compute offset. */
+ rtx elt = XEXP (XVECEXP (reg, 0, 0), 0);
+ used = partial * GET_MODE_SIZE (GET_MODE (elt));
+ offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
+ }
+ else
+ offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
if (size == 0)
abort ();
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.467
diff -c -p -r1.467 function.c
*** function.c 14 Nov 2003 17:28:23 -0000 1.467
--- function.c 14 Nov 2003 19:49:12 -0000
*************** assign_parms (tree fndecl)
*** 4704,4709 ****
--- 4704,4718 ----
Set DECL_RTL to that place. */
+ if (GET_CODE (entry_parm) == PARALLEL && nominal_mode != BLKmode)
+ {
+ /* Objects the size of a register can be combined in registers */
+ rtx parmreg = gen_reg_rtx (nominal_mode);
+ emit_group_store (parmreg, entry_parm, TREE_TYPE (parm),
+ int_size_in_bytes (TREE_TYPE (parm)));
+ SET_DECL_RTL (parm, parmreg);
+ }
+
if (nominal_mode == BLKmode
#ifdef BLOCK_REG_PADDING
|| (locate.where_pad == (BYTES_BIG_ENDIAN ? upward : downward)
*************** assign_parms (tree fndecl)
*** 4727,4733 ****
assign_stack_local if space was not allocated in the argument
list. If it was, this will not work if PARM_BOUNDARY is not
a multiple of BITS_PER_WORD. It isn't clear how to fix this
! if it becomes a problem. */
if (stack_parm == 0)
{
--- 4736,4743 ----
assign_stack_local if space was not allocated in the argument
list. If it was, this will not work if PARM_BOUNDARY is not
a multiple of BITS_PER_WORD. It isn't clear how to fix this
! if it becomes a problem. Exception is when BLKmode arrives
! with arguments not conforming to word_mode. */
if (stack_parm == 0)
{
*************** assign_parms (tree fndecl)
*** 4735,4741 ****
PUT_MODE (stack_parm, GET_MODE (entry_parm));
set_mem_attributes (stack_parm, parm, 1);
}
!
else if (PARM_BOUNDARY % BITS_PER_WORD != 0)
abort ();
--- 4745,4753 ----
PUT_MODE (stack_parm, GET_MODE (entry_parm));
set_mem_attributes (stack_parm, parm, 1);
}
! else if (GET_CODE (entry_parm) == PARALLEL
! && GET_MODE(entry_parm) == BLKmode)
! ;
else if (PARM_BOUNDARY % BITS_PER_WORD != 0)
abort ();
*************** assign_parms (tree fndecl)
*** 4798,4804 ****
move_block_from_reg (REGNO (entry_parm), mem,
size_stored / UNITS_PER_WORD);
}
! SET_DECL_RTL (parm, stack_parm);
}
else if (! ((! optimize
&& ! DECL_REGISTER (parm))
--- 4810,4819 ----
move_block_from_reg (REGNO (entry_parm), mem,
size_stored / UNITS_PER_WORD);
}
! /* If parm is already bound to register pair, don't change
! this binding. */
! if (! DECL_RTL_SET_P (parm))
! SET_DECL_RTL (parm, stack_parm);
}
else if (! ((! optimize
&& ! DECL_REGISTER (parm))