Commit Graph
100 Commits
Author SHA1 Message Date
David Nadlinger 9f1c26b52a gc2stack: Handle _d_allocmemory.
This allows us to clean up after inlining closures.
2013-10-27 17:05:19 +01:00
David Nadlinger 3539e201f8 gc2stack: Move TypeInfo handling code into FunctionInfo subclass.
This is to properly support calls that don't involve TypeInfo
at all, like it is already the case for _d_newclass, and will be
for _d_allocmemory.
2013-10-27 17:05:19 +01:00
David Nadlinger 5b9208ef85 gc2stack: Extract static size checking code into helper function. 2013-10-27 17:05:19 +01:00
David Nadlinger e1a6d8144b gc2stack: Replace return type bool with proper enum flag.
This makes the code much easier to read.
2013-10-27 15:43:12 +01:00
David Nadlinger 27b4f730aa gc2stack: Remove unused safeToDelete mechanism. 2013-10-27 15:36:14 +01:00
David Nadlinger b052b30442 Correct signature of _d_newclass runtime call.
Fixes programs trying to directly access it (e.g. the
GtkD bindings). Not sure why this didn't come up earlier.
2013-10-24 00:27:09 +02:00
David Nadlinger 1f59740524 _d_allocclass -> "_d_newclass".
The define is a leftover from the times when we supported
both D1 and D2.
2013-10-24 00:25:36 +02:00
David Nadlinger 3d8e2e5e5c Add virtual destructor to GarbageCollect2Stack to silence GCC warning. 2013-10-24 00:24:55 +02:00
David Nadlinger 36b70b68e8 Do not generate invalid IR in dgc2stack pass.
Branching to a block that starts with a landing pad
instruction is illegal.

GitHub: Fixes #524.
2013-10-23 22:53:18 +02:00
David Nadlinger 847b7ac611 Merge pull request #522 from redstar/sanitize
Build LDC with address sanitizer enabled.
2013-10-22 02:57:56 -07:00
David Nadlinger 66484b580a Simplify git_describe to work on CMake 2.8.0.
FindGit doesn't seem to work as expected on Ubuntu 10.04
(GIT-NOTFOUND even though Git is installed and available
on the $PATH).

This implementation might be overly simplistic and it
should probably use find_program() to locate Git. We need
to revisit this after the 0.12.0 release is out.
2013-10-21 23:35:28 +02:00
David Nadlinger ad126e7155 Fix Git tag -> version string conversion on CMake 2.8.0.
This version is notably shipped with Ubuntu 10.04 LTS, used
for building the Linux release binaries.
2013-10-21 23:35:15 +02:00
David Nadlinger 234772767a Merge pull request #520 from klickverbot/ldmd-m32-m64
LDMD: Properly initialize Params::targetModel.
2013-10-21 05:43:59 -07:00
David Nadlinger 883fd768d3 LDMD: Properly initialize Params::targetModel. 2013-10-21 13:55:49 +02:00
David Nadlinger 1d7fd40893 Merge pull request #516 from klickverbot/fix-version-format
Add 'v' back in at beginning of global.version.
2013-10-20 17:06:22 -07:00
David Nadlinger f8531f1b3c Add 'v' back in at beginning of global.version.
The lexer expects it to be there for handling __VERSION__.
2013-10-20 23:51:34 +02:00
David Nadlinger 0e71a8caef Merge pull request #512 from klickverbot/help-cleanup
-help output cleanup
2013-10-14 17:22:43 -07:00
David Nadlinger 7ca329e77e More accurate description for "-vv".
Still not happy with it, but I feel it is still better
than just "very verbose".
2013-10-15 01:50:44 +02:00
David Nadlinger 28cd8b0ad2 Capitalize option decriptions. 2013-10-15 01:50:44 +02:00
David Nadlinger fd012bb002 Hide obsucre LLVM flags on versions that support it.
The idea is to hide any flags that an end user is unlikely
to need so that the -help output gets clearer. Some of the
flags are also downright confusing, as they seem similar
to unrelated D concepts. The hidden flags are still
available using -help-hidden.

Unfortunately, this is only possible on LLVM 3.3+.
2013-10-15 01:50:44 +02:00
David Nadlinger f80be41713 Merge pull request #511 from klickverbot/issue-470
Gracefully handle struct decl/type mismatch when generating TypeInfo.
2013-10-13 18:24:21 -07:00
David Nadlinger 19066c4cb4 Merge pull request #510 from klickverbot/issue-497
Do not try to emit nested functions with unanalyzed parents.
2013-10-13 18:24:09 -07:00
David Nadlinger 07e8fe4908 Gracefully handle struct decl/type mismatch when generating TypeInfo.
The type should have already been resolved if the struct
itself is, but due to multiple-types-per-declaration issues
in DMD, this might not be the case.

GitHub: Fixes #470.
2013-10-13 21:58:41 +02:00
David Nadlinger 265d3ee069 Do not try to emit nested functions with unanalyzed parents.
GitHub: Fixes #497.
2013-10-13 21:37:53 +02:00
David Nadlinger 07eec1840e Folded in test suite updates. 2013-10-13 21:31:40 +02:00
David Nadlinger 0954b2763a [Trivial] Fixed class/struct mismatch. 2013-10-13 21:22:10 +02:00
David Nadlinger 00bb7f5c2e Merge pull request #508 from klickverbot/mcpu-mattr-help
Display -mcpu/-mattr help even with no source files given.
2013-10-13 12:17:46 -07:00
David Nadlinger 40cb10edf1 Merge pull request #509 from klickverbot/fix-disable-fp-elim
Bring back -disable-fp-elim.
2013-10-13 12:17:19 -07:00
David Nadlinger be497c7344 Merge pull request #507 from klickverbot/issue-454
Use Module::members -> Dsymbol::codegen to define symbols.
2013-10-13 12:16:16 -07:00
David Nadlinger 257da5afe5 Bring back -disable-fp-elim.
It was moved to llvm/CodeGen/CommandLineFlags.h.

GitHub: Fixes #502.
2013-10-13 20:26:19 +02:00
David Nadlinger 54aa182f72 Remove Walter-ism that doesn't even work in release mode. 2013-10-13 20:16:40 +02:00
David Nadlinger c466796b93 Display -mcpu/-mattr help even with no source files given.
Unfortunately, we can't easily add a test for this in our
current test runner setup (i.e. dmd-testsuite).

GitHub: Fixes #505.
2013-10-13 20:16:08 +02:00
David Nadlinger 60f385b062 Use IRState parameter instead of gIR where available. 2013-10-13 19:47:41 +02:00
David Nadlinger 1242be25d0 Remove unused, empty Ir type.
The codegen parameter was changed to IRState instead of
removing it to set the stage for an eventual eradication
of the gIR global.
2013-10-13 19:44:29 +02:00
David Nadlinger c6cf35a012 Remove unused DMD IRState implementations. 2013-10-13 19:20:37 +02:00
David Nadlinger 857d37636e Handle void[0] struct/class members.
This was also broken before the symbol emission
changes; we just accidentally managed to avoid
the only occurence in the standard library tests.
2013-10-13 19:18:24 +02:00
David Nadlinger 4fee629c4d Prefer more specific functions to DtoResolveDsymbol.
The remaining ones should also be easy to remove with a
closer look at the situation.

Ideally, we would get rid of all of them at some point and
use safe wrapper functions for accessing the IrDsymbol
associated with a given declaration (which would emit the
declarations on the fly if not already present).
2013-10-13 19:18:24 +02:00
David Nadlinger 48b7710d22 More robust way of handling static array single element initialization.
Fixes a std.traits test where there would be a mismatch
in const/shared qualifiers on the element type of a dynamic
array initializer.
2013-10-13 19:18:24 +02:00
David Nadlinger 8ead24a2bb Handle typeof(null) -> Object conversion.
Not sure why this wasn't triggered by the test suite before.
2013-10-13 19:18:24 +02:00
David Nadlinger 787c147986 Use Module::members -> Dsymbol::codegen to define symbols.
This commit fundamentally changes the way symbol emission in
LDC works: Previously, whenever a declaration was used in some
way, the compiler would check whether it actually needs to be
defined in the currently processed module, based only on the
symbol itself. This lack of contextual information proved to
be a major problem in correctly handling emission of templates
(see e.g. #454).

Now, the DtoResolve…() family of functions and similar only
ever declare the symbols, and definition is handled by doing
a single pass over Module::members for the root module. This
is the same strategy that DMD uses as well, which should
also reduce the maintainance burden down the road (which is
important as during the last few releases, there was pretty
much always a symbol emission related problem slowing us
down).

Our old approach might have been a bit better tuned w.r.t.
avoiding emission of unneeded template instances, but 2.064
will bring improvements here (DMD: FuncDeclaration::toObjFile).
Barring such issues, the change shoud also marginally improve
compile times because of declarations no longer being emitted
when they are not needed.

In the future, we should also consider refactoring the code
so that it no longer directly accesses Dsymbol::ir but uses
wrapper functions that ensure that the appropriate
DtoResolve…() function has been called.

GitHub: Fixes #454.
2013-10-13 19:18:24 +02:00
David Nadlinger b556ad9996 Don't log the uninteresting case of DtoConstExpInit. 2013-10-13 01:00:25 +02:00
David Nadlinger e1abb01e55 Remove superfluous Dsymbol::codegen overload. 2013-10-13 01:00:25 +02:00
David Nadlinger 7dff0bbe4b Fix IrType::isVector (so far unused anyway). 2013-10-13 01:00:24 +02:00
David Nadlinger 3d9b70c7a6 Mention TypeInfo emission in debug log. 2013-10-13 01:00:24 +02:00
David Nadlinger d46d4ce4b1 Merge pull request #503 from klickverbot/const-array
Fix assertion error when building Phobos with debug builds.
2013-10-12 16:00:03 -07:00
David Nadlinger 49835a3ce2 Fix assertion error when building Phobos with debug builds.
Turns out that Expression::isConst() actually is much too
pessemistic as it e.g. never regards struct literals as
const.

We should get this fixed to avoid unnecessary heap
allocations for array initialization.
2013-10-13 00:58:56 +02:00
David Nadlinger b20ba76677 Merge pull request #500 from klickverbot/ldmd-valgrind
LDMD: Avoid unitialized data.
2013-10-09 11:50:50 -07:00
David Nadlinger 18fbc20c0e Merge pull request #498 from klickverbot/cmake-version-tag
Prefer named tags to Git revision hashes for LDC verison.
2013-10-09 11:50:32 -07:00
David Nadlinger 1c36a35009 Merge pull request #499 from klickverbot/travis
Travis CI fixes
2013-10-09 11:50:14 -07:00
David Nadlinger a2a3e400c9 LDMD: Avoid unitialized data.
Found using Valgrind.
2013-10-09 19:50:28 +02:00
David Nadlinger 0ade0d6404 Travis: Use Launchpad PPA for LLVM 3.3; the llvm.org repo no longer has it. 2013-10-09 19:39:26 +02:00
David Nadlinger d80325170e Travis: Avoid running testsuite when build didn't succeed. 2013-10-09 19:30:35 +02:00
David Nadlinger f9e141a006 Prefer named tags to Git revision hashes for LDC verison.
This allows for building of release packages without
manually overriding the version string.

The --tag argument is needed to pick up un-annotated tags
as well.
2013-10-09 16:05:29 +02:00
David Nadlinger c5d4897872 Merge pull request #494 from ldc-developers/unnamed-addr
unnamed_addr for immutable array literals
2013-10-08 21:54:03 -07:00
David Nadlinger 4987894468 Also make storage for immutable array const initializers constant/unnamed_addr. 2013-10-09 05:32:41 +02:00
David Nadlinger 498b7cfc2e Merge pull request #493 from klickverbot/sarray-init
Avoid allocating array literals on initialization
2013-10-08 20:26:14 -07:00
David Nadlinger 47e212178e Emit array literals as unnamed_addr.
There is really no reason not to.
2013-10-09 04:34:32 +02:00
David Nadlinger 26e3cc8a40 Never emit long array literals as inline constant.
Also cleaned up rest of the code a bit.

The LLVM 3.1 problem was already fixed before by not doing
anything on zero-element arrays anyway.
2013-10-09 04:27:41 +02:00
David Nadlinger 0cdb74aae7 Do not heap-allocate immutable array literals. 2013-10-09 04:07:46 +02:00
David Nadlinger 60cdf58168 Combine ArrayLiteralExp::toConstElem and initializeArrayLiteral implementations. 2013-10-09 04:07:46 +02:00
David Nadlinger eb3261f93c Do not GC-allocate temporary for static array initialization. 2013-10-09 01:51:45 +02:00
David Nadlinger 9866e5a14f Comment typo fix. 2013-10-09 01:51:45 +02:00
David Nadlinger 44f60199ad Factored actual literal building code out of ArrayLiteralExp::toElem. 2013-10-09 01:51:45 +02:00
David Nadlinger d51d05c52e Merge pull request #491 from klickverbot/ldmd-3.4
Fix prependMainExecutablePath for LLVM 3.4.
2013-10-08 09:33:23 -07:00
David Nadlinger 7b8a85a8df Fix prependMainExecutablePath for LLVM 3.4. 2013-10-08 17:56:10 +02:00
David Nadlinger 5dc02c0f74 Merge pull request #488 from klickverbot/arm
Phobos "Hello World" compiles now on ARM.

No EH support yet.
2013-10-06 12:01:25 -07:00
David Nadlinger e4fee1116a ARM: Use -arm-enable-ehabi(-descriptors).
D exception handling does not work at all yet, but with these
flags it does for C++/Clang, at least in simple cases.
2013-10-06 20:15:28 +02:00
David Nadlinger aba1b82539 Finally fix LLVM 3.1 compilation. 2013-10-06 19:26:58 +02:00
David Nadlinger 445b743ba5 Implement lookupTarget() with arch override for LLVM 3.1.
To be removed again once we drop 3.1 support.
2013-10-06 19:12:36 +02:00
David Nadlinger 250f7fab27 ARM: Fold in druntime fixes. 2013-10-06 14:54:02 +02:00
David Nadlinger 1d7943bc7e Simplify FindLibconfig++ using find_package_handle_standard_args features. 2013-10-06 07:39:12 +02:00
David Nadlinger 422715fc89 Add -float-abi switch and auto-detection for ARM.
This is based on the implementation that was reverted in
fc8e0c4c20.
2013-10-06 07:39:12 +02:00
David Nadlinger 49697a8bc2 if chain -> switch. 2013-10-06 07:39:12 +02:00
David Nadlinger 1335e26c45 Log/error message prettification. 2013-10-06 07:37:03 +02:00
David Nadlinger 359f6c585a CPU detection for ARM.
This is not perfect yet, as lookupTarget wipes out any more
specific arch info (e.g. armv8) the triple might have.
2013-10-06 07:36:59 +02:00
David Nadlinger 5900d6845e Merge pull request #487 from klickverbot/targetmachine
driver/target -> driver/targetmachine and main() cleanup
2013-10-05 17:40:11 -07:00
David Nadlinger e9e4e10085 Auto-detect target attributes for -mcpu=native.
This is currently only implemented for ARM in LLVM.
2013-10-06 02:38:50 +02:00
David Nadlinger e57d0458fb getX86TargetCPU cleanup. 2013-10-06 01:48:21 +02:00
David Nadlinger d17aa2aaac Disentangle -march and -mcpu.
-mcpu=native now actually works.

GitHub: Fixes #414.
2013-10-06 01:48:12 +02:00
David Nadlinger 02abf028f8 Don't require -triple when using -march.
There is really no reason we should, and I couldn't find out
why that check was added back in 2009.

Also cleaned up the code a bit now that the LLVM 3.0 branches
are gone.
2013-10-06 01:35:20 +02:00
David Nadlinger 639bc0ab71 Removed a few fatal() calls in argument parsing code.
global.errors is checked immediately after return anyway.
2013-10-06 01:33:29 +02:00
David Nadlinger b2b56203a9 Use llvm::Triple::isArch64Bit (LLVM 3.1+). 2013-10-06 01:33:29 +02:00
David Nadlinger b94ed4092e De-ancient-C-ification, spelled out EXIT_SUCCESS. 2013-10-06 01:33:29 +02:00
David Nadlinger 7e74f65b32 Also factored out argument parsing to separate function.
The code is still messy, but we have to start somewhere...
2013-10-06 01:33:28 +02:00
David Nadlinger cc11af3473 Factored predefined version handling code out of main(). 2013-10-06 01:33:28 +02:00
David Nadlinger 71c67457c3 Cleanup: Kill backend_init/term. 2013-10-06 01:33:28 +02:00
David Nadlinger 177b892bf0 Cleanup: We don't support DMC. 2013-10-06 01:33:28 +02:00
David Nadlinger 68c272d6d9 Renamed driver/target to .../targetmachine to avoid confusion with the frontend file. 2013-10-06 01:33:28 +02:00
David Nadlinger c5643219d4 Merge pull request #486 from klickverbot/dmd-diff
Low-hanging DMD diff reduction fruit
2013-10-05 15:43:17 -07:00
David Nadlinger b6a73fbd65 More trivial diff reduction now that #484 is in. 2013-10-05 22:04:54 +02:00
David Nadlinger ee7fe16e40 Low-hanging DMD diff reduction fruit.
The trailing whitespace isn't pretty, but removes the
files completly from the diff.
2013-10-05 21:19:35 +02:00
David Nadlinger ca82589e25 Merge pull request #482 from klickverbot/ldmd-create-directory
LDMD: Create output directories if they do not exist.
2013-10-03 19:21:23 -07:00
David Nadlinger 7f20de16cf LDMD: Create output directories if they do not exist.
There might be other cases using the LLVM output code as well
that I haven't handled here, but the changes are sufficient to
make LDC work with rdmd on Linux.

GitHub: Fixes #480.
2013-10-02 18:09:47 +02:00
David Nadlinger c58c833be9 Trivial indentation fix. 2013-10-02 18:02:41 +02:00
David Nadlinger 75f990aa08 Merge pull request #478 from klickverbot/symoffexp-toconstelem
Fix SymOffExp::toConstElem.
2013-09-25 03:51:50 -07:00
David Nadlinger 20cc082413 Merge pull request #479 from klickverbot/ldmd-quiet
LDMD: Ignore -quiet, it is the default.
2013-09-21 10:00:08 -07:00
David Nadlinger f35176efad Fix SymOffExp::toConstElem.
I am surprised and horrified at the same time that the test suite
(on platforms other than Windows, where the code path is triggered
in core.stdc.stdio) did not catch this at all.

The elemSize-dependent path probably doesn't make too much sense for
global variables, as it always refers to the total size of the global.
Should add a special case for arrays for clearer codegen in those cases.

GitHub: Fixes #477.
2013-09-21 18:53:26 +02:00
David Nadlinger cf18366c46 LDMD: Ignore -quiet, it is the default.
GitHub: Fixes #472.
2013-09-21 18:31:14 +02:00
David Nadlinger b17a6421a4 Merge pull request #475 from klickverbot/assert-release-trap
Emit trap for assert(0) in release mode.
2013-09-15 23:46:26 -07:00
David Nadlinger fe20a7dfac Merge pull request #474 from klickverbot/mingw-invariant
Fix _d_invariant mangling on MinGW/Win32.
2013-09-15 14:54:22 -07:00