Commit graph

168 commits

Author SHA1 Message Date
kai
e6529cfd3d [experimental] Add sanitizer options to LDC.
Add some of the sanitizer passes to LDC. This is not complete (linking must be
done using clang and the right `-fsanitize=` option) and may not be useful at
all.

If it proves to be usefull then a lot of other options (e.g. blacklist) must be
added.
2013-11-05 13:03:52 +01:00
kai
609b362410 Fix the LLVM 3.4 build.
The disable-simplify-libcalls is gone.
2013-06-21 23:44:42 +02:00
David Nadlinger
43e27d0dd1 Remove USE_METADATA.
It has been on by default for quite some time now.
2013-06-07 02:48:53 +02:00
David Nadlinger
c02b38fe9a Removed LLVM 3.0 compatibility code.
There might be still some pieces left here and there, and
there is certainly code that could be rewritten in a nicer
way with the 3.0 requirement out of the picture.
2013-05-31 20:48:38 +02:00
David Nadlinger
bb5b60e591 Make '-O' equivalent to '-O3'.
I have seen it used several times in benchmarks comparing it
to 'gdc -O3' and 'dmd -O -inline' now, so people apparently
expect it to yield the highest available optimization level.
2013-03-17 02:09:54 +01:00
David Nadlinger
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
kai
a11459bc31 "The Great Renaming" continues.
More changes to match the renamed files of LLVM 3.3.
2013-01-06 17:17:30 +01:00
kai
272e7b7a55 Follow "The Great Renaming" in LLVM 3.3
This time VMCore was renamed to IR. Several top level include
files were moved to new subfolder IR.
2013-01-03 08:52:23 +01:00
David Nadlinger
7be9c5c5c7 dgc2stack: LLVM 3.2 compatibility. 2012-12-20 23:52:25 +01:00
David Nadlinger
9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
David Nadlinger
2d02270434 Re-enabled codegen optimization on LLVM 3.2.
The bug (PR14376) has been fixed in both master and the release branch.
2012-11-24 14:07:17 +01:00
kai
45848d19fc Remove unused include. This fixes yet another MSVC-related compile problem.
Root cause is the `root.h` defines `strtof` which is used in `llvm/Target/TargetLibraryInfo.h` as an enumeration identifier.
2012-11-18 17:52:10 +01:00
David Nadlinger
c558f9caab Added -disable-simplify-libcalls.
-disable-simplify-drtcalls was only intended to disable our
custom druntime call simplication pass for debugging purposes.

The new flag controls C runtime library calls optimizations as
performed by the LLVM pass, just as the corresponding LLVM tool
flags do.
2012-11-06 23:53:59 +01:00
David Nadlinger
03ef134aad StripExternals only makes sense with GlobalDCE for cleanup afterwards. 2012-11-06 23:48:19 +01:00
David Nadlinger
fbd62f0532 It makes no sense to not inline alwaysinline functions. 2012-11-06 23:47:12 +01:00
David Nadlinger
0647cfb50c Re-enable inlining by default for -O2 and above.
This fixes a bug introduced in 2f78dc686.

Thanks to Jernej (jerro) for the fix!
2012-11-06 19:40:18 +01:00
David Nadlinger
f95371aeb5 Amend -verify-each description to PassManagerBuilder changes.
We can't verify after each pass anymore with PassManagerBuilder, but
-verify-each is a hidden flag mainly useful for debugging our own
passes anyway.
2012-11-04 00:56:36 +01:00
David Nadlinger
dbe5e97d85 Clean up optimizer command line switch descriptions. 2012-11-04 00:56:36 +01:00
David Nadlinger
2f78dc686d Use llvm::PassManagerBuilder for optimization scheduling.
This commit is based on Kai's pull request #157.
2012-11-04 00:56:36 +01:00
kai
a7c7b514c0 Add changes for LLVM 3.2
- The Attributes class was changed again
- TargetData was renamed to DataLayout

Compiles again with LLVm 3.0, 3.1 and trunk(3.2).
2012-10-13 18:54:42 +02:00
kai
ebf5d8b92e Add missing return statement.
This fixes #159.
2012-09-11 18:05:13 +02:00
kai
0a53cb2ac0 Add -vectorize to the optimizer. This is available starting with LLVM 3.1. 2012-09-08 13:36:31 +02:00
kai
e6a07ffdfe Several changes to optimizer related code.
- New functions codeGenOptLevel() and verifyModule() to remove code duplication
- Hidden option no-verify renamed to disable-verify and moved to optimizer (like opt tool)
- Removed global.params.noVerify
2012-08-16 23:26:52 +02:00
kai
34d595de26 Enable FunctionAttrsPass again.
This pass requires an alias analysis, which is also added.
2012-08-11 19:17:18 +02:00
Alexey Prokhin
8c5cf40bb5 Fixed compilation of ldc1 2012-04-22 12:26:25 +04:00
Alexey Prokhin
bca73ec8b9 Merged dmd 2.059beta 2012-04-05 15:30:00 +04:00
Alexey Prokhin
629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
David Nadlinger
3e28eecfea Quick workaround for a LLVM 2.9 crash with higher optimization levels.
createFunctionAttrsPass() is a LLVM pass and the crash is deep in LLVM code, maybe something is wrong with the pass manager state.
2011-04-20 20:44:49 +02:00
Kelly Wilson
72ea043124 Recommit klickverbot's patch for LLVM-2.9. 2011-04-20 09:28:37 -06:00
Kelly Wilson
7c81278b9c Backed out changeset 5253bfbb3890 2011-04-20 00:28:23 -06:00
Kelly Wilson
b26b0f4196 Upgrade to LLVM-2.9. Thanks to David Nadlinger for the patch. 2011-04-19 21:57:15 -06: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
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
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
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
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
Frits van Bommel
465f15eda0 Return void* from _d_allocclass so LLVM doesn't do weird things with it...
This allows `-instcombine` followed by `-gvn` to do devirtualization, so add
`-gvn` in strategic places in the default pass order.
2009-06-20 11:39:13 +02:00
Frits van Bommel
bc7737a03b Add some passes that opt runs to the default pass list. 2009-06-11 16:57: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
96fdcd6347 Run semantic3 on imported modules, and emit new symbols with
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
2009-06-07 16:00:13 +02:00
Frits van Bommel
b972dcb92d Add -memcpyopt to the optimization pass list. 2009-06-07 15:07:29 +02:00
Frits van Bommel
5edb7545f2 Move -tailcallelim to a place in the optimization sequence where it seems to
be more useful.
2009-06-04 15:59:51 +02:00
Frits van Bommel
6619190ba5 * Add -functionattrs to default pass list so -dgc2stack is more effective
when callees aren't inlined. This should also improve various standard LLVM
  optimizations.
* Comment out some verbose logging.
2009-05-28 00:07:21 +02:00
Frits van Bommel
a2eee70761 Add -verify-each option to ease debugging 2009-05-03 21:58:28 +02:00
Frits van Bommel
865ae79e27 Strip metadata even when addPassesForOptLevel() isn't called, for instance when
only inlining or when manually specifying passes.
2009-05-03 20:16:15 +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