summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/WinEHPrepare.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* [winehprepare] Update and sort includes. NFC.Benjamin Kramer2015-03-231-1/+2
| | | | llvm-svn: 232994
* Fixing a bug with WinEH PHI handlingAndrew Kaylor2015-03-201-1/+19
| | | | llvm-svn: 232851
* WinEH: Make llvm.eh.actions emission match the EH docsReid Kleckner2015-03-191-8/+5
| | | | | | | | | This switches the sense of the i32 values and updates the test cases. We can also use CHECK-SAME to clean up some tests, and reduce the visual noise from bitcasts. llvm-svn: 232774
* Use WinEHPrepare to outline SEH finally blocksReid Kleckner2015-03-181-41/+109
| | | | | | | | | | | No outlining is necessary for SEH catch blocks. Use the blockaddr of the handler in place of the usual outlined function. Reviewers: majnemer, andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D8370 llvm-svn: 232664
* Make llvm.eh.actions an intrinsic and add docs for itReid Kleckner2015-03-121-5/+3
| | | | | | | | These docs *don't* match the way WinEHPrepare uses them yet, and verifier support isn't implemented either. The implementation will come after the documentation text is reviewed and agreed upon. llvm-svn: 232003
* Stop calling DwarfEHPrepare from WinEHPrepareReid Kleckner2015-03-121-39/+8
| | | | | | | | Instead, run both EH preparation passes, and have them both ignore functions with unrecognized EH personalities. Pass delegation involved some hacky code for creating an AnalysisResolver that we don't need now. llvm-svn: 231995
* Fix some clang warnings in WinEHPrepareReid Kleckner2015-03-111-3/+2
| | | | llvm-svn: 231985
* Extended support for native Windows C++ EH outliningAndrew Kaylor2015-03-111-139/+857
| | | | | | Differential Review: http://reviews.llvm.org/D7886 llvm-svn: 231981
* DataLayout is mandatory, update the API to reflect it with references.Mehdi Amini2015-03-101-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that the DataLayout is a mandatory part of the module, let's start cleaning the codebase. This patch is a first attempt at doing that. This patch is not exactly NFC as for instance some places were passing a nullptr instead of the DataLayout, possibly just because there was a default value on the DataLayout argument to many functions in the API. Even though it is not purely NFC, there is no change in the validation. I turned as many pointer to DataLayout to references, this helped figuring out all the places where a nullptr could come up. I had initially a local version of this patch broken into over 30 independant, commits but some later commit were cleaning the API and touching part of the code modified in the previous commits, so it seemed cleaner without the intermediate state. Test Plan: Reviewers: echristo Subscribers: llvm-commits From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231740
* Reland r229944: EH: Prune unreachable resume instructions during Dwarf EH ↵Reid Kleckner2015-03-091-3/+25
| | | | | | | | | | | | preparation Fix the double-deletion of AnalysisResolver when delegating through to Dwarf EH preparation by creating one from scratch. Hopefully the new pass manager simplifies this. This reverts commit r229952. llvm-svn: 231719
* Fix uninitialized memory references in WinEHPrepareAndrew Kaylor2015-03-051-1/+3
| | | | llvm-svn: 231405
* Replace llvm.frameallocate with llvm.frameescapeReid Kleckner2015-03-051-159/+54
| | | | | | | | | | Turns out it's pretty straightforward and simplifies the implementation. Reviewers: andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D8051 llvm-svn: 231386
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: DataLayout keeps the string used for its creation. As a side effect it is no longer needed in the Module. This is "almost" NFC, the string is no longer canonicalized, you can't rely on two "equals" DataLayout having the same string returned by getStringRepresentation(). Get rid of DataLayoutPass: the DataLayout is in the Module The DataLayout is "per-module", let's enforce this by not duplicating it more than necessary. One more step toward non-optionality of the DataLayout in the module. Make DataLayout Non-Optional in the Module Module->getDataLayout() will never returns nullptr anymore. Reviewers: echristo Subscribers: resistor, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D7992 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231270
* WinEH: Remove vestigial EH objectReid Kleckner2015-03-031-43/+13
| | | | | | | | Ultimately, we'll need to leave something behind to indicate which alloca will hold the exception, but we can figure that out when it comes time to emit the __CxxFrameHandler3 catch handler table. llvm-svn: 231164
* Fixing problem with field initialization orderAndrew Kaylor2015-03-031-2/+2
| | | | llvm-svn: 231122
* Outline cleanup handlers for native Windows C++ exception handlingAndrew Kaylor2015-03-031-97/+251
| | | | | | Differential Revision: http://reviews.llvm.org/D7865 llvm-svn: 231117
* Remap arguments and non-alloca values used by outlined C++ exception handlers.Andrew Kaylor2015-03-031-40/+76
| | | | | | Differential Revision: http://reviews.llvm.org/D7844 llvm-svn: 231042
* Fixing a problem with insert location in WinEH outliningAndrew Kaylor2015-02-251-0/+1
| | | | llvm-svn: 230535
* Fixing eol-styleAndrew Kaylor2015-02-241-625/+625
| | | | llvm-svn: 230378
* Removing unused private field.Andrew Kaylor2015-02-231-3/+1
| | | | llvm-svn: 230259
* Second attempt to fix WinEHCatchDirector build failures.Andrew Kaylor2015-02-231-1/+0
| | | | llvm-svn: 230257
* Attempting to fix WinEHCatchDirector destructor related build failures.Andrew Kaylor2015-02-231-0/+1
| | | | llvm-svn: 230252
* Remap frame variables for native Windows exception handling.Andrew Kaylor2015-02-231-390/+627
| | | | | | Differential Revision: http://reviews.llvm.org/D7770 llvm-svn: 230249
* Revert r229944: EH: Prune unreachable resume instructions during Dwarf EH ↵Chandler Carruth2015-02-201-12/+3
| | | | | | | | | preparation This doesn't pass 'ninja check-llvm' for me. Lots of tests, including the ones updated, fail with crashes and other explosions. llvm-svn: 229952
* EH: Prune unreachable resume instructions during Dwarf EH preparationReid Kleckner2015-02-201-3/+12
| | | | | | | | | | | | | | | | | Today a simple function that only catches exceptions and doesn't run destructor cleanups ends up containing a dead call to _Unwind_Resume (PR20300). We can't remove these dead resume instructions during normal optimization because inlining might introduce additional landingpads that do have cleanups to run. Instead we can do this during EH preparation, which is guaranteed to run after inlining. Fixes PR20300. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D7744 llvm-svn: 229944
OpenPOWER on IntegriCloud