Commit graph

198 commits

Author SHA1 Message Date
Tomas Lindquist Olsen
5dbe3ee8e2 Abstracted more (most) ABI details out of the normal codegen. 2009-03-03 02:51:21 +01:00
Tomas Lindquist Olsen
61dfb11bc5 - Fixed x86-32 C ABI for complex number return values.
- Removed unused code from the ABI class.
2009-03-01 19:01:05 +01:00
Frits van Bommel
4f51adc810 Implement support for intrinsics returning struct types
(such as llvm.*.with.overflow)
2009-02-26 22:47:06 +01:00
Tomas Lindquist Olsen
57a69e8177 - Fixed LLVM style CL args for D2.
- Moved main() into its own file gen/main.cpp
- Fixed basic cross compilation
- removed the option for setting OS
- added support for llc's mattr, mcpu and mtriple switches
- added basic ABI abstraction for return value rewrites, it's not perfect and will probably be completely rewritten once I get to handling parameter rewrites as well.
- x86-64 extern(C) abi for cfloat returns now match (llvm-)gcc.
2009-02-26 14:11:49 +01:00
Christian Kamm
f0dc6cb13e Static ctors/dtors added via template mixins should not be added to modules
that just import a module containing such a mixin.
2009-02-15 14:54:36 +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
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
Christian Kamm
a1e6510c39 Automated merge with http://hg.dsource.org/projects/ldc 2009-02-04 18:39:39 +01:00
Christian Kamm
c3cdcab8d2 Convert struct arg to integer when passing inreg to make sure LLVM doesn't
ignore the attribute!
2009-02-04 18:39:33 +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
bd4f7ec731 Replace assertion with errormessage for unsupported calling conventions. like Pascal. See dstress/run/e/extern_10_A.d 2009-02-04 00:04:09 +01:00
Christian Kamm
bbcea86cf2 Follow the D ABI and pass the last arg in a register if it is a struct that fits. 2009-02-03 21:46:46 +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
99396c2e7a Fixed problem with nested function inside static nested function. see mini/compile_nested2.d. fixes #143 . 2008-12-09 14:57:01 +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
Christian Kamm
fe71199772 Only run unittests contained directly in the module. 2008-12-07 14:12:39 +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
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
ca6b37cd38 Enable function parameter debug info for a wider range of args. 2008-11-03 15:23:22 +01:00
Christian Kamm
36a98404ae Fix accidental double-inreg caused by shared TupleType. Enabled inreg by default. 2008-10-30 10:16:37 +01:00
Tomas Lindquist Olsen
80e29f86e4 Disabled parameter reversing by default, it broke mini/typeinfo10.d
Fixed 'inreg' property placement for functions with reversed parameters.
Made parameter reversal and inreg passing of first arg configurable in premake.lua
2008-10-25 18:12:07 +02:00
Tomas Lindquist Olsen
3c3a5dda14 Implemented correct parameter order according to x86-32 ABI documentation.
Changed AA types to just a void* .
2008-10-25 06:03:28 +02:00
Tomas Lindquist Olsen
f71b7ac284 Added inreg attribute where appropriate on x86 to follow ABI docs.
Removed now unnecessary temporary variable in StringExp.
2008-10-23 00:34:46 +02: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
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
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
d78677961b Removed D_InlineAsm and D_InlineAsm_X86 versions.
Made use of 'naked' in inline asm an error.
2008-08-25 19:36:27 +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
Tomas Lindquist Olsen
3346a78e71 First step towards D abi compliance.
Framepointer elimination is now disabled for functions using inline asm (with a hack from aKor).
2008-08-19 20:18:01 +02:00
Christian Kamm
d0fec06c7d Abstract functions may have bodies.
Fixes:
run/a/abstract_17_A,B
2008-08-17 11:39:36 +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
8362b86c5a Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding. 2008-08-05 19:28:19 +02:00
Tomas Lindquist Olsen
daad516579 Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially
in this regard. Code for accessing nested variables and contexts rewritten. Probably more. Fairly well tested.
2008-08-04 02:59:34 +02:00
Tomas Lindquist Olsen
00072e5fd0 Fixed debug info and lazy arguments. 2008-08-02 21:51:49 +02:00
Tomas Lindquist Olsen
55639e01ea Fixed inserting an AA entry with 'this' as key.
Fixed debug info for aggregate parameters. Only seems to work on byval arguments.
2008-08-02 17:24:10 +02:00
Tomas Lindquist Olsen
18b376ba66 Added generation of the llvm 'sret' parameter attribute where applicable.
Fixed some wrong argument handling code when setting parameter attributes.
Updated the tango unittest script in the tango patch, does not work yet, all modules don't compile...
2008-08-02 02:54:57 +02:00
Tomas Lindquist Olsen
e31070a437 Fixed problems with nested 'this'. Fixes #39 .
Fixed problem with debug info order of intrinsic calls (func.start after declare).
2008-08-02 00:50:39 +02:00
Tomas Lindquist Olsen
885a805d26 Fixed problem where global variables did not resolve type before using it. 2008-08-01 21:54:40 +02:00
Tomas Lindquist Olsen
fd2fac6aa7 Fixed param attrs for return values (not really broken, but would be if more return attrs were added) 2008-08-01 18:07:33 +02:00
Tomas Lindquist Olsen
9b45fc5533 Changed the handling of variadic intrinsics a bit.
Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues.
Changed the handling of parameter attributes to a bit more generalized approach.
Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 .
Parameter attribs now properly set for intrinsic calls if necessary.
Made the tango.math.Math patch less intrusive.
Fixed/added some mini tests.
2008-08-01 17:59:58 +02:00
Tomas Lindquist Olsen
07cfb67178 Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Reworked the LLVMDC specific pragmas.
2008-08-01 00:32:06 +02:00
Tomas Lindquist Olsen
905ca019dd Added type param to DVarValue as DMD sometimes overrides the type of the VarDeclaration.
Added support for align(1)/packed structs, other alignments are still ignored.
Fixed some problems with accessing lazy arguments.
2008-07-30 10:12:55 +02:00
Christian Kamm
f2c5fa2c2f Enable insertion of missing terminator instruction for main. 2008-07-29 15:58:45 +02:00
Christian Kamm
907a03a3be Give error messages for invalid casts.
This required passing Loc information to certain functions.
Fixes nocompile/b/bug_cgcs_354_A/B.
2008-07-26 17:19:16 +02:00
Christian Kamm
8f20b1ed00 Introducing opaque type to dmd frontent to be used with certain runtime array
and aa args and returns. There are still some bugs with aas.
2008-07-22 23:06:46 +02:00
Christian Kamm
566eac93fe Get rid of runTimeHack and instead add proper argument info to the frontend
declatation.
2008-07-22 19:24:40 +02:00