summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-06-02 17:16:06 +0000
committerDuncan Sands <baldrick@free.fr>2007-06-02 17:16:06 +0000
commitf708f73a1bb3402fb9fad7c1b542be1cf30f043f (patch)
treeded72cd24cdbfdcc6ad734421a74e682be719aea /llvm/lib/CodeGen/MachineModuleInfo.cpp
parentc063f5f362d91eaed2db0faf5190cb8ab1a73111 (diff)
downloadbcm5719-llvm-f708f73a1bb3402fb9fad7c1b542be1cf30f043f.tar.gz
bcm5719-llvm-f708f73a1bb3402fb9fad7c1b542be1cf30f043f.zip
The semantics of invoke require that we always jump to the unwind block
(landing pad) when an exception unwinds through the call. This doesn't quite match the way the dwarf unwinder works: by default it only jumps to the landing pad if the catch or filter specification matches, and otherwise it keeps on unwinding. There are two ways of specifying to the unwinder that it should "always" (more on why there are quotes here later) jump to the landing pad: follow the specification by a 0 typeid, or follow it by the typeid for the NULL typeinfo. GCC does the first, and this patch makes LLVM do the same as gcc. However there is a problem: the unwinder performs optimizations based on C++ semantics (it only expects destructors to be run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no exceptions will be raised and that the raised exception will be reraised at the end of the cleanup code. So if someone writes their own LLVM code using the exception intrinsics they will get a nasty surprise if they don't follow these rules. The other possibility of using the typeid corresponding to NULL (catch-all) causes the unwinder to make no assumptions, so this is probably what we should use in the long-run. However since we are still having trouble getting exception handling working properly, for the moment it seems best to closely imitate GCC. llvm-svn: 37399
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 32d8394527a..6ac038a1d9e 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -1728,6 +1728,10 @@ void MachineModuleInfo::TidyLandingPads() {
LandingPadInfo &LandingPad = LandingPads[i];
LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel);
+ if (!LandingPad.LandingPadBlock)
+ // Must not have cleanups if no landing pad.
+ LandingPad.TypeIds.clear();
+
// Special case: we *should* emit LPs with null LP MBB. This indicates
// "rethrow" case.
if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {
OpenPOWER on IntegriCloud