Commit graph

140 commits

Author SHA1 Message Date
Alexey Prokhin
48d89916ef Work on typeinfo. 2010-12-19 15:50:44 +03:00
Alexey Prokhin
360a99caa9 Resolving nested context for structs.
* * *
Another fix for nested structs
* * *
Yet another fix for nested structs
2010-11-02 13:21:36 +03:00
Alexey Prokhin
4d7a6eda23 Different fixes for d2 2010-10-07 22:35:32 +04:00
Christian Kamm
3479e91996 Merge DMD 1.051 2009-11-06 23:58:01 +01:00
Robert Clipsham
089e792258 DMD 2.032 Merge. 2009-09-08 10:07:56 +01:00
Benjamin Kramer
c220dcac05 IntegerType is now contextifed.
Requires llvm >= 78969. resistor says this will be the last context API change :)
2009-08-14 00:39:18 +02:00
Benjamin Kramer
4c5457ba61 getNullValue is in Constant again
Requires LLVM >= r77721
2009-07-31 23:01:29 +02:00
Benjamin Kramer
66101517d7 LLVMContext changes up to r77366 2009-07-30 15:25:10 +02:00
Benjamin Kramer
0ee2f34611 Don't use llvm::getGlobalContext() anymore 2009-07-13 20:16:15 +02:00
Benjamin Kramer
331319dab1 Build fix for the latest LLVMContext changes (LLVM r75445)
This shouldn't break the build with older LLVM revs. We include
LLVMContext.h in gen/llvm.h now to make the transition a little bit
easier.
2009-07-13 12:17:58 +02:00
Frits van Bommel
4158fb474a Add an llvm::OStream workalike class for use with Logger::cout(), with the
crucial difference being special handling of `llvm::Type`s so they get printed
by name rather than printing their full representation (which can be positively
*huge*).

This allows re-enabling some logger calls that were disabled due to extreme
verbosity.
2009-06-16 19:31:10 +02:00
Frits van Bommel
96fdcd6347 Run semantic3 on imported modules, and emit new symbols with
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
2009-06-07 16:00:13 +02:00
Tomas Lindquist Olsen
f6997cb604 D2:
Applied function type from D1 frontend that got removed in D2, it's critical for member function type to be correct.

Fixed a bunch of type discrepancies in druntime object.di vs. genobj.d .

Disabled (#if 0) some potentally very large type dumps for -vv .

Updated classinfo and typeinfo generation for D2, almost complete now.

Added finer grained checks for vtbl type mismatching, aids debugging.
2009-06-03 02:28:48 +02:00
Robert Clipsham
cf08cc2844 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-01 19:02:20 +01:00
Robert Clipsham
91ddf6140a More tweaks. 2009-06-01 18:58:21 +01:00
Frits van Bommel
da593c99dc Remove code duplication for vtable loads and improve instruction naming to make
bitcode with virtual calls easier to read.
2009-05-30 13:04:49 +02:00
Tomas Lindquist Olsen
be25445461 Added simple check for ClassInfo change introduced in DMD 1.045, it must have 12 fields. 2009-05-17 23:15:04 +02:00
Tomas Lindquist Olsen
0b8413b4bc Fixed class -> integer casts. 2009-05-17 22:02:03 +02:00
Tomas Lindquist Olsen
b1fa43ce24 Increased RTTIBuilder buffer to 14 constants, to be big enough for !ClassInfo as well as !TypeInfo 2009-05-17 16:29:49 +02:00
Tomas Lindquist Olsen
dc4b7e8118 Update !ClassInfo generation to use !RTTIBuilder, slight update of !RTTIBuilder . 2009-05-17 16:27:01 +02:00
Tomas Lindquist Olsen
6633d696c9 Forgot to set the (ClassInfo.flags & 32) bit added in 1.045. 2009-05-16 22:24:49 +02:00
Tomas Lindquist Olsen
e8780d50e8 Merged DMD 1.045 !!! 2009-05-16 22:21:31 +02:00
Tomas Lindquist Olsen
f5d635dfc7 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 . 2009-05-14 13:26:40 +02:00
Tomas Lindquist Olsen
ca4f588c08 Fixed deal breaker bug for more-at-once compilation when any module contained aggregates. Fixes ticket #272 . 2009-05-07 02:10:29 +02:00
Tomas Lindquist Olsen
ba38e15f0d Fixed class default initializers and type generation. Bug #260 is fixed. 2009-04-27 03:40:40 +02:00
Tomas Lindquist Olsen
3e882d422b Fixed struct default initializers. 2009-04-25 18:26:54 +02:00
Tomas Lindquist Olsen
575038bfbd Fixed classinfo.interfaces for .. interfaces! 2009-04-21 20:19:53 +02:00
Tomas Lindquist Olsen
4567a55f7f Fixed emitting declarations nested inside interfaces. 2009-04-21 19:32:22 +02:00
Tomas Lindquist Olsen
f5ce8eda1d Resolve all base classes, including interfaces (!) before resolving the class itself. 2009-04-17 03:01:43 +02:00
Tomas Lindquist Olsen
803fbf4882 Make !TypeInfo output lazy unless we need to provide full definitions in general. 2009-04-16 22:20:26 +02:00
Tomas Lindquist Olsen
9a86f9c0b5 Fixed some minitest regressions. 2009-04-16 19:21:30 +02:00
Tomas Lindquist Olsen
bb98d68f64 Now compiles again, and fixed type of the Interface[N] ClassInfo symbol. 2009-04-16 11:01:49 +02:00
Tomas Lindquist Olsen
37cf5a5789 Added Doxygen file.
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
2009-04-15 20:06:25 +02:00
Frits van Bommel
071bad95dc Add some alignment info where LLVM might otherwise be more pessimistic.
In particular, %.nest_arg is always aligned even though it's bitcast from i8*.

Pointers in vtables are also guaranteed to be stored at aligned addresses.
2009-04-12 21:56:43 +02:00
Frits van Bommel
b5af30636e Isolate all knowledge of what a function's nested context looks like in a
single place. No functional change.
2009-04-12 13:08:24 +02:00
Tomas Lindquist Olsen
be3bfbff5d Fixed problems introduced by previous commits that prevented Tango from compiling. 2009-03-27 23:17:04 +01:00
Tomas Lindquist Olsen
ec986231e5 Eliminated the need for resolve, declare, const-init and define lists to drive code generation. 2009-03-27 21:50:32 +01:00
Tomas Lindquist Olsen
daef67acc3 Changed use of toObjFile to a new codegen method.
More versioning of DMD specific codegen code.
2009-03-27 17:54:27 +01:00
Frits van Bommel
d0a8ee9573 Return null from a static class to interface cast if the class reference was
null. Fixes #237.
2009-03-20 15:50:01 +01:00
Frits van Bommel
27d3ab4546 Some calling convention work for x86-64:
- Implement x86-64 extern(C), hopefully correctly.
 - Tried to be a bit smarter about extern(D) while I was there.

Interestingly, this code seems to be generating more efficient code than
gcc and llvm-gcc in some edge cases, like returning a `{ [7 x i8] }` loaded from
a stack slot from an extern(C) function. (gcc generates 7 1-byte loads, while
this code generates a 4-byte, a 2-byte and a 1-byte load)

I also added some changes to make sure structs being returned from functions or
passed in as parameters are stored in memory where the rest of the backend seems
to expect them to be. These should be removed when support for first-class
aggregates improves.
2009-03-06 16:00:47 +01:00
Frits van Bommel
dd41366a99 Use llvm::CallSite instead of custom CallOrInvoke class. 2009-02-28 22:16:52 +01:00
Tomas Lindquist Olsen
fc480b7fd8 SWITCHED TO LLVM 2.5 !
Applied patch from ticket #129 to compile against latest LLVM. Thanks Frits van Bommel.

Fixed implicit return by asm block at the end of a function on x86-32. Other architectures will produce an error at the moment. Adding support for new targets is fairly simple.

Fixed return calling convention for complex numbers, ST and ST(1) were switched around.

Added some testcases.

I've run a dstress test and there are no regressions. However, the runtime does not seem to compile with symbolic debug information. -O3 -release -inline works well and is what I used for the dstress run. Tango does not compile, a small workaround is needed in tango.io.digest.Digest.Digest.hexDigest. See ticket #206 .
2009-02-08 05:26:54 +01:00
Tomas Lindquist Olsen
9bd52922bd Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases. 2009-02-04 18:48:03 +01:00
Tomas Lindquist Olsen
dc5944df99 Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Fixed align N; in asm blocks.

Fixed inreg parameter passing on x86 for ref/out params.

Removed support for lazy initialization of function local static variables, I have no idea why I ever implemented this, it's not in the D spec, and DMD doesn't support it :P

Some of the global variable related changes might cause minor regressions, but they should be easily fixable.
2009-02-03 08:54:57 +01:00
Christian Kamm
f82ca73c76 Casts from interface to class generally need to be dynamic. Fixes #189. 2009-01-25 12:35:11 +01:00
Tomas Lindquist Olsen
637c59a422 more moreatatime fixes 2008-12-09 18:45:25 +01:00
Tomas Lindquist Olsen
827113a0b2 Fixed another moreatatime (as opposed to oneatatime) issue with indexing unresolved class. 2008-12-09 17:14:52 +01:00
Tomas Lindquist Olsen
3c400ff21c Removed error on naked, not fully complete, but I'll be doing more work on it during this Christmas, and some things do work.
Fixed taking delegate of final class method. see mini/delegate3.d.
2008-12-09 14:07:30 +01:00
Tomas Lindquist Olsen
a2bf0796ce Added back a bunch of static's to gen/classes.cpp, it's not superfluous, it makes the functions internal to the compilation unit, and we don't call them anywhere else. 2008-12-09 02:07:24 +01:00
Christian Kamm
c8fdab1715 Add all base interfaces to interfaceMap, not just direct parents.
Removed some superfluous 'static'.
2008-12-07 16:43:20 +01:00