avoid unnecessary register saves for setjmp

Chris Lattner sabre@nondot.org
Thu Nov 27 09:22:00 GMT 2003


On Thu, 27 Nov 2003, Andrew Haley wrote:

> Chris Lattner writes:
>  > Zack Weinberg said:
>  > > I'm going to take this opportunity to throw in a suggestion I've
>  > > made before, which is that setjmp/longjmp should - always, not
>  > > just when special variants are used - be converted by the front
>  > > end into invocations of the exception-unwinding facility, which
>  > > gives us tons more control.
>
> True.  But the obvious problem with this is that it places a burden on
> small applications (boot ROMs, say) that might only have a single
> setjmp/longjmp.  These would be forced to include the unwinder and all
> its baggage just for that.

Not at all.  For example, somewhat confusingly, the LLVM->C backend
actually turns "stack unwinding" operations into setjmp/longjmp calls.
This is basically equivalent to SJLJ exception handling, with all of it's
problems, but the point is that you don't _NEED_ to include an unwinder.

The entire point of LLVM is to make these implementation decisions as
orthogonal as possible so that the end user can decide how they want EH
implemented.  *shrug*  setjmp/longjmp is just the C form of exception
handling.  Why represent it any differently?

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/



More information about the Gcc-patches mailing list