Commit Graph
51 Commits
Author SHA1 Message Date
kai dbb5a34eda Add changes for LLVM 3.2. 2012-07-29 17:31:50 +02:00
Alexey Prokhin 629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
Robert Clipsham 2234264acf Merged klickverbot's off-by-one fixes for D optimisation passes. Thanks. 2011-01-05 23:39:32 +00:00
Kelly Wilson 11cbacf9da Fix for ticket #440 by klickverbot. Thx. 2011-01-02 00:42:10 -05:00
Alexey Prokhin 4d7a6eda23 Different fixes for d2 2010-10-07 22:35:32 +04:00
Moritz Warning c151d37365 fixes #434 :: add llvm 2.8 support 2010-10-23 13:38:26 +02:00
Tomas Lindquist Olsen 1fac40d2bd Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).

Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.

Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
2010-05-19 12:42:32 +02:00
Benjamin Kramer 8b6f11938a Kill off StripMetaData. 2009-08-25 21:35:43 +02:00
Benjamin Kramer c220dcac05 IntegerType is now contextifed.
Requires llvm >= 78969. resistor says this will be the last context API change :)
2009-08-14 00:39:18 +02:00
Benjamin Kramer 0a1d467ac7 getTrue/getFalse were moved back to ConstantInt
Requires LLVM >= r77685
2009-07-31 19:11:07 +02:00
Tomas Lindquist Olsen d5d3ecdb05 Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake. 2009-07-31 11:28:31 +02:00
Benjamin Kramer e34f07505b use the new NamedMDNode class
this will need a LLVM >= r77619
2009-07-30 20:54:03 +02:00
Benjamin Kramer 66101517d7 LLVMContext changes up to r77366 2009-07-30 15:25:10 +02:00
Benjamin Kramer 3f0a0686a8 Value::getNameStart and Value::getNameLength were removed 2009-07-23 20:34:35 +02:00
Benjamin Kramer 27a9f93767 DOUT is deprecated, use DEBUG(errs()) instead 2009-07-27 11:44:01 +02:00
Benjamin Kramer a398cd39b3 ConstantInt::get{True,False} moved to LLVMContext
Non-breaking build fix for LLVM r76533. Also fixes a context related
bug in GarbageCollect2Stack.
2009-07-21 13:11:39 +02:00
Benjamin Kramer 51c02d192a Some minor cleanups
* remove an #ifdef USE_METADATA I accidently left in
* remove now unneeded llvm-version includes
* fix indentation in metadata.h
* prevent the "Found native target" message from interrupting ccmake
2009-07-20 18:16:11 +02:00
Benjamin Kramer d7049de966 More factory methods moved to LLVMContext 2009-07-15 18:09:41 +02:00
Benjamin Kramer 076ef17159 Build fix for LLVM r75546 and r75559 2009-07-14 02:19:05 +02:00
Benjamin Kramer 0ee2f34611 Don't use llvm::getGlobalContext() anymore 2009-07-13 20:16:15 +02:00
Benjamin Kramer 8576788245 Get rid of USE_METADATA 2009-07-11 14:19:21 +02:00
Benjamin Kramer 45f7401a5b Remove all of the now unecessary #if LLVM_REV 2009-07-11 14:09:33 +02:00
Christian Kamm 756a2cb2a1 Adjust LDC to work with the LLVMContext LLVM changes.
This means we now require a fairly new LLVM revision. I use 75234.
2009-07-10 21:30:02 +02:00
Frits van Bommel 5ecdf1a70a Eliminate comparisons between GC allocations and constants. This removes some
`assert(this !is null)`s when member functions get inlined.

Also tweak pass order a bit.
2009-06-20 14:28:59 +02:00
Christian Kamm 8bcc2d9b3f Increment the iterator before deleting redundant functions or globals in the StripExternals pass. 2009-06-11 21:48:10 +02:00
Frits van Bommel 1f7a2a7884 Teach stack promotion to walk the CFG when a potential reuse of an allocation
is found to see if it can actually happen instead of just assuming it will.

This allows it to catch cases like
{{{
int i;
Foo f;
while (cond(i))
    f = new Foo(i++);
return f.value;
}}}
where it previously wouldn't because a phi using the allocation would appear in
the condition block to propagate it to the use after the loop.
2009-06-11 02:04:44 +02:00
Frits van Bommel 9ba306a42f Oops, I accidentally pushed r1486 before the last touches were committed. 2009-06-08 13:52:45 +02:00
Frits van Bommel b999f679a7 Teach -dgc2stack to promote GC allocations in simple loops to stack
allocations too. (A "simple" loop is one where the allocation isn't used in a
subsequent iteration)

This also means it's no longer necessary to run this pass multiple times.
Running it once after inlining should now catch all cases.
2009-06-08 12:35:55 +02:00
Frits van Bommel 96650855ed Add a pass to strip the bodies of available_externally functions so string
literals and `TypeInfo`s only referenced by them can be deleted by `-globaldce`.
2009-06-07 16:00:13 +02:00
Frits van Bommel c8b10643f9 Add some missing returns. 2009-05-30 23:48:22 +02:00
Frits van Bommel a24a2201f1 Teach -dgc2stack to preserve the call graph. This should allow for more
efficient execution by the pass manager.
2009-05-28 02:14:01 +02:00
Benjamin Kramer 46b200a4ed silence a gcc warning 2009-05-16 13:50:44 +02:00
Tomas Lindquist Olsen f5d635dfc7 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 . 2009-05-14 13:26:40 +02:00
Frits van Bommel e4e07baf87 Re-enable consistency check for fixed LLVM versions. 2009-05-11 15:48:33 +02:00
Frits van Bommel 49a2924823 Update for metadata changes in LLVM trunk. 2009-05-11 11:59:22 +02:00
Frits van Bommel d1f582583b Turn new _d_array_slice_copy runtime call into memcpy when the slice lengths are
equal and alias analysis says it's safe.
2009-05-10 04:18:14 +02:00
Frits van Bommel 634d623b34 Some tweaks to -simplify-drtcalls. 2009-05-09 02:34:27 +02:00
Frits van Bommel 5b82f780f8 Allocate objects on the stack if they (a) don't have a destructor, and
(b) don't override the delete operator (on top of the regular conditions for
stack allocation that also apply to arrays, structs, etc.).
The "no destructor" clause is not strictly necessary, but calling them at the
right time would be tricky to say the least; it would involve, among other
things, "manually" inserting a try-finally block around anything that might
throw exceptions not caught in the current function.

Note: objects with custom new operators are automatically ignored because they
don't use the regular allocation runtime call, so there's no need to pay special
attention to them.
2009-05-09 00:50:15 +02:00
Frits van Bommel adf1fd4d44 Work around an LLVM bug by not referring to globals from metadata. This was
only used for consistency checking anyway.
For the LLVM bug, see http://llvm.org/PR4180 / http://llvm.org/PR4046
2009-05-08 16:00:44 +02:00
Frits van Bommel 52c22c6c27 Stack-allocate zero-initialized arrays. 2009-05-06 20:27:48 +02:00
Frits van Bommel ec573df5b2 Some refactoring 2009-05-06 15:58:15 +02:00
Frits van Bommel c6b6d1874a Postpone (expensive) escape analysis until we're sure it's needed. 2009-05-06 14:11:37 +02:00
Frits van Bommel f7e54dce10 Don't forget to update the control flow when deleting an invoke.
Fixes #284.
2009-05-04 12:08:30 +02:00
Frits van Bommel fa79329102 Stack promotion for _d_newarrayvT. Array literals, concatenations (a ~ b) and
such are eligible for stack-allocation now.
2009-05-03 18:01:45 +02:00
Frits van Bommel 67fc0aca20 Remove some overly verbose debug output 2009-05-03 20:19:49 +02:00
Frits van Bommel c831367b24 Factor out some constants into the header so producers and consumers of
metadata stay in sync (and are more readable).
2009-05-02 20:42:58 +02:00
Matti Niemenmaa 87d960c29a Fix build when USE_METADATA is off. 2009-05-02 19:03:33 +03:00
Frits van Bommel 262ef97945 There's an issue with LLVM metadata support; it triggers an assert when trying
to generate asm for code with metadata globals.
This new pass is used as a workaround: it strips metadata from the module before
it reaches the code generator.
Obviously, this is disabled if LLVM doesn't support metadata.
2009-05-02 12:19:43 +02:00
Frits van Bommel 34955bcbf9 Remove calls to some runtime functions if their results are unused 2009-05-02 11:58:50 +02:00
Frits van Bommel cff0f1f446 Implement another D-specific pass: -dgc2stack
This one promotes GC allocations to stack memory when it can determine it's safe
to do so.
Not all GC calls are recognized yet (in fact only one *is* recognized for now).
Needs metadata, so disabled for LLVM versions that don't support it.
2009-05-02 11:58:50 +02:00