Commit Graph

1808 Commits

Author SHA1 Message Date
kai
8408afcf6d Add SSE4.1, SSE4.2, AES and SHA opcodes.
Also adds comments for all AVX opcodes supported by DMD.
This fixes issue #514.
2013-10-29 17:31:43 +01:00
David Nadlinger
9f1c26b52a gc2stack: Handle _d_allocmemory.
This allows us to clean up after inlining closures.
2013-10-27 17:05:19 +01:00
David Nadlinger
3539e201f8 gc2stack: Move TypeInfo handling code into FunctionInfo subclass.
This is to properly support calls that don't involve TypeInfo
at all, like it is already the case for _d_newclass, and will be
for _d_allocmemory.
2013-10-27 17:05:19 +01:00
David Nadlinger
5b9208ef85 gc2stack: Extract static size checking code into helper function. 2013-10-27 17:05:19 +01:00
David Nadlinger
e1a6d8144b gc2stack: Replace return type bool with proper enum flag.
This makes the code much easier to read.
2013-10-27 15:43:12 +01:00
David Nadlinger
27b4f730aa gc2stack: Remove unused safeToDelete mechanism. 2013-10-27 15:36:14 +01:00
kai
a73e4602ee Simplify EmitMemSet in GarbageCollect2Stack.
Simply take advantage of the predefined `CreateMemSet()` function.
2013-10-25 23:28:29 +02:00
kai
835e972e6b Fix va_arg handling.
The change of symbol emission ignored the fact that the va_arg intrinsic must be
handled in a special way. This commit corrects the omission (which leads to seg
faults on Linux/PPC64).
2013-10-25 16:15:52 +02:00
Kai Nacke
e5fe110280 Merge pull request #526 from klickverbot/newclass-signature
Correct signature of _d_newclass runtime call.
2013-10-23 21:43:11 -07:00
David Nadlinger
b052b30442 Correct signature of _d_newclass runtime call.
Fixes programs trying to directly access it (e.g. the
GtkD bindings). Not sure why this didn't come up earlier.
2013-10-24 00:27:09 +02:00
David Nadlinger
1f59740524 _d_allocclass -> "_d_newclass".
The define is a leftover from the times when we supported
both D1 and D2.
2013-10-24 00:25:36 +02:00
David Nadlinger
3d8e2e5e5c Add virtual destructor to GarbageCollect2Stack to silence GCC warning. 2013-10-24 00:24:55 +02:00
David Nadlinger
36b70b68e8 Do not generate invalid IR in dgc2stack pass.
Branching to a block that starts with a landing pad
instruction is illegal.

GitHub: Fixes #524.
2013-10-23 22:53:18 +02:00
David Nadlinger
7ca329e77e More accurate description for "-vv".
Still not happy with it, but I feel it is still better
than just "very verbose".
2013-10-15 01:50:44 +02:00
Kai Nacke
90d0f6c12a Merge pull request #429 from redstar/moduleflags
Implement pragma(lib) on Windows using module metadata.
2013-10-14 00:26:17 -07:00
David Nadlinger
f80be41713 Merge pull request #511 from klickverbot/issue-470
Gracefully handle struct decl/type mismatch when generating TypeInfo.
2013-10-13 18:24:21 -07:00
David Nadlinger
07e8fe4908 Gracefully handle struct decl/type mismatch when generating TypeInfo.
The type should have already been resolved if the struct
itself is, but due to multiple-types-per-declaration issues
in DMD, this might not be the case.

GitHub: Fixes #470.
2013-10-13 21:58:41 +02: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
kai
4f7bc678fb Implement pragma(lib) using module metadata.
Since LLVM 3.3 pragma(lib) can be implemented like DMD does.
2013-10-13 20:35:34 +02:00
David Nadlinger
60f385b062 Use IRState parameter instead of gIR where available. 2013-10-13 19:47:41 +02:00
David Nadlinger
1242be25d0 Remove unused, empty Ir type.
The codegen parameter was changed to IRState instead of
removing it to set the stage for an eventual eradication
of the gIR global.
2013-10-13 19:44:29 +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
48b7710d22 More robust way of handling static array single element initialization.
Fixes a std.traits test where there would be a mismatch
in const/shared qualifiers on the element type of a dynamic
array initializer.
2013-10-13 19:18:24 +02:00
David Nadlinger
8ead24a2bb Handle typeof(null) -> Object conversion.
Not sure why this wasn't triggered by the test suite before.
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
David Nadlinger
b556ad9996 Don't log the uninteresting case of DtoConstExpInit. 2013-10-13 01:00:25 +02:00
David Nadlinger
e1abb01e55 Remove superfluous Dsymbol::codegen overload. 2013-10-13 01:00:25 +02:00
David Nadlinger
3d9b70c7a6 Mention TypeInfo emission in debug log. 2013-10-13 01:00:24 +02:00
David Nadlinger
49835a3ce2 Fix assertion error when building Phobos with debug builds.
Turns out that Expression::isConst() actually is much too
pessemistic as it e.g. never regards struct literals as
const.

We should get this fixed to avoid unnecessary heap
allocations for array initialization.
2013-10-13 00:58:56 +02:00
David Nadlinger
a2a3e400c9 LDMD: Avoid unitialized data.
Found using Valgrind.
2013-10-09 19:50:28 +02:00
David Nadlinger
4987894468 Also make storage for immutable array const initializers constant/unnamed_addr. 2013-10-09 05:32:41 +02:00
David Nadlinger
47e212178e Emit array literals as unnamed_addr.
There is really no reason not to.
2013-10-09 04:34:32 +02:00
David Nadlinger
26e3cc8a40 Never emit long array literals as inline constant.
Also cleaned up rest of the code a bit.

The LLVM 3.1 problem was already fixed before by not doing
anything on zero-element arrays anyway.
2013-10-09 04:27:41 +02:00
David Nadlinger
0cdb74aae7 Do not heap-allocate immutable array literals. 2013-10-09 04:07:46 +02:00
David Nadlinger
60cdf58168 Combine ArrayLiteralExp::toConstElem and initializeArrayLiteral implementations. 2013-10-09 04:07:46 +02:00
David Nadlinger
eb3261f93c Do not GC-allocate temporary for static array initialization. 2013-10-09 01:51:45 +02:00
David Nadlinger
9866e5a14f Comment typo fix. 2013-10-09 01:51:45 +02:00
David Nadlinger
44f60199ad Factored actual literal building code out of ArrayLiteralExp::toElem. 2013-10-09 01:51:45 +02:00
David Nadlinger
71c67457c3 Cleanup: Kill backend_init/term. 2013-10-06 01:33:28 +02:00
Alexey Prokhin
19d8845bef DtoType doc 2013-10-05 19:41:43 +04: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
David Nadlinger
f35176efad Fix SymOffExp::toConstElem.
I am surprised and horrified at the same time that the test suite
(on platforms other than Windows, where the code path is triggered
in core.stdc.stdio) did not catch this at all.

The elemSize-dependent path probably doesn't make too much sense for
global variables, as it always refers to the total size of the global.
Should add a special case for arrays for clearer codegen in those cases.

GitHub: Fixes #477.
2013-09-21 18:53:26 +02:00
David Nadlinger
b17a6421a4 Merge pull request #475 from klickverbot/assert-release-trap
Emit trap for assert(0) in release mode.
2013-09-15 23:46:26 -07:00
David Nadlinger
945f4882c2 Emit trap for assert(0) in release mode. 2013-09-15 23:53:52 +02:00
David Nadlinger
3556f52b95 Fix _d_invariant mangling on MinGW/Win32.
This is getting uglier and uglier, should probably just switch back
to extern(C) irrespective of what upstream DMD does.
2013-09-15 19:57:25 +02:00
David Nadlinger
dd2a2a6cf9 Merge pull request #456 from klickverbot/issue-447
Properly handle delegate literals in nested context code.
2013-09-12 14:38:03 -07:00
David Nadlinger
243146199f Function literals start again at nesting depth zero.
GitHub: Fixes #447.
2013-09-12 13:47:54 +02:00
David Nadlinger
e5463f77b7 FuncDeclaration::nestedVars should only be filled in DtoCreateNestedContextType. 2013-09-12 13:46:45 +02:00
David Nadlinger
0063546bc3 Added newline at end of file. 2013-09-12 10:23:21 +02:00