rt: Move personality to functions from their landing pads

This is for llvm/cc714e214298cfbf11de65b46de31900d51422cf
This commit is contained in:
Richo Healey 2015-06-27 14:39:22 -07:00 committed by Alex Crichton
parent ea317e8ea4
commit c55d3f1ba1
2 changed files with 15 additions and 10 deletions

View File

@ -14,7 +14,9 @@
; See also: libstd/rt/unwind/mod.rs
define i8* @rust_try(void (i8*)* %f, i8* %env) {
define i8* @rust_try(void (i8*)* %f, i8* %env)
personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*)
{
%1 = invoke i8* @rust_try_inner(void (i8*)* %f, i8* %env)
to label %normal
@ -24,13 +26,15 @@ normal:
ret i8* %1
catch:
landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*)
catch i8* null
; rust_try_inner's landing pad does not resume unwinds, so execution will never reach here
landingpad { i8*, i32 } catch i8* null
; rust_try_inner's landing pad does not resume unwinds, so execution will
; never reach here
ret i8* null
}
define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env) {
define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env)
personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*)
{
invoke void %f(i8* %env)
to label %normal
@ -40,8 +44,7 @@ normal:
ret i8* null
catch:
%1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*)
catch i8* null
%1 = landingpad { i8*, i32 } catch i8* null
; extract and return pointer to the exception object
%2 = extractvalue { i8*, i32 } %1, 0
ret i8* %2

View File

@ -21,7 +21,9 @@
;
; See also: src/libstd/rt/unwind/seh.rs
define i8* @rust_try(void (i8*)* %f, i8* %env) {
define i8* @rust_try(void (i8*)* %f, i8* %env)
personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
{
invoke void %f(i8* %env)
to label %normal
unwind label %catch
@ -58,8 +60,8 @@ normal:
; but apparently LLVM chokes on this, so we do the more complicated thing to
; placate it.
catch:
%vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*)
%vals = landingpad { i8*, i32 }
catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*)
%ehptr = extractvalue { i8*, i32 } %vals, 0
%sel = extractvalue { i8*, i32 } %vals, 1
%filter_sel = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*))