Commit graph

89 commits

Author SHA1 Message Date
Martin
90197d6c72 Simplify working with LLVM attributes 2015-11-01 16:19:27 +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
kai
2b6dbb03f4 Add IF_LOG to more logging statements.
Evaluating arguments which call toChars() or toPrettyChars() are much more expensive then checking Logger::enabled().
2014-06-26 06:54:38 +02:00
Kai Nacke
fb18a7ab82 Merge branch 'merge-2.064' into merge-2.065 2014-05-13 06:56:23 +02:00
Kai Nacke
ec63589a36 Remove some casts. 2014-05-10 22:55:23 +02:00
Kai Nacke
92c06dede0 Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-05-10 21:38:37 +02:00
kai
a56be4af43 Fix compile errors on OpenIndiana (OpenSolaris) 2014-04-08 17:50:00 +02:00
kai
456924116b Merge branch 'merge-2.064' into merge-2.065 2014-04-05 22:37:27 +02:00
Kai Nacke
ecbd01a2fa Merge branch 'master' into merge-2.064 2014-04-05 22:23:36 +02:00
Kai Nacke
3a77228b69 Fix unresolved reference with shared libldc.so 2014-04-05 22:22:05 +02:00
Kai Nacke
fe39da53e3 Merge of 2.065.0-b3.
The new visitor class is used for IR generation. This removes some modifications from DMD source.
2014-02-10 08:47:25 +01:00
Kai Nacke
d6b4000f8c Merge remote-tracking branch 'origin/master' into merge-2.064 2014-01-26 00:01:38 +01:00
Kai Nacke
704ab30001 Emit ldc version as llvm.ident metadata. 2014-01-26 00:00:21 +01:00
Kai Nacke
c193a3b4c8 Merge branch 'master' into merge-2.064 2014-01-13 18:17:51 +01:00
Kai Nacke
87afa717ae Fix more files for LLVM 3.5. 2014-01-13 18:16:22 +01:00
Kai Nacke
61720bf1ba Fix ouput for test diag8354 2014-01-03 18:02:29 +01:00
Kai Nacke
e7fdbafe2d Fix generation of position-independent code.
The new module discovery scheme requires the following section order:

.minfo_beg
.minfo
.minfo_end

This works for non-PIC code because the segments have the same attributes.
However, if -relocation-model=pic is passed to ldc2 then the .minfo section
becomes writeable and the sequence of sections is changed.

The quick fix is to mark the data always as writeable. Then all sections are
always writeable.

I think a better solution would be to base this in the used relocation model.
But this information is currently only available in the driver.

This fixes the failure in test case runnable/eh2.d
2013-12-18 16:54:49 +01:00