History log of /external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e36b47e17be0e3289890f33fe8aaecfc231d83a0 08-Mar-2013 Bill Wendling <isanbard@gmail.com> Revert r176154 in favor of a better approach.

Code generation makes some basic assumptions about the IR it's been given. In
particular, if there is only one 'invoke' in the function, then that invoke
won't be going away. However, with the advent of the `llvm.donothing' intrinsic,
those invokes may go away. If all of them go away, the landing pad no longer has
any users. This confuses the back-end, which asserts.

This happens with SjLj exceptions, because that's the model that modifies the IR
based on there being invokes, etc. in the function.

Remove any invokes of `llvm.donothing' during SjLj EH preparation. This will
give us a CFG that the back-end won't be confused about. If all of the invokes
in a function are removed, then the SjLj EH prepare pass won't insert the bogus
code the relies upon the invokes being there.
<rdar://problem/13228754&13316637>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
69e42dbd006c0afb732067ece7327988b1e24c01 11-Jan-2013 Benjamin Kramer <benny.kra@googlemail.com> Split TargetLowering into a CodeGen and a SelectionDAG part.

This fixes some of the cycles between libCodeGen and libSelectionDAG. It's still
a complete mess but as long as the edges consist of virtual call it doesn't
cause breakage. BasicTTI did static calls and thus broke some build
configurations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
3574eca1b02600bac4e625297f4ecf745f4c4f32 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f68b87f5fc1985c897e7a84ee040bcfff75b4959 03-Sep-2012 Benjamin Kramer <benny.kra@googlemail.com> IRBuilderify the SjlLjEHPrepare pass.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
06cb8ed00696eb14d1b831921452e50ec0568ea2 29-Jun-2012 Chandler Carruth <chandlerc@gmail.com> Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h

This was always part of the VMCore library out of necessity -- it deals
entirely in the IR. The .cpp file in fact was already part of the VMCore
library. This is just a mechanical move.

I've tried to go through and re-apply the coding standard's preferred
header sort, but at 40-ish files, I may have gotten some wrong. Please
let me know if so.

I'll be committing the corresponding updates to Clang and Polly, and
Duncan has DragonEgg.

Thanks to Bill and Eric for giving the green light for this bit of cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
bace5da91dbfc15d04c0e9897805ed4c5c0461ad 16-Mar-2012 Chad Rosier <mcrosier@apple.com> Revert r152705, which reapplied r152486 as this appears to be causing failures
on our internal nightly testers. So, basically revert r152486 again.

Abbreviated original commit message:
Implement a more intelligent way of spilling uses across an invoke boundary.

It looks as if Chander's inlining work, r152737, exposed an issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
30442f95573d7e0f505c573bd7462b77769010fa 14-Mar-2012 Bill Wendling <isanbard@gmail.com> Reapply r152486 with a fix for the nightly testers.

There were cases where a value could be used and it's both crossing an invoke
and NOT crossing an invoke. This could happen in the landing pads. In that case,
we will demote the value to the stack like we did before.
<rdar://problem/10609139>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
eabae1d07bffac60d9f4f2473cf6736d6a1c372d 13-Mar-2012 Bill Wendling <isanbard@gmail.com> s/SjLjEHPass/SjLjEHPrepare/
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
9eb5f170a219decc4ee07b57b0403d3836a8d946 12-Mar-2012 Bill Wendling <isanbard@gmail.com> Revert due to nightly test failures.

--- Reverse-merging r152486 into '.':
U lib/CodeGen/SjLjEHPrepare.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
fbf9ff462134a635eb0fc3bc86c70cc59fb065d1 10-Mar-2012 Bill Wendling <isanbard@gmail.com> Implement a more intelligent way of spilling uses across an invoke boundary.

The old way of determine when and where to spill a value that was used inside of
a landing pad resulted in spilling that value everywhere and not just at the
invoke edge.

This algorithm determines which values are used within a landing pad. It then
spills those values before the invoke and reloads them before the uses. This
should prevent excessive spilling in many cases, e.g. inside of loops.
<rdar://problem/10609139>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
4cc4666268c6c62de763c46fefe304adf08a01a1 27-Jan-2012 Bill Wendling <isanbard@gmail.com> Place the GEP instructions nearer to the instructions which use them.

GEP instructions are there for the compiler and shouldn't really output much
code (if any at all). When a GEP is stored in the entry block, Fast ISel (for
one) will not know that it could fold it into further uses. For instance, inside
of the EH handling code. This results in a lot of unnecessary spills and loads
which bloat code and slows down pretty much everything.
<rdar://problem/10694814>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
9c7b3da04ab39646e6d6687c309153410dafb916 07-Jan-2012 Andrew Trick <atrick@apple.com> Missing raw_ostream.h breaks MSVC build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
b937b76045d4442165009c8e6276c7c8df9efa78 06-Jan-2012 Andrew Trick <atrick@apple.com> Tracing to help investigate issues with SjLj spill code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
69fdcd7f902256d6deec8f085f5bb12bd39f762e 14-Dec-2011 Bill Wendling <isanbard@gmail.com> Reapply r146481 with a fix to create the Builder value in the correct place and
with the correct iterator.
<rdar://problem/10530851>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
dbdc616ed5eb1c92d75465333b0d96b0185f8c8f 14-Dec-2011 Bill Wendling <isanbard@gmail.com> Revert r146481 to review possible miscompilations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
4762f7525162ddcd3a527677ed8a2d53856f21d9 13-Dec-2011 Bill Wendling <isanbard@gmail.com> Avoid using the 'insertvalue' instruction here.

Fast ISel isn't able to handle 'insertvalue' and it causes a large slowdown
during -O0 compilation. We don't necessarily need to generate an aggregate of
the values here if they're just going to be extracted directly afterwards.
<rdar://problem/10530851>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f1b41dd38d2b2713e3870f384525b020bbac05f6 16-Nov-2011 Bob Wilson <bob.wilson@apple.com> Record landing pads with a SmallSetVector to avoid multiple entries.

There may be many invokes that share one landing pad, and the previous code
would record the landing pad once for each invoke. Besides the wasted
effort, a pair of volatile loads gets inserted every time the landing pad is
processed. The rest of the code can get optimized away when a landing pad
is processed repeatedly, but the volatile loads remain, resulting in code like:

LBB35_18:
Ltmp483:
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r2, [r7, #-72]
ldr r2, [r7, #-68]
ldr r4, [r7, #-72]
ldr r2, [r7, #-68]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
20c918dfed5830f6d0c54c9c38817bd660cb6a13 16-Nov-2011 Bob Wilson <bob.wilson@apple.com> Update the SP in the SjLj jmpbuf whenever it changes. <rdar://problem/10444602>

This same basic code was in the older version of the SjLj exception handling,
but it was removed in the recent revisions to that code. It needs to be there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
d2dae0cfa00ca3c5164b2543ed712ace6c08386b 24-Oct-2011 Bill Wendling <isanbard@gmail.com> Cleanup. Get rid of the old SjLj EH lowering code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
0ad56122e585d3d27ea852115390a9e53cabc9d5 22-Oct-2011 Bill Wendling <isanbard@gmail.com> Make sure that the landing pads themselves have no PHI instructions in them.

The assumption in the back-end is that PHIs are not allowed at the start of the
landing pad block for SjLj exceptions.
<rdar://problem/10313708>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
13a7121858238bc3490b27206a609bf8a2ce1f21 18-Oct-2011 Bill Wendling <isanbard@gmail.com> Now Igor, throw the switch...give my creation life!

Use the custom inserter for the ARM setjmp intrinsics. Instead of creating the
SjLj dispatch table in IR, where it frequently violates serveral assumptions --
in particular assumptions made by the landingpad instruction about what can
branch to a landing pad and what cannot. Performing this in the back-end allows
us to violate these assumptions without the IR getting angry at us.

It also allows us to perform a small optimization. We can shove the address of
the dispatch's basic block into the function context and not have to add code
around the setjmp to check for the return value and jump to the dispatch.

Neat, huh?
<rdar://problem/10116753>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
d5d170097241534401bbbebb4be59451d5c312ca 08-Oct-2011 Bill Wendling <isanbard@gmail.com> Use the code that lowers the arguments and spills any values which are alive
across unwind edges. This is for the back-end which expects such things.

The code is from the original SjLj EH pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
2130ab0131ca0c0f5607937fe1f6ed48c28d39a2 06-Oct-2011 Bill Wendling <isanbard@gmail.com> Fix comment to reflect the new EH stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
da7e6a9c8888fe9c4198214cc19f6f55e21e72e4 04-Oct-2011 Bill Wendling <isanbard@gmail.com> Generic cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141050 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f8520d564c095e3ee278090b605c4b827604c817 04-Oct-2011 Bill Wendling <isanbard@gmail.com> Don't carry over the dispatchsetup hack from the old system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
631d11765b9f7ebdb49679c92bd41083fbab3f62 03-Oct-2011 Bill Wendling <isanbard@gmail.com> Move the grabbing of the jump buffer into the caller function, eliminating the need for returning a std::pair.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
cc8cf97be434b4e2b9c0388db1bfb709f09098eb 28-Sep-2011 Bill Wendling <isanbard@gmail.com> Have the SjLjEHPrepare pass do some more heavy lifting.

Upon further review, most of the EH code should remain written at the IR
level. The part which breaks SSA form is the dispatch table, so that part will
be moved to the back-end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
eef108d5608c50742450a36ed6149e040b14a988 28-Sep-2011 Bill Wendling <isanbard@gmail.com> Bitcast the alloca to an i8* to match the intrinsic's signature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
6ef94175d1bbab95f195770bb3c559b3ab38c4e5 28-Sep-2011 Bill Wendling <isanbard@gmail.com> Create and use an llvm.eh.sjlj.functioncontext intrinsic.

This intrinsic is used to pass the index of the function context to the back-end
for further processing. The back-end is in charge of filling in the rest of the
entries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
2b6bd7ba5819d8c73c89291c6de89a86dbbffe9c 28-Sep-2011 Bill Wendling <isanbard@gmail.com> In the new EH model, setup the function context and the call site info.

The DWARF exception pass uses the call site information, which is set up here. A
pre-RA pass is too late for it to use this information. So create and setup the
function context here, and then insert the call site values here (and map the
call sites for the DWARF EH pass). This is simpler than the original pass, and
doesn't make the CFG lose its SSA-ness.

It's a win-win-win-win-lose-win-win situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
3669915c6dc8d57a4525fb0c592e6c8c1df098f5 12-Sep-2011 Bill Wendling <isanbard@gmail.com> Introduce a bit of a hack.

Splitting a landing pad takes considerable care because of PHIs and other
nasties. The problem is that the jump table needs to jump to the landing pad
block. However, the landing pad block can be jumped to only by an invoke
instruction. So we clone the landingpad instruction into its own basic block,
have the invoke jump to there. The landingpad instruction's basic block's
successor is now the target for the jump table.

But because of PHI nodes, we need to create another basic block for the jump
table to jump to. This is definitely a hack, because the values for the PHI
nodes may not be defined on the edge from the jump table. But that's okay,
because the jump table is simply a construct to mimic what is happening in the
CFG. So the values are mysteriously there, even though there is no value for the
PHI from the jump table's edge (hence calling this a hack).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
8557e6c0c17a94ac6655aa6b5f56a23709410081 27-Aug-2011 Bill Wendling <isanbard@gmail.com> These splits should be done whether they are critical edges or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
51fb91c04c920703fbd4a67ac3f85c0971b2c5a5 26-Aug-2011 Bill Wendling <isanbard@gmail.com> Split the landing pad block only if it's a critical edge. Also intelligently
split it in the other place where we're splitting critical edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
3ae96d69ef0695460eb3d046427d22dcda10d9f0 24-Aug-2011 Bill Wendling <isanbard@gmail.com> Add the sentinal "no handle" value to the ResumeInst.

A value of -1 at a call site tells the personality function that this call isn't
handled by the current function. Since the ResumeInsts are converted to calls to
_Unwind_SjLj_Resume, add a (volatile) store of -1 to its 'call site'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138416 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
fc8713ff74c2ed83d453057b24c578a0709fc180 24-Aug-2011 Bill Wendling <isanbard@gmail.com> Don't replace *all* uses with the new stuff.

This is not necessarily the first or dominating use of the EH values. The IR
breaks if it's not. So replace the specific value in the instruction with the
new value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
cfcccef926bd142c885dfa3f506bff933939350c 24-Aug-2011 Bill Wendling <isanbard@gmail.com> Look at the end of the entry block for an invoke.

The invoke could be at the end of the entry block. If it's the only one, then we
won't process all of the landingpad instructions correctly. This code is
currently ugly, but should be made much nicer once the new EH switch is thrown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
aef508dfc1d844bb3a4f7606f54bf4c616c10eff 23-Aug-2011 Bill Wendling <isanbard@gmail.com> Split the landing pad's edge. Then for all uses of a landingpad instruction's
value, we insert a load of the exception object and selector object from memory,
which is where it actually resides. If it's used by a PHI node, we follow that
to where it is being used. Eventually, all landingpad instructions should have
no uses. Any PHI nodes that were associated with those landingpads should be
removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
d36b3e36811e8b50476076ee4986068481916f66 22-Aug-2011 Bill Wendling <isanbard@gmail.com> Some whitespace fixes and #include reordering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
a9203109f4ac95aa7e9624f2838e3d89623ec902 25-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert GetElementPtrInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
5fdd6c8793462549e3593890ec61573da06e3346 12-Jul-2011 Jay Foad <jay.foad@gmail.com> Second attempt at de-constifying LLVM Types in FunctionType::get(),
StructType::get() and TargetData::getIntPtrType().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
2280ebd61416b73d0b6137f275b25af82e268d1f 12-Jul-2011 Bill Wendling <isanbard@gmail.com> Revert r134893 and r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\
ne 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134893 into '.':
U include/llvm/Target/TargetData.h
U include/llvm/DerivedTypes.h
U tools/bugpoint/ExtractFunction.cpp
U unittests/Support/TypeBuilderTest.cpp
U lib/Target/ARM/ARMGlobalMerge.cpp
U lib/Target/TargetData.cpp
U lib/VMCore/Constants.cpp
U lib/VMCore/Type.cpp
U lib/VMCore/Core.cpp
U lib/Transforms/Utils/CodeExtractor.cpp
U lib/Transforms/Instrumentation/ProfilingUtils.cpp
U lib/Transforms/IPO/DeadArgumentElimination.cpp
U lib/CodeGen/SjLjEHPrepare.cpp
--- Reverse-merging r134888 into '.':
G include/llvm/DerivedTypes.h
U include/llvm/Support/TypeBuilder.h
U include/llvm/Intrinsics.h
U unittests/Analysis/ScalarEvolutionTest.cpp
U unittests/ExecutionEngine/JIT/JITTest.cpp
U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
U unittests/VMCore/PassManagerTest.cpp
G unittests/Support/TypeBuilderTest.cpp
U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
U lib/VMCore/IRBuilder.cpp
G lib/VMCore/Type.cpp
U lib/VMCore/Function.cpp
G lib/VMCore/Core.cpp
U lib/VMCore/Module.cpp
U lib/AsmParser/LLParser.cpp
U lib/Transforms/Utils/CloneFunction.cpp
G lib/Transforms/Utils/CodeExtractor.cpp
U lib/Transforms/Utils/InlineFunction.cpp
U lib/Transforms/Instrumentation/GCOVProfiling.cpp
U lib/Transforms/Scalar/ObjCARC.cpp
U lib/Transforms/Scalar/SimplifyLibCalls.cpp
U lib/Transforms/Scalar/MemCpyOptimizer.cpp
G lib/Transforms/IPO/DeadArgumentElimination.cpp
U lib/Transforms/IPO/ArgumentPromotion.cpp
U lib/Transforms/InstCombine/InstCombineCompares.cpp
U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
U lib/Transforms/InstCombine/InstCombineCalls.cpp
U lib/CodeGen/DwarfEHPrepare.cpp
U lib/CodeGen/IntrinsicLowering.cpp
U lib/Bitcode/Reader/BitcodeReader.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
eeb64ae6e52ac2a7980884fe89c01508014af6a9 11-Jul-2011 Jay Foad <jay.foad@gmail.com> De-constify Types in StructType::get() and TargetData::getIntPtrType().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
b2318662b6d2e6d9ea9917fd280dde0ba9a938ad 19-Jun-2011 Chris Lattner <sabre@nondot.org> fix the varargs version of StructType::get to not require an LLVMContext, making usage
much cleaner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
61512ba251097888963a8f07a35605564bcfc537 11-May-2011 Bill Wendling <isanbard@gmail.com> Give the 'eh.sjlj.dispatchsetup' intrinsic call the value coming from the setjmp
intrinsic call. This prevents it from being reordered so that it appears
*before* the setjmp intrinsic (thus making it completely useless).
<rdar://problem/9409683>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
cc88595bce813464f4dc0c8351f7311bb233a3e2 11-Apr-2011 Bill Wendling <isanbard@gmail.com> The default of the dispatch switch statement was to branch to a BB that executed
the 'unwind' instruction. However, later on that instruction was converted into
a jump to the basic block it was located in, causing an infinite loop when we
get there.

It turns out, we get there if the _Unwind_Resume_or_Rethrow call returns (which
it's not supposed to do). It returns if it cannot find a place to unwind
to. Thus we would get what appears to be a "hang" when in reality it's just that
the EH couldn't be propagated further along.

Instead of infinitely looping (or calling `unwind', which none of our back-ends
support (it's lowered into nothing...)), call the @llvm.trap() intrinsic
instead. This may not conform to specific rules of a particular language, but
it's rather better than infinitely looping.

<rdar://problem/9175843&9233582>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f05b1dcf870346094f8aaee8e387c92d3e47e98d 05-Apr-2011 Bill Wendling <isanbard@gmail.com> Revamp the SjLj "dispatch setup" intrinsic.

It needed to be moved closer to the setjmp statement, because the code directly
after the setjmp needs to know about values that are on the stack. Also, the
'bitcast' of the function context was causing a dead load. This wouldn't be too
horrible, except that at -O0 it wasn't optimized out, and because it wasn't
using the correct base pointer (if there is a VLA), it would try to access a
value from a garbage address.
<rdar://problem/9130540>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
8d90b7190f9411e0e48d8a29705240f7679ae201 07-Jan-2011 Bill Wendling <isanbard@gmail.com> Early exit if we don't have invokes. The 'Unwinds' vector isn't modified unless
we have invokes, so there is no functionality change here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f788854d20b12c60fd8b43c587adb3227b6b1bff 06-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Prune includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
e4ad387a5a88dae20f0f7578e55170bbc8eee2a9 20-Oct-2010 Jim Grosbach <grosbach@apple.com> Add a pre-dispatch SjLj EH hook on the unwind edge for targets to do any
setup they require. Use this for ARM/Darwin to rematerialize the base
pointer from the frame pointer when required. rdar://8564268

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
90c579de5a383cee278acc3f7e7b9d0a656e6a35 06-Aug-2010 Owen Anderson <resistor@mac.com> Reapply r110396, with fixes to appease the Linux buildbot gods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
1f74590e9d1b9cf0f1f81a156efea73f76546e05 06-Aug-2010 Owen Anderson <resistor@mac.com> Revert r110396 to fix buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
9ccaf53ada99c63737547c0235baeb8454b04e80 06-Aug-2010 Owen Anderson <resistor@mac.com> Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier. Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
e70fc8ea6427934ee780db68d72aca07c629e0cd 01-Jul-2010 Jim Grosbach <grosbach@apple.com> Handle array and vector typed parameters in sjljehprepare like we do
structs. rdar://8145832

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
45c097fe43d565905041d2a9fc77567d2deca709 25-Jun-2010 Gabor Greif <ggreif@gmail.com> use ArgOperand API

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
956352eb4682ba7000486d8712a4435a843a48d4 16-Jun-2010 Jim Grosbach <grosbach@apple.com> add FIXME

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
288694f430bc227d12b74f84f7e26e64d3b7f56b 15-Jun-2010 Jim Grosbach <grosbach@apple.com> fix naming

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
2f3257ef04a40adfeb6440d1b02f7bbfee0dd4fc 01-Jun-2010 Jim Grosbach <grosbach@apple.com> Add a FIXME

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
dc58b25ebc4d6b79f36db09a0b718ca957a610eb 01-Jun-2010 Jim Grosbach <grosbach@apple.com> When processing function arguments when splitting live ranges across invokes,
handle structs passed by value via an extract/insert pair, as a bitcast
won't work on a struct. rdar://7742824

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
0798eddd07b8dc827a4e6e9028c4c3a8d9444286 28-May-2010 Jim Grosbach <grosbach@apple.com> Update the saved stack pointer in the sjlj function context following either
an alloca() or an llvm.stackrestore(). rdar://8031573



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
551754c4958086cc6910da7c950f2875e212f5cf 17-Apr-2010 Eric Christopher <echristo@apple.com> Revert 101465, it broke internal OpenGL testing.

Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
4ec2258ffb495d7ce00177e447740ef1123a27db 16-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
607a7ab3da72a2eb53553a520507cbb8068dd1d8 16-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101423 and r101397, they break llvm-gcc self-host on darwin10

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
2ff961f66816daab8bbc58a19025161d969821c2 15-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
9ee17208115482441953127615231c59a2f4d052 15-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101364, as it trips the linux nightlybot on some clang C++ tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
165dac08d1bb8428b32a5f39cdd3dbee2888987f 15-Apr-2010 Gabor Greif <ggreif@gmail.com> rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
b58a59b3c1563ab5bd7225748e32933bf6d76c03 04-Mar-2010 Jim Grosbach <grosbach@apple.com> For SJLJ exception handling, make sure that all calls that are not marked
as nounwind are marked with a -1 call-site value. This is necessary to, for
example, correctly process exceptions thrown from within an "unexpected"
execption handler (see SingleSource/Regression/C++/EH/expection_spec_test.cpp).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
ca752c9020a1b1cf151142bd9e0cbca9af12d807 28-Jan-2010 Jim Grosbach <grosbach@apple.com> Update of 94055 to track the IR level call site information via an intrinsic.
This allows code gen and the exception table writer to cooperate to make sure
landing pads are associated with the correct invoke locations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f38a33cd0aafff87a8f48debccb09971d2b82dd9 21-Jan-2010 Jim Grosbach <grosbach@apple.com> back this out for now. Growing Function is not good.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
d0a0c382ea51d36dc7e5938291763da73b4262dc 21-Jan-2010 Jim Grosbach <grosbach@apple.com> Make sure that landing pad entries in the EH call site table are in the proper
order for SjLj style exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
03825f8401f703ba59ae9ef20d9d4f4303b3d041 15-Jan-2010 Jim Grosbach <grosbach@apple.com> Fix 80 column violations and clean up whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
f5a86f45e75ec744c203270ffa03659eb0a220c1 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
6726b6d75a8b679068a58cb954ba97cf9d1690ba 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
b01bbdcc1af27bd90b552bb1b62b48916e0d4be3 14-Oct-2009 Duncan Sands <baldrick@free.fr> I don't see any point in having both eh.selector.i32 and eh.selector.i64,
so get rid of eh.selector.i64 and rename eh.selector.i32 to eh.selector.
Likewise for eh.typeid.for. This aligns us with gcc, which always uses a
32 bit value for the selector on all platforms. My understanding is that
the register allocator used to assert if the selector intrinsic size didn't
match the pointer size, and this was the reason for introducing the two
variants. However my testing shows that this is no longer the case (I
fixed some bugs in selector lowering yesterday, and some more today in the
fastisel path; these might have caused the original problems).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
ac53a0b272452013124bfc70480aea5e41b60f40 06-Oct-2009 Duncan Sands <baldrick@free.fr> Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type. For example, to get
an i8* use getInt8PtrTy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
0bb61c56bcad7a738d50f705b5966be446ef06c1 31-Aug-2009 Jim Grosbach <grosbach@apple.com> PR4747

Shared landing pads run into trouble with SJLJ, as the dispatch table is
mapped to call sites, and merging the pads will throw that off. There needs
to be a one-to-one mapping of landing pad exception table entries to invoke
call points.

Detecting the shared pad during lowering of SJLJ info insn't sufficient, as
the dispatch function may still need separate destinations to properly
handle phi-nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
a235d13217ff14621a88f3ea96a8a3b980c56d02 23-Aug-2009 Jim Grosbach <grosbach@apple.com> SJLJ pass needs to punt if there's no personality function available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
8fc3b6903ac555e21d6c64c34f9815781e68c88b 20-Aug-2009 Jim Grosbach <grosbach@apple.com> Check for shared landing pads when assigning call site values. Invokes which
share a landing pad should also use the same call site value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
606f3d696ff78211524fa49c3ca0c4de6db37041 17-Aug-2009 Jim Grosbach <grosbach@apple.com> cleanups per review. Mostly cosmetic, plus use SmallVector in place of std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
5d17eddb0cc07c13acbb38205778db7678a65065 17-Aug-2009 Daniel Dunbar <daniel@zuster.org> Fix build warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp
8b818d7e98309125c6058c4ea72a7dc73b031db2 17-Aug-2009 Jim Grosbach <grosbach@apple.com> Move the sjlj exception handling conversions to a back-end pass where they
more properly belong. This allows removing the front-end conditionalized
SJLJ code, and cleans up the generated IR considerably. All of the
infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc) is
added by the SjLjEHPrepare pass.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SjLjEHPrepare.cpp