Commit graph

213 commits

Author SHA1 Message Date
Alexey Prokhin
2fe6817294 Fixed a druntime crash in _d_delclass 2010-10-31 12:23:35 +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
eb68fc3d8c Fixed building of LDC1. Work on arrays 2010-10-08 15:58:10 +04:00
Alexey Prokhin
41a66cf437 Use druntime functions for array operations 2010-10-08 15:10:56 +04:00
Alexey Prokhin
4d7a6eda23 Different fixes for d2 2010-10-07 22:35:32 +04:00
Christian Kamm
9cd32549c4 Improve array append performance.
Actually use the appropriate runtime function, instead of just
growing the array by one!
2010-02-14 10:11:05 +01:00
Benjamin Kramer
d24643bb50 Avoid some unecessary heap allocations by using llvm's StringRef class. 2009-08-14 01:43:30 +02: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
51c02d192a Some minor cleanups
* remove an #ifdef USE_METADATA I accidently left in
* remove now unneeded llvm-version includes
* fix indentation in metadata.h
* prevent the "Found native target" message from interrupting ccmake
2009-07-20 18:16:11 +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
Benjamin Kramer
45f7401a5b Remove all of the now unecessary #if LLVM_REV 2009-07-11 14:09:33 +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
Robert Clipsham
4fbcd9b9c4 A couple of ldc2 tweaks now druntime compiles. 2009-07-09 12:36:08 +01:00
Robert Clipsham
951e961f9e Merge. 2009-07-06 23:56:11 +01:00
Robert Clipsham
1812c5b00a Fixed some unmerged parts of the D2 frontend.
Removed the automatic linker flags for D2 (temp).
Renamed a runtime function for D2.
2009-07-06 23:54:02 +01:00
Benjamin Kramer
22b36384b0 Fix build for LLVM >= r74640
Some LLVM objects now take a 'Context' to make multi-threaded apps easier.
Since we're not multi-threaded it's safe to use llvm::getGlobalContext()
which gives us the same behavior as we had before.
2009-07-03 17:24:35 +02:00
Christian Kamm
265cbea170 Make == for associative arrays test for equality, not identity.
_aaEq was added to runtime/internal/aaA.d which forwards to
TypeInfo_AssociativeArray.equals in genobj.d. On the codegen side, DtoAAEquals
was added to gen/aa.cpp and is called from EqualExp::toElem in gen/toir.cpp.

I assume that the frontend will produce an error if == is used on associative
arrays of different type.

This fixes DMD bug 1429.
2009-06-21 19:05:24 +02:00
Frits van Bommel
465f15eda0 Return void* from _d_allocclass so LLVM doesn't do weird things with it...
This allows `-instcombine` followed by `-gvn` to do devirtualization, so add
`-gvn` in strategic places in the default pass order.
2009-06-20 11:39:13 +02:00
Frits van Bommel
f7ab031c7e Delete some code I forgot about in [1480]. 2009-06-07 23:00:53 +02:00
Frits van Bommel
e7b3f5415f Make "aa[key]" use the same runtime call as "key in aa". The runtime calls
these were using were different, but with equivalent definitions.

With `ldc -O3`, the following functions now all compile to the exact same code:
{{{
int[int] y;
void foo(int x) {
    if (x in y) {
        auto z = x in y;
        sink(*z);
    }
}

void bar(int x) {
    if (x in y) {
        sink(y[x]);
    }
}

void baz(int x) {
    if (auto p = x in y) {
        sink(*p);
    }
}
}}}
2009-05-25 12:50:40 +02:00
Frits van Bommel
371cdb71ba Remove an incorrect attribute: noalias doesn't apply to struct types, even if
we prefer to think of that type as an array :(.
2009-05-17 02:22:21 +02:00
Tomas Lindquist Olsen
dfea022a86 Changed array slice copying to call a runtime function when assertions or array bound checks are enabled instead of just doing a memcpy. This makes sure an exception is thrown if the copy is invalid (ie. different lengths or overlap). Fixes ticket #283 . Rebuilding the runtime is necessary. 2009-05-10 02:23:05 +02:00
Frits van Bommel
5723fa7492 Add 'nounwind' attribute to the relevant runtime functions, and use it when
deciding whether or not to generate an invoke instead of a call.
2009-05-04 20:26:45 +02:00
Frits van Bommel
3572944b90 Remove bogus noalias attribute from _d_arraysetlength[i]T. 2009-05-03 15:24:05 +02:00
Frits van Bommel
b6a6391116 Add some attributes to runtime calls, to provide the standard LLVM optimization
passes with more information.
2009-04-29 17:47:24 +02:00
Christian Kamm
c5a09c9deb Force initialize the runtime module in Module::genLLVMModule. It is required
for all non-trivial D modules anyway, so why load it lazily? This fixes
run/typeid_83.d (DtoDeclareTypeInfo expects runtime to be initialized)
2009-03-28 20:01:37 +01:00
Frits van Bommel
b3d87205ad Use LLVM-style command line (instead of DMD-style)
Note: For a backward compatible interface, use the new bin/ldmd script. It
      supports all old options while passing on anything it doesn't recognize.

Some changes caused by this:
* -debug and -version are now -d-debug and -d-version due to a conflict with
  standard LLVM options.
* All "flag" options now allow an optional =true/=1/=false/=0 suffix.
* Some "hidden debug switches" starting with "--" were renamed because LLVM
  doesn't care about the number of dashes, so they were conflicting with other
  options (such as -c).
  The new versions start with "-hidden-debug-" instead of "--"
* --help works, but has a non-zero exit code. This breaks some Tango scripts
  which use it to test for compiler existence. See tango.patch.

Some changes not (directly) caused by this;
* (-enable/-disable)-FOO options are now available for pre- and postconditions.
* -march is used instead of -m (like other LLVM programs), but -m is an alias
  for it.
* -defaultlib, -debuglib, -d-debug and -d-version allow comma-separated values.
  The effect should be identical to specifying the same option multiple times.
  I decided against allowing these for some other options because paths might
  contain commas on some systems.
* -fPIC is removed in favor of the standard LLVM option -relocation-model=pic

Bug:
* If -run is specified as the last argument in DFLAGS, no error is generated.
  (Not very serious IMHO)
2009-02-25 17:34:51 +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
cdbc4f84d2 Fix warnings on x86-64. By fvbommel. 2008-11-28 21:24:08 +01:00
Christian Kamm
891d17e4b5 Applied easy part from wilsonk's x86-64 patch in #107 2008-10-30 11:08:34 +01:00
Christian Kamm
cfcda83291 Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create. 2008-10-26 14:12:03 +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
6eeeafdba6 First part of rename to LDC. 2008-10-06 22:46:55 +02:00
Tomas Lindquist Olsen
60cb084af7 Updated the Tango patch to latest revision. Removed problematic (Jarrett) include <cassert> from gen/runtime.cpp 2008-10-05 02:01:50 +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
Christian Kamm
30c9af1945 Add _d_newarrayvT and _d_newarraymvT to create arrays without initialization.
Adjust DtoNewDynArray to use DtoArrayInit for initialization of new arrays.
Make Type::tvoid->defaultInit() not error.
2008-09-14 10:13:50 +02:00
Tomas Lindquist Olsen
d474fa027a Fixed most regressions from last commit. 2008-09-10 12:33:33 -07:00
Christian Kamm
ef80c904dc Make class invariants work. 2008-08-21 15:19:45 +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
d1e41f611e [svn r361] Removed some dead code. 2008-07-13 02:04:25 +02:00
Tomas Lindquist Olsen
85c1b42b1b [svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
Fixed issues with slice initialization (!!!) of multidimensional static arrays.
Attempt to fix issue with referencing nested 'this' pointers introduced in DMD 1.033 merge.
2008-07-13 01:29:49 +02:00
Christian Kamm
9f0b3fb062 [svn r335] The basics of exception handling are in place.
Still need to make sure calls are turned into invokes everywhere. (NewExpression for instance)
Still some rough edges and corner cases to figure out.
Needs testing!
2008-07-02 22:20:18 +02:00
Tomas Lindquist Olsen
0d160ffc76 [svn r330] Implemented synchronized statements.
Changed the tryfinally handlers to a more generalized EnclosingHandler.
Changed ClassInfoS to be mutable so they can be used as locks.
Added new BB after throw ala return/break etc.
2008-06-28 11:37:53 +02:00
Tomas Lindquist Olsen
67dd564222 [svn r307] Fixed: multidimensional new expressions now work. Eg.:
auto ma = new int[][] (3,9);
2008-06-21 04:47:14 +02:00
Tomas Lindquist Olsen
8b83eda2a2 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
Did a lot of smaller cleans up here and there.
Replaced more llvm::Foo with LLFoo for common stuff.
Split up tollvm.cpp.
2008-06-09 09:37:08 +02:00
Tomas Lindquist Olsen
4a2d8494a6 [svn r257] Fixed: array .sort and .reverse runtime code was incorrect.
Fixed: most runtime calls did not get correct param attrs.
2008-06-09 00:01:10 +02:00