Commit graph

39 commits

Author SHA1 Message Date
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
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
Kai Nacke
d072bdf7b6 Do not use global.params.is<OS>
This PR replaces the few uses of global.params.is<OS> with
global.params.targetTriple.isOS<OS>(). This avoids adding a new
boolean for each supported OS.
It also defines all xBSD-type OS as using the dso-registry.
2016-01-12 09:15:05 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
51afced357 Also clang-tidy driver/ 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Rainer Schuetze
7413f1a8f5 fix build against llvm master (llvm 3.8) 2015-10-17 16:07:17 +02:00
Martin
5645901dbc Windows: don't overwrite object file extension to .o
In case of a singleobj build and a provided output file (.exe or .obj).
The dmd-testsuite tests used to produce lots of .o files while expecting
.obj ones as specified in the command line.
2015-08-08 23:02:07 +02:00
Kai Nacke
d1e764cec1 Backport of "Avoid using llvm::Linker" to master.
See pull request #974 for the original code.
2015-06-27 22:08:44 +02:00