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: [PATCH] First attempt@unwind epilogue support for s390{,x}


Ulrich Weigand wrote:
+      REG_NOTES (insn) = cfa_restores;
+      add_reg_note (insn, REG_CFA_DEF_CFA,
+		    plus_constant (stack_pointer_rtx, STACK_POINTER_OFFSET));
Given the above, I might think that the only safe CFA definition
for the return insn is CFA = SP + 0.

Well, as mentioned above, it needs to be CFG = SP + STACK_POINTER_OFFSET.

The unwind state exactly at the return instruction would appear to be a special case.

Consider how the unwinder will view the state of the
program at that location:  The return address is loaded
in the appropriate return register, all saved registers
are restored, including the stack pointer.  However, we
still need to unwind to the caller.

Since there's no copy of the stack pointer value remaining
on the stack (is this true, or is there a red-zone?), the
saved-stack-value-overrides-copy-cfa-to-sp logic does not
fire, which means that if we set CFA=SP+OFFSET, then we'll
assign SP = SP+OFFSET during the unwinding.  Which will if
I am not greatly mistaken, give incorrect results for the
rest of the unwinding.

Or is there some hack in the unwinder that I can't find?


r~



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