Commit graph

67 commits

Author SHA1 Message Date
Alexey Prokhin
eccd26ac93 Fixed crashes when compiling interpret test. 2010-12-17 12:55:28 +03:00
Alexey Prokhin
e48d0f6b79 Fixed test runnable/arrayop 2010-12-14 14:38:46 +03:00
Alexey Prokhin
e4c3179d43 Different fixes: phobos compiles now 2010-10-28 14:53:01 +04:00
Alexey Prokhin
b1e5993873 Started work on phobos 2010-10-27 18:13:46 +04:00
Alexey Prokhin
df87607ba2 Updated to 2.049 2010-09-30 21:54:45 +04:00
Alexey Prokhin
93ddf8112b Fixed compilation of ldc2 2010-09-28 20:51:27 +04:00
Tomas Lindquist Olsen
1fac40d2bd Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).

Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.

Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
2010-05-19 12:42:32 +02:00
Leandro Lucarella
357dc9c1a9 Merge DMD r253: refactor: Argument => Parameter
---
 dmd/arrayop.c     |   30 ++++----
 dmd/arraytypes.h  |    2 +-
 dmd/class.c       |    8 +-
 dmd/declaration.c |   10 ++--
 dmd/declaration.h |   16 ++--
 dmd/doc.c         |   12 ++--
 dmd/dsymbol.c     |    4 +-
 dmd/expression.c  |   48 +++++++-------
 dmd/expression.h  |   32 +++++-----
 dmd/func.c        |   78 +++++++++++-----------
 dmd/init.c        |    2 +-
 dmd/interpret.c   |    8 +-
 dmd/mtype.c       |  190 ++++++++++++++++++++++++++--------------------------
 dmd/mtype.h       |   32 +++++-----
 dmd/opover.c      |   34 +++++-----
 dmd/parse.c       |   40 ++++++------
 dmd/parse.h       |    2 +-
 dmd/statement.c   |   90 +++++++++++++-------------
 dmd/statement.h   |   14 ++--
 dmd/struct.c      |    8 +-
 dmd/template.c    |   30 ++++----
 gen/functions.cpp |   10 ++--
 gen/functions.h   |    2 +-
 gen/tocall.cpp    |   10 ++--
 gen/typinf.cpp    |    6 +-
 25 files changed, 359 insertions(+), 359 deletions(-)
2010-01-06 15:18:20 -03: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
977fa551ee Push the context through StructType::get.
Requires LLVM >= 78258. Also remove old #if's.
2009-08-06 01:47:39 +02:00
Benjamin Kramer
66101517d7 LLVMContext changes up to r77366 2009-07-30 15:25:10 +02:00
Benjamin Kramer
d7049de966 More factory methods moved to LLVMContext 2009-07-15 18:09:41 +02:00
Christian Kamm
756a2cb2a1 Adjust LDC to work with the LLVMContext LLVM changes.
This means we now require a fairly new LLVM revision. I use 75234.
2009-07-10 21:30:02 +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
Frits van Bommel
2fe8f2cd74 Improve ABI conformance on x86 by passing the sret parameter in EAX if there's
no `this`.
2009-05-31 12:43:59 +02:00
Frits van Bommel
6619190ba5 * Add -functionattrs to default pass list so -dgc2stack is more effective
when callees aren't inlined. This should also improve various standard LLVM
  optimizations.
* Comment out some verbose logging.
2009-05-28 00:07:21 +02:00
Tomas Lindquist Olsen
c0f2af5afd Added IrTypeFunction and IrTypeDelegate and eliminated IrDType. This means the Type::ir field can be removed. It's the final part needed for the move to a slightly more sane type system. Now the whole thing just needs to be cleaned up :P
Added -v-cg switch, which right now just prints "codegen: module.name (module/name.d)" to stdout, this can really help figuring out where, in some complex build command, things go wrong.
2009-05-16 18:19:52 +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
dbe4852b7b Fixed D-style vararg arguments with types that have sizes bigger that pointers, yet are not aligned to pointer sizes. Fixes ticket #276 . 2009-05-10 04:37:03 +02:00
Frits van Bommel
8c3cc1467f Remove 'noalias' and 'nocapture' from %.nest_arg. They no longer apply now that
it may point to a struct containing variables from outer functions.
2009-04-15 20:59:21 +02:00
Frits van Bommel
376a825075 Fix a bug in nested context code that occured when calling a function nested in
the outermost scope with a context frame from a function using a more nested
context frame.
2009-04-13 12:19:18 +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
Frits van Bommel
b7ca040f7c Fix a bug I noticed. Varargs were broken if preceded by tuple parameters. 2009-03-30 00:00:43 +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
Frits van Bommel
b237079854 Fun with parameter attributes: For several of the "synthetic" parameters added
to D functions, we can apply noalias and nocapture. They are sret parameters,
'nest' pointers passed to nested functions, and _argptr:
Nocapture:
 - Sret and nest are nocapture because they don't represent D-level variables,
   and thus the callee can't (validly) obtain a pointer to them, let alone keep
   it around after it returns.
 - _argptr is nocapture because although the callee has access to it as a
   pointer, that pointer is invalidated when it returns.

All three are noalias because they're function-local variables
 - Sret and _argptr are noalias because they're freshly alloca'd memory only
   used for a single function call that's not allowed to keep an aliasing
   pointer to it around (since the parameter is nocapture).
 - 'Nest' is noalias because the callee only ever has access to one such pointer
   per parent function, and every parent function has a different one.

This commit also ensures attributes set on sret, _arguments and _argptr are
propagated to calls to such functions.

It also adds one exception to the general rule that attributes on function types
should propagate to calls: the type of a delegate's function pointer has a
'nest' parameter, but this can either be a true 'nest' (for delegates to nested
functions) or a 'this' (for delegates to member functions). Since 'this' is
neither noalias nor nocapture, and there's generally no way to tell which one it
is, we remove these attributes at the call site if the callee is a delegate.
2009-03-14 22:15:31 +01:00
Christian Kamm
ed9591d81f Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
same LDC call.
2009-03-07 14:25:30 +01:00
Frits van Bommel
5af82ee8d3 Fix a bug in the X86 ABI. The size of a struct is different from the size of a
pointer to that struct...
2009-03-06 21:15:13 +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
Tomas Lindquist Olsen
65ba1d4d88 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries. 2009-03-04 17:24:25 +01:00
Tomas Lindquist Olsen
fdecec122a Disabled some extensive LLVM value logging with -vv that dramatically increases -vv output length for little value. 2009-03-03 17:21:35 +01:00
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
dd41366a99 Use llvm::CallSite instead of custom CallOrInvoke class. 2009-02-28 22:16:52 +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
Kelly Wilson
6511dc8239 Revert return value swapping on x86_64 2009-02-11 08:32:33 -07:00
Kelly Wilson
707c7bc29f changes to get the naked asm stuff working for x64 2009-02-10 08:02:25 -07: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
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
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
827113a0b2 Fixed another moreatatime (as opposed to oneatatime) issue with indexing unresolved class. 2008-12-09 17:14:52 +01:00
Tomas Lindquist Olsen
dcf3c96f65 Ensure all logging of llvm values/types is only called when -vv is passed 2008-11-29 23:39:04 +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
5b2a380680 Fix StdCall selection. 2008-11-25 17:15:02 +01:00
Christian Kamm
a08f244733 Don't use StdCall on Windows. 2008-11-22 21:08:00 +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
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