Convert to the new EH model.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2011-11-08 00:17:28 +00:00
parent 30ceba32b2
commit 8b7d76990c
3 changed files with 20 additions and 28 deletions

View File

@ -10,9 +10,10 @@ entry:
invoke void @raise()
to label %eh_then unwind label %unwind
unwind: ; preds = %entry
%eh_ptr = tail call i8* @llvm.eh.exception()
%eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error)
unwind: ; preds = %entry
%eh_ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*)
catch i8* @error
%eh_select = extractvalue { i8*, i32 } %eh_ptr, 1
%eh_typeid = tail call i32 @llvm.eh.typeid.for(i8* @error)
%tmp2 = icmp eq i32 %eh_select, %eh_typeid
br i1 %tmp2, label %eh_then, label %Unwind
@ -21,16 +22,11 @@ eh_then: ; preds = %unwind, %entry
ret void
Unwind: ; preds = %unwind
%0 = tail call i32 (...)* @_Unwind_Resume(i8* %eh_ptr)
unreachable
resume { i8*, i32 } %eh_ptr
}
declare void @raise()
declare i8* @llvm.eh.exception() nounwind readonly
declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
declare i32 @llvm.eh.typeid.for(i8*) nounwind
declare i32 @__gnat_eh_personality(...)

View File

@ -30,14 +30,16 @@ invoke.cont: ; preds = %entry
br label %finally
terminate.handler: ; preds = %match.end
%exc = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
%1 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exc, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
%1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
cleanup
call void @_ZSt9terminatev() noreturn nounwind
unreachable
try.handler: ; preds = %entry
%exc1 = call i8* @llvm.eh.exception() ; <i8*> [#uses=3]
%selector = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exc1, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) ; <i32> [#uses=1]
%exc1.ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
catch i8* null
%exc1 = extractvalue { i8*, i32 } %exc1.ptr, 0
%selector = extractvalue { i8*, i32 } %exc1.ptr, 1
%2 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) ; <i32> [#uses=1]
%3 = icmp eq i32 %selector, %2 ; <i1> [#uses=1]
br i1 %3, label %match, label %catch.next
@ -55,9 +57,10 @@ invoke.cont2: ; preds = %match
br label %match.end
match.handler: ; preds = %match
%exc3 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
%7 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exc3, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) ; <i32> [#uses=0]
store i8* %exc3, i8** %_rethrow
%exc3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
cleanup
%7 = extractvalue { i8*, i32 } %exc3, 0
store i8* %7, i8** %_rethrow
store i32 2, i32* %cleanup.dst
br label %match.end
@ -124,10 +127,6 @@ declare void @_Z6throwsv() ssp
declare i32 @__gxx_personality_v0(...)
declare i8* @llvm.eh.exception() nounwind readonly
declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
declare void @_ZSt9terminatev()
declare void @_Unwind_Resume_or_Rethrow(i8*)

View File

@ -10,14 +10,15 @@ bb1:
ret void
lpad:
%exn = tail call i8* @llvm.eh.exception() nounwind
%eh.selector = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exn, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1, i8* null) nounwind
%exn.ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
catch i8* null
%exn = extractvalue { i8*, i32 } %exn.ptr, 0
%eh.selector = extractvalue { i8*, i32 } %exn.ptr, 1
%ehspec.fails = icmp slt i32 %eh.selector, 0
br i1 %ehspec.fails, label %ehspec.unexpected, label %cleanup
cleanup:
tail call void @_Unwind_Resume_or_Rethrow(i8* %exn) noreturn nounwind
unreachable
resume { i8*, i32 } %exn.ptr
ehspec.unexpected:
tail call void @__cxa_call_unexpected(i8* %exn) noreturn nounwind
@ -26,12 +27,8 @@ ehspec.unexpected:
declare noalias i8* @malloc()
declare i8* @llvm.eh.exception() nounwind readonly
declare i32 @__gxx_personality_v0(...)
declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
declare void @_Unwind_Resume_or_Rethrow(i8*)
declare void @__cxa_call_unexpected(i8*)