Commit Graph

723 Commits

Author SHA1 Message Date
Frits van Bommel
7e99e31b91 Clean up some suspicious code.
There's no guarantee a constant of integer type is a ConstantInt, so it's not
safe to just cast<> these to ConstantInt. (It could be a constant expression,
for example)

The code is shorter this way too :).
2009-03-29 03:27:04 +02:00
Christian Kamm
ca6a07e2e5 Emit function bodies before generating the module info to make sure static
ctors are collected correctly. Fixes run/constructor_03.
2009-03-28 20:45:33 +01:00
Christian Kamm
42da8b98b1 Do not skip abstract function declarations if they have a function body. Fixes abstract_17_A,B. 2009-03-28 20:25:59 +01:00
Christian Kamm
c5a09c9deb Force initialize the runtime module in Module::genLLVMModule. It is required
for all non-trivial D modules anyway, so why load it lazily? This fixes
run/typeid_83.d (DtoDeclareTypeInfo expects runtime to be initialized)
2009-03-28 20:01:37 +01:00
Christian Kamm
0ef57dcfbe Reenable error for gotos into or out of finally blocks. 2009-03-28 19:16:53 +01:00
Tomas Lindquist Olsen
14b8aff809 Fixed issue with runtime supplied typeinfo generating multiple symbols.
Added new ldc.llvmasm import in runtime cmake file.
2009-03-28 09:45:33 +01:00
Tomas Lindquist Olsen
740cdaa588 Fixed forward reference problem in struct methods on x86-64. 2009-03-28 09:00:32 +01:00
Tomas Lindquist Olsen
e61562033d Added support for tuple return with __asmtuple!(int,int) etc. 2009-03-28 08:25:58 +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
be3bfbff5d Fixed problems introduced by previous commits that prevented Tango from compiling. 2009-03-27 23:17:04 +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
Tomas Lindquist Olsen
367b8da8f4 Moved IRTargetScopeS from IRState into IrFunction, fixes #240 . 2009-03-26 18:46:21 +01:00
Christian Kamm
c189b011b5 Automated merge with http://hg.dsource.org/projects/ldc 2009-03-24 21:18:29 +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
Frits van Bommel
479b97ca87 Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
2009-03-24 15:24:59 +01:00
Christian Kamm
a0d93e699a Automated merge with http://hg.dsource.org/projects/ldc 2009-03-24 14:34:16 +01:00
Christian Kamm
eb1deec50d Fix #239. 2009-03-24 14:33:57 +01:00
Frits van Bommel
058998f1ad Update comments now that LLVM PR3861 has been fixed. However, since
conditionally removing the workaround makes the ABI dependent on LLVM version,
I reconsidered that.
(The same revision of LDC compiling for the same target should probably produce
code that follows the same ABI, right?)
2009-03-24 02:46:57 +01:00
Frits van Bommel
2dcc7be873 Workaround for LLVM PR 3861 (http://llvm.org/PR3861).
(LLVM abort()s in codegen if the second integer in a return value is <= i8 on
x86/x86-64)

This was breaking native compilation of Tango's TempFile module on x86-64.
2009-03-23 01:01:55 +01:00
Frits van Bommel
d0a8ee9573 Return null from a static class to interface cast if the class reference was
null. Fixes #237.
2009-03-20 15:50:01 +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
b237079854 Fun with parameter attributes: For several of the "synthetic" parameters added
to D functions, we can apply noalias and nocapture. They are sret parameters,
'nest' pointers passed to nested functions, and _argptr:
Nocapture:
 - Sret and nest are nocapture because they don't represent D-level variables,
   and thus the callee can't (validly) obtain a pointer to them, let alone keep
   it around after it returns.
 - _argptr is nocapture because although the callee has access to it as a
   pointer, that pointer is invalidated when it returns.

All three are noalias because they're function-local variables
 - Sret and _argptr are noalias because they're freshly alloca'd memory only
   used for a single function call that's not allowed to keep an aliasing
   pointer to it around (since the parameter is nocapture).
 - 'Nest' is noalias because the callee only ever has access to one such pointer
   per parent function, and every parent function has a different one.

This commit also ensures attributes set on sret, _arguments and _argptr are
propagated to calls to such functions.

It also adds one exception to the general rule that attributes on function types
should propagate to calls: the type of a delegate's function pointer has a
'nest' parameter, but this can either be a true 'nest' (for delegates to nested
functions) or a 'this' (for delegates to member functions). Since 'this' is
neither noalias nor nocapture, and there's generally no way to tell which one it
is, we remove these attributes at the call site if the callee is a delegate.
2009-03-14 22:15:31 +01:00
Frits van Bommel
457ccf751a Disable this for -release, -disable-boundscheck, etc. 2009-03-14 01:32:10 +01:00
Frits van Bommel
85a3433791 Call _d_array_bounds when an associative array is indexed with a non-existent
key (unless it's being assigned to). Closes #233.
2009-03-14 01:22:05 +01:00
Frits van Bommel
1e6bd8f8e8 Hopefully fix #232 2009-03-13 19:22:40 +01:00
Frits van Bommel
ad46ec8bd0 Split out LLVM_REV into separate header, to reduce rebuilding when only the LDC
revision has changed.
2009-03-13 16:18:43 +01:00
Frits van Bommel
8b185b8b6a Fix field access from inline asm. See tests/mini/asm10.d 2009-03-12 23:48:43 +01:00
Frits van Bommel
ed9af11856 Apply r1106 to x86-64 asm too 2009-03-12 23:31:26 +01:00
Tomas Lindquist Olsen
4399ff3700 Corrected bad asm match for fstp on x86-32 2009-03-12 23:12:36 +01:00
Tomas Lindquist Olsen
269e37dc88 - Fixed building tango-user-ldc on x86-32.
- Added CMake option for extra LLVM components to be linked in.
2009-03-12 22:30:30 +01: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
ff354d59b2 Use stringstream in asm generation instead of OutBuffer.
Besides looking better, this should reduce allocations and copying.
2009-03-12 14:08:57 +01:00
Frits van Bommel
c1bd2234a9 Clean up asm code a bit.
- Use vector instead of Array, reducing allocations.
 - Use vectors instead of deques since we only push_back and index.
 - Remove redundant typedefs of iterators.
 - Comment out unused variable (used only in commented-out GDC code).
 - A few whitespace changes.
2009-03-12 14:08:57 +01:00
Frits van Bommel
723ae9f9d5 Fix an error in the ASM tables introduced by the recent fistp fixes.
(There are only 3 fields for operands)
2009-03-12 14:08:57 +01:00
Kelly Wilson
6e44efb9d2 Logic error fix 2009-03-11 13:54:29 -04:00
Kelly Wilson
e5a4e4cb41 Fix FS:4 problem for x32 2009-03-11 12:13:41 -04:00
Kelly Wilson
15a19c738f Fix FS:4 miswrite due to earlier changes for a constant displacement 2009-03-11 09:16:41 -06:00
Frits van Bommel
8bb206447f Add missing EBX clobber to CPUID asm instruction. 2009-03-11 14:17:13 +01:00
Kelly Wilson
cff2c92fd3 Change faulty offset for asm in Cache.d (ie. change "-20(%rbp)+4)" to
"4+-20(%rbp)")
2009-03-11 00:08:45 -04:00
Kelly Wilson
85090ef9c9 Change x64 asm in Cache.d from a positive offset from after rbp "-20(%rbp)+4" to before
"4+-20(%rbp)"
2009-03-10 22:02:11 -06:00
Kelly Wilson
40887efe59 Fix for x32 fmul/div/add/sub with no operands. 2009-03-10 20:40:22 -04:00
Kelly Wilson
58d34a9660 Fix for fmul/div/add/sub with no operands. Revert explicit ST0 definition since a typo
had caused the need for that.
2009-03-10 18:34:19 -06:00
Frits van Bommel
475061ffeb Merge 2009-03-11 01:01:40 +01:00
Kelly Wilson
2d11484649 fix fistp properly for x32 2009-03-10 13:59:50 -04:00
Kelly Wilson
d13e841511 Merging 2009-03-10 11:08:35 -06:00
Kelly Wilson
e59c7db637 Properly fix fistp for x64 2009-03-10 11:06:38 -06:00