[llvm-branch-commits] [llvm-branch] r136073 - in /llvm/branches/exception-handling-rewrite: include/llvm-c/Core.h lib/VMCore/Core.cpp

Bill Wendling isanbard at gmail.com
Tue Jul 26 03:30:49 PDT 2011


Author: void
Date: Tue Jul 26 05:30:49 2011
New Revision: 136073

URL: http://llvm.org/viewvc/llvm-project?rev=136073&view=rev
Log:
Add an API for generating the LandingPadInst and filling it with clauses.

Modified:
    llvm/branches/exception-handling-rewrite/include/llvm-c/Core.h
    llvm/branches/exception-handling-rewrite/lib/VMCore/Core.cpp

Modified: llvm/branches/exception-handling-rewrite/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/include/llvm-c/Core.h?rev=136073&r1=136072&r2=136073&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/include/llvm-c/Core.h (original)
+++ llvm/branches/exception-handling-rewrite/include/llvm-c/Core.h Tue Jul 26 05:30:49 2011
@@ -277,6 +277,11 @@
   LLVMRealPredicateTrue   /**< Always true (always folded) */
 } LLVMRealPredicate;
 
+typedef enum {
+  LLVMCatch,              /**< A catch clause   */
+  LLVMFilter              /**< A filter clause  */
+} LLVMLandingPadClauseTy;
+
 void LLVMInitializeCore(LLVMPassRegistryRef R);
 
 
@@ -834,6 +839,13 @@
 /* Add a destination to the indirectbr instruction */
 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
 
+/* Add a clause to the landingpad instruction */
+void LLVMAddClause(LLVMValueRef LandingPad, LLVMLandingPadClauseTy ClauseTy,
+                   LLVMValueRef ClauseVal);
+
+/* Set the 'cleanup' flag in the landingpad instruction */
+void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
+
 /* Arithmetic */
 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);

Modified: llvm/branches/exception-handling-rewrite/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/lib/VMCore/Core.cpp?rev=136073&r1=136072&r2=136073&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/lib/VMCore/Core.cpp (original)
+++ llvm/branches/exception-handling-rewrite/lib/VMCore/Core.cpp Tue Jul 26 05:30:49 2011
@@ -1683,6 +1683,13 @@
                                       Name));
 }
 
+LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
+                                 LLVMValueRef PersFn, unsigned NumClauses,
+                                 const char *Name) {
+  return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), unwrap(PersFn),
+                                          NumClauses, Name));
+}
+
 LLVMValueRef LLVMBuildUnwind(LLVMBuilderRef B) {
   return wrap(unwrap(B)->CreateUnwind());
 }
@@ -1704,6 +1711,17 @@
   unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
 }
 
+void LLVMAddClause(LLVMValueRef LandingPad, LLVMLandingPadClauseTy ClauseTy,
+                   LLVMValueRef ClauseVal) {
+  unwrap<LandingPadInst>(LandingPad)->
+    addClause(static_cast<LandingPadInst::ClauseType>(ClauseTy),
+              unwrap(ClauseVal));
+}
+
+void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val) {
+  unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);
+}
+
 /*--.. Arithmetic ..........................................................--*/
 
 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,





More information about the llvm-branch-commits mailing list