aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-04-12 12:49:49 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-04-12 12:49:49 -0700
commit6ea81f7c3e816f7fb9c8ff9a9f2ea961865ff03c (patch)
treefa121c6d5aa45272c34be1291bf6b692db0beac1
parent29d2ddad89f1124216210a1e3fc9a216ed83f01c (diff)
PNaCl ABI checker: Disallow invoke+landingpad instructions
The first release of the stable PNaCl ABI won't support zero-cost C++ exception handling. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3377 TEST=toolchain trybots + gcc torture tests + Spec2k + LLVM regression tests Review URL: https://codereview.chromium.org/14044006
-rw-r--r--lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp5
-rw-r--r--test/NaCl/PNaClABI/instructions.ll18
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
index 5e773e9751..4c4c935ec5 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
@@ -67,6 +67,9 @@ bool PNaClABIVerifyFunctions::runOnFunction(Function &F) {
default:
// We expand GetElementPtr out into arithmetic.
case Instruction::GetElementPtr:
+ // Zero-cost C++ exception handling is not supported yet.
+ case Instruction::Invoke:
+ case Instruction::LandingPad:
// indirectbr may interfere with streaming
case Instruction::IndirectBr:
// No vector instructions yet
@@ -84,7 +87,6 @@ bool PNaClABIVerifyFunctions::runOnFunction(Function &F) {
case Instruction::Switch:
case Instruction::Resume:
case Instruction::Unreachable:
- case Instruction::Invoke:
// Binary operations
case Instruction::Add:
case Instruction::FAdd:
@@ -134,7 +136,6 @@ bool PNaClABIVerifyFunctions::runOnFunction(Function &F) {
case Instruction::Select:
case Instruction::Call:
case Instruction::VAArg:
- case Instruction::LandingPad:
break;
}
// Check the types. First check the type of the instruction.
diff --git a/test/NaCl/PNaClABI/instructions.ll b/test/NaCl/PNaClABI/instructions.ll
index 49585b1fca..e00e7f89f6 100644
--- a/test/NaCl/PNaClABI/instructions.ll
+++ b/test/NaCl/PNaClABI/instructions.ll
@@ -109,5 +109,23 @@ foo:
bar:
ret void
}
+
+declare void @external_func()
+declare void @personality_func()
+
+define void @invoke_func() {
+ invoke void @external_func() to label %ok unwind label %onerror
+; CHECK-NOT: disallowed
+; CHECK: Function invoke_func has disallowed instruction: invoke
+ok:
+ ret void
+onerror:
+ %lp = landingpad i32
+ personality i8* bitcast (void ()* @personality_func to i8*)
+ catch i32* null
+; CHECK-NEXT: Function invoke_func has disallowed instruction: landingpad
+ ret void
+}
+
; CHECK-NOT: disallowed
; If another check is added, there should be a check-not in between each check