mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-18 13:34:04 +00:00
Add support for the Objective-C personality function to the instruction
combining of the landingpad instruction. The ObjC personality function acts almost identically to the C++ personality function. In particular, it uses "null" as a "catch-all" value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6f9c28060f
commit
76f267df17
@ -1414,7 +1414,8 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
|||||||
enum Personality_Type {
|
enum Personality_Type {
|
||||||
Unknown_Personality,
|
Unknown_Personality,
|
||||||
GNU_Ada_Personality,
|
GNU_Ada_Personality,
|
||||||
GNU_CXX_Personality
|
GNU_CXX_Personality,
|
||||||
|
GNU_ObjC_Personality
|
||||||
};
|
};
|
||||||
|
|
||||||
/// RecognizePersonality - See if the given exception handling personality
|
/// RecognizePersonality - See if the given exception handling personality
|
||||||
@ -1427,6 +1428,7 @@ static Personality_Type RecognizePersonality(Value *Pers) {
|
|||||||
return StringSwitch<Personality_Type>(F->getName())
|
return StringSwitch<Personality_Type>(F->getName())
|
||||||
.Case("__gnat_eh_personality", GNU_Ada_Personality)
|
.Case("__gnat_eh_personality", GNU_Ada_Personality)
|
||||||
.Case("__gxx_personality_v0", GNU_CXX_Personality)
|
.Case("__gxx_personality_v0", GNU_CXX_Personality)
|
||||||
|
.Case("__objc_personality_v0", GNU_ObjC_Personality)
|
||||||
.Default(Unknown_Personality);
|
.Default(Unknown_Personality);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1440,6 +1442,7 @@ static bool isCatchAll(Personality_Type Personality, Constant *TypeInfo) {
|
|||||||
// match foreign exceptions (or didn't, before gcc-4.7).
|
// match foreign exceptions (or didn't, before gcc-4.7).
|
||||||
return false;
|
return false;
|
||||||
case GNU_CXX_Personality:
|
case GNU_CXX_Personality:
|
||||||
|
case GNU_ObjC_Personality:
|
||||||
return TypeInfo->isNullValue();
|
return TypeInfo->isNullValue();
|
||||||
}
|
}
|
||||||
llvm_unreachable("Unknown personality!");
|
llvm_unreachable("Unknown personality!");
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
declare i32 @generic_personality(i32, i64, i8*, i8*)
|
declare i32 @generic_personality(i32, i64, i8*, i8*)
|
||||||
declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
|
declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
|
||||||
|
declare i32 @__objc_personality_v0(i32, i64, i8*, i8*)
|
||||||
|
|
||||||
declare void @bar()
|
declare void @bar()
|
||||||
|
|
||||||
@ -179,3 +180,54 @@ lpad.d:
|
|||||||
; CHECK-NEXT: null
|
; CHECK-NEXT: null
|
||||||
; CHECK-NEXT: unreachable
|
; CHECK-NEXT: unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define void @foo_objc() {
|
||||||
|
; CHECK: @foo_objc
|
||||||
|
invoke void @bar()
|
||||||
|
to label %cont.a unwind label %lpad.a
|
||||||
|
cont.a:
|
||||||
|
invoke void @bar()
|
||||||
|
to label %cont.b unwind label %lpad.b
|
||||||
|
cont.b:
|
||||||
|
invoke void @bar()
|
||||||
|
to label %cont.c unwind label %lpad.c
|
||||||
|
cont.c:
|
||||||
|
invoke void @bar()
|
||||||
|
to label %cont.d unwind label %lpad.d
|
||||||
|
cont.d:
|
||||||
|
ret void
|
||||||
|
|
||||||
|
lpad.a:
|
||||||
|
%a = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0
|
||||||
|
catch i32* null
|
||||||
|
catch i32* @T1
|
||||||
|
unreachable
|
||||||
|
; CHECK: %a = landingpad
|
||||||
|
; CHECK-NEXT: null
|
||||||
|
; CHECK-NEXT: unreachable
|
||||||
|
|
||||||
|
lpad.b:
|
||||||
|
%b = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0
|
||||||
|
filter [1 x i32*] zeroinitializer
|
||||||
|
unreachable
|
||||||
|
; CHECK: %b = landingpad
|
||||||
|
; CHECK-NEXT: cleanup
|
||||||
|
; CHECK-NEXT: unreachable
|
||||||
|
|
||||||
|
lpad.c:
|
||||||
|
%c = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0
|
||||||
|
filter [2 x i32*] [i32* @T1, i32* null]
|
||||||
|
unreachable
|
||||||
|
; CHECK: %c = landingpad
|
||||||
|
; CHECK-NEXT: cleanup
|
||||||
|
; CHECK-NEXT: unreachable
|
||||||
|
|
||||||
|
lpad.d:
|
||||||
|
%d = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0
|
||||||
|
cleanup
|
||||||
|
catch i32* null
|
||||||
|
unreachable
|
||||||
|
; CHECK: %d = landingpad
|
||||||
|
; CHECK-NEXT: null
|
||||||
|
; CHECK-NEXT: unreachable
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user