Commit graph

296 commits

Author SHA1 Message Date
Alexey Prokhin
76f3fd02bd Call _d_arraybounds for bounds checking instead of _d_array_bounds.
It expects file name as a first argument instead of pointer to Module.
2014-08-22 16:01:35 +04:00
Alexey Prokhin
76dec46df5 WIP: merge dmdfe 2.066 2014-08-22 16:01:28 +04:00
Alexey Prokhin
e0b9048998 Rename 'enclosingFinally' to the original 'tf' to minimize differences with mainstream 2014-07-11 18:06:58 +02:00
Alexey Prokhin
a6f358c59b Remove LINKintrisic 2014-07-10 18:10:46 +04:00
David Nadlinger
fc7acc48fc Add pragma(LDC_extern_weak) for symbols with (ELF-style) weak linkage.
For now, this is only an internal feature to be used in the
implementation of rt.sections_linux.
2014-07-10 00:45:06 +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
Alexey Prokhin
ffb67f2918 Fix crashes when a variable is accessed by nested function inside __traits(compile) or typeof 2014-06-27 21:38:58 +04:00
Alexey Prokhin
61979387fd Fix DMD Issue 11394 - NRVO should work for object field initialization in constructor 2014-06-27 14:47:10 +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 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
Alexey Prokhin
dcf005213b Implement cast to void 2013-12-08 14:37:15 +04:00
Kai Nacke
18d53f8937 Enable NRVO for static arrays.
This is new in 2.064 and fixes a test failure in runnable/sdtor.d.
2013-11-20 21:29:50 +01:00
Kai Nacke
b22b7aef3c Merge branch 'master' into merge-2.064 2013-11-14 21:35:10 +01:00
Kai Nacke
2063b4ea89 Fix for issue #543.
Immutables are constant values, too.
2013-11-14 21:21:04 +01:00
Kai Nacke
7743f56450 Fix for the tuple assignment error in test aliasthis.d
The DMD front end uses a hack to avoid a "has no effect" error. This
hack must be recognised by LDC, too.
2013-11-10 20:34:48 +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
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
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
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
3d9b70c7a6 Mention TypeInfo emission in debug log. 2013-10-13 01:00:24 +02:00
David Nadlinger
a2a3e400c9 LDMD: Avoid unitialized data.
Found using Valgrind.
2013-10-09 19:50:28 +02: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
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
Alexey Prokhin
1999749415 Issue #426 part 2. Generate a try-finally block only if it is required
(i.e. there are actually some destructor calls that are needed to be put into finally)
2013-07-10 13:34:52 +04:00
kai
e5655c5e05 Add command line option for the thread model.
On Linux/PPC, just ignore the provided model. Only local-exec is supported.
2013-07-10 07:52:48 +02:00
David Nadlinger
1215ffacd3 Complete IrStruct->IrAggr rename. 2013-06-17 13:14:15 +02:00
David Nadlinger
0206269230 Ignore StaticAssert in DtoDeclarationExp.
Fixes DMD testcase 'testrightthis'.
2013-06-16 21:17:46 +02:00
David Nadlinger
acd508945a Allow multiple declarations to share the same mangled name/LLVM global.
This is necessary to enable aliasing compiler-generated
symbols with pragma(mangle, …).

Note that globals for internal use are still directly
created.
2013-06-16 00:28:02 +02:00
David Nadlinger
0305d3bce2 Never make external variables something else than external.
Fixes crash in DMD testcase 'mangle'.
2013-06-15 23:22:34 +02:00
David Nadlinger
86563a2ee1 Allow casting AAs to bool.
Fixed DMD testcase 'nulltype'.
2013-06-14 16:01:09 +02:00
David Nadlinger
95b34c3625 zext bool to i8 in makeLValue. 2013-06-12 20:39:34 +02:00
David Nadlinger
ab7ffa9988 Removed obsolete importprot members. 2013-06-12 20:16:37 +02:00
David Nadlinger
4d3f9333c6 Never make functions without body available_externally. 2013-06-12 20:16:37 +02:00
David Nadlinger
292caa1438 Merge the 2.063 frontend. 2013-06-12 20:16:37 +02:00
David Nadlinger
978c2c1b6a Re-enable SymOffExp and remove associated LLVM-only modifications. 2013-06-11 00:40:48 +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
7e92984ebe Downgraded accepts-invalid workaround error to assertion.
Bug 9268 was fixed in 2.062.
2013-06-07 03:20:39 +02:00
David Nadlinger
1c883c5071 Do not generate invalid memcpy() for struct self assignment.
This catches only the most trivial case, need to investigate
this further.

See GitHub #385.
2013-06-07 02:23:00 +02:00
David Nadlinger
3b38d34698 Fix up botched merge in 005f993. 2013-06-02 22:02:09 +02:00
David Nadlinger
005f993982 Merge branch 'release-0.11.0'.
Conflicts:
	gen/llvmhelpers.cpp
2013-06-02 21:53:41 +02:00
David Nadlinger
c89d4809d6 Be more lenient with initializer type mismatch; zext as necessary.
The integer initializer width mismatch issue should really be
fixed in the frontend, but is related to forward referencing
and thus hard to track down.

Also fixes an unlisted regression since the 2.061 merge, where
there would be a const(char*) vs. immutable(char*) mismatch
reported for some string constants.

GitHub: Fixes #378.
2013-06-02 21:05:33 +02:00
David Nadlinger
ae48a19251 Refactoring-only part of DtoConstExpInit fix. 2013-06-02 21:05:33 +02:00