Commit graph

191 commits

Author SHA1 Message Date
Johan Engelen
8edd8de439
Add --fno-discard-value-names : Do not discard value names in LLVM IR (#4012) 2022-07-23 12:06:44 +02:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
101ebce014 Hide new cmdline options leaking from LLVM 14
Checked on Linux.
2022-03-30 18:09:05 +02:00
Martin Kinkelin
4cbaebd965
Make -linkonce-templates less aggressive by default & add -linkonce-templates-aggressive (#3924)
Make -linkonce-templates *not* tamper with the general template
emission algorithm anymore (so on top of default non-allinst or
-allinst modes), and keep those tweaks as experimental
-linkonce-templates-aggressive.

Compiling the druntime/Phobos unittests is only marginally slowed
down compared to the more aggressive variant (~1.5% for debug,
~2.5% for release). It does show some rough 10% increase in required
memory, but that's in line with non-linkonce-templates.

The more aggressive variant has the advantage of skipping
needsCodegen() and potentially codegen'ing less symbols. The problem
is that if an instantiated symbol isn't explicitly referenced, for
instance a CRT ctor, it might not be codegen'd at all.
2022-03-01 00:10:34 +01:00
Martin Kinkelin
fa9897fb18 Sync with dmd/mars.d 2022-02-18 22:04:07 +01:00
Martin Kinkelin
019e9c8e30 Add support for LLVM 13 2021-10-11 19:20:15 +02:00
Martin Kinkelin
5e8490d69e
Merge pull request #3821 from kinke/merge-2.098
Upgrade frontend & libs to early v2.098.0
2021-09-11 20:12:55 +02:00
Martin Kinkelin
16b9eab374
-dllimport=defaultLibsOnly: Avoid -linkonce-templates requirement (#3816)
Via a sorts-of '-linkonce-templates light', only defining all *data*
symbols instantiated from druntime/Phobos templates in each
referencing CU.
2021-09-11 04:53:21 +02:00
Martin Kinkelin
e126c86b41 Adapt to global.params.useDIP1000 refactoring 2021-09-07 16:51:19 +02:00
Johan Engelen
c517ce9d12
Improve ftime-trace implementation. (#3797)
* Improve ftime-trace implementation.
- Rewrite ftime-trace to our own implementatation instead of using LLVM's time trace code. The disadvantage is that this removes LLVM's work from the trace (optimization), but has the large benefit of being able to tailor the tracing output to our needs.
- Add memory tracing to ftime-trace (not possible with LLVM's implementation)
- Do not output the sum for each "category"/named string. This causes the LLVM output to be _very_ long, because we put more information in each time segment name. Tooling that processes the time trace output can do this summing itself (i.e. Tracy), and makes the time trace much more pleasant to view in trace viewers.
- Use MonoTime, move timescale calculation to output stage, 'measurement' stage uses ticks as unit
- Fix crash on `ldc2 -ftime-trace` without files passed.
2021-08-14 14:11:22 +02:00
Martin Kinkelin
db4faf336a Refactoring: Add little dllimportSymbol() helper 2021-06-18 22:31:35 +02:00
Martin Kinkelin
a8475bec8a Add -dllimport CLI option for explicitly controlling implicit dllimports 2021-06-15 00:15:19 +02:00
Johan Engelen
f9147a6f62
Add -cov-increment option to specify the type of increment instruction. Add atomic, non-atomic, and boolean increment types. (#3724) 2021-06-09 12:49:07 +02:00
Martin Kinkelin
ee0d5fbe3c Windows: Default to dllexport with -shared, and enforce dllimport with -link-defaultlib-shared 2021-05-03 20:54:57 +02:00
Martin Kinkelin
eaeb65a9d8 Windows: Make -fvisibility=public export all defined symbols
To pave the way for simple DLL generation (end goal:
druntime-ldc-shared.dll).

The dllexport storage class for functions definitions is enough; the
automatically generated import .lib seems to resolve the regular symbol
name to the actual symbol (__imp_*), so dllimport for declarations seems
superfluous.

For global variables, things are apparently different unfortunately.
2021-04-29 17:20:32 +02:00
Martin Kinkelin
879c8ba465 Upgrade frontend & libs to v2.096.0-beta.1+ (dlang/dmd@0c2d8bd2ab) 2021-02-28 17:40:11 +01:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00
Martin Kinkelin
2172c605b4 Add support for -makedeps[=<filename>]
And streamline implicit -singleobj with DMD, also enforcing it when
compiling a *single* module *and* specifying the -of name.
[-makedeps currently depends on -singleobj.]
2021-01-07 15:55:00 +01:00
Martin Kinkelin
a4922f6460 Add support for -extern-std=c++20 2021-01-07 01:51:33 +01:00
Martin Kinkelin
fe5a1776ac Merge remote-tracking branch 'origin/master' into merge-2.095 2021-01-06 23:58:20 +01:00
Johan Engelen
29245c8255
Add --ftime-trace functionality. (#3624)
This uses LLVM's TimeProfiler functionality, such that LLVM's work is traced in the same profile (optimization and machine code gen).
Functionality is meant to be identical to Clang and LLD's --ftime-trace.
2020-12-28 17:05:04 +01:00
Martin Kinkelin
079858f3b2 Upgrade frontend & libs to early v2.095.0 (dlang/dmd@a4274b3c39) 2020-11-27 17:45:13 +01:00
Martin Kinkelin
45a9e062f0 Default to -linkonce-templates=false again but enable for defaultlib unittests & dmd-testsuite (release) 2020-11-13 02:41:11 +01:00
Martin Kinkelin
145ce40b11 Extend -linkonce-templates by matching template emission scheme
I.e., *define* templated symbols in each referencing compilation unit
when using discardable linkonce_odr linkage, analogous to C++.

This makes each compilation unit self-sufficient wrt. templated symbols,
which also means increased opportunity for inlining and less need for
LTO. There should be no more undefined symbol issues caused by buggy
template culling.

The biggest advantage is that the optimizer can discard unused
linkonce_odr symbols early instead of optimizing and forwarding to the
assembler. So this is especially useful with -O to decrease compilation
times and can at least in some scenarios greatly outweigh the
(potentially very much) higher number of symbols defined by the glue
layer.

Libraries compiled with -linkonce-templates can generally not be linked
against dependent code compiled without -linkonce-templates; the other
way around works.
2020-11-13 02:41:11 +01:00
Martin Kinkelin
c61b1357ed Fix -Xcc=-Wl,... - disallow comma-separated shortcut for -Xcc
E.g., -Xcc=-Wl,-blub used to expand to `cc -Wl -blub`, which is invalid.
With this change, it's now properly forwarded as `cc -Wl,-blub`.
2020-10-03 17:12:29 +02:00
Martin Kinkelin
6f5730049b Merge remote-tracking branch 'origin/master' into merge-2.094
Conflicts:
	gen/tocall.cpp
	runtime/phobos
2020-09-30 19:46:43 +02:00
Martin Kinkelin
4b7f14f58d Hide new LLVM 11 CLI options 2020-09-26 01:04:50 +02:00
Martin Kinkelin
eb64be821a Adapt to llvm:🆑:parser<bool> being final for LLVM < 9 2020-09-25 03:04:19 +02:00
Martin Kinkelin
4be4501227 Re-add support for -HC without value 2020-09-23 21:32:46 +02:00
Martin Kinkelin
4431f6744f Add support for -vtemplates=list-instances 2020-09-23 21:02:59 +02:00
Martin Kinkelin
47b25ca6ab Add support for -cov=ctfe
Incl. making sure `-cov=N ... -cov[=ctfe]` doesn't reset the required
percentage to 0.

Use a dummy *bool* option for a better help output (displaying `--cov`,
not `--cov=<value>`).
2020-09-23 20:57:06 +02:00
Martin Kinkelin
f202c851ae Upgrade frontend & libs to v2.094.0-beta.1 2020-09-22 00:06:19 +02:00
Martin Kinkelin
877ce6fe4c
Add -gdwarf CLI option to emit DWARF debuginfos for MSVC targets (#3533)
Analogous to clang.
2020-08-11 10:30:31 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
e3a1096e44 Merge upstream stable (dlang/dmd@bafab33f27) 2020-07-03 22:20:29 +02:00
Martin Kinkelin
9725dcd5de Add CLI option -vtemplates 2020-06-21 05:31:40 +02:00
Hiroki Noda
b8b7615696
Add --fno-plt option to avoid PLT external calls (#3443)
This patch gives new option which avoids the PLT and lazy binding while
making external calls.
Implementation inspired by `-fno-plt` support to Clang.

Clang's patch: https://reviews.llvm.org/D39079
2020-05-24 22:31:07 +02:00
Roberto Rosmaninho
6274217c39
Add -output-mlir and prepare for MLIR emission (#3313) 2020-05-22 12:31:24 +02:00
Martin Kinkelin
26678a1631 Support new CLI switches -verror-style and -HC, -HCd, -HCf 2020-02-27 01:54:28 +01:00
Martin Kinkelin
2d86e49fba
Finalize support for LLVM 10 (#3323) 2020-02-14 17:53:40 +01:00
Martin Kinkelin
4d167b09f3 Merge upstream stable (47874e5b37) 2019-11-17 15:14:41 +01:00
Martin Kinkelin
fbfbdf3503 Hide command-line options leaking from LLVM 9 2019-10-27 00:12:13 +02:00
Guillaume Piolat
1f9ce7e613 Disambiguate that -link-defaultlib-shared can take a parameter (#3169) 2019-10-09 21:43:38 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
b5fda2e59c Clean up front-end diff some more 2019-04-14 15:47:16 +02:00
Martin Kinkelin
9624834ccf Hide a few new LLVM 8 cmdline options 2019-03-02 19:54:36 +01:00
Martin Kinkelin
0530f08e9a Hide legacy cmdline options -dip<N> 2019-03-01 18:19:00 +01:00
Martin Kinkelin
b8dc871e81 Add cmdline options -preview and -revert
Reusing parsing and usage functionality from DMD, as the number of these
is likely to grow.
2019-03-01 18:19:00 +01:00
Martin Kinkelin
6c3d8b952e Add cmdline option -extern-std=c++{98,11,14,17} 2019-03-01 18:19:00 +01:00
Martin Kinkelin
40ca840560 Add cmdline option -verrors-context (-verrors=context for LDMD) 2019-03-01 18:19:00 +01:00