summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/WinEHPrepare.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Style updatesAndrew Kaylor2015-04-281-18/+19
| | | | llvm-svn: 236048
* [WinEH] Split blocks at calls to llvm.eh.begincatchAndrew Kaylor2015-04-281-26/+90
| | | | | | Differential Revision: http://reviews.llvm.org/D9311 llvm-svn: 236046
* Fix build error from accidental changeAndrew Kaylor2015-04-241-2/+1
| | | | llvm-svn: 235792
* [WinEH] Find correct cloned entry block for outlined handler functions.Andrew Kaylor2015-04-241-1/+2
| | | | llvm-svn: 235791
* [WinEH] Find correct cloned entry block for outlined handler functions.Andrew Kaylor2015-04-241-4/+13
| | | | llvm-svn: 235789
* Remove an unused variable to prevent -Werror build failures.Kaelyn Takata2015-04-241-1/+0
| | | | llvm-svn: 235773
* [SEH] Implement GetExceptionCode in __except blocksReid Kleckner2015-04-241-6/+54
| | | | | | | | | This introduces an intrinsic called llvm.eh.exceptioncode. It is lowered by copying the EAX value live into whatever basic block it is called from. Obviously, this only works if you insert it late during codegen, because otherwise mid-level passes might reschedule it. llvm-svn: 235768
* [WinEH] Split the landingpad BB instead of cloning itReid Kleckner2015-04-241-21/+9
| | | | | | | This means we don't have to RAUW the landingpad instruction and landingpad BB, which is a nice win. llvm-svn: 235725
* Re-commit "[SEH] Remove the old __C_specific_handler code now that ↵Reid Kleckner2015-04-231-15/+0
| | | | | | | | | | WinEHPrepare works" This reverts commit r235617. r235649 should have addressed the problems. llvm-svn: 235667
* [WinEH] Ignore filter clauses while mapping landing pad blocks.Andrew Kaylor2015-04-231-0/+6
| | | | llvm-svn: 235656
* Remove trivial assert to fix NDEBUG Werror buildsReid Kleckner2015-04-231-2/+0
| | | | llvm-svn: 235652
* [WinEH] Replace more lpad value uses with undefReid Kleckner2015-04-231-9/+20
| | | | | | | | | | | | | | | | | | | | | We were asserting on code like this: extern "C" unsigned long _exception_code(); void might_crash(unsigned long); void foo() { __try { might_crash(0); } __except(1) { might_crash(_exception_code()); } } Gtest and many other libraries get the exception code from the __except block. What's supposed to happen here is that EAX is live into the __except block, and it contains the exception code. Eventually we'll represent that as a use of the landingpad ehptr value, but for now we can replace it with undef. llvm-svn: 235649
* [WinEH] Handle stubs for outlined functions that have only unreached ↵Andrew Kaylor2015-04-231-9/+16
| | | | | | terminators. llvm-svn: 235618
* Revert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare ↵Reid Kleckner2015-04-231-0/+15
| | | | | | | | | | works" We still have some "uses remain after removal" issues in -O0 builds. This reverts commit r235557. llvm-svn: 235617
* [WinEH] Don't skip landing pads that end with an unreachable instruction.Andrew Kaylor2015-04-231-6/+4
| | | | llvm-svn: 235563
* [SEH] Remove the old __C_specific_handler code now that WinEHPrepare worksReid Kleckner2015-04-221-15/+0
| | | | | | | | | | This removes the -sehprepare flag and makes __C_specific_handler functions always to use WinEHPrepare. This was tested by building all of chromium_builder_tests and running a few tests that use SEH, but if something breaks, we can revert this. llvm-svn: 235557
* [WinEH] Demote values and phis live across exception handlers up frontReid Kleckner2015-04-221-68/+277
| | | | | | | | | | | | | | | | | | In particular, this handles SSA values that are live *out* of a handler. The existing code only handles values that are live *in* to a handler. It also handles phi nodes in the block where normal control should resume after the end of a catch handler. When EH return points have phi nodes, we need to split the return edge. It is impossible for phi elimination to emit copies in the previous block if that block gets outlined. The indirectbr that we leave in the function is only notional, and is eliminated from the MachineFunction CFG early on. Reviewers: majnemer, andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D9158 llvm-svn: 235545
* [WinEH] Correctly handle inlined __finally blocks with capturesReid Kleckner2015-04-221-6/+33
| | | | | | | | We should also teach the inliner to collapse framerecover of frameaddress of the current frame down to an alloca, but that can happen later. llvm-svn: 235459
* [WinEH] Fix problem with landing pad return values used in PHI nodes during ↵Andrew Kaylor2015-04-201-0/+4
| | | | | | outlining. llvm-svn: 235358
* [WinEH] Fix problem with mapping shared empty handler blocks.Andrew Kaylor2015-04-201-2/+38
| | | | | | Differential Revision: http://reviews.llvm.org/D9125 llvm-svn: 235354
* [WinEH] Fix memory leak with catch-all mapping.Andrew Kaylor2015-04-201-5/+12
| | | | llvm-svn: 235328
* Fix build wanrings and line endingsAndrew Kaylor2015-04-171-1/+0
| | | | llvm-svn: 235241
* [WinEH] Fixes for a few cppeh failures.Andrew Kaylor2015-04-171-13/+82
| | | | | | Differential Review: http://reviews.llvm.org/D9065 llvm-svn: 235239
* Revert r235154-r235156, they cause asserts when building win64 code ↵Nico Weber2015-04-171-0/+15
| | | | | | (http://crbug.com/477988) llvm-svn: 235170
* [SEH] Reimplement x64 SEH using WinEHPrepareReid Kleckner2015-04-171-15/+0
| | | | | | | | | | | | | | | | This now emits simple, unoptimized xdata tables for __C_specific_handler based on the handlers listed in @llvm.eh.actions calls produced by WinEHPrepare. This adds support for running __finally blocks when exceptions are thrown, and removes the old landingpad fan-in codepath. I ran some manual execution tests on small basic test cases with and without optimization, as well as on Chrome base_unittests, which uses a small amount of SEH. I'm sure there are bugs, and we may need to revert. llvm-svn: 235154
* [WinEH] Handle a landingpad, resume, and cleanup all rolled into a BBReid Kleckner2015-04-161-6/+4
| | | | | | This happens a lot with simple cleanups after SimplifyCFG. llvm-svn: 235117
* [SEH] Deal with users of the old lpad for SEH catch-all blocksReid Kleckner2015-04-161-0/+9
| | | | | | | | | | | The way we split SEH catch-all blocks can leave some dead EH values behind at -O0. Try to remove them, and if we fail, replace them all with undef. Fixes a crash when removing the old unreachable landingpad which is still used by extractvalue instructions in the catch-all block. llvm-svn: 235061
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-1/+1
| | | | | | No functionality change. llvm-svn: 234963
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-2/+2
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* [WinEH] Recognize SEH finally block inserted by the frontendReid Kleckner2015-04-101-63/+118
| | | | | | | | | | | This allows winehprepare to build sensible llvm.eh.actions calls for SEH finally blocks. The pattern matching in this change is brittle and should be replaced with something more robust soon. In the meantime, this will let us write the code that produces __C_specific_handler xdata tables, which we need regardless of how we decide to get finally blocks through EH preparation. llvm-svn: 234663
* [WinEH] Try to make outlining invokes work a little betterReid Kleckner2015-04-101-1/+4
| | | | | | | | WinEH currently turns invokes into calls. Long term, we will reconsider this, but for now, make sure we remap the operands and clone the successors of the new terminator. llvm-svn: 234608
* Formmatting correctionAndrew Kaylor2015-04-081-1/+2
| | | | llvm-svn: 234438
* [WinEH] Minor bug fixes.Andrew Kaylor2015-04-081-2/+3
| | | | | | | Fixed insert point for allocas created for demoted values. Clear the nested landing pad list after it has been processed. llvm-svn: 234433
* [WinEH] Add invoke of llvm.donothing to outlined catch and cleanup handlers ↵Andrew Kaylor2015-04-071-14/+65
| | | | | | | | to identify their personality. Differential Review: http://reviews.llvm.org/D8835 llvm-svn: 234360
* [WinEH] Don't sink allocas into child handlersReid Kleckner2015-04-061-11/+3
| | | | | | | | | | The uselist isn't enough to infer anything about the lifetime of such allocas. If we want to re-add this optimization, we will need to leverage lifetime markers to do it. Fixes PR23122. llvm-svn: 234196
* [WinEH] Fill out .xdata for catch objectsDavid Majnemer2015-04-031-4/+4
| | | | | | | This add support for catching an exception such that an exception object available to the catch handler will be initialized by the runtime. llvm-svn: 234062
* [WinEH] Sink UnwindHelp completely out of IRDavid Majnemer2015-04-031-14/+0
| | | | | | | | We don't need to represent UnwindHelp in IR. Instead, we can use the knowledge that we are emitting the parent function to decide if we should create the UnwindHelp stack object. llvm-svn: 234061
* Fixing a memory leak in WinEHPrepareAndrew Kaylor2015-04-031-0/+2
| | | | llvm-svn: 234059
* Fixing a build errorAndrew Kaylor2015-04-031-1/+1
| | | | llvm-svn: 234045
* Fixing build warnings.Andrew Kaylor2015-04-031-2/+0
| | | | llvm-svn: 234043
* [WinEH] Handle nested landing pads in outlined catch handlersAndrew Kaylor2015-04-031-27/+247
| | | | | | Differential Revision: http://reviews.llvm.org/D8596 llvm-svn: 234041
* [WinEH] Fold cast into assertion based on review feedbackReid Kleckner2015-04-031-3/+2
| | | | llvm-svn: 234034
* Fix unused variable in NDEBUG buildsReid Kleckner2015-04-021-0/+1
| | | | llvm-svn: 233978
* [WinEH] Make llvm.eh.actions use frameescape indices for catch paramsReid Kleckner2015-04-021-9/+44
| | | | | | | | | | | | | | | | | | This makes it possible to use the same representation of llvm.eh.actions in outlined handlers as we use in the parent function because i32's are just constants that can be copied freely between functions. I had to add a sentinel alloca to the list of child allocas so that we don't try to sink the catch object into the handler. Normally, one would use nullptr for this kind of thing, but TinyPtrVector doesn't support null elements. More than that, it's elements have to have a suitable alignment. Therefore, I settled on this for my sentinel: AllocaInst *getCatchObjectSentinel() { return static_cast<AllocaInst *>(nullptr) + 1; } llvm-svn: 233947
* Fix WinEHPrepare bug with multiple catch handlersAndrew Kaylor2015-04-011-179/+126
| | | | | | Differential Revision: http://reviews.llvm.org/D8682 llvm-svn: 233824
* [WinEH] Generate .xdata for catch handlersDavid Majnemer2015-03-311-10/+0
| | | | | | | | | | | | | | This lets us catch exceptions in simple cases. N.B. Things that do not work include (but are not limited to): - Throwing from within a catch handler. - Catching an object with a named catch parameter. - 'CatchHigh' is fictitious, we aren't sure of its purpose. - We aren't entirely efficient with regards to the number of EH states that we generate. - IP-to-State tables are sensitive to the order of emission. llvm-svn: 233767
* [WinEH] Run cleanup handlers when an exception is thrownDavid Majnemer2015-03-301-67/+9
| | | | | | | | Generate tables in the .xdata section representing what actions to take when an exception is thrown. This currently fills in state for cleanups, catch handlers are still unfinished. llvm-svn: 233636
* Fixing a bug with optimized catch-all handlers in WinEHPrepareAndrew Kaylor2015-03-271-5/+14
| | | | llvm-svn: 233439
* WinEH: Create a parent frame alloca for HandlerType xdata tablesDavid Majnemer2015-03-271-0/+10
| | | | | | | | We don't have any logic to emit those tables yet, so the SDAG lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233354
* WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tablesReid Kleckner2015-03-251-0/+13
| | | | | | | | We don't have any logic to emit those tables yet, so the sdag lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233209
OpenPOWER on IntegriCloud