[PATCH] D15405: [EHPersonality] Add a new personality enum to represent langindPad of token type

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 21:44:32 PST 2015


chenli created this revision.
chenli added a reviewer: JosephTremoulet.
chenli added a subscriber: llvm-commits.

This patch adds a new personality enum to represent landingPad of token type. Exceptions with such landingPads currently do not support extraction of exception pointers or selector values, but will be added in later patches.

http://reviews.llvm.org/D15405

Files:
  include/llvm/Analysis/EHPersonalities.h
  lib/Analysis/EHPersonalities.cpp
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/token_landingpad.ll

Index: test/CodeGen/X86/token_landingpad.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/token_landingpad.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s | FileCheck %s
+
+; This test verify that SelectionDAG can handle landingPad of token type.
+
+define void @test() personality i32 (...)* @ProcessTokenLandingPad {
+; CHECK: .cfi_personality 155, _ProcessTokenLanding
+entry:
+  invoke void @dummy()
+          to label %return unwind label %unwind
+
+unwind:                                           ; preds = %entry
+  %lp = landingpad token
+            cleanup
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}
+
+declare void @dummy()
+
+declare i32 @ProcessTokenLandingPad(...)
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -17432,6 +17432,11 @@
 
 unsigned X86TargetLowering::getExceptionPointerRegister(
     const Constant *PersonalityFn) const {
+  // LandingPad of token type currently doesn't support exception pointer
+  // extraction.
+  if (classifyEHPersonality(PersonalityFn) == EHPersonality::Token_LP)
+    return 0;
+
   if (classifyEHPersonality(PersonalityFn) == EHPersonality::CoreCLR)
     return Subtarget->isTarget64BitLP64() ? X86::RDX : X86::EDX;
 
@@ -17442,6 +17447,11 @@
     const Constant *PersonalityFn) const {
   // Funclet personalities don't use selectors (the runtime does the selection).
   assert(!isFuncletEHPersonality(classifyEHPersonality(PersonalityFn)));
+  // LandingPad of token type currently doesn't support selector value
+  // extraction.
+  if (classifyEHPersonality(PersonalityFn) == EHPersonality::Token_LP)
+    return 0;
+
   return Subtarget->isTarget64BitLP64() ? X86::RDX : X86::EDX;
 }
 
Index: lib/Analysis/EHPersonalities.cpp
===================================================================
--- lib/Analysis/EHPersonalities.cpp
+++ lib/Analysis/EHPersonalities.cpp
@@ -29,6 +29,7 @@
     .Case("__C_specific_handler",  EHPersonality::MSVC_Win64SEH)
     .Case("__CxxFrameHandler3",    EHPersonality::MSVC_CXX)
     .Case("ProcessCLRException",   EHPersonality::CoreCLR)
+    .Case("ProcessTokenLandingPad",EHPersonality::Token_LP)
     .Default(EHPersonality::Unknown);
 }
 
Index: include/llvm/Analysis/EHPersonalities.h
===================================================================
--- include/llvm/Analysis/EHPersonalities.h
+++ include/llvm/Analysis/EHPersonalities.h
@@ -25,7 +25,8 @@
   MSVC_X86SEH,
   MSVC_Win64SEH,
   MSVC_CXX,
-  CoreCLR
+  CoreCLR,
+  Token_LP
 };
 
 /// \brief See if the given exception handling personality function is one


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15405.42380.patch
Type: text/x-patch
Size: 2778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151210/f0d171da/attachment.bin>


More information about the llvm-commits mailing list