================
@@ -4619,6 +4619,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
     // Buffer is a void**.
     Address Buf = EmitPointerWithAlignment(E->getArg(0));
 
+    if (getTarget().getTriple().getArch() == llvm::Triple::systemz) {
+      // Call LLVM's EH setjmp, which is lightweight.
----------------
uweigand wrote:

I see.  It seems back in the day the `eh.sjlj.setjmp` intrinsic was used by 
both the front-end to implement `__builtin_setjmp` and by the middle-end 
(SjLjEHPrepare.cpp) for exception handling.  Since these two users apparently 
require somewhat different information in the buffer, filling this in was left 
to the user.

However, these days those two users actually emit two different intrinsics.  
The middle-end now uses `eh.sjlj.setup.dispatch` (which is apparently only 
intended for internal usage; it's not documented at all), while only the 
front-end continues to use `eh.sjlj.setjmp`.  See http://reviews.llvm.org/D9313.

I still think the most straightfoward way would be to have `eh.sjlj.setjmp` 
just be completely implemented in the back end, and simply do exactly what is 
needed to implement `__builtin_setjmp` on the platform, just like is done with 
longjmp.  This could be done for all targets (probably the cleanest solution, 
but would require updating the existing targets and might introduce 
incompatibilities with existing bytecode on those targets), or just for 
selected targets (I guess this would then need to be documented?  And should it 
be a positive or negative list of targets?).


https://github.com/llvm/llvm-project/pull/116642
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to