Commit Graph

1032 Commits

Author SHA1 Message Date
Tomas Lindquist Olsen
8ce5a07fc0 Fixed potential assertion failure in taking address of function as a constant expression. 2009-03-03 17:27:14 +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
c3a53c0128 Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct. 2009-03-03 15:08:26 +01:00
Tomas Lindquist Olsen
8cad8d6c7a Merged ABI changes into D2 frontend. 2009-03-03 14:10:37 +01:00
Frits van Bommel
84963b9a03 Oops, merge with mainline and actually push this time... 2009-03-03 09:51:15 +01:00
Tomas Lindquist Olsen
6778f06dfe Fixed #218 by disabling the problematic optimization. 2009-03-03 04:41:11 +01:00
Tomas Lindquist Olsen
5dbe3ee8e2 Abstracted more (most) ABI details out of the normal codegen. 2009-03-03 02:51:21 +01:00
Frits van Bommel
a742c59a67 Pass -m32/-m64 on to gcc when assembling and linking 2009-03-01 22:59:03 +01:00
Tomas Lindquist Olsen
100815c097 Fixed find alt script. 2009-03-01 22:40:15 +01:00
Tomas Lindquist Olsen
5275ac0db4 Added script to find the alternative triple of the host. 2009-03-01 22:27:37 +01:00
Tomas Lindquist Olsen
a71b028a0f Implemented basic -m32 and -m64 options. 2009-03-01 22:27:03 +01:00
Tomas Lindquist Olsen
3d6b0b68d5 Remember to set asm type back to void and n=0 when rewriting to sret asm return. 2009-03-01 20:22:10 +01:00
Tomas Lindquist Olsen
ee1e545a0a Removed some code that wasn't supposed to be in last commit! 2009-03-01 19:06:47 +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
757601af09 Remove Tango patch that's been applied upstream. 2009-03-01 11:04:05 +01:00
Kelly Wilson
093a22d1d2 Just forgot an opcode for x64 2009-02-28 18:17:45 -07:00
Tomas Lindquist Olsen
1ba0dc70f1 Same fix for align size of void type on D2. 2009-03-01 01:34:20 +01:00
Tomas Lindquist Olsen
c3504e59f3 Fixed alignsize for void types. (it's one byte) 2009-03-01 01:33:08 +01:00
Frits van Bommel
dd41366a99 Use llvm::CallSite instead of custom CallOrInvoke class. 2009-02-28 22:16:52 +01:00
Christian Kamm
b7febcf35a Error gracefully for +=, -=, *=, /= if rhs is complex but lhs isn't. 2009-02-28 19:58:30 +01:00
Frits van Bommel
031474c724 Apply previous changes to dmd2/mtype.c as well. 2009-02-28 17:44:53 +01:00
Frits van Bommel
94790c0cdf Automated merge with http://hg.dsource.org/projects/ldc 2009-02-28 17:35:45 +01:00
Frits van Bommel
d4fdbf59a1 Use LLVM alignment data instead of hand-picked. 2009-02-28 16:09:44 +01:00
Frits van Bommel
99ed181690 Preparation for next patch. Don't ask about why this is needed.
I hate the preprocessor. Let's just leave it at that.
2009-02-28 16:09:35 +01:00
Christian Kamm
2f5b7bcd3e Readded indentation that got lost in the dmd/mars.c -> gen/main.cpp move. 2009-02-28 15:06:09 +01:00
Christian Kamm
d3ea6fb855 Fix alignment info of cdouble, cfloat. They align the same as double, float now. 2009-02-28 13:48:49 +01:00
Christian Kamm
993a624e3e Don't reset gTargetData after compiling a module. Fixes segfault when
compiling more than one file.
2009-02-28 09:06:25 +01:00
Frits van Bommel
70b97b9d1e Remove initialization of padding of reals, ireals and creals.
According to the spec and C ABIs, the contents of padding is undefined.
This was breaking dstress creal_01,02,03,07,08,09 and 20 on x86-64.

The code was apparently added to fix creal_13,14 and 15, which explicitly
compare padding and assert if it's different. I'd argue those tests are broken.
(Also, on x86-64 they *also* fail)

The tests this fixes, on the other hand, are basic arithmetic.
2009-02-27 19:41:25 +01:00
Frits van Bommel
2beff65988 Fix struct field alignment on x86-64 (for align > 8, like real.alignof) 2009-02-27 12:35:31 +01:00
Frits van Bommel
03ce6604a0 Fix cfloat return on x86_64: only perform ABI transformation for non-extern(D)
functions.
There's no need to waste cycles with extern(D), which we get to define
ourselves. Fixes tests/mini/asm8.d. (Since the asm abiret code already assumed
{xmm0, xmm1} returns)
2009-02-26 23:35:39 +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
693e796893 Fixed druntime lib path in ldc2.conf.in, thanks Matt 2009-02-26 18:43:25 +01:00
Tomas Lindquist Olsen
bcd05cf258 Added some missing version identifiers. 2009-02-26 18:28:50 +01:00
Tomas Lindquist Olsen
7ef533b136 Fixed debug info for globals in D2. 2009-02-26 18:02:13 +01:00
Tomas Lindquist Olsen
886a66f4e0 Missing %s error param in main.cpp 2009-02-26 15:51:19 +01:00
Frits van Bommel
001f83a296 Don't crash if we don't know what ABI to use. Assume some defaults instead. 2009-02-26 15:23:52 +01:00
Frits van Bommel
695fc3f5c3 Fix some -vv output 2009-02-26 14:51:05 +01:00
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
Tomas Lindquist Olsen
58a8711bc1 Fixed const/invariant struc/class fields of the form const int i = 4; they don't add a field. 2009-02-26 15:24:20 +01:00
Frits van Bommel
1a155e6439 Fix dstress runner to use ldmd 2009-02-26 14:49:32 +01:00
Frits van Bommel
ff31c804a9 Fix x86_64 cfloat support to work on intended target :) 2009-02-26 14:48:47 +01:00
Tomas Lindquist Olsen
d5d15cdc05 oups, seems like I broke some constness in D1 last commit, compiles again! 2009-02-26 14:23:18 +01:00
Tomas Lindquist Olsen
024946219a Forgot new files that were supposed to be in last commit. 2009-02-26 14:13:27 +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
Frits van Bommel
f61733cb57 Call llvm_shutdown when shutting down the backend. 2009-02-25 19:30:06 +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
Frits van Bommel
6a02292c10 Clean up regexes in .hgignore, making it more strict. 2009-02-19 13:51:44 +01:00
Frits van Bommel
9259089c2b Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Added it to .hgignore.
This gets rid of spurious differences caused by CMake regenerating it differently.
Just run 'cmake .' to get it back in your local checkout.
2009-02-19 13:50:05 +01:00
Frits van Bommel
ad7ad71e11 Fix out-ouf-source build for runtime as well.
To build out-of-source, follow these steps:
    # [[Insert LLVM build instructions here]]
    mkdir my_build_dir
    cd my_build_dir
    svn co http://svn.dsource.org/projects/tango/trunk tango
    ccmake <PATH_TO_SOURCE>
    # (Regular ccmake stuff, press 'c' a few times followed by 'g')
    make
    make runtime
    # add `PWD`/bin to PATH

closes #213
2009-02-19 11:01:34 +01:00
Frits van Bommel
bfacf4477c Add explicit paths to revisions.* to unbreak out-of-source build. 2009-02-19 00:50:35 +01:00