On Wed, Feb 06, 2013 at 03:18:27PM -0500, David Miller wrote:
> From: Eric Botcazou <ebotca...@adacore.com>
> Date: Wed, 06 Feb 2013 11:13:30 +0100
> 
> > I think testing crtl->uses_only_leaf_regs is sufficient here (and
> > while you're at it, you could also test the value of
> > HAVE_window_save, which can be 0 if -mflat is passed on the SPARC),
> > so
> > 
> > #ifdef HAVE_window_save
> >     if (HAVE_window_save && !crtl->uses_only_leaf_regs)
> >       {
> > 
> >       }
> > #endif
> 
> Yes, this works perfectly, Jakub any objections?

Perhaps some progress, but not fully working.  I guess you should start
with deciding when the regs should be remapped.  Consider even
simple testcase like (-O2 -g -dA):

int
foo (int a, int b)
{
  int c = a;
  int d = a + b;
  int e = a + b;
  return e;
}

Before *.vartrack, all debug_insn as well as normal insns refer to
%i0 and %i1, before your patch some NOTE_INSN_VAR_LOCATION were referring
to %o[01] registers, others to %i[01] registers, with your patch all refer
to %i[01] registers.  leaf_renumber_regs isn't performed on notes (so,
neither NOTE_INSN_VAR_LOCATION nor NOTE_INSN_CALL_ARG_LOCATION are
adjusted).  Then supposedly somewhere in dwarf2out we do some adjustment,
but still end up with d/e loclist of:
.LLST2:
        .uaxword        .LVL0-.Ltext0   ! Location list begin address (*.LLST2)
        .uaxword        .LVL1-.Ltext0   ! Location list end address (*.LLST2)
        .uahalf 0x6     ! Location expression size
        .byte   0x88    ! DW_OP_breg24
        .byte   0       ! sleb128 0
        .byte   0x89    ! DW_OP_breg25
        .byte   0       ! sleb128 0
        .byte   0x22    ! DW_OP_plus
        .byte   0x9f    ! DW_OP_stack_value
        .uaxword        .LVL1-.Ltext0   ! Location list begin address (*.LLST2)
        .uaxword        .LFE0-.Ltext0   ! Location list end address (*.LLST2)
        .uahalf 0x1     ! Location expression size
        .byte   0x58    ! DW_OP_reg8
        .uaxword        0       ! Location list terminator begin (*.LLST2)
        .uaxword        0       ! Location list terminator end (*.LLST2)
where I'd expect breg8/breg9 instead.

        Jakub

Reply via email to