Commit Graph

1007 Commits

Author SHA1 Message Date
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
Frits van Bommel
9ab133963d Update some testcases now that 64-bit immediates are working. 2009-02-18 23:18:34 +01:00
Frits van Bommel
8ce2c9773e Clean up the code generated when jumping out of inline asm and make label names more expressive. 2009-02-18 22:50:22 +01:00
Frits van Bommel
e3d6b1c051 Fix some assembler issues:
The assembler was miscompiling "add" (specifically, the "add reg/mem, imm"
variations).
The change that caused this seems to have been made because without it, some
"add"s didn't compile at all.

This patch reverts the previous change, and makes sure assembler operands are
remapped correctly even though the input operands auto-generated due to
updating operations aren't explicitly used.
2009-02-18 21:46:14 +01:00
Frits van Bommel
3ee7952451 Fix a latent bug in the asm code.
I think that technically, using "*m0" instead of "*0" allows LLVM to pick
between using the same memory as output 0 and using a new memory location.
(So far I haven't been able to construct a testcase that actually breaks
because of this, though)
2009-02-18 03:38:12 +01:00
Frits van Bommel
976096811c Update .hgignore due to moved(?) idgen/impcnvgen locations.
Also add *.patch and *.diff.
2009-02-17 23:14:19 +01:00
Christian Kamm
461544fce8 Fix for fix from [974]. 2009-02-17 19:08:38 +01:00
Christian Kamm
b3de4e773e Fix #217. getInternalTypeInfo doesn't work with LDC. 2009-02-17 18:57:11 +01:00
Christian Kamm
f62df176d6 Allow 'return exp;' for void main().
It's unfortunate that for main the llvm type and D type don't match up...
2009-02-17 18:53:15 +01:00
Christian Kamm
d6a264e74b Fix #216 by implementing TypeExp::toElem. It just provides the appropriate
error message.
2009-02-17 18:25:34 +01:00
Frits van Bommel
aa85c805c1 Change the way the version is printed (more verbose, with short hash)
If the user has patches managed by the mq extension, the version and hash
printed are those of the qparent revision (the revision the patches were
applied on top of) instead of tip.
Also fixes a bug: print LLVM revision even if there are local modifications to
it.
Sorry for the long line in the perl file. I have no idea how to break it up.
2009-02-17 01:13:18 +01:00
Frits van Bommel
9cad440d4c Fix the problems exposed by the callingconv1.d test case.
The first was that unless otherwise specified, inputs are assumed to be in
registers even if they specify a "matching output" that's in memory.

While testing that fix, I also ran into a bug causing the generated "matching
output" for any input was always the first one instead of the correct one.
2009-02-17 00:08:20 +01:00
Frits van Bommel
7c7ed26a17 Revert wilsonk's "fix" for the callingconv1.d problem. 2009-02-16 23:56:56 +01:00
Frits van Bommel
f5bd002d80 Add some extra debug output that's useful in diagnosing inline assembler bugs. 2009-02-16 23:56:56 +01:00
Frits van Bommel
9186ee8935 Fix {,w,d}char handling in tests/mini/vararg6.d:print() 2009-02-16 19:31:10 +01:00
Christian Kamm
913669eab5 Fix test on x86-32. 2009-02-16 19:17:15 +01:00
Christian Kamm
51385fe325 Reduce size of integer constant make x86-64 asm parsing code compile on x86-32. 2009-02-16 18:27:33 +01:00
Kelly Wilson
62e0f85043 Merging fvbommels fix for asm8.d x86-64 code 2009-02-15 23:09:53 -07:00
Kelly Wilson
b77c44b7dc Fix for tests/mini/callingconv1.d 2009-02-15 22:56:10 -07:00
Frits van Bommel
347cfc419d Some changes I missed in my last commit (wound up in wrong patch file) 2009-02-16 01:43:14 +01:00
Kelly Wilson
7ea5df5a26 Fix 32 bit truncation of 'asm { movq RAX, 0xAA_1234_5678; }'...ie. move constant larger than 32 bits 2009-02-15 16:30:15 -07:00
Kelly Wilson
cc02076479 Fix shl/r bad operand size error 2009-02-15 16:26:12 -07:00
Christian Kamm
648e0b02cc Add OSX version declaration for Mac OS X to improve dmd-mac compatibility. 2009-02-15 21:44:03 +01:00
Frits van Bommel
2dec6aeb41 Implement implicit return after inline asm on x86_64 2009-02-15 18:04:22 +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
5471533dd0 Backed out changeset [369996c08420].
The argument and order dependent numbering of static ctors/dtors generally doesn't matter
because other modules shouldn't reference their symbols. The next changeset
will fix a LDC bug that caused such references within ModuleInfo.
2009-02-15 14:50:33 +01:00