This is the mail archive of the 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]

[PATCH] Second attempt@unwind epilogue support for s390{,x}

On Wed, Jun 03, 2009 at 08:02:00PM +0200, Ulrich Weigand wrote:
> Jakub Jelinek wrote:
> > Ok, I'm withdrawing the save_gprs changes (and the change to special case
> > %r15 for .cfi_restore).  For global regs I'd say .cfi_restore does no harm,
> > but could be omitted, but we shouldn't be having .cfi_offset in the prologue
> > for them either.
> Hmm, good point.  The function might change the value in the global
> register; that change will persist once the function returns, it will not
> be reverted to the value the register had before the function call; and
> therefore the .cfi_offset seems to be actually wrong ...

Yeah.  Seems the reason why cleanup-9 was hanging for me was that I've been
using gcc 4.1.x, which didn't have
fix (that is only in 4.3+), thus DW_CFA_re{member,store}_state was broken.
When using 4.4/trunk libgcc_s or after backporting the DW_CFA_re{member,store}_state
fix to 4.1 cleanup-9 works, obviously only when %15 is mentioned in DWARF.
Attached patch should work and handle also the global regs correctly
register long r8 asm ("%r8");
void bar (void);
void bar2 (int, int, int, int);
void bar3 (int, int, int, int, int, int, int);
long foo (int x, int y)
  long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
  double Q, R, S, T, U, V, W, X, Y, Z;
  char buf[131077];
  asm volatile ("" : "=rm" (a), "=rm" (b), "=rm" (c), "=rm" (d), "=rm" (e), "=rm" (f), "=rm" (g), "=rm" (h), "=rm" (i), "=rm" (j), "=rm" (k), "=rm" (l), "=rm" (m), "=rm" (n), "=rm" (o), "=rm" (p) : "r" (buf));
  asm volatile ("# %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" : "=f" (Q), "=f" (R), "=f" (S), "=f" (T), "=f" (U), "=f" (V), "=f" (W), "=f" (X), "=f" (Y), "=f" (Z));
  bar ();
  bar2 (0, 1, 2, 3);
  bar ();
  bar3 (0, 1, 2, 3, 4, 5, 6);
  bar ();
  bar2 (0, 1, 2, 3);
  asm volatile ("# %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" : : "f" (Q), "f" (R), "f" (S), "f" (T), "f" (U), "f" (V), "f" (W), "f" (X), "f" (Y), "f" (Z));
  return a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p;

> The problem is that we need the literal pool (when it is intermixed
> with code) to participate in the shorten_branches () and insn length
> computations.  That's why we use UNSPEC_VOLATILE insns ...

> However, it is of course true that this not code, and therefore does
> not require CFI.  I'm not sure how to provide that information at
> the RTL level -- maybe a new UNSPEC_DATA instead?  Or some REG_NOTE?

Richard, what is your preference here?  Yet another alternative could
be special REG_* notes that mark the beginning (and optionally end) of
region with "instructions" not needing unwind info.

OT, for all architectures IMHO dwarf2out.c should move .cfi_remember_state
note from NOTE_INSN_EPILOGUE_BEG down to the first insn in the epilogue
that actually has any CFI emitted, that way we'll get rid of an unnecessary
DW_CFA_advance_loc*.  Of course DW_CFA_remember_state has to be the first
op emitted after that instruction in that case.


Attachment: Y326
Description: Text document

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