<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sorry about that, missed a free after adding handlers in the echo test.<br class=""><br class="">Re-submitting in <a href="https://reviews.llvm.org/D45100" class="">D45100</a><br class=""><br class="">~Robert Widmann <br class=""><br class=""><blockquote type="cite" class="">On Mar 30, 2018, at 2:47 AM, Vlad Tsyrklevich <<a href="mailto:vlad@tsyrklevich.net" class="">vlad@tsyrklevich.net</a>> wrote:<br class=""><br class="">I reverted this change in r328858.<br class=""><br class="">On Thu, Mar 29, 2018 at 2:23 PM Vlad Tsyrklevich <<a href="mailto:vlad@tsyrklevich.net" class="">vlad@tsyrklevich.net</a>> wrote:<br class="">Hi, the http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap bot has been failing since this change was committed.<br class=""><br class="">On Wed, Mar 28, 2018 at 8:46 PM Robert Widmann via llvm-commits <llvm-commits@lists.llvm.org> wrote:<br class="">Author: codafi<br class="">Date: Wed Mar 28 20:43:15 2018<br class="">New Revision: 328759<br class=""><br class="">URL: http://llvm.org/viewvc/llvm-project?rev=328759&view=rev<br class="">Log:<br class="">[LLVM-C] Finish exception instruction bindings<br class=""><br class="">Summary:<br class="">Add support for cleanupret, catchret, catchpad, cleanuppad and catchswitch and their associated accessors.<br class=""><br class="">Test is modified from SimplifyCFG because it contains many diverse usages of these instructions.<br class=""><br class="">Reviewers: whitequark, deadalnix, echristo<br class=""><br class="">Reviewed By: echristo<br class=""><br class="">Subscribers: llvm-commits, harlanhaskins<br class=""><br class="">Differential Revision: https://reviews.llvm.org/D44496<br class=""><br class="">Modified:<br class=""> llvm/trunk/include/llvm-c/Core.h<br class=""> llvm/trunk/lib/IR/Core.cpp<br class=""> llvm/trunk/test/Bindings/llvm-c/echo.ll<br class=""> llvm/trunk/tools/llvm-c-test/echo.cpp<br class=""><br class="">Modified: llvm/trunk/include/llvm-c/Core.h<br class="">URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=328759&r1=328758&r2=328759&view=diff<br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm-c/Core.h (original)<br class="">+++ llvm/trunk/include/llvm-c/Core.h Wed Mar 28 20:43:15 2018<br class="">@@ -2555,11 +2555,12 @@ LLVMValueRef LLVMInstructionClone(LLVMVa<br class=""> /**<br class=""> * Obtain the argument count for a call instruction.<br class=""> *<br class="">- * This expects an LLVMValueRef that corresponds to a llvm::CallInst or<br class="">- * llvm::InvokeInst.<br class="">+ * This expects an LLVMValueRef that corresponds to a llvm::CallInst,<br class="">+ * llvm::InvokeInst, or llvm:FuncletPadInst.<br class=""> *<br class=""> * @see llvm::CallInst::getNumArgOperands()<br class=""> * @see llvm::InvokeInst::getNumArgOperands()<br class="">+ * @see llvm::FuncletPadInst::getNumArgOperands()<br class=""> */<br class=""> unsigned LLVMGetNumArgOperands(LLVMValueRef Instr);<br class=""><br class="">@@ -2644,9 +2645,12 @@ LLVMBasicBlockRef LLVMGetNormalDest(LLVM<br class=""> /**<br class=""> * Return the unwind destination basic block.<br class=""> *<br class="">- * This only works on llvm::InvokeInst instructions.<br class="">+ * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and<br class="">+ * llvm::CatchSwitchInst instructions.<br class=""> *<br class=""> * @see llvm::InvokeInst::getUnwindDest()<br class="">+ * @see llvm::CleanupReturnInst::getUnwindDest()<br class="">+ * @see llvm::CatchSwitchInst::getUnwindDest()<br class=""> */<br class=""> LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef InvokeInst);<br class=""><br class="">@@ -2662,9 +2666,12 @@ void LLVMSetNormalDest(LLVMValueRef Invo<br class=""> /**<br class=""> * Set the unwind destination basic block.<br class=""> *<br class="">- * This only works on llvm::InvokeInst instructions.<br class="">+ * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and<br class="">+ * llvm::CatchSwitchInst instructions.<br class=""> *<br class=""> * @see llvm::InvokeInst::setUnwindDest()<br class="">+ * @see llvm::CleanupReturnInst::setUnwindDest()<br class="">+ * @see llvm::CatchSwitchInst::setUnwindDest()<br class=""> */<br class=""> void LLVMSetUnwindDest(LLVMValueRef InvokeInst, LLVMBasicBlockRef B);<br class=""><br class="">@@ -2893,11 +2900,26 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilder<br class=""> LLVMValueRef *Args, unsigned NumArgs,<br class=""> LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,<br class=""> const char *Name);<br class="">+LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);<br class="">+<br class="">+/* Exception Handling */<br class="">+LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);<br class=""> LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,<br class=""> LLVMValueRef PersFn, unsigned NumClauses,<br class=""> const char *Name);<br class="">-LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);<br class="">-LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);<br class="">+LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad,<br class="">+ LLVMBasicBlockRef BB);<br class="">+LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad,<br class="">+ LLVMBasicBlockRef BB);<br class="">+LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMValueRef *Args, unsigned NumArgs,<br class="">+ const char *Name);<br class="">+LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMValueRef *Args, unsigned NumArgs,<br class="">+ const char *Name);<br class="">+LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMBasicBlockRef UnwindBB,<br class="">+ unsigned NumHandlers, const char *Name);<br class=""><br class=""> /* Add a case to the switch instruction */<br class=""> void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,<br class="">@@ -2921,6 +2943,51 @@ LLVMBool LLVMIsCleanup(LLVMValueRef Land<br class=""> /* Set the 'cleanup' flag in the landingpad instruction */<br class=""> void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);<br class=""><br class="">+/* Add a destination to the catchswitch instruction */<br class="">+void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest);<br class="">+<br class="">+/* Get the number of handlers on the catchswitch instruction */<br class="">+unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch);<br class="">+<br class="">+/**<br class="">+ * Obtain the basic blocks acting as handlers for a catchswitch instruction.<br class="">+ *<br class="">+ * The Handlers parameter should point to a pre-allocated array of<br class="">+ * LLVMBasicBlockRefs at least LLVMGetNumHandlers() large. On return, the<br class="">+ * first LLVMGetNumHandlers() entries in the array will be populated<br class="">+ * with LLVMBasicBlockRef instances.<br class="">+ *<br class="">+ * @param CatchSwitch The catchswitch instruction to operate on.<br class="">+ * @param Handlers Memory address of an array to be filled with basic blocks.<br class="">+ */<br class="">+void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers);<br class="">+<br class="">+/* Funclets */<br class="">+<br class="">+/* Get the number of funcletpad arguments. */<br class="">+LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i);<br class="">+<br class="">+/* Set a funcletpad argument at the given index. */<br class="">+void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value);<br class="">+<br class="">+/**<br class="">+ * Get the parent catchswitch instruction of a catchpad instruction.<br class="">+ *<br class="">+ * This only works on llvm::CatchPadInst instructions.<br class="">+ *<br class="">+ * @see llvm::CatchPadInst::getCatchSwitch()<br class="">+ */<br class="">+LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad);<br class="">+<br class="">+/**<br class="">+ * Set the parent catchswitch instruction of a catchpad instruction.<br class="">+ *<br class="">+ * This only works on llvm::CatchPadInst instructions.<br class="">+ *<br class="">+ * @see llvm::CatchPadInst::setCatchSwitch()<br class="">+ */<br class="">+void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch);<br class="">+<br class=""> /* Arithmetic */<br class=""> LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,<br class=""> const char *Name);<br class=""><br class="">Modified: llvm/trunk/lib/IR/Core.cpp<br class="">URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=328759&r1=328758&r2=328759&view=diff<br class="">==============================================================================<br class="">--- llvm/trunk/lib/IR/Core.cpp (original)<br class="">+++ llvm/trunk/lib/IR/Core.cpp Wed Mar 28 20:43:15 2018<br class="">@@ -2196,12 +2196,15 @@ LLVMValueRef LLVMInstructionClone(LLVMVa<br class=""> return nullptr;<br class=""> }<br class=""><br class="">-/*--.. Call and invoke instructions ........................................--*/<br class="">-<br class=""> unsigned LLVMGetNumArgOperands(LLVMValueRef Instr) {<br class="">+ if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) {<br class="">+ return FPI->getNumArgOperands();<br class="">+ }<br class=""> return CallSite(unwrap<Instruction>(Instr)).getNumArgOperands();<br class=""> }<br class=""><br class="">+/*--.. Call and invoke instructions ........................................--*/<br class="">+<br class=""> unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {<br class=""> return CallSite(unwrap<Instruction>(Instr)).getCallingConv();<br class=""> }<br class="">@@ -2284,6 +2287,11 @@ LLVMBasicBlockRef LLVMGetNormalDest(LLVM<br class=""> }<br class=""><br class=""> LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke) {<br class="">+ if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {<br class="">+ return wrap(CRI->getUnwindDest());<br class="">+ } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {<br class="">+ return wrap(CSI->getUnwindDest());<br class="">+ }<br class=""> return wrap(unwrap<InvokeInst>(Invoke)->getUnwindDest());<br class=""> }<br class=""><br class="">@@ -2292,6 +2300,11 @@ void LLVMSetNormalDest(LLVMValueRef Invo<br class=""> }<br class=""><br class=""> void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B) {<br class="">+ if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(unwrap(Invoke))) {<br class="">+ return CRI->setUnwindDest(unwrap(B));<br class="">+ } else if (CatchSwitchInst *CSI = dyn_cast<CatchSwitchInst>(unwrap(Invoke))) {<br class="">+ return CSI->setUnwindDest(unwrap(B));<br class="">+ }<br class=""> unwrap<InvokeInst>(Invoke)->setUnwindDest(unwrap(B));<br class=""> }<br class=""><br class="">@@ -2513,10 +2526,53 @@ LLVMValueRef LLVMBuildLandingPad(LLVMBui<br class=""> return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));<br class=""> }<br class=""><br class="">+LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMValueRef *Args, unsigned NumArgs,<br class="">+ const char *Name) {<br class="">+ return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),<br class="">+ makeArrayRef(unwrap(Args), NumArgs),<br class="">+ Name));<br class="">+}<br class="">+<br class="">+LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMValueRef *Args, unsigned NumArgs,<br class="">+ const char *Name) {<br class="">+ if (ParentPad == nullptr) {<br class="">+ Type *Ty = Type::getTokenTy(unwrap(B)->getContext());<br class="">+ ParentPad = wrap(Constant::getNullValue(Ty));<br class="">+ }<br class="">+ return wrap(unwrap(B)->CreateCleanupPad(unwrap(ParentPad),<br class="">+ makeArrayRef(unwrap(Args), NumArgs),<br class="">+ Name));<br class="">+}<br class="">+<br class=""> LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn) {<br class=""> return wrap(unwrap(B)->CreateResume(unwrap(Exn)));<br class=""> }<br class=""><br class="">+LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad,<br class="">+ LLVMBasicBlockRef UnwindBB,<br class="">+ unsigned NumHandlers, const char *Name) {<br class="">+ if (ParentPad == nullptr) {<br class="">+ Type *Ty = Type::getTokenTy(unwrap(B)->getContext());<br class="">+ ParentPad = wrap(Constant::getNullValue(Ty));<br class="">+ }<br class="">+ return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(UnwindBB),<br class="">+ NumHandlers, Name));<br class="">+}<br class="">+<br class="">+LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad,<br class="">+ LLVMBasicBlockRef BB) {<br class="">+ return wrap(unwrap(B)->CreateCatchRet(unwrap<CatchPadInst>(CatchPad),<br class="">+ unwrap(BB)));<br class="">+}<br class="">+<br class="">+LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad,<br class="">+ LLVMBasicBlockRef BB) {<br class="">+ return wrap(unwrap(B)->CreateCleanupRet(unwrap<CleanupPadInst>(CatchPad),<br class="">+ unwrap(BB)));<br class="">+}<br class="">+<br class=""> LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B) {<br class=""> return wrap(unwrap(B)->CreateUnreachable());<br class=""> }<br class="">@@ -2551,6 +2607,40 @@ void LLVMSetCleanup(LLVMValueRef Landing<br class=""> unwrap<LandingPadInst>(LandingPad)->setCleanup(Val);<br class=""> }<br class=""><br class="">+void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest) {<br class="">+ unwrap<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Dest));<br class="">+}<br class="">+<br class="">+unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {<br class="">+ return unwrap<CatchSwitchInst>(CatchSwitch)->getNumHandlers();<br class="">+}<br class="">+<br class="">+void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {<br class="">+ CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);<br class="">+ for (CatchSwitchInst::handler_iterator I = CSI->handler_begin(),<br class="">+ E = CSI->handler_end(); I != E; ++I)<br class="">+ *Handlers++ = wrap(*I);<br class="">+}<br class="">+<br class="">+LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad) {<br class="">+ return wrap(unwrap<CatchPadInst>(CatchPad)->getCatchSwitch());<br class="">+}<br class="">+<br class="">+void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch) {<br class="">+ unwrap<CatchPadInst>(CatchPad)<br class="">+ ->setCatchSwitch(unwrap<CatchSwitchInst>(CatchSwitch));<br class="">+}<br class="">+<br class="">+/*--.. Funclets ...........................................................--*/<br class="">+<br class="">+LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i) {<br class="">+ return wrap(unwrap<FuncletPadInst>(Funclet)->getArgOperand(i));<br class="">+}<br class="">+<br class="">+void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value) {<br class="">+ unwrap<FuncletPadInst>(Funclet)->setArgOperand(i, unwrap(value));<br class="">+}<br class="">+<br class=""> /*--.. Arithmetic ..........................................................--*/<br class=""><br class=""> LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,<br class=""><br class="">Modified: llvm/trunk/test/Bindings/llvm-c/echo.ll<br class="">URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/llvm-c/echo.ll?rev=328759&r1=328758&r2=328759&view=diff<br class="">==============================================================================<br class="">--- llvm/trunk/test/Bindings/llvm-c/echo.ll (original)<br class="">+++ llvm/trunk/test/Bindings/llvm-c/echo.ll Wed Mar 28 20:43:15 2018<br class="">@@ -122,3 +122,38 @@ do:<br class=""> done:<br class=""> ret i32 %p<br class=""> }<br class="">+<br class="">+declare void @personalityFn()<br class="">+<br class="">+define void @exn() personality void ()* @personalityFn {<br class="">+entry:<br class="">+ invoke void @decl()<br class="">+ to label %via.cleanup unwind label %exn.dispatch<br class="">+via.cleanup:<br class="">+ invoke void @decl()<br class="">+ to label %via.catchswitch unwind label %cleanup.inner<br class="">+cleanup.inner:<br class="">+ %cp.inner = cleanuppad within none []<br class="">+ cleanupret from %cp.inner unwind label %exn.dispatch<br class="">+via.catchswitch:<br class="">+ invoke void @decl()<br class="">+ to label %exit unwind label %dispatch.inner<br class="">+dispatch.inner:<br class="">+ %cs.inner = catchswitch within none [label %pad.inner] unwind label %exn.dispatch<br class="">+pad.inner:<br class="">+ %catch.inner = catchpad within %cs.inner [i32 0]<br class="">+ catchret from %catch.inner to label %exit<br class="">+exn.dispatch:<br class="">+ %cs = catchswitch within none [label %pad1, label %pad2] unwind label %cleanup<br class="">+pad1:<br class="">+ catchpad within %cs [i32 1]<br class="">+ unreachable<br class="">+pad2:<br class="">+ catchpad within %cs [i32 2]<br class="">+ unreachable<br class="">+cleanup:<br class="">+ %cp = cleanuppad within none []<br class="">+ cleanupret from %cp unwind to caller<br class="">+exit:<br class="">+ ret void<br class="">+}<br class=""><br class="">Modified: llvm/trunk/tools/llvm-c-test/echo.cpp<br class="">URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/echo.cpp?rev=328759&r1=328758&r2=328759&view=diff<br class="">==============================================================================<br class="">--- llvm/trunk/tools/llvm-c-test/echo.cpp (original)<br class="">+++ llvm/trunk/tools/llvm-c-test/echo.cpp Wed Mar 28 20:43:15 2018<br class="">@@ -146,8 +146,8 @@ struct TypeCloner {<br class=""> return LLVMMetadataTypeInContext(Ctx);<br class=""> case LLVMX86_MMXTypeKind:<br class=""> return LLVMX86MMXTypeInContext(Ctx);<br class="">- default:<br class="">- break;<br class="">+ case LLVMTokenTypeKind:<br class="">+ return LLVMTokenTypeInContext(Ctx);<br class=""> }<br class=""><br class=""> fprintf(stderr, "%d is not a supported typekind\n", Kind);<br class="">@@ -311,6 +311,13 @@ static LLVMValueRef clone_constant_impl(<br class=""> return LLVMGetUndef(TypeCloner(M).Clone(Cst));<br class=""> }<br class=""><br class="">+ // Try null<br class="">+ if (LLVMIsNull(Cst)) {<br class="">+ check_value_kind(Cst, LLVMConstantTokenNoneValueKind);<br class="">+ LLVMTypeRef Ty = TypeCloner(M).Clone(Cst);<br class="">+ return LLVMConstNull(Ty);<br class="">+ }<br class="">+<br class=""> // Try float literal<br class=""> if (LLVMIsAConstantFP(Cst)) {<br class=""> check_value_kind(Cst, LLVMConstantFPValueKind);<br class="">@@ -631,6 +638,57 @@ struct FunCloner {<br class=""> LLVMSetCleanup(Dst, LLVMIsCleanup(Src));<br class=""> break;<br class=""> }<br class="">+ case LLVMCleanupRet: {<br class="">+ LLVMValueRef CatchPad = CloneValue(LLVMGetOperand(Src, 0));<br class="">+ LLVMBasicBlockRef Unwind = nullptr;<br class="">+ if (LLVMBasicBlockRef UDest = LLVMGetUnwindDest(Src))<br class="">+ Unwind = DeclareBB(UDest);<br class="">+ Dst = LLVMBuildCleanupRet(Builder, CatchPad, Unwind);<br class="">+ break;<br class="">+ }<br class="">+ case LLVMCatchRet: {<br class="">+ LLVMValueRef CatchPad = CloneValue(LLVMGetOperand(Src, 0));<br class="">+ LLVMBasicBlockRef SuccBB = DeclareBB(LLVMGetSuccessor(Src, 0));<br class="">+ Dst = LLVMBuildCatchRet(Builder, CatchPad, SuccBB);<br class="">+ break;<br class="">+ }<br class="">+ case LLVMCatchPad: {<br class="">+ LLVMValueRef ParentPad = CloneValue(LLVMGetParentCatchSwitch(Src));<br class="">+ SmallVector<LLVMValueRef, 8> Args;<br class="">+ int ArgCount = LLVMGetNumArgOperands(Src);<br class="">+ for (int i = 0; i < ArgCount; i++)<br class="">+ Args.push_back(CloneValue(LLVMGetOperand(Src, i)));<br class="">+ Dst = LLVMBuildCatchPad(Builder, ParentPad,<br class="">+ Args.data(), ArgCount, Name);<br class="">+ break;<br class="">+ }<br class="">+ case LLVMCleanupPad: {<br class="">+ LLVMValueRef ParentPad = CloneValue(LLVMGetOperand(Src, 0));<br class="">+ SmallVector<LLVMValueRef, 8> Args;<br class="">+ int ArgCount = LLVMGetNumArgOperands(Src);<br class="">+ for (int i = 0; i < ArgCount; i++)<br class="">+ Args.push_back(CloneValue(LLVMGetArgOperand(Src, i)));<br class="">+ Dst = LLVMBuildCleanupPad(Builder, ParentPad,<br class="">+ Args.data(), ArgCount, Name);<br class="">+ break;<br class="">+ }<br class="">+ case LLVMCatchSwitch: {<br class="">+ LLVMValueRef ParentPad = CloneValue(LLVMGetOperand(Src, 0));<br class="">+ LLVMBasicBlockRef UnwindBB = nullptr;<br class="">+ if (LLVMBasicBlockRef UDest = LLVMGetUnwindDest(Src)) {<br class="">+ UnwindBB = DeclareBB(UDest);<br class="">+ }<br class="">+ unsigned NumHandlers = LLVMGetNumHandlers(Src);<br class="">+ Dst = LLVMBuildCatchSwitch(Builder, ParentPad, UnwindBB, NumHandlers, Name);<br class="">+ if (NumHandlers > 0) {<br class="">+ LLVMBasicBlockRef *Handlers = static_cast<LLVMBasicBlockRef*>(<br class="">+ safe_malloc(NumHandlers * sizeof(LLVMBasicBlockRef)));<br class="">+ LLVMGetHandlers(Src, Handlers);<br class="">+ for (unsigned i = 0; i < NumHandlers; i++)<br class="">+ LLVMAddHandler(Dst, DeclareBB(Handlers[i]));<br class="">+ }<br class="">+ break;<br class="">+ }<br class=""> case LLVMExtractValue: {<br class=""> LLVMValueRef Agg = CloneValue(LLVMGetOperand(Src, 0));<br class=""> if (LLVMGetNumIndices(Src) != 1)<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class="">llvm-commits@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></blockquote><br class=""></body></html>