Commit graph

267 commits

Author SHA1 Message Date
kai
2f2fa92df3 Fix includes for LLVM 3.5 2014-03-07 06:40:39 +01:00
kai
c6f856c01e Remove last uses of ArrayIter<>. 2014-01-12 18:07:27 +01:00
kai
6287a4d422 Replace ArrayIter<> with Array<>::iterator.
Just use the new iterator instead of the old Java-like class.
Also removes a dead iterator and replaces an iterator with a
pointer in some place.
2014-01-11 14:48:41 +01:00
kai
5aa06092cd Fix issue #570.
The use of std::vector<> is replaced by Array<> for MSVC only. This fixes
the error. But it is still unclear why std::vector<> fails.
2014-01-10 12:08:08 +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
b021a2930d Remove MSVC crap.
The code was a work around and did not solve the underlying problem.
With 2.064 even the work around stops working.
2014-01-03 15:17:08 +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
a24b8b69b3 Merge branch 'master' into merge-2.064 2013-12-29 20:31:10 +01:00
Kai Nacke
192f3eb13d Fix a typo in MSVC build. 2013-12-29 20:04:34 +01:00
David Nadlinger
68f8e38f51 Merge branch 'master' into merge-2.064. 2013-12-26 12:37:03 +01:00
David Nadlinger
f85d2a5a0a Respect type alignment when choosing padding fields.
Fixes ABI mismatch when e.g. padding a 28 byte union from a
20 byte member, where previously, an i64 would be emitted,
yielding a 32 byte LLVM struct size on ulong.alignof == 8
platforms.

Test case will follow on the 2.064 branch.
2013-12-26 12:35:19 +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
87965cdc19 Merge branch 'master' into merge-2.064
Conflicts:
	runtime/druntime
2013-11-26 08:00:10 +01:00
Kai Nacke
7f017608a8 Use enum literal instead of constant 2013-11-26 07:56:50 +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
Kai Nacke
f772efaec3 Merge branch 'master' into merge-2.064 2013-11-04 02:24:02 +01:00
kai
8d7f0bf0eb Fix for issue #535.
The symbols must have weak_odr linkage if they result from a template instantiation.
2013-11-04 02:21:05 +01:00
David Nadlinger
2b800b8732 Fix catch clause codegen.
In the 2.064 frontend, the catch variables have a zero
initializer, so DtoDeclarationExp overwrote the actually
caught exception with null.
2013-10-29 19:21:15 +01:00
David Nadlinger
55c02f725a Fix IRLandingPadCatchInfo initialization order warning. 2013-10-29 19:21:15 +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
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
857d37636e Handle void[0] struct/class members.
This was also broken before the symbol emission
changes; we just accidentally managed to avoid
the only occurence in the standard library tests.
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
7dff0bbe4b Fix IrType::isVector (so far unused anyway). 2013-10-13 01:00: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
967b986629 Fix for issue #430 2013-08-05 21:36:02 +02: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
407f45b07d Extend IRLandingPad to support arbitrary finally blocks.
Just laying down the ground work before fixing issue 426.
2013-07-10 13:34:16 +04:00
Alexey Prokhin
90bb32d2d8 extern(C++) interfaces 2013-06-22 17:33:00 +04:00
Alexey Prokhin
09c471ae74 Properly implement exception chaining 2013-06-18 17:06:00 +04:00
Alexey Prokhin
49f8cfe99e Fixed codegen of nested try-catch-finally blocks 2013-06-18 14:16:51 +04:00
David Nadlinger
1215ffacd3 Complete IrStruct->IrAggr rename. 2013-06-17 13:14:15 +02:00
David Nadlinger
9700d84132 Initialize IrTypeAggr members in order to silence warning. 2013-06-17 02:38:38 +02:00
David Nadlinger
dd8652768c Remove unused IrTypeFunction::fty().
The design split between IrFuncTy/IrTypeFunction might need
a review at some point.
2013-06-17 02:37:55 +02:00
David Nadlinger
cfd5c052fe Fix LLVM 3.1 build. 2013-06-16 20:49:23 +02:00
David Nadlinger
a0ffaf56bf Do not codegen aggregate types from within debug info generation.
This avoids problems where we would codegen children of an
"inner" template instantiation (i.e. a member of a non-template
aggregate in another module) because we have no way to know the
outer (declare-only) entity exists in the respective
mustDefineSymbol invocation.

An example for this are the std.typecons.RefCounted internals of
std.file.DirIterator, as used from std.datetime and other modules.
This is not only inefficient, but also causes linking issues due
to attribute inference for these functions not having run yet
(and consequently the mangled name being different from the
actual definition).
2013-06-16 19:33:04 +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
c813ccdcf7 Small debug diagnostics improvements. 2013-06-15 15:04:48 +02:00
David Nadlinger
eb14970fd0 Minor nested context doc comment improval. 2013-06-14 17:10:50 +02:00
David Nadlinger
292caa1438 Merge the 2.063 frontend. 2013-06-12 20:16:37 +02:00
David Nadlinger
9a016a1002 Refactor struct initializers codegen.
This not only reduces code duplication, but the unification
also enables code a la StructLiteralExp to handle classes
(for CTFE class constant support in 2.063).
2013-06-12 20:16:05 +02:00
David Nadlinger
2cebe6408c Divided ir/irtypestruct.* in general aggregate and struct specific part.
This is just to improve clarity, as it was rather non-obvious
what of the code also applied to classes before.

IrTypeAggr::createInitializerConstant would currently belong in
IrTypeStruct, but this will be refactored anyway.
2013-06-12 17:17:09 +02:00
David Nadlinger
abc6c147dc Fix potential latent struct initialization bug.
Apparently the initializer array never was actually
unsorted so far.
2013-06-12 17:16:52 +02:00
David Nadlinger
55d7fc708e Remove leftover declaration. 2013-06-12 17:16:39 +02:00
David Nadlinger
f2f3c751b3 Renamed IrStruct to IrAggr, as it is also used for classes.
The class-specific parts should probably be factored out.
2013-06-12 17:16:35 +02:00
David Nadlinger
e0d78ef0e3 Make irtype.h compile without needing other includes first. 2013-06-12 17:15:55 +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