search for: exception_int_divide_by_zero

Displaying 2 results from an estimated 2 matches for "exception_int_divide_by_zero".

2014 Nov 10
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
...think we can > model this by always catching the exception and then re-raising it. > Obviously, this isn't 100% faithful, but it can work. > > --- > > Here’s some example IR for how we might lower this C code: > > #define GetExceptionCode() _exception_code() > enum { EXCEPTION_INT_DIVIDE_BY_ZERO = 0xC0000094 }; > int safe_div(int n, int d) { > int r; > __try { > r = n / d; > } __except(GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO) { > r = 0; > } > return r; > } > > define internal void @try_body(i32* %r, i32* %n, i32* %d) { > entr...
2014 Nov 13
2
[LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
...an operand. However, in the short term, I think we can model this by always catching the exception and then re-raising it. Obviously, this isn't 100% faithful, but it can work. --- Here’s some example IR for how we might lower this C code: #define GetExceptionCode() _exception_code() enum { EXCEPTION_INT_DIVIDE_BY_ZERO = 0xC0000094 }; int safe_div(int n, int d) { int r; __try { r = n / d; } __except(GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO) { r = 0; } return r; } define internal void @try_body(i32* %r, i32* %n, i32* %d) { entry: %0 = load i32* %n, align 4 %1 = load i32* %d, align...