Commit Graph

286 Commits

Author SHA1 Message Date
Frits van Bommel
3f89a04f27 Make sure instantiations of template intrinsics are marked as intrinsics. 2009-03-10 12:12:24 +01:00
Christian Kamm
fc5f35c410 Automated merge with http://hg.dsource.org/projects/ldc 2009-03-08 16:22:06 +01:00
Christian Kamm
13e83bf1c1 Improved template emission control for singleobj building. 2009-03-08 16:21:56 +01:00
Frits van Bommel
622a93a810 Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Also moved the #defines for linkage types into a separate header instead of
mars.h so we can #include revisions.h without having to rebuild the entire
frontend every time we update.
(I'm using revisions.h to get the LLVM revision for use in preprocessor
conditionals. It should work with LLVM release 2.5, old trunk and new trunk)
2009-03-08 16:13:10 +01:00
Christian Kamm
95f12f04f1 Add '-singleobj' command line switch that will tell LDC to link LLVM modules internally and only emit a single object file.
The switch allows the optimizer and inliner to run on all modules at once and opens the door for template instantiation improvements that should lower compile time and executable size.
2009-03-07 19:38:00 +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
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
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
Tomas Lindquist Olsen
c3504e59f3 Fixed alignsize for void types. (it's one byte) 2009-03-01 01:33:08 +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
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
d3ea6fb855 Fix alignment info of cdouble, cfloat. They align the same as double, float now. 2009-02-28 13:48:49 +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
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
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
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
Christian Kamm
b3de4e773e Fix #217. getInternalTypeInfo doesn't work with LDC. 2009-02-17 18:57:11 +01: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
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
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
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
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
Christian Kamm
bbcea86cf2 Follow the D ABI and pass the last arg in a register if it is a struct that fits. 2009-02-03 21:46:46 +01:00
Tomas Lindquist Olsen
dc5944df99 Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Fixed align N; in asm blocks.

Fixed inreg parameter passing on x86 for ref/out params.

Removed support for lazy initialization of function local static variables, I have no idea why I ever implemented this, it's not in the D spec, and DMD doesn't support it :P

Some of the global variable related changes might cause minor regressions, but they should be easily fixable.
2009-02-03 08:54:57 +01:00
Tomas Lindquist Olsen
75591b3c16 Changed templates and typeinfo to use linkonce linkage instead of weak linkage, this should fix inlining problems, fixing bug #197 . If problems show up, it's easy to change it back by changing the define in mars.h . I'm 95% sure this is safe, given how we handle templates. 2009-02-02 01:44:51 +01:00
Tomas Lindquist Olsen
9b85a345e9 Removed use of TARGET_LINUX and replaced with POSIX, fixes bug [172] 2009-02-02 00:58:36 +01:00
Christian Kamm
01f19c466c Fix #198 and #199 by making CTFE on static struct initializers work.
Renamed SymbolDeclaration to StaticStructInitDeclaration to make its usage clearer.
2009-02-01 20:20:56 +01:00
Christian Kamm
f2ce0df11c Port some LDC1 portability fixes to LDC2. Fixes #196. 2009-01-29 17:19:48 +01:00
Christian Kamm
c433e6fbbb Apply patch for #193. Thanks fvbommel. 2009-01-29 16:56:48 +01:00
Christian Kamm
320c22810a Fix #174. 2009-01-22 21:46:40 +01:00
Christian Kamm
ab9b9cc2e9 Solaris compatibility and proc map parsing #183, thanks BlueZeniX! 2009-01-22 18:53:32 +01:00
Christian Kamm
6594665d5d Remove optimizer syntax copies where they weren't proven to be necessary.
Copying without calling semantic() leads to issues for more complicated
expressions.
2009-01-18 14:14:40 +01:00
Christian Kamm
4e05607355 Change custom allocator new size argument to size_t instead of uint. See #175. 2009-01-18 13:10:19 +01:00
Christian Kamm
71a5ff83c7 Fix #164. 2009-01-17 17:41:03 +01:00
Tomas Lindquist Olsen
6f3aff87df Fixed 64bit problem in mtype.c with _adReverse runtime call, fixes #161 . 2009-01-10 14:35:48 +01:00
Tomas Lindquist Olsen
b3884c6d15 Removed extraneous "|| __APPLE__" in dmd/man.c, 1.039 adds an __APPLE__ specific implementation, thanx Scriptor. 2009-01-09 19:36:56 +01:00
Tomas Lindquist Olsen
dcb9628849 Merged DMD 1.039 2009-01-07 19:34:48 +01:00
Tomas Lindquist Olsen
16409a3367 Merged DMD 1.038 2009-01-06 16:33:51 +01:00
Christian Kamm
e7f750aee1 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158. 2009-01-04 15:49:28 +01:00
Christian Kamm
8f62c080e2 Add more toConstElem stubs to get better error messages. 2008-12-18 07:59:03 +01:00
Christian Kamm
dff06d0f15 Add Elrood's patch to output LDC and LLVM source revs. 2008-12-14 16:51:36 +01:00