Commit graph

68 commits

Author SHA1 Message Date
Martin Kinkelin
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Nicholas Wilson
4349388563
Prepare for LLVM15: Headers, attributes (#3936)
`llvm::AttrBuilder` was changed to require an LLVMContext in its constructor, and can no longer be copied.

declare `DEBIG_TYPE` after includes for the GC2Stack pass as `llvm/Support/GenericDomTreeConstruction.h `(included from `llvm/IR/Dominators.h` `#define`s and `#undef`s it.

`llvm::DIBuilder::createExpression` now takes an `ArrayRef<uint64_t>` instead of `int64_t`. EmitLocalVariable has similarly changed
2022-03-11 16:38:49 +01:00
Martin Kinkelin
406e469e99
Merge pull request #3832 from kinke/fix_compilability
Fix little compilability regression
2021-09-18 02:39:40 +02:00
Nicholas Wilson
1568d0cdca
Fix compilation with LLVM 14 (#3822) 2021-09-17 16:41:49 +02:00
Martin Kinkelin
86f430c039 Slightly revise frontend diff
E.g., preferring local imports for less merge conflict potential.
2021-09-11 17:34:51 +02:00
Martin Kinkelin
bfa3cead08 Upgrade frontend & libs to early v2.097.0 (dlang/dmd@cb0457daf3) 2021-05-29 00:19:22 +02:00
Hiroki Noda
a8d98fc054
Use new OpenFlags enumeration (#3710)
[This](https://reviews.llvm.org/D101506) drops old deprecated
OpenFlags support.
OF_{Append,None,Text} has been available since LLVM 9.

- https://reviews.llvm.org/rG1f67a3cba9b09636c56e2109d8a35ae96dc15782
2021-05-01 00:43:45 +00: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
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