Commit Graph

3287 Commits

Author SHA1 Message Date
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
Christian Kamm
89bf7d82d7 Change the numbering of static ctors/dtors to be module based instead of being global.
This fixes #210 by making sure that the static ctor always gets the same
number, regardless of the order of the modules given at the command line.
2009-02-15 11:46:28 +01:00
Christian Kamm
0676cf018d Make sure debug info uses the right compilation units - in particular the
current cu if a symbol is a template instance. Fixes #211.
2009-02-14 21:18:47 +01:00
Tomas Lindquist Olsen
4dee095dc3 Added support for using a temporary to implement emulated ABI return from inline asm, could be easier to use, but I think this will do. It's so extremely target dependent in any case that doing a completely generic approach seems hard. 2009-02-14 15:25:48 +01:00
Tomas Lindquist Olsen
3e17a21e0b Merged a bunch recent dmd v1 frontend changes into the dmd v2 tree. 2009-02-13 22:20:30 +01:00
Christian Kamm
cedd029720 Automated merge with http://hg.dsource.org/projects/ldc 2009-02-12 18:39:14 +01:00
Christian Kamm
b3524ef5f4 Now that we're using LLVM 2.5, we can stop always running the
CFGSimplification pass.

The pass was originally added as a workaround for a LLVM 2.4 bug where debug
info would reference labels that have been optimized away.
2009-02-12 18:39:03 +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
Christian Kamm
a4ca550874 Revert templates to old behavior.
While emitting a template instantiation only once is good for compile times
and binary sizes, it doesn't work with linkonce linkage as inlined function
bodies could be discarded. Since we don't want to inhibit inlining, templates
are reverted to the previous behavior, where an instantiation is emitted for
each module using it.

In the future, a custom inlining pass may allow us to switch back to
common/weak linkage and reenable smart template instance emission.
2009-02-08 21:44:46 +01:00
Christian Kamm
789eefd943 Switch some getModule to getCompilationModule to make sure templates are
emitted in the right module.
2009-02-08 18:51:32 +01:00
Christian Kamm
7c93355672 Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Add getCompilationModule to Dsymbol and fix template compile unit decision code.
Runtime compiles with -g again.
2009-02-08 16:50:22 +01: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
Tomas Lindquist Olsen
3f7c7c5327 Fixed accessing function symbols from inline asm.
Ran x86(-64) asm processors through a code formatter.
2009-02-08 05:14:24 +01:00
Tomas Lindquist Olsen
54c3e2cf0c Reverted the template instantiation changes from rev [940]. Wasn't safe it seems :( 2009-02-05 18:17:42 +01:00
Tomas Lindquist Olsen
319e058410 Reverted back to the LLVM_InlineAsm_X86 versions, a few more things still needs to be sorted out first. 2009-02-04 20:47:27 +01:00
Christian Kamm
ab521c06ff LDC should follow the D ABI now. Switch back from LLVM_InlineAsm_X86 to
D_InlineAsm_X86.
2009-02-04 18:51:11 +01:00
Tomas Lindquist Olsen
9bd52922bd Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases. 2009-02-04 18:48:03 +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
1e8eae2e5d Fixed warning on osx as per request from mwarning. 2009-02-04 16:02:05 +01:00