Commit graph

595 commits

Author SHA1 Message Date
Alexey Prokhin
71f653f19b Fixes for closures 2010-12-15 17:05:16 +03:00
Alexey Prokhin
3eb6b5e8c8 Fixed a crash when compiling test runnable/A16. 2010-12-14 14:35:52 +03:00
Eldar Insafutdinov
410cb0dc4e fix building of ldc1 2010-11-05 22:40:36 +00:00
Alexey Prokhin
14c6dfb895 Added pointers to shared constructors and destructors to ModuleInfo. 2010-11-05 17:40:29 +03:00
Alexey Prokhin
b1e5993873 Started work on phobos 2010-10-27 18:13:46 +04:00
Alexey Prokhin
4d7a6eda23 Different fixes for d2 2010-10-07 22:35:32 +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
4c5457ba61 getNullValue is in Constant again
Requires LLVM >= r77721
2009-07-31 23:01:29 +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
c261c03752 Put scope-limited data on the stack instead of using 'new' and 'delete'. 2009-06-20 19:44:54 +02:00
Christian Kamm
42b3da8ac7 Move function codegen data from IrFunction to new FuncGen.
This change reduces memory consumption significantly by releasing the
memory held by the STL containers that are now inside FuncGen.
2009-06-20 19:11:44 +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
25ebb3dbcd Generate less dead code by deleting unreachable blocks at the end of functions
(which would otherwise appear if a function ends with a return, for example).
2009-06-12 16:41:38 +02:00
Tomas Lindquist Olsen
092381577f Some minor changes to handling of variables referenced from nested functions in D2 .
Added generation of new 'void*[4] reserved;' !ModuleInfo member .
2009-06-03 03:04:47 +02:00
Frits van Bommel
2739cd108c Let TargetABI::passByValue() know when a parameter is byref (either explicitly
or because it's a static array) by giving it the pointer type instead of the
type itself.
This fixes Derelict compilation on x86-64, where the ABI wasn't expecting a
static array to be passed in at all.
2009-05-22 00:19:54 +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
Frits van Bommel
541f3723cd Intrinsics shouldn't see struct padding, so use a special TargetABI for them
that removes it.
This unbreaks the `llvm_*_with_overflow` intrinsics.
2009-05-16 13:06:49 +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
Christian Kamm
8916f783b7 Revert change to treat bodyless functions in abstract classes as abstract.
See DMD bug 2894.
2009-04-25 09:11:32 +02:00
Christian Kamm
f6772bd600 Add forgotten null check. 2009-04-21 19:17:29 +02:00
Christian Kamm
0e6364a158 Automated merge with http://hg.dsource.org/projects/ldc 2009-04-21 18:57:29 +02:00
Tomas Lindquist Olsen
b3db60cbda Merge. 2009-04-21 17:54:43 +02:00
Frits van Bommel
0e8216fbd6 Remove some logging I didn't mean to commit. 2009-04-20 00:04:35 +02:00
Frits van Bommel
21f273671a Fix a problem which occurred when a function type was forward-referenced by
parameter types.

This was intended to fix the following test case:
{{{
  void delegate(Hit) dg;
  struct Hit { void delegate(Hit) a; }
}}}
which ChristianK reduced from a problem downs had on IRC.

It also seems to fix mini/compile_delegate.d (which turns out to be quite
similar, but produced a different error message).
2009-04-19 23:15:03 +02:00
Christian Kamm
522c580647 Do not emit declare or emit a vtbl entry for bodyless functions in abstract classes.
Maybe the better fix would be to adjust FuncDeclaration::isAbstract, but there
may be unwelcome sideeffects.
2009-04-19 00:06:23 +02:00
Tomas Lindquist Olsen
1437bd6b7e Merge. 2009-04-16 20:31:21 +02:00
Tomas Lindquist Olsen
02466de996 Removed invalid assertion. 2009-04-16 20:30:30 +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
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
751f528969 Implement -nested-ctx=hybrid 2009-04-12 20:23:00 +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
Christian Kamm
42da8b98b1 Do not skip abstract function declarations if they have a function body. Fixes abstract_17_A,B. 2009-03-28 20:25:59 +01:00
Tomas Lindquist Olsen
740cdaa588 Fixed forward reference problem in struct methods on x86-64. 2009-03-28 09:00:32 +01:00
Tomas Lindquist Olsen
99b863e2b1 Added initial support for raw LLVM inline asm. 2009-03-28 06:32:06 +01:00
Tomas Lindquist Olsen
36f6ebc77f - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
- Eliminated the DLRValue DValue.

- Implemented proactive handling of l-value CastExpS.

- Minor tweak in runtime memory.d .
2009-03-28 05:00:43 +01: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
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
Frits van Bommel
0182641f85 Ignore the ABI some more for intrinsics 2009-03-09 03:44:11 +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
1c6c4bc361 Two small bugfixes:
- See through typedefs and enums in passByVal
 - Don't depend on TypeFunction::parameters->dim being the actual number of
   parameters; it contains unexpanded tuples as single elements.
2009-03-06 19:12:48 +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
b8e9d554e5 Fixed lazy arguments again. 2009-03-05 18:33:20 +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
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