[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-31 Thread Heejin Ahn via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL333703: [WebAssembly] Use Windows EH instructions for Wasm EH (authored by aheejin, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D44931 Files:

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-29 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added a comment. Oh no, sorry, it actually depends on https://reviews.llvm.org/D43746; but not others on the chain. I changed the signatures of `wasm.get.exception` and `wasm.get.ehselector` intrinsics to take a token argument, and the intrinsic signature change is added in

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-29 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added a comment. Thanks! No, it does not depend on the other CL chain on the llvm side. Repository: rC Clang https://reviews.llvm.org/D44931 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-29 Thread Derek Schuff via Phabricator via cfe-commits
dschuff accepted this revision. dschuff added a comment. This revision is now accepted and ready to land. LGTM assuming we are convinced for now that finding the rethrow block from the CatchSwitch will work. Does this need to wait until after https://reviews.llvm.org/D43746 or other CLs from

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-20 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added inline comments. Comment at: lib/CodeGen/CGException.cpp:1241-1245 +while (llvm::TerminatorInst *TI = RethrowBlock->getTerminator()) { + llvm::BranchInst *BI = cast(TI); + assert(BI->isConditional()); + RethrowBlock = BI->getSuccessor(1); +}

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-20 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments. Comment at: lib/CodeGen/CGException.cpp:1173 +cast(CatchStartBlock->getFirstNonPHI()); +CurrentFuncletPad = CPI; + } aheejin wrote: > majnemer wrote: > > Hmm, why is this done? Won't RestoreCurrentFuncletPad undo

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-19 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 147696. aheejin added a comment. Test case fix was missing in the last commit Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h lib/CodeGen/CGException.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-19 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 147695. aheejin added a comment. - Make `wasm.get.exception/selector` intrinsics take a token argument Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-17 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added inline comments. Comment at: lib/CodeGen/CGException.cpp:1241-1245 +while (llvm::TerminatorInst *TI = RethrowBlock->getTerminator()) { + llvm::BranchInst *BI = cast(TI); + assert(BI->isConditional()); + RethrowBlock = BI->getSuccessor(1); +}

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-17 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added a comment. Thank you for the reviews! Comment at: lib/CodeGen/CGException.cpp:1173 +cast(CatchStartBlock->getFirstNonPHI()); +CurrentFuncletPad = CPI; + } majnemer wrote: > Hmm, why is this done? Won't RestoreCurrentFuncletPad undo

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-17 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 147287. aheejin marked an inline comment as done. aheejin added a comment. `CatchStartBlock` -> `WasmCatchStartBlock` Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-16 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments. Comment at: lib/CodeGen/CGException.cpp:1164 + CurrentFuncletPad); + llvm::BasicBlock *CatchStartBlock = nullptr; + if (EHPersonality::get(*this).isWasmPersonality()) { Maybe this should be called WasmCatchStartBlock?

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-05-10 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 146076. aheejin added a comment. - getMSVCDispatchBlock -> getFuncletEHDispatchBlock Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h lib/CodeGen/CGException.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-04-11 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 141983. aheejin added a comment. - Rebase Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h lib/CodeGen/CGException.cpp lib/CodeGen/ItaniumCXXABI.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-04-11 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 141979. aheejin added a comment. - Change personality function name to a unique one Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h lib/CodeGen/CGException.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-04-09 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 141759. aheejin added a comment. - Add a test in which try-catches are nested within a catch - Rebase Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added inline comments. Comment at: lib/CodeGen/CGException.cpp:1541 + } llvm::CallInst *terminateCall = + CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn); aheejin wrote: > dschuff wrote: > > Should this be in an else block? No

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 140156. aheejin marked an inline comment as done. aheejin added a comment. - GNU_CPlusCPlus -> GNU_CPlusPlus Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added inline comments. Comment at: lib/CodeGen/CGException.cpp:1541 + } llvm::CallInst *terminateCall = + CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn); dschuff wrote: > Should this be in an else block? No need to emit it after

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added a comment. Otherwise it looks good to me, although @majnemer would know more about the subtleties of what IR actually gets generated. Comment at: lib/CodeGen/CGCleanup.h:630 static const EHPersonality MSVC_CxxFrameHandler3; + static const EHPersonality

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 140144. aheejin marked an inline comment as done. aheejin added a comment. - Rebase & Simplified the if condition Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-28 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added inline comments. Comment at: lib/CodeGen/CGCXXABI.h:610 +struct CatchRetScope final : EHScopeStack::Cleanup { + llvm::CatchPadInst *CPI; dschuff wrote: > Should be `public`? This code was moved from [[

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-27 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added inline comments. Comment at: lib/CodeGen/CGCXXABI.h:610 +struct CatchRetScope final : EHScopeStack::Cleanup { + llvm::CatchPadInst *CPI; Should be `public`? Comment at: lib/CodeGen/CGCleanup.h:630 static const EHPersonality

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-27 Thread David Majnemer via Phabricator via cfe-commits
majnemer added a comment. Some quick first pass comments. Comment at: lib/CodeGen/CGCleanup.cpp:985 +// does not have a runtime support for that. +if (!Personality.usesFuncletPads() || Personality.isWasmPersonality()) { + EHStack.pushTerminate();

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-27 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin updated this revision to Diff 139920. aheejin added a comment. - Comment fix Repository: rC Clang https://reviews.llvm.org/D44931 Files: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGCleanup.h lib/CodeGen/CGException.cpp lib/CodeGen/ItaniumCXXABI.cpp

[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

2018-03-27 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin created this revision. aheejin added reviewers: majnemer, dschuff. Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100, jfb. Because wasm control flow needs to be structured, using WinEH instructions to support wasm EH brings several benefits. This patch makes wasm EH