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: Problems with builtin setjmp receiver getting eliminated - Help


With David Daney suggestion I referred to MIPS port. And it looks like I figured a similar workaround in target.

builin-setjmp and friends , are seriously messed up. To make matters worse, target overrides are not well structured and various optimization stages rip out receiver code. My solution is thus very contrived - but no more than MIPS.

I defined a copykat nonlocal_goto_receiver. I did not need it but its presence is the only way to override a key part of the randomly optimized builtin_setjmp_receiver code
As receivers now contains no real instructions , it no longer matters if optimizers removes them or not (MIPS uses unspecs to keep code - but I can't trust that to always work)


I then defined TARGET_BUILTIN_SETJMP_FRAME_VALUE - which allows expand_builtin_setjmp_setup to store the unadjusted frame_pointer, which can be fully restored in expand_builtin_longjmp - rather than the receiver.

Tada!

So that got the testcase working!

I still have to check all call saved registers are saved by function doing setjmp - they appear not to be at higher optimization levels. Either gcc is being smarter than me or there is still a problem.

Lastly, TWO receivers still being created - one is setjmp_receiver the other is non_local_receiver. It's not my code, it happens on HEAD - I have not figured out why.


Andy





David Daney wrote:
Andrew Hutchinson wrote:
I have realised that  part of the problem is that the receiver block
has no incoming edges so cfgcleanup removes it as unreachable block -
right?

So any target that need a non trivial receiver for builtin_setjmp will
not work? That would mean  any that have an offset between stack and
pointers?

I guess the same problem exists for non-local goto?

I am not convinced it could be this wrong. So please comment and
suggest solution - I'm sure I can write target handler but it seems so
wrong to leave this as  issue open.

MIPS uses an unspec_volatile in the nonloca_goto_receiver  That keeps it
from being removed.

David Daney



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