Commit graph

368 commits

Author SHA1 Message Date
Alexey Prokhin
61110e3ea4 Fix crash in runnable/arrayop 2014-06-26 19:47:21 +04: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
ecd59cbb77 Fix compilation error 2014-06-23 18:02:14 +02:00
kai
b7615f6a28 Merge branch 'master' into merge-2.065
Conflicts:
	dmd2/declaration.h
	dmd2/dsymbol.h
	dmd2/func.c
	gen/functions.cpp
	gen/toir.cpp
	runtime/druntime
2014-06-23 07:57:30 +02:00
kai
7c289fd673 Introduce needsCodegen.
This is a backport of the code from 2.065.
2014-06-19 13:20:28 +02:00
Kai Nacke
09da15be0f Merge branch 'merge-2.064' into merge-2.065 2014-06-16 07:30:31 +02:00
kai
bef0a62622 Merge branch 'master' into merge-2.064 2014-06-15 14:07:58 +02:00
Christian Kamm
bb46ac8758 doc: Fix description of when template function instances are skipped. 2014-06-14 14:22:43 +02:00
kai
5372e57595 Fix for issue #624 2014-06-13 14:08:27 +02:00
kai
f8a53ab3dc Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-03-12 18:27:43 +01:00
kai
2f2fa92df3 Fix includes for LLVM 3.5 2014-03-07 06:40:39 +01: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
4006fbbd85 Merge branch 'master' into merge-2.064 2014-01-19 13:43:15 +01:00
Kai Nacke
49599f71e9 Add sanitizer attributes.
If the sanitizer is enabled (e.g. -sanitize=address) then the corresponding
attribute (e.g. llvm::Attribute::SanitizerAddress) must be set.
2014-01-19 13:03:37 +01:00
Kai Nacke
680568bb62 Merge branch 'master' into merge-2.064 2014-01-12 11:53:00 +01:00
Kai Nacke
b4b71e6c79 Fix include for LLVM 3.5 2014-01-12 11:37:52 +01:00
Kai Nacke
1463f4a275 Merge branch 'master' into merge-2.064 2014-01-06 11:24:03 +01:00
Jernej Krempuš
7436d94e09 Fixed a bug in DtoInlineIR
Before this fix, debug info was removed from the module while
parsing inline ir.
2014-01-06 01:27:26 +01:00
Kai Nacke
731f2a8fdf Merge branch 'master' into merge-2.064
Conflicts:
	dmd2/root/rmem.c
2014-01-03 15:56:01 +01:00
Kai Nacke
9b4a70c367 Use caching in DtoVaFunctionType.
Remove now unused method IrFuncTy.reset().
2014-01-03 15:14:39 +01:00
Kai Nacke
87006d0a5b Merge branch 'master' into merge-2.064 2014-01-03 13:54:10 +01:00
Kai Nacke
551bce6d18 Change location of assign to irFty.
If the comment about this function is still right (can be called recursively) then the assignment
to irFty should be done after all functions are called.
Takes advantage of move assignment, too.
2014-01-03 13:14:12 +01:00
Kai Nacke
58aadf88ef Merge branch 'master' into merge-2.064 2014-01-02 20:31:28 +01:00
Kai Nacke
1619b18f73 Small cleanup of attribute mess. 2013-12-31 17:29:25 +01:00
Kai Nacke
c231ae0ad0 Merge remote-tracking branch 'origin/master' into merge-2.064
Conflicts:
	gen/arrays.cpp
2013-12-19 21:27:53 +01:00
Kai Nacke
5f520fccf9 Cache result of DtoFunctionType. 2013-12-19 19:45:16 +01:00
Kai Nacke
248d3f2b66 Merge branch 'master' into merge-2.064 2013-11-05 10:47:43 +01:00
kai
6fe28e1660 Small code modifications to Ir-Classes.
Adds some constructors and moves the code to the header file. Uses some of the new constructors.

A big problem with the source are the different strategies used for otherwise similar classes.
E.g. a IrField registers itself with the VarDeclaration. Same is required for IrParameter, but
in this case it is done by the caller.
2013-11-05 10:31:14 +01:00
David Nadlinger
cb341586e3 First merge of 2.064 beta.
This corresponds to DMD commit a913ce4bc59a94a022a27e390fc841f4aededffb.

Doesn't build Phobos yet.
2013-10-29 19:21:15 +01:00
David Nadlinger
c400d180d2 Immediately exit on function type mismatch to avoid LLVM crash. 2013-10-29 19:21:14 +01:00
David Nadlinger
f67cbcda98 DtoType -> DtoFunctionType. 2013-10-29 19:21:14 +01:00
David Nadlinger
265d3ee069 Do not try to emit nested functions with unanalyzed parents.
GitHub: Fixes #497.
2013-10-13 21:37:53 +02:00
David Nadlinger
4fee629c4d Prefer more specific functions to DtoResolveDsymbol.
The remaining ones should also be easy to remove with a
closer look at the situation.

Ideally, we would get rid of all of them at some point and
use safe wrapper functions for accessing the IrDsymbol
associated with a given declaration (which would emit the
declarations on the fly if not already present).
2013-10-13 19:18:24 +02:00
David Nadlinger
787c147986 Use Module::members -> Dsymbol::codegen to define symbols.
This commit fundamentally changes the way symbol emission in
LDC works: Previously, whenever a declaration was used in some
way, the compiler would check whether it actually needs to be
defined in the currently processed module, based only on the
symbol itself. This lack of contextual information proved to
be a major problem in correctly handling emission of templates
(see e.g. #454).

Now, the DtoResolve…() family of functions and similar only
ever declare the symbols, and definition is handled by doing
a single pass over Module::members for the root module. This
is the same strategy that DMD uses as well, which should
also reduce the maintainance burden down the road (which is
important as during the last few releases, there was pretty
much always a symbol emission related problem slowing us
down).

Our old approach might have been a bit better tuned w.r.t.
avoiding emission of unneeded template instances, but 2.064
will bring improvements here (DMD: FuncDeclaration::toObjFile).
Barring such issues, the change shoud also marginally improve
compile times because of declarations no longer being emitted
when they are not needed.

In the future, we should also consider refactoring the code
so that it no longer directly accesses Dsymbol::ir but uses
wrapper functions that ensure that the appropriate
DtoResolve…() function has been called.

GitHub: Fixes #454.
2013-10-13 19:18:24 +02:00
Alexey Prokhin
8fea7484fe Don't use TypeFunction::funcdecl as it is about to be removed 2013-10-05 19:04:18 +04:00
Alexey Prokhin
b819975c84 Eliminate the need for TypeFunction::funcdecl 2013-10-05 19:03:03 +04:00
kai
c28c7fb134 Introduce a debug info builder.
Moves all code from todebug into a new class.
Also caches the compilation unit in order to fix a LLVM 3.4 compile error.
2013-07-29 00:04:08 +02:00
David Nadlinger
848dee32d4 Store bools as i8.
I really hope we can refactor this to use a less leaky
abstraction later – it should at least be possible to merge
voidToI8 and i1ToI8.
2013-06-07 03:20:54 +02:00
David Nadlinger
d402cd382e Always add 'uwtable' attribute on x86_64.
This is what Clang does, and omitting it could lead to problems
w.r.t. the System V ABI. Doesn't seem to have caused any issues
so far, though.
2013-05-19 21:47:15 +02:00
David Nadlinger
a792ecbaf2 Fix function attribute handling on LLVM 3.3+.
The issue was that when merging in the old attributes, attrs
wasn't assigned to, thus silently dropping all of them
(leading e.g. to noinline being omitted on functions containing
inline asm).

The new code hopefully also makes the intent clearer.
2013-05-09 22:57:33 +02:00
kai
2e7884a80d Add support for new parameter attribute returned.
Starting with LLVM 3.3 a new parameter attribute `returned` is supported.
The attribute states that the parameter is the return value, too. This is the
case in constructors. (Destructors and postblits do not return `this`.)
Attribute `returned` is now added to the `this` parameter of constructors.
2013-05-05 16:17:34 +02:00
kai
0b19b81ac9 Add new intrinsic LDC_never_inline.
LDC_never_inline is a complementary intrinsic to LDC_allow_inline.
It tells the LLVM optimizer to never inline a function. This can be
useful if inlining creates incorrect code.
A possible application is core.thread.getStackTop().
2013-03-11 22:32:40 +01:00
kai
37558273c2 Remove SARRAYVALUE 2013-03-06 10:20:24 +01:00
kai
c3801d65f5 Remove STRUCTTHISREF 2013-03-06 10:20:24 +01:00
kai
1e4a8fffc2 Remove DMDV1 and DMDV2. 2013-03-06 10:20:24 +01:00
kai
5a9336bf25 Fix another attribute problem with LLVM 3.3. 2013-03-03 15:10:33 +01:00
David Nadlinger
2d3de4a3d4 Fix ABI on Win32.
We can't simply use the C calling convention, as the D(MD)
ABI is callee-pop, and this is hardcoded in naked functions
with stack parameters.

The \1 "trick" is normally used to avoid prefixes added by
LLVM; on the 3.2 release, a patch is needed to make it work
for the @<n> stdcall suffixes as well.
2013-02-26 13:14:32 +01:00
David Nadlinger
3392f70a4e Move calling convention conversion into TargetABI.
The code is tightly coupled to TargetABI (the transformations
there only make sense knowing that the right CC is selected).
2013-02-26 00:20:45 +01:00
David Nadlinger
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
David Nadlinger
5616753768 Consistently use quotes for LLVM includes. 2013-02-07 21:20:54 +01:00