Commit Graph

1789 Commits

Author SHA1 Message Date
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
David Nadlinger
90127ab87a Fix broken indentation in debug log output. 2013-09-12 10:21:01 +02:00
David Nadlinger
14bc59f31a Nested context creation code beautification. 2013-09-12 10:14:17 +02:00
kai
e0288564a8 Fix annoying clang warning about missing newline 2013-09-11 06:56:08 +02:00
kai
d38448d664 Changed mangling for naked assembler on Win32.
Reported by Temtaime on the newsgroup!
2013-09-08 12:30:04 +02:00
kai
3c800d2380 Fix for issue #461 2013-09-01 23:09:06 +02:00
kai
3ba3b12783 Fix more LLVM 3.4 debug info problems.
The expression llvm::DIType(NULL) is not accepted by LLVM.
This commit replaces this with an unspecified type (which is
new in LLVM 3.4).
2013-09-01 16:47:33 +02:00
kai
6bd78496a1 Preliminary fix for debug info generation with LLVM 3.4.
There is no debug information generated for several types.
As LLVM 3.4 does not support empty nodes, it is now time to
implement the missing debug info.
2013-08-20 07:47:12 +02:00
kai
6875d8a20f Mark frontend generated strings with attribute unnamed_addr.
This is part of a fix for issue #133.
2013-08-18 23:34:41 +02:00
kai
80a65e34f3 Use memset to initialize arrays with constant byte value.
This extends the existing code for null values.
2013-08-18 21:58:07 +02:00
kai
62683c4efe Simplify calling memcpy/memset 2013-08-18 20:56:24 +02:00
kai
f769406216 Fix for issue #119.
Instead of creating individual stores to the array elements an constant
array is created and assigned to the destination memory. This is much
less IR than before. With -O it is optimized to a memset.
2013-08-18 19:36:58 +02:00
kai
b1160c3d16 Fix for issue #440 2013-08-17 13:02:26 +02:00
kai
89f59b4eeb Fix an assertion error regarding void type with LLVM 3.4.
In Dwarf debug symbol generation the void type was modelled as
DIType(NULL). This triggers an assertion error with LLVM 3.4.
The solution is to use the unspecified type provided by Dwarf for
this purpose.
2013-08-11 22:16:48 +02:00
Kai Nacke
07cb4cca0d Merge pull request #434 from AlexeyProkhin/minimize-dmd-diff
Minimize dmd diff
2013-07-30 22:39:10 -07:00
Alexey Prokhin
d45931972c Move Target implementation out of dmdfe 2013-07-29 11:18:25 +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
Alexey Prokhin
21b07c783a Remove Module::moduleInfoType 2013-07-28 21:59:01 +04:00
Alexey Prokhin
69e7907875 Move implementation of Module::buildTargetFiles and Module::buildFilePath to gem/module.cpp 2013-07-28 21:17:25 +04:00
Kai Nacke
795df4da1b Merge pull request #427 from AlexeyProkhin/issue426
Fixed issue #426 — dtor / destructor not called for (rvalue) struct used in opApply
2013-07-20 11:19:07 -07:00