search for: __try

Displaying 20 results from an estimated 71 matches for "__try".

2014 Nov 10
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
...ead: define i32 @safe_div(i32 %n, i32 %d) { entry: %d.addr = alloca i32, align 4 %n.addr = alloca i32, align 4 %r = alloca i32, align 4 store i32 %d, i32* %d.addr, align 4 store i32 %n, i32* %n.addr, align 4 invoke void @try_body(i32* %r, i32* %n.addr, i32* %d.addr) to label %__try.cont unwind label %lpad filter: %eh_code = call i32 @llvm.eh.seh.exception_code() ; or similar %cmp = icmp eq i32 %eh_code, 0xC0000094 %r = zext i1 %cmp to i32 call void @llvm.eh.seh.filter(i32 %r) lpad: %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_hand...
2014 Dec 03
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
On Wed, Dec 3, 2014 at 1:41 PM, Reid Kleckner <rnk at google.com> wrote: > On Wed, Dec 3, 2014 at 1:27 PM, Vadim Chugunov <vadimcn at gmail.com> wrote: > >> If we added unwind target to every potentially throwing instruction >> (loads, stores, all binary operations), wouldn't all such instructions have >> to become BB terminators? I'd expect that CFG
2014 Nov 13
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
...nd most importantly, what can I do to help? Thanks, Andy From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Reid Kleckner Sent: Monday, November 10, 2014 3:39 PM To: LLVM Developers Mailing List; John McCall Subject: Re: [LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR Hm, this idea won't work. If we point to labels from landingpadinst then passes like SimplifyCFG will consider the blocks to be unreachable. I realized this by looking at llvm-dis output after hacking in asmparser support for this syntax. :) I'll have to think longe...
2019 Nov 08
2
Exceptions on Windows & MSVC
...'t been updated since 2015, was there any progress since? This is most likely known, but there's significant divergence between the behavior of MSVC cl.exe and clang-cl.exe: Consider: void crash() { struct A { ~A() {} } Obj; *(volatile int *)0x11 = 0; } #ifdef SEH #define TRY __try #define CATCH_ALL __except (1) #else #define TRY try #define CATCH_ALL catch (...) #endif int main() { TRY { crash(); } CATCH_ALL {} return 0; } using try/catch (SEH not defined): | (default) | /EHa | /EHs |...
2020 May 03
2
[RFC] [Windows SEH] Local_Unwind (Jumping out of a _finally)
...nt mechanism except that now it’s allowed to report EH state ranges that only contain memory/computation instructions (for obvious reason). I’m not sure which part of that concerns you. I think we need rules about how LLVM is allowed to transform the following code: void foo(volatile int *pv) { __try { if (cond()) { ++*pv; __builtin_unreachable(); } } __except(1) { } __try { if (cond()) { ++*pv; __builtin_unreachable(); } } __except(1) { } } In this case, the *pv operation may throw, but I believe it would be semantics preserving to merge the two i...
2014 Dec 03
1
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
...efore I start outlining, I’m just picking them up as I go. It seems like that may need to change. -Andy From: Reid Kleckner [mailto:rnk at google.com] Sent: Wednesday, December 03, 2014 1:32 PM To: Kaylor, Andrew Cc: LLVM Developers Mailing List Subject: Re: [LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR I went ahead and implemented @llvm.frameallocate in a patch here: http://reviews.llvm.org/D6493 Andrew, do you have a wip patch for outlining, or any lessons learned from attempting it? I think outlining is now the next step, so let me know if there's something you'...
2011 Jun 12
5
[LLVMdev] Is LLVM expressive enough to represent asynchronous exceptions?
...ble-based Windows SEH for the COFF format. That is, implementing synchronous exceptions using the native platform's asynchronous exception framework. I am concerned with representing the handling of asynchronous exceptions in LLVM as there is language-level support in Windows C++ compilers via __try/__except/__finally blocks (Clang already supports this at the AST level). I believe that this is not currently possible and needs new no-op instructions or a change in syntax. A SEH-block in C++ consists of a __try block and either of two following blocks: * A __except block consisting of a filte...
2015 Apr 16
2
[LLVMdev] Exception filter IR model
...ut the IR model for SEH filters (as I want to use the same model for CLR filters). In particular, when an outer filter is invoked before entering an inner finally, which piece of IR reflects the filter's side-effects? To take a concrete example, consider this C code: void foo() { int x; __try { x = 0; __try { x = 2; may_throw(); } __finally { if (x == 1) { printf("correct\n"); } else { printf("incorrect\n"); } } } __except (x = 1) { } } The IR for the path from "x = 2" to the l...
2014 Dec 03
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
If we added unwind target to every potentially throwing instruction (loads, stores, all binary operations), wouldn't all such instructions have to become BB terminators? I'd expect that CFG would then end up consisting mostly of single-instruction BBs. This can't be good for compilation performance and optimizations... Another vague idea: what if lifetime.start() returned some kind
2014 Dec 03
3
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
Hi Reid, Is this design supposed to be able to cope with asynchronous exceptions? I am having trouble imagining how this would work without adding the ability to associate landing pads with scopes in LLVM IR. Vadim On Tue, Nov 25, 2014 at 5:27 PM, Reid Kleckner <rnk at google.com> wrote: > On Tue, Nov 25, 2014 at 3:09 PM, Kaylor, Andrew <andrew.kaylor at intel.com> > wrote:
2020 Apr 15
2
[RFC] [Windows SEH][-EHa] Support Hardware Exception Handling
...nt mechanism except that now it’s allowed to report EH state ranges that only contain memory/computation instructions (for obvious reason). I’m not sure which part of that concerns you. I think we need rules about how LLVM is allowed to transform the following code: void foo(volatile int *pv) { __try { if (cond()) { ++*pv; __builtin_unreachable(); } } __except(1) { } __try { if (cond()) { ++*pv; __builtin_unreachable(); } } __except(1) { } } In this case, the *pv operation may throw, but I believe it would be semantics preserving to merge the two i...
2015 May 18
2
[LLVMdev] RFC: New EH representation for MSVC compatibility
On Sat, May 16, 2015 at 7:29 AM, Steve Cheng <steve.ckp at gmail.com> wrote: > On 2015-05-15 18:37:58 -0400, Reid Kleckner said: > > After a long tale of sorrow and woe, my colleagues and I stand here >> before you defeated. The Itanium EH representation is not amenable to >> implementing MSVC-compatible exceptions. We need a new representation that >> preserves
2020 Apr 16
2
[RFC] [Windows SEH][-EHa] Support Hardware Exception Handling
...C] [Windows SEH][-EHa] Support Hardware Exception Handling I still have basically the same concerns. I’ll try to give more concrete examples for what I’m concerned about. Suppose I have something like the following: typedef struct C { int x[2]; } C; void threw_exception(); void z(); C f() { __try { z(); return *(C*)0; } __except(1) { threw_exception(); } C c = {0}; return c; } Currently, under your proposal, this won’t call threw_exception() if optimization is enabled, as far as I can tell. I have no idea if this is intentional: your proposal and y...
2014 Jul 30
2
[LLVMdev] LLVM 3.5 support for Microsoft Windows Structured Exception Handling?
I was wondering if the upcoming LLVM 3.5 release will have support for Microsoft Windows Structured Exception handling (e.g., __try/__except/__finally)? Thanks, Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140730/e3d18989/attachment.html>
2011 Jun 12
0
[LLVMdev] Is LLVM expressive enough to represent asynchronous exceptions?
...COFF format. That is, implementing > synchronous exceptions using the native platform's asynchronous > exception framework. > > I am concerned with representing the handling of asynchronous > exceptions in LLVM as there is language-level support in Windows C++ > compilers via __try/__except/__finally blocks (Clang already supports > this at the AST level). I believe that this is not currently possible > and needs new no-op instructions or a change in syntax. > > A SEH-block in C++ consists of a __try block and either of two > following blocks: > > * A __e...
2014 Jan 17
2
[LLVMdev] Unable to catch Win64 exceptions that occur in the mcjit(ted) code
Hi all, In my MSVC-compiled project I am using MCJIT to run some generated code. I faced that in case of Win64 ('x86_64-pc-win32-elf') __try/__except block doesn't work - the stack can not be unwound. I have found that the only way to fix it is implementing my own *registerEHFrames* function of the Memory Manager (but I'm not sure this helps). Maybe someone had a success solving the same problem? What would be the best approach...
2014 Dec 19
5
[LLVMdev] Windows EH support
...ironment. I've put together a list, including work in progress, but I'm guessing that I've missed some details. Can you look this over and tell me if it matches your idea of what needs to be done? Structured Exception Handling --------------------------------------- * Add support for __try and __except in clang. It looks like this is mostly implemented by your changes in the D5607 review, but there hasn't been any activity on that review for quite a while. You're going to rewrite a lot of that to change the way filters are implemented, right? * Add support for __finally i...
2018 Apr 04
2
llvm.localsescape/recover
...m 6.0 though. I'll try with svn HEAD. On Tue, Apr 3, 2018, at 19:22, Reid Kleckner wrote: > I would guess that %threedoubles has a large alignment and that is making things go wrong. I thought we fixed this bug, though. I can't find it in the tracker, but it's in there. Someone used __try with local variables of type 'double' on 32-bit and things didn't work out. I'm pretty sure we fixed it though. > > On Tue, Apr 3, 2018 at 4:53 AM Carlo Kok via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> I 'm using locals recover to have a seh finally in...
2012 Sep 17
2
[LLVMdev] Detail question about how to implement Win64 SEH
Hi! I try to add more functionality to Win64 exception handling, based on the posted patches from Charles Davis and João Matos. But I have a question about how to map SEH handling to LLVM IR. The basic structure of SEH in C is as follows: __try { // Do something. } __except (filter(GetExceptionCode(), GetExceptionInformation())) { // Handle exception } How to translate this? - The filter expression is basically a nested function which is called with the exception code and exception information. - The body of the _...
2020 Apr 01
2
[RFC] [Windows SEH] Local_Unwind (Jumping out of a _finally) and -EHa (Hardware Exception Handling)
Hi, all, The intend of this thread is to complete the support for Windows SEH. Currently there are two major missing features: Jumping out of a _finally and Hardware exception handling. The document below is my proposed design and implementation to fully support SEH on LLVM. I have completely implemented this design on a branch in repo: