Commit graph

142 commits

Author SHA1 Message Date
Tomas Lindquist Olsen
3cf7b6a95c Fixed potential crash with complex recursive struct types. 2009-07-26 19:12:37 +02:00
Benjamin Kramer
d7049de966 More factory methods moved to LLVMContext 2009-07-15 18:09:41 +02:00
Benjamin Kramer
0ee2f34611 Don't use llvm::getGlobalContext() anymore 2009-07-13 20:16:15 +02:00
Benjamin Kramer
331319dab1 Build fix for the latest LLVMContext changes (LLVM r75445)
This shouldn't break the build with older LLVM revs. We include
LLVMContext.h in gen/llvm.h now to make the transition a little bit
easier.
2009-07-13 12:17:58 +02:00
Christian Kamm
8bbf6ab984 Treat ConditionalDeclarations correctly in DtoDeclarationExp.
Fixes #332.
2009-06-26 17:18:36 +02:00
Christian Kamm
d7b00783d3 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-20 19:12:04 +02:00
Christian Kamm
42b3da8ac7 Move function codegen data from IrFunction to new FuncGen.
This change reduces memory consumption significantly by releasing the
memory held by the STL containers that are now inside FuncGen.
2009-06-20 19:11:44 +02:00
Robert Clipsham
f13c5e82f5 Added a stripModifiers() function to remove shared|const|immutable storage classes in D2 (should eventually be moved to a dhelpers file rather than llvm helpers).
Replaced a few occurances of STCinvariant with STCimmutable.
2009-06-18 15:44:04 +01:00
Kelly Wilson
0c1b6e27d9 fix problem reported in ticket 327 - thanks d0k 2009-06-16 08:57:20 -06:00
Frits van Bommel
96fdcd6347 Run semantic3 on imported modules, and emit new symbols with
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
2009-06-07 16:00:13 +02:00
Frits van Bommel
1958e17734 Rewrite StructLiteralExp::toElem to store individual fields instead of
generating a constant to fill the entire struct with a single `store`.
This is much more efficient at compile time (fixing #320) and vastly reduces
the size of the emitted code. Since LLVM no longer needs to keep the data for
all fields in "registers" until the store happens, it should also be more
efficient at run time in cases where the fields aren't assigned with constants.

There's also some code clean-up by removing duplicated logic.
2009-06-06 20:16:13 +02:00
Christian Kamm
b4f8bd6e52 Fix #318 by making a list of all seen template instances in a module for
singleobj compilation and then making sure they get emitted in their entirety.
2009-06-06 09:47:32 +02:00
Tomas Lindquist Olsen
062b6d93c4 Make sure typeinfo output are mutable types, this is a temporary workaround to get druntime genobj.d to compile until we figure out what typeinfos are actually needed here and there ... 2009-06-03 04:12:28 +02:00
Tomas Lindquist Olsen
f6997cb604 D2:
Applied function type from D1 frontend that got removed in D2, it's critical for member function type to be correct.

Fixed a bunch of type discrepancies in druntime object.di vs. genobj.d .

Disabled (#if 0) some potentally very large type dumps for -vv .

Updated classinfo and typeinfo generation for D2, almost complete now.

Added finer grained checks for vtbl type mismatching, aids debugging.
2009-06-03 02:28:48 +02:00
Frits van Bommel
cf5ad1a5b0 Remove some unnecessary #ifs. The D1 frontend has a Type::nextOf() which just
returns `next`.
2009-06-02 18:41:10 +02:00
Robert Clipsham
c5be82c5ae LDC 2 compiles again. 2009-05-30 17:23:32 +01:00
Christian Kamm
5b799deeb4 Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad. 2009-05-23 00:23:39 +02:00
Frits van Bommel
adfc5b3ee9 Fix scope(exit) foreach (ref v; arr) foo(v); 2009-05-22 21:38:01 +02:00
Christian Kamm
c433604243 Fix bug #307 by doing what DMD does: add the arrayop to
sc->module->importedFrom instead of sc->module. That way array ops in template
instantiations will be semantic3'ed.
2009-05-22 10:17:47 +02:00
Christian Kamm
f675d36cfb Tentative fix for semantic3 on imported modules and unnecessary template
function definition issue. Please test!
Also change linkage of __interfaceInfos to external (same as __Class, __vtbl,
__init). The other change might make this superfluous.
2009-05-21 10:56:04 +02:00
Tomas Lindquist Olsen
0680e6a3ca Enabled fix for ticket #294 . It will try it's best to let LLVM handle the alignment, and fall back to manual padding when that's not possible. If this causes problems again, we'll have to consistently pad manually using packed structs. 2009-05-15 17:05:35 +02:00
Tomas Lindquist Olsen
ad142b5fda Erm... Revert the rev [1352] change, the original code was correct ... 2009-05-15 15:30:59 +02:00
Tomas Lindquist Olsen
a0678dc9ec Oups, fix assertion condition in disabled code from rev [1351]. 2009-05-14 17:23:55 +02:00
Tomas Lindquist Olsen
b147ecc66d Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset . 2009-05-14 17:20:17 +02:00
Tomas Lindquist Olsen
f5d635dfc7 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 . 2009-05-14 13:26:40 +02:00
Tomas Lindquist Olsen
ca39bb4f4d Fixed array operation codegen when used from imported templates. All array operations are now emitted with template linkage. Fixed #270 . 2009-04-29 18:59:39 +02:00
Tomas Lindquist Olsen
617861ead4 Fixed file name in imported mixins containing assertions. 2009-04-29 18:39:59 +02:00
Tomas Lindquist Olsen
95b94935ee Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.
Fixed filenames for array bounds errors and probably others, fixes #271 .
2009-04-27 13:30:48 +02:00
Tomas Lindquist Olsen
687395cda6 Rewrote runtime struct literal codegen. 2009-04-22 03:08:28 +02:00
Tomas Lindquist Olsen
37cf5a5789 Added Doxygen file.
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
2009-04-15 20:06:25 +02:00
Frits van Bommel
b5af30636e Isolate all knowledge of what a function's nested context looks like in a
single place. No functional change.
2009-04-12 13:08:24 +02:00
Frits van Bommel
605593bcef Reduce include-order dependencies 2009-04-12 12:52:01 +02:00
Christian Kamm
04f3c61b97 Make sure debug info is only declared once per alloca. 2009-04-02 20:56:39 +02:00
Frits van Bommel
3f49ddb6d5 Fix nested references to 'ref' foreach variables.
These "walk around" the array being iterated over, so they're a bit trickier
than other variables to get right.
2009-04-01 00:01:44 +02:00
Frits van Bommel
9af4c078a0 Another big-endian fix. (Don't lie to [s]printf...) 2009-03-29 03:53:22 +02: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
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
367b8da8f4 Moved IRTargetScopeS from IRState into IrFunction, fixes #240 . 2009-03-26 18:46:21 +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
5e95a6640e Move "invalid intrinsic name" error to declaration, not instantiation. 2009-03-10 11:30:51 +01:00
Frits van Bommel
5d9bd5d139 Intrinsics overhaul:
- More error checking for pragma(intrinsic)
 - Properly handle templating for real (use actual nr of bits, not .sizeof * 8)
 - Template all .i* and .f* intrinsics
   - The old names are deprecated aliases now

I also added a preliminary patch to make tango.math.Math use the new versions.
(I think it looks a lot nicer now)
2009-03-10 04:45:32 +01:00
Christian Kamm
13e83bf1c1 Improved template emission control for singleobj building. 2009-03-08 16:21:56 +01:00
Frits van Bommel
cc612c7290 Fix hasUnalignedFields(): take static arrays into account too. 2009-03-04 23:17:32 +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
ee1e545a0a Removed some code that wasn't supposed to be in last commit! 2009-03-01 19:06:47 +01:00
Tomas Lindquist Olsen
61dfb11bc5 - Fixed x86-32 C ABI for complex number return values.
- Removed unused code from the ABI class.
2009-03-01 19:01:05 +01:00
Frits van Bommel
dd41366a99 Use llvm::CallSite instead of custom CallOrInvoke class. 2009-02-28 22:16:52 +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