This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [3/7] v10: Collect alignment info


HJ,

Your fixes looks OK. I didn't expect when default_internal_arg_pointer is used, virtual-incoming-args-rtx is still alive. Now looks both can be alive.

Thanks - Joey 

-----Original Message-----
From: H.J. Lu [mailto:hjl.tools@gmail.com] 
Sent: 2008年8月1日 3:59
To: Steve Ellcey
Cc: gcc-patches@gcc.gnu.org; Ye, Joey
Subject: Re: [3/7] v10: Collect alignment info

On Thu, Jul 31, 2008 at 9:10 AM, Steve Ellcey <sje@cup.hp.com> wrote:
> HJ,
>
> I think this patch is causing a hppa64-*-* bootstrap failure.  I haven't
> tracked it down to the specific svn checkin, but I see you have been working
> in this area.  Compiling a trivial 'int main() {return 0;}' program with
> the stage 1 compiler using the latest sources I get:
>
> x.c: In function 'main':
> x.c:5: internal compiler error: in instantiate_new_reg, at function.c:1221
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
> If I look at (crtl->args.internal_arg_pointer I see:
>        (reg/f:DI 68)
> and if I look at virtual_incoming_args_rtx I see:
>        (reg/f:DI 61 virtual-incoming-args)
>
> But stack_realign_drap must be false since I hit the gcc_assert.
>
> Has anyone else reported a problem like this?  Is there any specific
> information I can give you to help in solving this?

Hi Joey,

In instantiate_new_reg:

  if (x == virtual_incoming_args_rtx)
    {
      /* Replace virtual_incoming_args_rtx to internal arg pointer here */
      if (crtl->args.internal_arg_pointer != virtual_incoming_args_rtx)
        {
          gcc_assert (stack_realign_drap);
          new = crtl->args.internal_arg_pointer;
          offset = 0;
        }
      else
        new = arg_pointer_rtx, offset = in_arg_offset;
    }

We check crtl->args.internal_arg_pointer != virtual_incoming_args_rtx
to see if we need to replace virtual_incoming_args_rtx  with
internal arg pointer when DRAP is used to align stack.  It doesn't work for
default_internal_arg_pointer:

rtx
default_internal_arg_pointer (void)
{
  /* If the reg that the virtual arg pointer will be translated into is
     not a fixed reg or is the stack pointer, make a copy of the virtual
     arg pointer, and address parms via the copy.  The frame pointer is
     considered fixed even though it is not marked as such.  */
  if ((ARG_POINTER_REGNUM == STACK_POINTER_REGNUM
       || ! (fixed_regs[ARG_POINTER_REGNUM]
             || ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)))
    return copy_to_reg (virtual_incoming_args_rtx);
  else
    return virtual_incoming_args_rtx;
}

when a copy of virtual_incoming_args_rtx is used.

I am testing this patch. Instead of checking crtl->args.internal_arg_pointer !=
virtual_incoming_args_rtx, we make sure that stack_realign_drap and
drap_rtx match. We can check stack_realign_drap to see if we need
to replace virtual_incoming_args_rtx with internal arg pointer.

Steve, can you give it a try?

Thanks.


H.J.
---
2008-07-31  H.J. Lu  <hongjiu.lu@intel.com>

	* cfgexpand.c (expand_stack_alignment): Assert that
	stack_realign_drap and drap_rtx must match.

	* function.c (instantiate_new_reg): If DRAP is used to realign
	stack, replace virtual_incoming_args_rtx with internal arg
	pointer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]