Commit graph

104 commits

Author SHA1 Message Date
Kai Nacke
e55823fd09 Merge remote-tracking branch 'origin/ltsmaster' 2016-04-23 11:19:20 +02:00
Joakim
ee8a832c49 Add a handful of fixes for Android 2016-04-19 22:09:14 +05:30
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00
Kai Nacke
88f3de8bea Merge branch 'ltsmaster' 2016-03-22 19:05:07 +01:00
Martin
88dcb4349a Refactor setting linkage type and COMDAT 2016-03-20 16:37:44 +01:00
Dan Olson
98a608e925 First proof -of-concept for objc support
This at least shows a path forward.  Pretty much a kludge to at this
point, but passes the tests.
2016-03-02 00:30:58 -08:00
Johan Engelen
14cae7d8b2 Coverage: fix initialization of cover_valid array. 2016-02-15 12:34: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
Kai Nacke
062fef3677 FreeBSD: generate calls to _d_dso_registry (as expected by druntime).
This fixes issue #1119.
2016-01-09 21:10:11 +01:00
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +01:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 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
David Nadlinger
0b4bcbc28c Merge pull request #1181 from kinke/attribs
Simplify working with LLVM attributes
2015-11-01 17:52:45 +02:00
Martin
90197d6c72 Simplify working with LLVM attributes 2015-11-01 16:19:27 +01:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01: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
Martin
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
David Nadlinger
553cc3705c Clarify ClassInfo/ModuleInfo size mismatch error messages
GitHub: Fix #1067.
2015-09-10 10:09:49 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +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
4cf4690ab0 Use C calling convention for variadic functions on x86.
0.15.1 used stdcall convention everywhere. But the ABI change in 0.15.2
requires use of the C calling convention for variadic calls on x86
because the stdcall convention does not support vararg functions.

Solution is to check the llvm::FunctionType if the function has varargs.
This commit also makes the C calling convention the global default
because according to the LLVM documentation the fastcc convention used
for D linkage does not support varargs.

This fixes issue #1000.
2015-07-15 21:34:00 +02:00
Kai Nacke
269e64e52e Add LLVM 3.7 changes to latest code merges. 2015-07-14 22:45:35 +02:00
David Nadlinger
4e2bc18957 Fix debug info builds with inlining on
This is likely an LLVM bug: The code in InlineFunctions.cpp
only updates the source location metadata for the instructions
in the inlined callee when the call site has a source location
set. When the caller has no location metadata, the scope for
the inlined instructions thus still points to the DISubprogram
for the original callee. This then leads to an assertion during
codegen.

GitHub: Fixes #998.
2015-07-13 02:22:38 +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
Kai Nacke
d7347a5829 Do not imply -singleObj if creating lib.
If a target file name is given (`-of`) and a library is created then
`-singleObj` is implied. This results in behaviour not compatible
with dmd. This commit checks for this situation and does not set
`-singleObj`. This fixes issue #978.
2015-06-26 07:41:16 +02:00
Kai Nacke
8d0fada2c2 LLVM 3.7: The signature of CreateCall() has changed.
The method now takes an array with the argument values.
2015-05-22 21:25:14 +02:00
kai
2f3b31909b LLVM 3.7: Fix GEP instructions in coverage code. 2015-04-28 00:13:43 +02:00
kai
fc59f0392f Fix a printf warning. 2015-04-26 21:10:54 +02:00
Kai Nacke
92c4361f2e LLVM 3.7: Mote GEP-related changes 2015-04-09 22:53:20 +02:00
Johan Engelen
505f18ca2a Add coverage analysis ("-cov=...") to ldc2 2015-04-07 22:11:02 +02:00
kai
908815256f LLVM 3.7: Explicit string conversion required for DataLayout. 2015-03-06 22:08:08 +01:00
kai
e73a7f2e23 Several updates to debug info generation.
- Do not create debug info after we called finalize.
- Clean up debug info generation for module ctor/dtor.
- Rename EmitSubProgramInternal() to EmitModuleCTor().
- Remove unused parameter from CreateTypeDescription().
2015-02-22 21:10:28 +01:00
kai
441c98532c Add changes related to the llvm::Metadata refactoring in LLVM 3.6.
In LLVM 3.6, the llvm::Metadata hierarchy is distinct from the llvm::Value hierarchy.
This refactoring causes several changes.
2014-12-25 19:02:15 +01:00
David Nadlinger
e4aa92deb3 Get rid of more superfluous casts with DMD arrays.
There are still a few more left.
2014-11-16 08:00:17 +01:00
kai
37349a7fb4 First set of changes to compile LDC on AIX 7.1. 2014-11-16 05:55:50 +01:00
Kai Nacke
fce5f432b9 Allow overriding of header files.
This is the same behavior as DMD.
2014-10-25 18:05:28 +02:00
Alexey Prokhin
66a392a5c2 Rename Type::irtype to ctype for consistency with dmd and gdc 2014-10-05 16:55:12 +04:00
Kai Nacke
382ad184d8 Merge branch 'master' into merge-2.066
Conflicts:
	dmd2/builtin.c
	gen/classes.cpp
	gen/functions.cpp
	gen/llvmhelpers.cpp
	gen/statements.cpp
	gen/toir.cpp
	runtime/druntime
	runtime/phobos
2014-09-13 23:11:54 +02:00
Alexey Prokhin
18f33b1815 Make IrDsymbol to be a typesafe union to reduce memory usage 2014-09-12 14:43:49 +04:00
Alexey Prokhin
76dec46df5 WIP: merge dmdfe 2.066 2014-08-22 16:01:28 +04:00
kai
f4e2d8486b Fix a typo in variable name 2014-07-14 06:47:42 +02:00
kai
bdd346c3ae Change type of ldc.dso_initialized to i8.
Also being only a flag, it is safer to use the i8 type and compare against 0.
This adds only an icmp instruction to the IR and should not change the generated machine code.
2014-07-14 06:47:39 +02:00
David Nadlinger
314c052f27 Fix broken merge. 2014-07-11 18:28:50 +02:00
David Nadlinger
3503206ccc Do not try to verify/emit LLVM module on codegen error. 2014-07-11 18:11:16 +02:00
David Nadlinger
04570399d4 Implement previously inoperative pragma(LDC_no_moduleinfo).
GitHub: Fixes #571.
2014-07-10 01:20:31 +02:00
kai
45fca1f3b5 Add line number to error message of -nogc switch.
This was suggested by bearophile in the news group.
It also changes all Loc objects to be passed by reference.
2014-07-04 07:15:05 +02:00
David Nadlinger
d8a7ae1841 Use --gc-sections on Linux.
This was painful.
2014-06-30 16:18:15 +02:00
David Nadlinger
2e80741d5e Remove unused 'seenTemplateInstances' mechanism. 2014-06-30 15:28:16 +02:00
David Nadlinger
b0ff0de9c1 Make function entry basic blocks unnamed.
The performance impact should be completely immeasurable,
but the main benefit is that this makes IR dumps slightly
nicer to look at (as the redundant "empty:" labels are
now omitted entirely).
2014-06-29 16:47:44 +02:00