Commit Graph
964 Commits
Author SHA1 Message Date
Christian Kamm 8bcc2d9b3f Increment the iterator before deleting redundant functions or globals in the StripExternals pass. 2009-06-11 21:48:10 +02:00
Frits van Bommel bc7737a03b Add some passes that opt runs to the default pass list. 2009-06-11 16:57:45 +02:00
Frits van Bommel 1f7a2a7884 Teach stack promotion to walk the CFG when a potential reuse of an allocation
is found to see if it can actually happen instead of just assuming it will.

This allows it to catch cases like
{{{
int i;
Foo f;
while (cond(i))
    f = new Foo(i++);
return f.value;
}}}
where it previously wouldn't because a phi using the allocation would appear in
the condition block to propagate it to the use after the loop.
2009-06-11 02:04:44 +02:00
Frits van Bommel bf89205f7d Look for configuration file in /etc and /etc/ldc too (absolute paths)
except on Windows. Also disabled the `$PREFIX/etc/ldc` case for Windows, since
the "/etc/ldc" part was #if'ed out anyway.
2009-06-09 12:19:52 +02:00
Christian Kamm f8840f66c4 Move locating the configuration file into a separate function. Also look in PREFIX/etc/ldc. Fixes #322. 2009-06-08 19:48:20 +02:00
Frits van Bommel 9ba306a42f Oops, I accidentally pushed r1486 before the last touches were committed. 2009-06-08 13:52:45 +02:00
Frits van Bommel b999f679a7 Teach -dgc2stack to promote GC allocations in simple loops to stack
allocations too. (A "simple" loop is one where the allocation isn't used in a
subsequent iteration)

This also means it's no longer necessary to run this pass multiple times.
Running it once after inlining should now catch all cases.
2009-06-08 12:35:55 +02:00
Frits van Bommel f7ab031c7e Delete some code I forgot about in [1480]. 2009-06-07 23:00:53 +02:00
Frits van Bommel f76870f255 Print the path to the configuration file being used if -v is passed. 2009-06-07 17:20:55 +02:00
Frits van Bommel 96650855ed Add a pass to strip the bodies of available_externally functions so string
literals and `TypeInfo`s only referenced by them can be deleted by `-globaldce`.
2009-06-07 16:00:13 +02: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 b972dcb92d Add -memcpyopt to the optimization pass list. 2009-06-07 15:07:29 +02:00
Frits van Bommel f79e40a491 Use llvm.memset instead of _d_array_init_i1 and _d_array_init_i8.
This exposes what's happening to LLVM, and memset is probably faster than the
runtime functions we were using anyway.
2009-06-07 13:57:59 +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
Frits van Bommel c6946d4072 Fix indentation, removing tabs. 2009-06-05 02:54:34 +02:00
Kelly Wilson 243a9bc4a6 There was another fix needed here for reading %%ldcbinarypath%% 2009-06-04 18:36:07 -06:00
Kelly Wilson 690ca32c0c Fix memory leak in configfile.cpp...probably the only one in ldc! 2009-06-04 16:46:05 -06:00
Kelly Wilson d21e61b8b8 merging 2009-06-04 16:06:35 -06:00
Kelly Wilson 7bf64922f5 Fix for finding ldc.conf file with mingw 2009-06-04 16:04:26 -06:00
Frits van Bommel 5edb7545f2 Move -tailcallelim to a place in the optimization sequence where it seems to
be more useful.
2009-06-04 15:59:51 +02:00
Frits van Bommel 060d18b91e Fix a bug in DtoNestedInit and update an unrelated comment. 2009-06-03 12:32:35 +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 b218bfc828 Added missing initializer of (LDC introduced) Expression::cachedLvalue in D2 frontend. 2009-06-03 03:49:24 +02:00
Tomas Lindquist Olsen 092381577f Some minor changes to handling of variables referenced from nested functions in D2 .
Added generation of new 'void*[4] reserved;' !ModuleInfo member .
2009-06-03 03:04:47 +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 435d3069f6 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-02 17:12:37 +01:00
Frits van Bommel ba72e39d24 Add syscall to the x86-64 asm parser, and both syscall and sysret to the
x86 one. Fixes #316.
2009-06-01 23:42:42 +02:00
Frits van Bommel fd037f35e9 Fix a type mismatch in ModuleInfo generation. 2009-06-01 23:17:47 +02:00
Robert Clipsham cf08cc2844 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-01 19:02:20 +01:00
Robert Clipsham 91ddf6140a More tweaks. 2009-06-01 18:58:21 +01:00
Frits van Bommel 2fe8f2cd74 Improve ABI conformance on x86 by passing the sret parameter in EAX if there's
no `this`.
2009-05-31 12:43:59 +02:00
Kelly Wilson 008d81afb0 Fix "garbage at end of line" errors on mingw...shouldn't affect linux/macosx 2009-05-31 09:10:33 -06:00
Christian Kamm 78aa98fdfb Error on invalid array cast. See DMD3041. 2009-05-31 15:07:04 +02:00
Frits van Bommel 3718bd23fb Add nest attribute to this parameters on x86-64. This is a free extra
parameter register :).
2009-05-31 10:41:20 +02:00
Frits van Bommel c8b10643f9 Add some missing returns. 2009-05-30 23:48:22 +02:00
Kelly Wilson 3eb4a4d389 merging 2009-05-30 14:36:00 -06:00
Kelly Wilson 71477fcb8c Forgot one windows underscore for asm output 2009-05-30 14:35:03 -06:00
Robert Clipsham c5be82c5ae LDC 2 compiles again. 2009-05-30 17:23:32 +01:00
Frits van Bommel da593c99dc Remove code duplication for vtable loads and improve instruction naming to make
bitcode with virtual calls easier to read.
2009-05-30 13:04:49 +02:00
Christian Kamm a05ed9a171 Fix #309: allow -of with multiple source files if -singleobj is given. 2009-05-30 12:58:04 +02:00
Christian Kamm e03a897bad Make sure complex -> integral casts are not used when casting to bool.
Error instead of assert on unimplemented cast.
2009-05-28 21:45:14 +02:00
Christian Kamm 803156b035 Allow complex -> integral casts. 2009-05-28 20:26:26 +02:00
Frits van Bommel a24a2201f1 Teach -dgc2stack to preserve the call graph. This should allow for more
efficient execution by the pass manager.
2009-05-28 02:14:01 +02:00
Frits van Bommel 6619190ba5 * Add -functionattrs to default pass list so -dgc2stack is more effective
when callees aren't inlined. This should also improve various standard LLVM
  optimizations.
* Comment out some verbose logging.
2009-05-28 00:07:21 +02:00
Christian Kamm 7fd43e8bf7 Error instead of assert on delegate literals as constant expressions.
Make function literal linkage internal inside functions and external otherwise.
2009-05-27 19:20:18 +02:00
Frits van Bommel e7b3f5415f Make "aa[key]" use the same runtime call as "key in aa". The runtime calls
these were using were different, but with equivalent definitions.

With `ldc -O3`, the following functions now all compile to the exact same code:
{{{
int[int] y;
void foo(int x) {
    if (x in y) {
        auto z = x in y;
        sink(*z);
    }
}

void bar(int x) {
    if (x in y) {
        sink(y[x]);
    }
}

void baz(int x) {
    if (auto p = x in y) {
        sink(*p);
    }
}
}}}
2009-05-25 12:50:40 +02:00
Frits van Bommel 1791d7b8b4 Fix a behavioral change accidentally introduced by the move to the LLVM
commandline system: `-output-(bc|ll|s)` used to disable generation of an object
file unless explicitly requested with `-output-o`. Now they do so again.
2009-05-23 20:57:22 +02:00
Christian Kamm 52329f071e Fix regression dstress.nocompile.finally_07. The EnclosingTryFinally handler
should not be set when emitting the landing pad's finally code.
2009-05-23 09:02:36 +02:00