summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WinEH
Commit message (Collapse)AuthorAgeFilesLines
...
* [WinEH] Teach AsmPrinter about funcletsDavid Majnemer2015-09-291-0/+3
| | | | | | | | | | | Summary: Funclets have been turned into functions by the time they hit the object file. Make sure that they have decent names for the symbol table and CFI directives explaining how to reason about their prologues. Differential Revision: http://reviews.llvm.org/D13261 llvm-svn: 248824
* [EH] Create removeUnwindEdge utilityJoseph Tremoulet2015-09-271-0/+31
| | | | | | | | | | | | | | | | | Summary: Factor the code that rewrites invokes to calls and rewrites WinEH terminators to their "unwind to caller" equivalents into a helper in Utils/Local, and use it in the three places I'm aware of that need to do this. Reviewers: andrew.w.kaylor, majnemer, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13152 llvm-svn: 248677
* [WinEH] Rip out the landingpad-based C++ EH state numbering codeReid Kleckner2015-09-165-978/+0
| | | | | | It never really worked, and the new code is working better every day. llvm-svn: 247860
* [WinEHPrepare] Turn terminatepad into a cleanuppad + call + cleanupretDavid Majnemer2015-09-161-0/+18
| | | | | | | | The MSVC doesn't really support exception specifications so let's just turn these into cleanuppads. Later, we might use terminatepad to more efficiently encode the "noexcept"-ness of a function body. llvm-svn: 247848
* [WinEH] Pull Adjectives and CatchObj out of the catchpad arg listReid Kleckner2015-09-161-2/+2
| | | | | | | | | | Clang now passes the adjectives as an argument to catchpad. Getting the CatchObj working is simply a matter of threading another static alloca through codegen, first as an alloca, then as a frame index, and finally as a frame offset. llvm-svn: 247844
* [WinEHPrepare] Provide a cloning mode which doesn't demoteDavid Majnemer2015-09-161-0/+87
| | | | | | | | | | | We are experimenting with a new approach to saving and restoring SSA values used across funclets: let the register allocator do the dirty work for us. However, this means that we need to be able to clone commoned blocks without relying on demotion. llvm-svn: 247835
* [WinEH] Skip state numbering when no EH pads are presentReid Kleckner2015-09-161-0/+8
| | | | | | | | | Otherwise we'd try to emit the thunk that passes the LSDA to __CxxFrameHandler3. We don't emit the LSDA if there were no landingpads, so we'd end up with an assembler error when trying to write the COFF object. llvm-svn: 247820
* [IR] Print the label operands of a catchpad like an invokeReid Kleckner2015-09-111-3/+6
| | | | | | | | | | | | | The rest of the EH pads are fine, since they have at most one label and take fewer operands for the personality. Old catchpad vs. new: %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0@0@main@@" to i8*)] to label %__except.ret.10 unwind label %catchendblock.9 ----- %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0@0@main@@" to i8*)] to label %__except.ret.10 unwind label %catchendblock.9 llvm-svn: 247433
* [WinEH] Fix single-block cleanup coloringJoseph Tremoulet2015-09-101-9/+45
| | | | | | | | | | | | | | | | | | Summary: The coloring code in WinEHPrepare queues cleanuprets' successors with the correct color (the parent one) when it sees their cleanuppad, and so later when iterating successors knows to skip processing cleanuprets since they've already been queued. This latter check was incorrectly under an 'else' condition and so inadvertently was not kicking in for single-block cleanups. This change sinks the check out of the 'else' to fix the bug. Reviewers: majnemer, andrew.w.kaylor, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12751 llvm-svn: 247299
* [WinEH] Add llvm.eh.exceptionpointer intrinsicJoseph Tremoulet2015-09-032-0/+72
| | | | | | | | | | | | | | | | | Summary: This intrinsic can be used to extract a pointer to the exception caught by a given catchpad. Its argument has token type and must be a `catchpad`. Also clarify ExtendingLLVM documentation regarding overloaded intrinsics. Reviewers: majnemer, andrew.w.kaylor, sanjoy, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12533 llvm-svn: 246752
* Fix CHECK directives that weren't checking.Hans Wennborg2015-08-311-2/+2
| | | | llvm-svn: 246485
* [WinEH] Update coloring to handle nested cases cleanlyJoseph Tremoulet2015-08-281-0/+384
| | | | | | | | | | | | | | | | | | | | | | | Summary: Change the coloring algorithm in WinEHPrepare to visit a funclet's exits in its parents' contexts and so properly classify the continuations of nested funclets. Also change the placement of cloned blocks to be deterministic and to maintain the relative order of each funclet's blocks. Add a lit test showing various patterns that require cloning, the last several of which don't have CHECKs yet because they require cloning entire funclets which is NYI. Reviewers: rnk, andrew.w.kaylor, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12353 llvm-svn: 246245
* [WinEH] Require token linkage in EH pad/ret signaturesJoseph Tremoulet2015-08-232-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: WinEHPrepare is going to require that cleanuppad and catchpad produce values of token type which are consumed by any cleanupret or catchret exiting the pad. This change updates the signatures of those operators to require/enforce that the type produced by the pads is token type and that the rets have an appropriate argument. The catchpad argument of a `CatchReturnInst` must be a `CatchPadInst` (and similarly for `CleanupReturnInst`/`CleanupPadInst`). To accommodate that restriction, this change adds a notion of an operator constraint to both LLParser and BitcodeReader, allowing appropriate sentinels to be constructed for forward references and appropriate error messages to be emitted for illegal inputs. Also add a verifier rule (noted in LangRef) that a catchpad with a catchpad predecessor must have no other predecessors; this ensures that WinEHPrepare will see the expected linear relationship between sibling catches on the same try. Lastly, remove some superfluous/vestigial casts from instruction operand setters operating on BasicBlocks. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12108 llvm-svn: 245797
* [WinEH] Calculate state numbers for the new EH representationDavid Majnemer2015-08-181-0/+96
| | | | | | | | | | | State numbers are calculated by performing a walk from the innermost funclet to the outermost funclet. Rudimentary support for the new EH constructs has been added to the assembly printer, just enough to test the new machinery. Differential Revision: http://reviews.llvm.org/D12098 llvm-svn: 245331
* [WinEHPrepare] Replace unreasonable funclet terminators with unreachableDavid Majnemer2015-08-171-34/+63
| | | | | | | | | | It is possible to be in a situation where more than one funclet token is a valid SSA value. If we see a terminator which exits a funclet which doesn't use the funclet's token, replace it with unreachable. Differential Revision: http://reviews.llvm.org/D12074 llvm-svn: 245238
* [WinEHPrepare] Fix catchret successor phi demotionJoseph Tremoulet2015-08-171-0/+86
| | | | | | | | | | | | | | | | | | | | Summary: When demoting an SSA value that has a use on a phi and one of the phi's predecessors terminates with catchret, the edge needs to be split and the load inserted in the new block, else we'll still have a cross-funclet SSA value. Add a test for this, and for the similar case where a def to be spilled is on and invoke and a critical edge, which was already implemented but missing a test. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12065 llvm-svn: 245218
* [IR] Give catchret an optional 'return value' operandDavid Majnemer2015-08-151-8/+8
| | | | | | | | | | | Some personality routines require funclet exit points to be clearly marked, this is done by producing a token at the funclet pad and consuming it at the corresponding ret instruction. CleanupReturnInst already had a spot for this operand but CatchReturnInst did not. Other personality routines don't need to use this which is why it has been made optional. llvm-svn: 245149
* Add a target environment for CoreCLR.Pat Gavlin2015-08-146-9/+11
| | | | | | | | | | Although targeting CoreCLR is similar to targeting MSVC, there are certain important differences that the backend must be aware of (e.g. differences in stack probes, EH, and library calls). Differential Revision: http://reviews.llvm.org/D11012 llvm-svn: 245115
* [WinEHPrepare] Update demotion logicJoseph Tremoulet2015-08-131-0/+296
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Update the demotion logic in WinEHPrepare to avoid creating new cleanups by walking predecessors as necessary to insert stores for EH-pad PHIs. Also avoid creating stores for EH-pad PHIs that have no uses. The store/load placement is still pretty naive. Likely future improvements (at least for optimized compiles) include: - Share loads for related uses as possible - Coalesce non-interfering use/def-related PHIs - Store at definition point rather than each PHI pred for non-interfering lifetimes. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11955 llvm-svn: 244894
* [WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk nameReid Kleckner2015-07-131-50/+71
| | | | | | Add another C++ 32-bit EH table test. llvm-svn: 242044
* [SEH] Push reloads of the SEH code past phi nodesReid Kleckner2015-07-101-0/+91
| | | | | | | | | | | This in turn would sometimes introduce new cleanupblocks that didn't previously exist. The uses were being introduced by SSA value demotion. We actually want to *promote* uses of EH pointers and selectors, so I added some spcecial casing to avoid demoting such instructions. This is getting overly complicated, but hopefully we'll come along and delete it in the new representation. llvm-svn: 241950
* [WinEH] Make sure LSDA tables are 4 byte alignedReid Kleckner2015-07-103-0/+4
| | | | | | | | | | Apparently this is important, otherwise _except_handler3 assumes that the registration node is corrupted and ignores it. Also fix a bug in WinEHPrepare where we would insert code after a terminator instruction. llvm-svn: 241877
* [SEH] Ensure that empty __except blocks have their own BBReid Kleckner2015-07-081-0/+32
| | | | | | | | | The 32-bit lowering assumed that WinEHPrepare had this invariant. WinEHPrepare did it for C++, but not SEH. The result was that we would insert calls to llvm.x86.seh.restoreframe in normal basic blocks, which corrupted the frame pointer. llvm-svn: 241699
* [WinEH] Add localaddress intrinsic instead of using frameaddressReid Kleckner2015-07-072-8/+8
| | | | | | | Clang uses this for SEH finally. The new intrinsic will produce the right value when stack realignment is required. llvm-svn: 241643
* Rename llvm.frameescape and llvm.framerecover to localescape and localrecoverReid Kleckner2015-07-0723-87/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Initially, these intrinsics seemed like part of a family of "frame" related intrinsics, but now I think that's more confusing than helpful. Initially, the LangRef specified that this would create a new kind of allocation that would be allocated at a fixed offset from the frame pointer (EBP/RBP). We ended up dropping that design, and leaving the stack frame layout alone. These intrinsics are really about sharing local stack allocations, not frame pointers. I intend to go further and add an `llvm.localaddress()` intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being used to address locals, which should not be confused with the frame pointer. Naming suggestions at this point are welcome, I'm happy to re-run sed. Reviewers: majnemer, nicholas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11011 llvm-svn: 241633
* [WinEH] Add some test cases I forgot to add to previous commitsReid Kleckner2015-07-062-0/+258
| | | | llvm-svn: 241510
* [WinEH] Insert the EH code load before the block terminatorReid Kleckner2015-07-061-0/+66
| | | | | | | The previous code put the load after the terminator, leading to invalid IR and downstream crashes. This caused http://crbug.com/506446. llvm-svn: 241509
* [Verifier] Verify invokes of intrinsicsPhilip Reames2015-06-261-2/+2
| | | | | | | | | | We support invoking a subset of llvm's intrinsics, but the verifier didn't account for this. We had previously added a special case to verify invokes of statepoints. By generalizing the code in terms of CallSite, we can verify invokes of other intrinsics as well. Interestingly, this found one test case which was invalid. Note: I'm deliberately leaving the naming change from CI to CS to a follow up change. That will happen shortly, I just wanted to reduce the diff to make it clear what was happening with this one. Differential Revision: http://reviews.llvm.org/D10118 llvm-svn: 240836
* Move the personality function from LandingPadInst to FunctionDavid Majnemer2015-06-1730-149/+149
| | | | | | | | | | | | | | | | | | | The personality routine currently lives in the LandingPadInst. This isn't desirable because: - All LandingPadInsts in the same function must have the same personality routine. This means that each LandingPadInst beyond the first has an operand which produces no additional information. - There is ongoing work to introduce EH IR constructs other than LandingPadInst. Moving the personality routine off of any one particular Instruction and onto the parent function seems a lot better than have N different places a personality function can sneak onto an exceptional function. Differential Revision: http://reviews.llvm.org/D10429 llvm-svn: 239940
* [WinEH] C++ EH state numbering fixesAndrew Kaylor2015-05-206-61/+58
| | | | | | Differential Revision: http://reviews.llvm.org/D9787 llvm-svn: 237854
* Changed renaming of local symbols by inserting a dot vefore the numeric suffix.Sunil Srivastava2015-05-126-29/+29
| | | | | | | One code change and several test changes to match that details in http://reviews.llvm.org/D9481 llvm-svn: 237150
* [WinEH] Handle nested landing pads that return directly to the parent function.Andrew Kaylor2015-05-115-5/+219
| | | | | | Differential Revision: http://reviews.llvm.org/D9684 llvm-svn: 237063
* [WinEH] Update exception numbering to give handlers their own base state.Andrew Kaylor2015-05-114-3/+300
| | | | | | Differential Revision: http://reviews.llvm.org/D9512 llvm-svn: 237014
* Flip r236172 testcase RUN option ordering for BSD sed(1). NFC.Ahmed Bougacha2015-04-301-1/+1
| | | | llvm-svn: 236186
* [WinEH] Start EH preparation for 32-bit x86, it uses no argumentsReid Kleckner2015-04-293-10/+14
| | | | | | | | | | | | | | | | | | 32-bit x86 MSVC-style exceptions are functionaly similar to 64-bit, but they take no arguments. Instead, they implicitly use the value of EBP passed in by the caller as a pointer to the parent's frame. In LLVM, we can represent this as llvm.frameaddress(1), and feed that into all of our calls to llvm.framerecover. The next steps are: - Add an alloca to the fs:00 linked list of handlers - Add something like llvm.sjlj.lsda or generalize it to store in the alloca - Move state number calculation to WinEHPrepare, arrange for FunctionLoweringInfo to call it - Use the state numbers to insert explicit loads and stores in the IR llvm-svn: 236172
* [WinEH] Split blocks at calls to llvm.eh.begincatchAndrew Kaylor2015-04-285-10/+116
| | | | | | Differential Revision: http://reviews.llvm.org/D9311 llvm-svn: 236046
* [SEH] Implement GetExceptionCode in __except blocksReid Kleckner2015-04-241-3/+2
| | | | | | | | | 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
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-04-242-8/+8
| | | | | | | | | | the invoke instruction Same as r235145 for the call instruction - the justification, tradeoffs, etc are all the same. The conversion script worked the same without any false negatives (after replacing 'call' with 'invoke'). llvm-svn: 235755
* [WinEH] Split the landingpad BB instead of cloning itReid Kleckner2015-04-246-8/+8
| | | | | | | 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-236-6/+6
| | | | | | | | | | WinEHPrepare works" This reverts commit r235617. r235649 should have addressed the problems. llvm-svn: 235667
* [WinEH] Replace more lpad value uses with undefReid Kleckner2015-04-231-0/+67
| | | | | | | | | | | | | | | | | | | | | 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
* Revert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare ↵Reid Kleckner2015-04-235-5/+5
| | | | | | | | | | 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-232-0/+2
| | | | llvm-svn: 235563
* [SEH] Remove the old __C_specific_handler code now that WinEHPrepare worksReid Kleckner2015-04-225-5/+5
| | | | | | | | | | 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-225-62/+190
| | | | | | | | | | | | | | | | | | 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-0/+48
| | | | | | | | 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
* Re-land r235154-r235156 under the existing -sehprepare flagReid Kleckner2015-04-211-0/+83
| | | | | | | | Keep the old SEH fan-in lowering on by default for now, since projects rely on it. This will make it easy to test this change with a simple flag flip. llvm-svn: 235399
* [WinEH] Fix problem with mapping shared empty handler blocks.Andrew Kaylor2015-04-201-0/+110
| | | | | | Differential Revision: http://reviews.llvm.org/D9125 llvm-svn: 235354
* Fixing line endingsAndrew Kaylor2015-04-201-14/+14
| | | | llvm-svn: 235342
* [WinEH] Fixes for a few cppeh failures.Andrew Kaylor2015-04-172-0/+537
| | | | | | Differential Review: http://reviews.llvm.org/D9065 llvm-svn: 235239
OpenPOWER on IntegriCloud