Commit graph

281 commits

Author SHA1 Message Date
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
David Nadlinger
d9ce9ce67b Removed TODO-riddled DtoInitializer only used in DtoVarDeclaration. 2013-06-02 21:05:33 +02:00
David Nadlinger
0a7eec400f Removed dead global initializer code. 2013-06-02 21:05:33 +02:00
David Nadlinger
c02b38fe9a Removed LLVM 3.0 compatibility code.
There might be still some pieces left here and there, and
there is certainly code that could be rewritten in a nicer
way with the 3.0 requirement out of the picture.
2013-05-31 20:48:38 +02:00
David Nadlinger
41e580a79f Get rid of now-obsolete DtoConstInitializerType. 2013-05-19 20:25:16 +02:00
David Nadlinger
15fd67be03 Remove code for unimplemented goto-into-asm check.
The check was never fully implemented. We need to look into
this again, as currently we fail with a fairly unintellegible
LLVM ICE (added as GitHub #).
2013-05-11 20:18:34 +02:00
David Nadlinger
2bf0789364 Fixed vector global initialization for > 1 byte elements. 2013-05-04 06:29:34 +02:00
David Nadlinger
b8cdfad8c0 global.params.useAvailableExternally -> global.inExtraInliningSemantic.
This will hopefully make the associated code a bit easier
to read.
2013-04-01 21:17:13 +02:00
kai
b13f3d3164 Merge branch 'master' into merge-2.062
Conflicts:
	runtime/druntime
2013-03-24 19:39:39 +01:00
kai
7d65a311b1 More changes to std::vector usage.
Replace with std::vector with static array, llvm::SmallVector or
add code to reserve space.
2013-03-17 23:58:30 +01:00
David Nadlinger
82ba7fe548 Fix casting typeof(null) to bool.
Covered by the DMD testsuite.
2013-03-16 09:35:29 +01:00
David Nadlinger
a303622074 Allow casting AAs to void*.
GitHub: Fixes #302.
2013-03-07 23:18:08 +01:00
kai
1e4a8fffc2 Remove DMDV1 and DMDV2. 2013-03-06 10:20:24 +01:00
sgraf812
db9edaf053 Fix #265: Use declared struct type in initexpr. 2013-02-11 04:20:59 +01:00
David Nadlinger
d49e1529ed Revert "Revert "Fix overly conservative inlining prediction".",
The previous failures were caused by the issue in
callWithStackShell(), which is fixed now.

This reverts commit 4a6444c320.
2013-02-09 10:42:52 +01:00
David Nadlinger
d13a997bd0 Added back NULL returns accidentally removed in 8ff3a8060.
No functionality change, as the return value wasn't used
anywhere.
2013-02-08 16:37:52 +01:00