Commit graph

59 commits

Author SHA1 Message Date
Martin Kinkelin
96b9cde428 Add support for LLVM 11
One major change is the removal of llvm::CallSite, which I've replaced
by llvm::CallBase*.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Roberto Rosmaninho
6274217c39
Add -output-mlir and prepare for MLIR emission (#3313) 2020-05-22 12:31:24 +02:00
Martin Kinkelin
1efbb4ff44 Revamp rt.sections_android, getting rid of some magic symbols
This should resolve #3350 and also gets rid of the previous Android-
specific requirement wrt. having a D main *and* making sure that object
file is the first one fed to the linker.
2020-03-17 16:44:05 +01:00
Martin Kinkelin
4629f156a7 Extend inline asm diagnostics by D source location 2020-02-25 02:31:58 +01:00
Martin Kinkelin
82f6d4fb85
Embed linker directives in ELF and Mach-O object files (#3259)
Resolves #3245 by adding `pragma(lib, <name>)` library names to
`llvm.dependent-libraries` for ELF object files.

For Mach-O, embed appropriate linker options for `pragma(lib)` and
support generic `pragma(linkerDirective, <flag>, ...)` as well.
2020-01-14 23:12:55 +01:00
Hiroki Noda
4734d2d878 Remove _d_execBss{Beg,End}Addr, used for copy-relocation check (#3247)
I think we can remove the copy-relocation logic since
9b97ede74f
was comitted.
2019-12-20 16:56:20 +01:00
Martin Kinkelin
211682e710
Fix issue #3221 (@assumeUsed on global union) (#3222) 2019-11-11 20:56:33 +01:00
Martin Kinkelin
262d4e2393 Upgrade front-end & libs to v2.089.0-beta.1 2019-10-18 20:55:13 +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
c193ad8047 Upgrade to v2.083.0 2018-11-02 02:52:13 +01: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
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +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
Ivan
c839e9dfd0 Rename functions 2017-11-09 21:59:26 +03:00
Ivan
5426ffbd3d rename compiler files 2017-11-09 21:51:13 +03:00
Ivan
ae4db7d3b3 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-11-01 22:24:27 +03:00
Martin
95915a8ab8 Fix and refactor Objective-C state
Tie the state to an LLVM module/object file instead of having a global
one. And finalize it once per LLVM module instead of once per D module
(previously, as part of ModuleInfo generation).

Fixes issue #2388.
2017-10-26 20:28:53 +02:00
Ivan
31861621eb Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-10-23 21:53:27 +03:00
Martin
4381a909ca Use upstream's genCmain() 2017-10-23 16:49:40 +01:00
Ivan
dc78564bf4 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-10-14 12:28:32 +03:00
Martin
d7f68dbeb3 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-10-01 18:28:44 +02:00
Ivan
808f36b2d2 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-10-01 17:02:50 +03:00
Johan Engelen
8ad5212399 Fix LLVM 6.0 build. (#2342)
* LLVM 6: tool_output_file was renamed to ToolOutputFile.

http://llvm.org/viewvc/llvm-project?view=revision&revision=314050

* Update SPIRV-LLVM

* Fix new LLVM6 API for sanitizerBlacklist->inSection
2017-09-30 17:58:08 +02:00
Ivan
42f283c221 D dynamic compilation support 2017-08-27 17:42:55 +03:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
kinke
f32d9b80f3 Merge pull request #2171 from kinke/union
Fix issue #2108 (triggered by T.init initializing dominated members in nested unions)
2017-07-15 20:15:49 +00:00
Martin
ea0167d652 Attempt to fix issue #1829 (dangling pointers after replacing globals)
Postpone the destruction of replaced global variables, register them in
`IRState::globalsToReplace` and perform a second replacement pass when
finalizing the IR module. The globals will be destroyed in that 2nd pass,
so there may still be dangling pointers in `IrGlobal::value`, but now only
after writing the module.

The nicer thing would be replacing IrGlobal::value by IrGlobal::getValue()
which could look it up in IRState, but that's not feasible due to the
field being inherited from IrVar and IrGlobal apparently quite often being
used as IrVar (via pointers union), so the cached field is currently
required.

So the feasible options to me were either registering each IrGlobal with
its mangled name and replacing their values when swapping out the global
variable, or performing this second replacement pass right before
finalizing the IR module to make sure we really replace all occurrences.
I went for the latter as it's both easier and safer (from the LL
perspective as the old global might be cached somewhere else too).
2017-07-15 20:30:47 +02:00
Johan Engelen
e8b28ebae9 Fix LLVM trunk build. 2017-07-02 21:11:07 +02:00
Johan Engelen
fdd66e5ea7 Fix LLVM 5.0 build (#2173)
* Fix LLVM 5.0 compilation.

* Fix adding linker option metadata to LLVM module.

See https://reviews.llvm.org/D31349

* Version the SPIRV cache dir on travis.
2017-07-02 11:35:40 +02:00
Johan Engelen
3fd99eb207 Add -fsave-optimization-record option.
Resolves issue #2089
2017-05-04 11:07:16 +02:00
Martin
badea5a78d Don't immediately delete generated doc file
Just before writing the object file. Module::deleteObjFile() deletes the
doc file too, and generating the docs happens in a prior pass before
codegen.
deleteObjFile() is already called in mars.d, after reading the source
file, before the generate-doc pass.

Fixes dmd-testsuite's runnable/test_switches.sh.
2017-02-06 21:10:28 +01:00
Johan Engelen
7deae74d89 Only emit llvm.used _once_ when compiling multiple D modules into one LLVM module. 2016-10-26 21:59:18 +09:00
Martin
b1a6315ee4 Don't reverse order of object file names
Make sure the overall order corresponds to the user's command-line order
of object and source files. The only exception being singleObj builds,
for which the single object file for all source files is always the first
entry in the object files list (which is forwarded to the linker in that
order). This is done so that we can easily get hold of the name when
emitting the single object file later in the `ldc::CodeGenerator` dtor.
It should also clearly define the linking order (affecting comdat
selections etc.) for special singleObj builds.

Also reuse some more code (wrt. output filenames) from DMD's main().
2016-09-27 01:34:05 +02:00
Johan Engelen
b70042a85e LLVMContext::setDiscardValueNames(true) when not compiling to textual IR.
Resolves #1749
2016-09-14 12:34:58 +02:00
Martin
c748eb9ed0 Replace global.params.singleObj by global.params.oneobj
singleObj was LDC-specific.
2016-09-07 09:53:35 +02:00
Martin
41fb7830df Remove LDC-specific global.obj_ext_alt
No functional changes intended.
2016-08-28 21:41:04 +02:00
David Nadlinger
d47bdb234a gen: Use single ldc.register_dso function for both module ctor/dtor
This reduces the size of a statically linked Phobos-based
Hello World by 11 kB on Linux x86_64.

Also creates a header file for gen/module.cpp, which has been
renamed to "modules" such as not to conflict with the frontend
header file.
2016-08-18 16:28:41 +02:00
David Nadlinger
6de981af75 codegen, runtime: Go back to old executable .bss range detection
We had switched to a somewhat simplified implementation Martin
came up with for DMD based on our old one. Unfortunately, that
turned out not to work for certain ld.bfd versions on Linux
(e.g. 2.26.0.20160501), where the .bss section from other shared
objects would be picked up instead.

This reverts commit 08ad4fddb5.

GitHub: Fixes #1534.
2016-06-21 11:25:36 +01:00
Johan Engelen
404d483c2a Bitcode cmd arguments: fix compilation for LLVM < 3.8, and disable for LLVM 3.5. 2016-06-10 12:43:31 +02:00
Johan Engelen
d9b267a4be Accept LLVM bitcode files (*.bc) on the commandline and add the code to the first source file on the cmdline (the first emitted module). 2016-06-05 16:07:14 +02:00
Joakim
bf2cb831f3 Add back Android TLS support that was supposedly merged in ee8a832c4 but isn't there for some reason. 2016-05-15 16:44:11 +05:30
David Nadlinger
610edb9659 codegenerator: Remove unused code, add some doc comments [nfc] 2016-02-04 17:11:16 +01:00
David Nadlinger
08ad4fddb5 codegen, runtime: Use upstream _bss_{start, end} access solution 2016-02-03 20:29:43 +01:00