Displaying 4 results from an estimated 4 matches for "handle_int".
2015 Jan 27
2
[LLVMdev] RFC: Native Windows C++ exception handling
...() {
// eh_state = -1
try {
// eh_state = 0
Outer outer;
// eh_state = 1
try {
// eh_state = 2
Inner inner;
// eh_state = 3
do_inner_thing();
// eh_state = 2 (because we’re going to destruct inner here)
} catch (int) {
// eh_state = 4
handle_int();
}
// eh_state = 0 (because we’re going to destruct outer here)
} catch (float) {
// eh_state = 5
handle_float();
}
// eh_state = -1;
keep_going();
}
Basically, the EH state needs to change any time we enter a new scope or construct a new object that needs to be destructe...
2015 Jan 26
2
[LLVMdev] RFC: Native Windows C++ exception handling
I am working on adding support for C++ exception handling when compiling for a native Windows target (that is a target with "MSVC" specified as the environment). Because of differences between how the native Windows runtime handles exceptions and the Itanium-based model used by current LLVM exception handling code, I believe this will require some extensions to the LLVM IR, though
2015 Jan 27
2
[LLVMdev] RFC: Native Windows C++ exception handling
...ut later today.
If we go this way, the inlining code will need to be taught to merge the landingpad of the inlined function, but I think that will be pretty easy.
So, here it is:
void test()
{
try {
Outer outer;
try {
Inner inner;
do_inner_thing();
} catch (int) {
handle_int();
}
} catch (float) {
handle_float();
}
keep_going();
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Original
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Function Attrs: uwtable
define void @_Z4testv() #0 {
entry:
%outer = alloca %class.Outer, align 1
%inner = alloca %class.Inne...
2015 Jan 27
2
[LLVMdev] RFC: Native Windows C++ exception handling
...i8* null, void (i8*, i8*)* @dtor_outer,
i32 2, i8* bitcast (i8** @_ZTIf to i8*), void (i8*, i8*)* @catch_float)
indirectbr i8* %recover2, [label %try.cont], [label %try.cont19]
}
One issue is that I'm not sure how to catch a "float" exception thrown by handle_int(). I'll have to think about that.
It's also not clear to me that we need to have the i32 selector in @llvm.eh.actions. We need a way to distinguish between catch-all (traditionally i8* null) and a cleanup. We could just use some other constant like 'i8* inttoptr (i32 1 to i8*)' and...