Commit Graph

1301 Commits

Author SHA1 Message Date
Frits van Bommel
5723fa7492 Add 'nounwind' attribute to the relevant runtime functions, and use it when
deciding whether or not to generate an invoke instead of a call.
2009-05-04 20:26:45 +02:00
Frits van Bommel
cf0b8936ce Factor out the code to find gcc, and add a command-line option to override the
default executable name.
This should help cross-compilation by allowing a cross-gcc to be specified from
the configuration file instead of only through the CC environment variable.
2009-05-04 13:32:16 +02:00
Frits van Bommel
f7e54dce10 Don't forget to update the control flow when deleting an invoke.
Fixes #284.
2009-05-04 12:08:30 +02:00
Frits van Bommel
fa79329102 Stack promotion for _d_newarrayvT. Array literals, concatenations (a ~ b) and
such are eligible for stack-allocation now.
2009-05-03 18:01:45 +02:00
Frits van Bommel
a2eee70761 Add -verify-each option to ease debugging 2009-05-03 21:58:28 +02:00
Frits van Bommel
67fc0aca20 Remove some overly verbose debug output 2009-05-03 20:19:49 +02:00
Frits van Bommel
865ae79e27 Strip metadata even when addPassesForOptLevel() isn't called, for instance when
only inlining or when manually specifying passes.
2009-05-03 20:16:15 +02:00
Frits van Bommel
3572944b90 Remove bogus noalias attribute from _d_arraysetlength[i]T. 2009-05-03 15:24:05 +02:00
Christian Kamm
77100f890c Make static int[] a = [1, 2]; a[0] = 4; not segfault
by making the array data ptr a non-const global variable.
2009-05-03 11:16:54 +02:00
Frits van Bommel
c831367b24 Factor out some constants into the header so producers and consumers of
metadata stay in sync (and are more readable).
2009-05-02 20:42:58 +02:00
Benjamin Kramer
2b18460169 Force SVN to C locale 2009-05-02 14:00:57 +02:00
Benjamin Kramer
0cc01f160f Add runtime support for darwin x86_64 2009-05-02 16:39:26 +02:00
Matti Niemenmaa
87d960c29a Fix build when USE_METADATA is off. 2009-05-02 19:03:33 +03:00
Frits van Bommel
262ef97945 There's an issue with LLVM metadata support; it triggers an assert when trying
to generate asm for code with metadata globals.
This new pass is used as a workaround: it strips metadata from the module before
it reaches the code generator.
Obviously, this is disabled if LLVM doesn't support metadata.
2009-05-02 12:19:43 +02:00
Frits van Bommel
34955bcbf9 Remove calls to some runtime functions if their results are unused 2009-05-02 11:58:50 +02:00
Frits van Bommel
cff0f1f446 Implement another D-specific pass: -dgc2stack
This one promotes GC allocations to stack memory when it can determine it's safe
to do so.
Not all GC calls are recognized yet (in fact only one *is* recognized for now).
Needs metadata, so disabled for LLVM versions that don't support it.
2009-05-02 11:58:50 +02:00
Frits van Bommel
a9c518d82b Add metadata for TypeInfo -> llvm::Type mapping.
Disabled for LLVM versions before the introduction of metadata.
2009-05-02 11:58:50 +02:00
Frits van Bommel
6c91185a77 Remove some dead code. 2009-05-02 11:58:50 +02:00
Christian Kamm
9812a8c8ae Commit workaround for TypeFunction comparing issue. 2009-04-30 23:16:21 +02:00
Frits van Bommel
da4450d2f5 Make sure this still compiles after LLVM r70437, which introduces a
specialization for command-line option template parser<char> which does the
wrong thing for us...
2009-04-30 12:25:04 +02:00
Frits van Bommel
96108f8e7c Now the backend wants an enum value as optimization level.
Hopefully this'll be the last change to that code...
2009-04-30 11:56:03 +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
Frits van Bommel
b6a6391116 Add some attributes to runtime calls, to provide the standard LLVM optimization
passes with more information.
2009-04-29 17:47:24 +02:00
Frits van Bommel
b9849d86b6 Update codegen to (hopefully) work correctly with newer LLVM trunk, where
there's no longer a Fast flag. (It has been replaced by an optimization level)
Untested because I haven't compiled that recent an LLVM yet :).
2009-04-29 10:26:28 +02:00
Frits van Bommel
0df1e34eb2 Implement first D-specific optimization pass: -simplify-drtcalls.
It uses the machinery of the standard -simplify-libcalls pass, but optimizes
calls to the D runtime instead of calls to C libraries.

At the moment, these optimizations are implemented by this pass:
 - Avoid the runtime call for `arr.length = newlen` if it can determine that
   the new length isn't longer than the old one.
 - Ditto for `cast(T[]) arr` if it will clearly always succeed.
   (e.g. if the length of the original array is zero, or if the old element
   size is a multiple of the new element size)
2009-04-28 21:58:06 +02:00
Frits van Bommel
f712c48312 Check in some old changes to the binding, from before I had commit access.
- Add bindings for InsertValue and ExtractValue
 - Updates to use new APIs where they were renamed or removed.
 - Add generic error messages if LLVM didn't provide one.
 - Enable typesafe variadic arguments for GetGEP.
2009-04-27 22:34:36 +02:00
Frits van Bommel
e3b8cb29ea Committing LLVM binding for D as it currently exists in the SVN repository. 2009-04-27 22:33:17 +02:00
Tomas Lindquist Olsen
f290ff0530 Forgot the special case part in last !ThisExp change. 2009-04-27 13:59:15 +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
ba38e15f0d Fixed class default initializers and type generation. Bug #260 is fixed. 2009-04-27 03:40:40 +02:00
Tomas Lindquist Olsen
3bd5cf70c2 Added testcase for overlapping struct default initializer I has missed. Slight tweak of the relevant error message. 2009-04-27 01:43:29 +02:00
Frits van Bommel
664c2c333e Remove a bit of code duplication. 2009-04-26 20:36:53 +02:00
Frits van Bommel
5d63aeaed9 Fix a logic bug. 2009-04-26 20:31:48 +02:00
Christian Kamm
17dbddfe41 Force 'fast' compilation when debug info is requested. LLVM trunk seems to
skip debug info for non-fast compilation.
2009-04-26 18:21:07 +02:00
Christian Kamm
5b71e2ef81 Fix interface indices. Closes #269 and #266. 2009-04-26 11:29:30 +02:00
Christian Kamm
c6b059ed73 Add (currently failing) test for correct virtual call resolution. 2009-04-26 10:29:39 +02:00
Tomas Lindquist Olsen
73f93d7240 Merge 2009-04-25 18:27:11 +02:00
Tomas Lindquist Olsen
3e882d422b Fixed struct default initializers. 2009-04-25 18:26:54 +02:00
Christian Kamm
8916f783b7 Revert change to treat bodyless functions in abstract classes as abstract.
See DMD bug 2894.
2009-04-25 09:11:32 +02:00
Frits van Bommel
83dda319ae Add #include "gen/llvm-version.h" to files that use the macro it defines... 2009-04-24 16:47:42 +02:00
Christian Kamm
0485196ae8 Fix parsing of import statements to only pass valid identifiers to Import
constructor. Fixes #264.
2009-04-23 20:44:55 +02:00
Christian Kamm
a38d34dead Trivial fix for bug #265 2009-04-23 20:28:29 +02:00
Kelly Wilson
d21cdb1df0 Changes for mingw to compile properly 2009-04-22 14:49:49 -06:00
Kelly Wilson
5c4455a394 Change needed for mingw 2009-04-22 14:40:56 -06:00
Tomas Lindquist Olsen
687395cda6 Rewrote runtime struct literal codegen. 2009-04-22 03:08:28 +02:00
Tomas Lindquist Olsen
f6f12e4241 Added checks for overlapping union initializers, as shown in bug #259 . 2009-04-22 01:18:21 +02:00
Tomas Lindquist Olsen
575038bfbd Fixed classinfo.interfaces for .. interfaces! 2009-04-21 20:19:53 +02:00
Tomas Lindquist Olsen
4567a55f7f Fixed emitting declarations nested inside interfaces. 2009-04-21 19:32:22 +02:00
Christian Kamm
f6772bd600 Add forgotten null check. 2009-04-21 19:17:29 +02:00