[PATCH] Outline C++ exception handlers for MSVC targets.

Andy Kaylor andrew.kaylor at intel.com
Mon Feb 2 15:34:29 PST 2015


Hi rnk,

This patch adds code to outline the catch handlers for Windows C++ exception handling support.

These changes are obviously derived from my earlier patch D6556, but since the direction has changed (from SEH to C++EH) it seemed reasonable to start a new differential.

The test cases are based on clang-generated IR for the listed code using an x86_64-pc-linux target, but I have edited this IR to match expected windows-msvc output.

I edited the IR to remove redundant store and load of the EH object and to replace invokes within a catch block with equivalent calls if the unwind destination does nothing but resume.  I have code to perform both of these transformations, but I am holding it back for a later review.

The following things are not yet implemented:

Intrinsic support for llvm.eh.begincatch/llvm.eh.endcatch
Removal of outlined catch handlers.
Use of frame variables within a catch block.
Removal (from the parent function) of frame variables which are only used in catch blocks.
Outlining of unwind handlers.
Chained catch handlers (catching an exception from within a catch handler).
Sharing of blocks between several landing pads.
Production of intrinsics to support .xdata table generation.

I think that making the begin/end catch calls intrinsics is the only thing that should block the current patch.  I'll submit a separate patch for that shortly.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7363

Files:
  include/llvm/Transforms/Utils/Cloning.h
  lib/CodeGen/WinEHPrepare.cpp
  lib/Transforms/Utils/CloneFunction.cpp
  test/CodeGen/X86/cppeh-catch-all.ll
  test/CodeGen/X86/cppeh-catch-scalar.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7363.19193.patch
Type: text/x-patch
Size: 33230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150202/5293b504/attachment.bin>


More information about the llvm-commits mailing list