Commit Graph

317 Commits

Author SHA1 Message Date
Tomas Lindquist Olsen
3d1f8cc565 Merged DMD 1.042. 2009-04-03 17:59:34 +02:00
Tomas Lindquist Olsen
57bf95cb42 Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041. 2009-04-03 17:02:52 +02:00
Frits van Bommel
b7b54b5878 Don't expand tilde ('~') in paths unless it's the first character of the path
in question.
This should fix #255.
2009-04-03 16:35:47 +02:00
Tomas Lindquist Olsen
9c4b2b4036 Started seperating type resolution from the rest of codegen again, the merge had too many regressions. 2009-04-03 16:34:11 +02:00
Christian Kamm
8d01068c9b Apply small includes patch for FreeBSD. Thanks kimelto! 2009-04-02 19:16:44 +02:00
Tomas Lindquist Olsen
c6e9f7f9e2 Moved ir/irtype.* into ir/irdtype.*.
Renamed IrType to IrDType, analogous to IrDSymbol.
2009-03-31 20:21:28 +02:00
Frits van Bommel
aa8aad611c Commit requested by lindquist. 2009-03-31 03:06:19 +02:00
Frits van Bommel
972fca5729 Fix #246 by running type->semantic() on parameters so tuples are expanded. 2009-03-29 23:57:51 +02:00
Christian Kamm
c9b82af9f2 Add newlines to end of file. 2009-03-29 19:19:32 +02:00
Frits van Bommel
e129494812 Allow specific optimization passes to be requested from the command line.
Now you can run "`ldc test.d -c -mem2reg -simplifycfg`" if you feel the urge.
The -O<N> options are still supported, and are inserted in the passes list in
the position where they appear on the command line.
(so -simplifycfg -O1 -instcombine does the "right thing")

One small change: -inline is renamed to -enable-inlining due to a naming
conflict with the option to add the -inline pass. -inline now inserts the
inlining pass in the position specified, not in the middle of -O<N>.
(ldmd has been updated to translate -inline to -enable-inlining)
2009-03-29 15:46:55 +02:00
Christian Kamm
f179acda32 Automated merge with http://hg.dsource.org/projects/ldc 2009-03-29 11:44:32 +02:00
Christian Kamm
d7de486493 A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
Fixes run/const_15, run/c/const_16_B.
The price is removing the lvalueness of struct literals. If it turns out too
much code depends on this behavior or we don't want to break with DMD, we
could keep struct literals as lvalues and instead convert struct literals used
as expression initializers into struct initializers.
2009-03-29 11:43:45 +02:00
Frits van Bommel
2586278349 This should fix integers below 64 bit on big-endian systems. 2009-03-29 01:29:30 +01:00
Christian Kamm
875a8b25b2 Fix bug in CaseStatement::semantic when there's no enclosing switch. 2009-03-28 21:10:53 +01:00
Christian Kamm
b2e601bd74 Add back some enclosing scope-exit information to the frontend to produce
proper error messages inside switch statements.
2009-03-28 14:39:16 +01:00
Christian Kamm
99168f443f Fix goto inside synchronized functions. 2009-03-28 14:26:23 +01:00
Tomas Lindquist Olsen
1809214995 Added support for single D type register return from __asm. 2009-03-28 07:24:53 +01:00
Tomas Lindquist Olsen
99b863e2b1 Added initial support for raw LLVM inline asm. 2009-03-28 06:32:06 +01:00
Tomas Lindquist Olsen
36f6ebc77f - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
- Eliminated the DLRValue DValue.

- Implemented proactive handling of l-value CastExpS.

- Minor tweak in runtime memory.d .
2009-03-28 05:00:43 +01:00
Tomas Lindquist Olsen
ec986231e5 Eliminated the need for resolve, declare, const-init and define lists to drive code generation. 2009-03-27 21:50:32 +01:00
Tomas Lindquist Olsen
daef67acc3 Changed use of toObjFile to a new codegen method.
More versioning of DMD specific codegen code.
2009-03-27 17:54:27 +01:00
Tomas Lindquist Olsen
c42c90ea80 * Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
* Added #if IN_DMD versioning around DMD backend specific code in the D1 frontend, D2 is currently broken.
* All part of a greater cleanup scheme.
2009-03-26 20:45:53 +01:00
Christian Kamm
31b46683e8 Fix to synchronized function storage class when getting the classinfo via dotExp. 2009-03-25 08:13:01 +01:00
Christian Kamm
671c7791e3 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
implement the synchronized storage class for functions.
2009-03-24 21:18:18 +01:00
Tomas Lindquist Olsen
3ac45285fc Cleanup DMD 1.041 merge. 2009-03-23 20:26:33 +01:00
Christian Kamm
372b40dd94 Fix tuple declarations in aggregates. 2009-03-23 14:47:51 +01:00
Frits van Bommel
434cb74980 Fix a bug where ::warning() was called with a va_list argument instead of an
actual vararg list.
Also cleaned up the format for warnings. (Previously some would start with
"warning - warning - Warning:" which was a bit redundant)
2009-03-18 15:03:17 +01:00
Frits van Bommel
bc9fae17a8 Another "pointers are 32 bits" issue in the frontend. long/ulong constants cast
to pointers were truncated to 32-bit values.

Closes #234.
2009-03-15 15:58:38 +01:00
Kelly Wilson
2a396614ad Fix 32bit "+2" typo for Outbuffer::reserve 2009-03-13 07:17:29 -06:00
Kelly Wilson
ff33ed6d74 Revert removal of "+2" from Outbuffer::reserve function for x64. Unless
somone can fix this properly, then the "+2" must stay in or tango won't
build.
2009-03-12 17:10:24 -06:00
Tomas Lindquist Olsen
8b751cce0e - Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
2009-03-12 20:37:27 +01:00
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