Commit graph

192 commits

Author SHA1 Message Date
Frits van Bommel
e37c82d1ec Use LLVM OStream wrapper instead of <iostream> in the logger.
llvm::OStream provides all std::ostream functionality (by holding a
std::ostream* internally), but
 * doesn't include <iostream>, avoiding per-file overhead.
 * allows the stream pointer to be null, and the (inlined) operators do nothing
   when that's the case. (This also allows removal of the ofstream("/dev/null")
   hack Logger used when disabled, which presumably wasn't very portable)
2009-02-26 14:51:02 +01:00
Frits van Bommel
8ce2c9773e Clean up the code generated when jumping out of inline asm and make label names more expressive. 2009-02-18 22:50:22 +01:00
Christian Kamm
a4ca550874 Revert templates to old behavior.
While emitting a template instantiation only once is good for compile times
and binary sizes, it doesn't work with linkonce linkage as inlined function
bodies could be discarded. Since we don't want to inhibit inlining, templates
are reverted to the previous behavior, where an instantiation is emitted for
each module using it.

In the future, a custom inlining pass may allow us to switch back to
common/weak linkage and reenable smart template instance emission.
2009-02-08 21:44:46 +01:00
Christian Kamm
789eefd943 Switch some getModule to getCompilationModule to make sure templates are
emitted in the right module.
2009-02-08 18:51:32 +01:00
Christian Kamm
7c93355672 Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Add getCompilationModule to Dsymbol and fix template compile unit decision code.
Runtime compiles with -g again.
2009-02-08 16:50:22 +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
54c3e2cf0c Reverted the template instantiation changes from rev [940]. Wasn't safe it seems :( 2009-02-05 18:17:42 +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
7d2a0a84a7 Removed some dead code.
Fixed assertion filenames for imported template instances. Fixes #152 .
2009-02-04 02:10:23 +01:00
Tomas Lindquist Olsen
584911ad4e Fixed problem with static ctors, in templated imported classes, not begin run. Fixes #203 2009-02-04 00:50:04 +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
Tomas Lindquist Olsen
75591b3c16 Changed templates and typeinfo to use linkonce linkage instead of weak linkage, this should fix inlining problems, fixing bug #197 . If problems show up, it's easy to change it back by changing the define in mars.h . I'm 95% sure this is safe, given how we handle templates. 2009-02-02 01:44:51 +01:00
Christian Kamm
cabc236a79 Only emit finalbody if there is one. Fixes #147. 2008-12-13 06:48:00 +01:00
Tomas Lindquist Olsen
8ee1fbca26 Fixed a nasty bug with how interface vtables for class initializers were output, causing some class fields to be skipped.
Fixed a problem in definition of ClassInfos where an invalid constant was potentially used. This needs to be looked into proper as it might happen again in the future.
2008-12-01 04:37:54 +01:00
Tomas Lindquist Olsen
5d1366d27f Removed DtoConstFieldInitializer, it's no longer needed and was buggy. 2008-11-29 21:26:50 +01:00
Christian Kamm
ca91c52c5a Use toParent instead of toParent2 to determine whether inside a function body. 2008-11-29 17:06:36 +01:00
Tomas Lindquist Olsen
f46f865375 Removed KDevelop3 project files, CMake can generate them just fine!
Fixed function literals in static initializers.
Changed alignment of delegates from 2*PTRSIZE to just PTRSIZE.
Changed errors to go to stderr instead of stdout.
Fairly major rewriting of struct/union/class handling, STILL A BIT BUGGY !!!
2008-11-29 21:25:43 +01:00
Christian Kamm
049e24cef8 Error instead of assert when trying to build a default initializer for void[n]. 2008-11-29 12:28:10 +01:00
Christian Kamm
cdbc4f84d2 Fix warnings on x86-64. By fvbommel. 2008-11-28 21:24:08 +01:00
Christian Kamm
0120dd767c Fix float->bool, #130. Thanks fvbommel. 2008-11-23 21:57:11 +01:00
Christian Kamm
6efc9a3324 Get rid of DtoBoolean - use DtoCast(... Type::tbool) instead.
Fixed some casts to bool that were using truncation.
2008-11-22 18:35:52 +01:00
Christian Kamm
b172c4a668 Fix RawVarDecl double codegen bug. Thanks to downs for the testcase. 2008-11-18 18:07:57 +01:00
Tomas Lindquist Olsen
c4c1c1d72e Added initial D2 support, D2 frontend and changes to codegen to make things compile. 2008-11-11 01:38:48 +01:00
Christian Kamm
fe49ee6448 Special case DtoCastInt for bool. 2008-11-10 20:55:24 +01:00
Tomas Lindquist Olsen
173639bdec Added DtoRawVarDeclaration routine to handle special variables in some statements. 2008-11-01 18:25:10 +01:00
Tomas Lindquist Olsen
a52f0330d0 Implemented first class delegates. closes #101 2008-10-22 21:50:08 +02:00
Tomas Lindquist Olsen
f7ea1da010 Removed TypeOpaque from DMD.
Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
2008-10-22 14:55:33 +02:00
Christian Kamm
0fe7297fba Add missing case to DtoAssign for T[n] = T[]. Fixes downs' initializer bug. 2008-10-16 22:36:26 +02:00
Tomas Lindquist Olsen
180487b614 Fixed issue with accessing a WithStatement context from inside a nested function. see mini/with2.d
Renamed some LLVM uses of ::create statics to ::Create , lower case ones will be deprecated soon.
2008-10-14 13:21:14 +02:00
Christian Kamm
6cb213badf Only allocate the module file name once. Fixes #90. 2008-10-12 10:35:16 +02:00
Tomas Lindquist Olsen
ed7dd481e5 Fixed dynamic array -> boolean. does (arr.ptr !is null) now instead of (arr.length != 0) 2008-10-08 22:38:52 +02:00
Tomas Lindquist Olsen
e109025c00 Removed some checks for abstract llvm types that were too strict, a 'opaque* null' is a valid initializer... when structs in D can be just a forward reference. 2008-10-06 14:37:00 +02:00
Christian Kamm
2a999b72e8 Fix VarDecls for tuples. Closes #99.
I've implemented it this way since it doesn't require any changes in the
frontend. However, I think having TypeTuple expressed as LLVM struct types
would make much more sense and open the door to tuple lvalues.
2008-10-05 11:47:47 +02:00
Christian Kamm
b3d4bc83f8 Move check for access of context for nested class from backend into frontend. 2008-10-02 23:12:19 +02:00
Tomas Lindquist Olsen
bce9368514 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke! 2008-10-01 23:17:14 +02:00
Tomas Lindquist Olsen
bcafbe169d Wrapped all the most potentially expensive logging calls in a conditional to only do work when actually requested.
Commented some logging calls that could potentially write out many megabytes of type dumps.
2008-10-01 18:32:31 +02:00
Christian Kamm
bb47b7c4ce Backed out changeset 1b62222581fb
Do not use i8 for bool. Instead rely on the target to store i1 as i8.
2008-09-21 14:45:41 +02:00
Christian Kamm
4b02533745 Change bool type to i8 2008-09-20 10:13:15 +02:00
Christian Kamm
e0635f1707 Allow VarDecl inside AttributeDecl inside DeclExp.
Fixes run/e/extern_10_D
2008-09-12 13:11:32 +02:00
Tomas Lindquist Olsen
8e9b957bce Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change. 2008-09-09 16:49:47 -07:00
Tomas Lindquist Olsen
f411df11e3 Fixed choosing default target machine without needing to link in targets. 2008-09-07 17:44:25 -07:00
Tomas Lindquist Olsen
2e1a2bfe4a Fixed problem with parameterized intrinsics taking bools. 2008-08-20 19:01:56 +02:00
Tomas Lindquist Olsen
5bf3e8911a Added support for overloaded intrinsics.
Added atomic intrinsics in the intrinsics.di header.
2008-08-20 01:02:22 +02:00
Christian Kamm
8efde8d38d Do not assert if there's a struct-this nested context. 2008-08-13 20:50:54 +02:00
Tomas Lindquist Olsen
aae027961c merge 2008-08-13 15:43:34 +02:00
Tomas Lindquist Olsen
0eeedba887 Fixed problems constant multidimensional static array initializers. 2008-08-13 15:43:13 +02:00
Christian Kamm
57cd1b4445 Get rid of 'static function cannot access nested' error. It is caught again later. 2008-08-12 19:48:42 +02:00
Tomas Lindquist Olsen
9d7f16b967 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
2008-08-10 08:37:38 +02:00
Christian Kamm
4ee26b350a Forgot return in DtoInitializer 2008-08-07 18:17:59 +02:00
Christian Kamm
f7cd3cf969 Move zero init of padding to DtoInitializer in order to respect void initializers. 2008-08-07 18:15:27 +02:00