Commit graph

70 commits

Author SHA1 Message Date
Johan Engelen
91d306894e
Add support for LLVM 17. (#4533) 2023-12-03 19:07:31 +01:00
Martin Kinkelin
406df56b82 Add new CLI options -fno-moduleinfo and -fno-rtti
Using the same names as GDC.
2023-11-06 21:25:18 +01:00
Martin Kinkelin
d435c8a451 Merge fix: Adapt to changed mangleToBuffer() signature 2023-11-06 01:10:16 +01:00
Martin Kinkelin
d6d79187e6 Merge fix: Adapt to removed error/warning members 2023-11-06 01:10:16 +01:00
Martin Kinkelin
b97ae0340d Merge remote-tracking branch 'origin/master' into merge-2.104 2023-07-23 22:50:27 +02:00
Johan Engelen
e03b08459f
Add -fcf-protection. (#4437) 2023-07-21 22:17:01 +02:00
Martin Kinkelin
49bb2ac590 Skip ModuleInfo generation for C files (incl. *.i)
Fixes dmd-testsuite's compilable/testcomplex.i.
2023-07-16 21:08:34 +02:00
Martin Kinkelin
de000a7b02 Fix assertion hit with LLVM 15+ and -cov 2023-02-24 15:23:40 +01:00
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
jamesragray
7d8e0f787b
Add UWTableKind for LLVM15+ (#4169)
uwtable attribute needs an argument. This was set using setUWTableKind

Co-authored-by: james <jamesragray@bitbucket.org>
2022-09-15 21:24:53 +08:00
Nicholas Wilson
194dfc91f0
Use typed GEP in modules.cpp (#4070) 2022-08-28 21:18:51 +08:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
7b6810b01b Fix LLVM 13 deprecation messages during build 2022-02-26 19:15:46 +01:00
Martin Kinkelin
694edca0ac Generalize rt.dso_windows to rt.dso, for Posix too
Addressing #3786.
2022-01-13 17:00:23 +01: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
9865e459d1 Windows: Make implicit dllimport more selective
* Newly require `-link-defaultlib-shared` for implicit dllimport.
  E.g., this enables to compile druntime DLL with `-fvisibility=public`
  for pure exports and no (local) imports (such as builtin TypeInfos).
* `-link-defaultlib-shared` alone now only implicitly imports symbols
  from druntime/Phobos.
  This simplifies building complex DLLs linked against a bunch of
  static libs (dub only supports static lib dependencies!); the static
  libs don't need to be compiled with `-fvisibility=public` anymore
  (if the DLL itself isn't either), `-link-defaultlib-shared` is
  sufficient.
  This is mainly useful for existing DLLs with explicit exports, to make
  them link against *shared* druntime/Phobos and so end up with a single
  druntime/Phobos for the whole process.
2021-06-14 17:47:32 +02:00
Martin Kinkelin
3e80c02a19
Merge pull request #3712 from kinke/sections_shared
druntime: Switch to rt.sections_elf_shared on Windows too
2021-05-21 21:38:47 +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
49caa9e8a0 Windows: Dllimport aggregate globals too
Init symbols, TypeInfos (classes only) & vtables - unless defined in a
root module. For explicitly exported aggregates, or, with
`-fvisibility=public`, all aggregates.
2021-04-29 17:22:12 +02:00
Martin Kinkelin
8d71c8624a
-cleanup-obj: Put object files into temporary directory by default (#3660)
To prevent conflicts for concurrent LDC processes in the same
working dir, resolving #3643.

Re-use this for the temporary object files of -run by enforcing
-cleanup-obj in that case. Additionally enforcing -oq prevents
conflicting filenames in that dir and allows to get rid of previous
Module.makeObjectFilenameUnique().
2021-02-11 00:08:47 +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
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
323e49e52a -cov=ctfe: Initialize _d_cover_data with CTFE coverage data
Fixing dmd-testsuite's runnable/ctfe_cov.d.
2020-09-25 00:52:42 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
9707bb1af8
WebAssembly: Switch from legacy linked-list ModuleInfo registry to __minfo section (#3348)
As LLD 9+ supports the magic __{start,stop}___minfo linker symbols for
wasm targets.
2020-03-07 22:57:56 +01:00
Jacob Carlborg
56d796d23b Fix undefined symbol __Dmodule_ref for Apple ARM 2020-01-19 20:57:23 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00
Johan Engelen
a72c318cb3 Add explicit casts to llvm::MaybeAlign for setAlignment to use the new LLVM trunk API (silences deprecation messages of old API) 2019-10-18 00:16:24 +02:00
Martin Kinkelin
030123410a Add support for LLVM 9.0.0
Including some of Nicholas' fixes in #3144.
2019-09-25 03:42:18 +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
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
c7c3f56415
Merge pull request #2826 from Syniurge/debug-info-fixes
Debug info improvements (for GDB): printing global and imported symbols, non-member and member function calls
2018-10-16 14:53:47 +02:00
Elie Morisse
841146644b Debug info: emit llvm::DIModule and llvm::DIImportedEntity for modules and imports
Matches GDC's DWARF output and enables access to global and imported symbols from GDB.
2018-10-15 22:48:03 +02:00
Martin Kinkelin
055fa1be8b Work around Mac issue wrt. discarding llvm.global_{c,d}tors 2018-10-15 22:36:47 +02:00
Martin Kinkelin
2676101847 Simplify DSO registration with druntime
* The explicit reference to the ModuleInfo should be obsolete, it's
  added to the llvm.used array.
* Only keep a single pair of ldc.dso_{c,d}tor per DSO (pointing to a
  common ldc.register_dso() function) instead of a pair per linked-in D
  object file. This simplifies ldc.register_dso() and allows to get rid
  of the explicit ctor/dtor functions and the ldc.dso_initialized global.
2018-10-15 22:33:28 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin
f38a7972a5 Split up getOrCreateGlobal() in {declare,define}Global()
Making it obvious which of the two operations is performed, reducing
call args and making sure a global isn't defined multiple times via
`defineGlobal()`.

The only [intended] functional change is in gen/trycatchfinally.cpp,
where I inserted a check for an existing __cpp_type_info_ptr global when
emitting a catch for C++ exceptions.
2018-04-10 22:13:00 +02:00
Martin
c17b71c3fc Skip ModuleInfo emission if there's no ModuleInfo declaration
This is compatible with DMD.
2018-04-04 19:59:10 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
2018-04-04 19:59:10 +02:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Johan Engelen
3ec79179b4 PGO: refactor such that there can be IR-based and frontend-based PGO. 2018-01-15 23:59:14 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Johan Engelen
f86e33f1d0
Remove LDC_WITH_PGO. (#2476)
It's no longer needed, all our builds have it set to true.
2017-12-29 23:54:32 +01:00
kinke
6d6167d83d MSVC: Emit ModuleInfo references into .minfo section (#2383)
Instead of the legacy linked list.
2017-10-25 00:15:40 +02:00
Johan Engelen
e34ac614f6 Move the call to the D-style code-coverage constructor (registration of code coverage for the current module) to the "ictor" constructors that are not included in cycle detection. (#2382)
Resolves issue #2177.
2017-10-25 00:14:28 +02:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +02:00