Commit Graph
100 Commits
Author SHA1 Message Date
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
David Nadlinger 945f4882c2 Emit trap for assert(0) in release mode. 2013-09-15 23:53:52 +02:00
David Nadlinger 0a8e1f78b7 Do not append unique suffix to asm file when -output-s is given.
This fixes a regression introduced by commit 50f145640
(pull request #473).
2013-09-15 23:41:55 +02:00
David Nadlinger 3556f52b95 Fix _d_invariant mangling on MinGW/Win32.
This is getting uglier and uglier, should probably just switch back
to extern(C) irrespective of what upstream DMD does.
2013-09-15 19:57:25 +02:00
David Nadlinger 286770ed7b Only use long double replacements on Win64; the MinGW runtime has them.
GitHub: Fixes #411.
2013-09-15 19:28:02 +02:00
David Nadlinger 61bc9eba52 Merge pull request #473 from klickverbot/assemble-temp-file
Use PathV1 for creating temporary files on pre-3.4 LLVM.
2013-09-15 08:59:35 -07:00
David Nadlinger 50f145640f Use PathV1 for creating temporary files on pre-3.4 LLVM.
GitHub: Fixes #471.
2013-09-15 17:03:39 +02:00
David Nadlinger dd2a2a6cf9 Merge pull request #456 from klickverbot/issue-447
Properly handle delegate literals in nested context code.
2013-09-12 14:38:03 -07:00
David Nadlinger 243146199f Function literals start again at nesting depth zero.
GitHub: Fixes #447.
2013-09-12 13:47:54 +02:00
David Nadlinger e5463f77b7 FuncDeclaration::nestedVars should only be filled in DtoCreateNestedContextType. 2013-09-12 13:46:45 +02:00
David Nadlinger 0063546bc3 Added newline at end of file. 2013-09-12 10:23:21 +02:00
David Nadlinger 90127ab87a Fix broken indentation in debug log output. 2013-09-12 10:21:01 +02:00
David Nadlinger 14bc59f31a Nested context creation code beautification. 2013-09-12 10:14:17 +02:00
David Nadlinger b3d8c497e1 Remove leftover D1-only comment. 2013-09-07 22:14:07 +02:00
David Nadlinger 6f5abdbe0e Merge pull request #452 from WebDrake/ldflags
Ensure LLVM LDFLAGS are placed after libraries in build commands.

Let's try this – add the removal of the second LLVM_LDFLAGS instance in the LDMD_EXE libraries if new LDMD linker errors pop up.
2013-08-20 13:00:08 -07:00
David Nadlinger 147267d9f8 Merge pull request #450 from redstar/debuginfo
Preliminary fix for debug info generation with LLVM 3.4.
2013-08-20 03:37:22 -07:00
David Nadlinger d0ef732cbd Merge pull request #409 from AlexeyProkhin/chaining
New exception chaining implementation
2013-06-21 12:20:33 -07:00
David Nadlinger 31d85d0910 Merge pull request #398 from ldc-developers/merge-2.063
DMD 2.063.1 merge
2013-06-17 14:04:36 -07:00
David Nadlinger 46e699b635 Fold in druntime OS X build fix. 2013-06-17 15:21:24 +02:00
David Nadlinger c9c8f51118 Fold in broken std.exception test case fix. 2013-06-17 13:37:53 +02:00
David Nadlinger 235bb94878 Make -release only disable bounds checking in non-@safe code. 2013-06-17 13:31:21 +02:00
David Nadlinger 1215ffacd3 Complete IrStruct->IrAggr rename. 2013-06-17 13:14:15 +02:00
David Nadlinger b15588ed15 Finally fix the _d_invariant declaration on x86. 2013-06-17 13:14:14 +02:00
David Nadlinger 9700d84132 Initialize IrTypeAggr members in order to silence warning. 2013-06-17 02:38:38 +02:00
David Nadlinger dd8652768c Remove unused IrTypeFunction::fty().
The design split between IrFuncTy/IrTypeFunction might need
a review at some point.
2013-06-17 02:37:55 +02:00
David Nadlinger 9b68c48611 Fold in disabling of std.traits test. 2013-06-17 00:46:49 +02:00
David Nadlinger e86a87ab6d Complete switch to extern(D) _d_invariant. 2013-06-17 00:03:52 +02:00
David Nadlinger 0206269230 Ignore StaticAssert in DtoDeclarationExp.
Fixes DMD testcase 'testrightthis'.
2013-06-16 21:17:46 +02:00
David Nadlinger cfd5c052fe Fix LLVM 3.1 build. 2013-06-16 20:49:23 +02:00
David Nadlinger 4774745f44 Do not try to generate metadata for unresolved types.
This does not fix the root cause, which is likely a frontend
bug/oddity, but avoids the crash.
2013-06-16 20:23:07 +02:00
David Nadlinger a0ffaf56bf Do not codegen aggregate types from within debug info generation.
This avoids problems where we would codegen children of an
"inner" template instantiation (i.e. a member of a non-template
aggregate in another module) because we have no way to know the
outer (declare-only) entity exists in the respective
mustDefineSymbol invocation.

An example for this are the std.typecons.RefCounted internals of
std.file.DirIterator, as used from std.datetime and other modules.
This is not only inefficient, but also causes linking issues due
to attribute inference for these functions not having run yet
(and consequently the mangled name being different from the
actual definition).
2013-06-16 19:33:04 +02:00
David Nadlinger 480d05c76e Removed unused and broken template instantiation origin detection.
Having something like this would be useful in determining
whether to define a given template symbol during codegen, but
the frontend sometimes produces TemplateInstances in a scope
where sc->tinst has not been semantic'd, thus breaking the
chaining mechanism.
2013-06-16 18:21:36 +02:00
David Nadlinger 6a1fef81f4 Test suite updates. 2013-06-16 01:06:20 +02:00
David Nadlinger 897c4382af Do not re-codegen struct literals on taking address of globals.
The AST the frontend generates is arguably invalid, but we
have to deal with that.

Fixes DMD testcase 'interpret'.
2013-06-16 01:02:46 +02:00
David Nadlinger 68798f06c8 Accept '.dd' pure DDoc files. 2013-06-16 00:39:47 +02:00
David Nadlinger 1d9804d03c Use '__ModuleInfoZ' for ModuleInfos, like DMD does.
This way, we stay at least compatible w.r.t. demanglers,
pragma(mangle, …) tricks.

Fixes DMD testcase 'mangle'.
2013-06-16 00:28:02 +02:00
David Nadlinger acd508945a Allow multiple declarations to share the same mangled name/LLVM global.
This is necessary to enable aliasing compiler-generated
symbols with pragma(mangle, …).

Note that globals for internal use are still directly
created.
2013-06-16 00:28:02 +02:00
David Nadlinger 0305d3bce2 Never make external variables something else than external.
Fixes crash in DMD testcase 'mangle'.
2013-06-15 23:22:34 +02:00
David Nadlinger 46b6fdd531 Implement '-main'. 2013-06-15 23:09:59 +02:00
David Nadlinger bed6243481 LDC does not support -transition yet. 2013-06-15 22:57:57 +02:00
David Nadlinger 08f27c0b6d Test suite updates. 2013-06-15 22:55:28 +02:00
David Nadlinger 2e0941c194 Add names for globals to make LDC compile against LLVM 3.1. 2013-06-15 16:16:47 +02:00
David Nadlinger e9d7c10109 Align our copy of TypeInfo code to upstream DMD version. 2013-06-15 15:11:17 +02:00
David Nadlinger a7882a8ae6 Fix another few issues caused by the upstream v2.063.1 retagging. 2013-06-15 15:08:19 +02:00
David Nadlinger 0e49a57a5f More upstream DMD alignment. 2013-06-15 15:06:57 +02:00
David Nadlinger c813ccdcf7 Small debug diagnostics improvements. 2013-06-15 15:04:48 +02:00
David Nadlinger 66e9427f88 Backport StructLiteralExp::toChars infinite recursion fix.
We absolutely need this for log output/debugging.
2013-06-15 15:04:48 +02:00
David Nadlinger 7874c95cdc Remove unused StructLiteralExp::constType variable. 2013-06-15 15:04:48 +02:00
David Nadlinger bca5dac669 Fixed ClassReferenceExp codegen, handle self-referential literals. 2013-06-15 15:04:48 +02:00
David Nadlinger 041e8e8b54 Remove LDC-specific .classinfo AST rewrite.
Apart from reducing the diff to upstream DMD, this also fixes a
"cannot interpret" CTFE issue.
2013-06-14 21:49:44 +02:00
David Nadlinger 3035735bc9 FuncDeclaration::canInline diff reduction.
The new arguments to the call in DtoLinkage do not exactly
match what was there before, but have been harmonized with
the other canInline call.
2013-06-14 19:14:19 +02:00
David Nadlinger 4f1374e211 Fold in testsuite merge fixes. 2013-06-14 17:44:08 +02:00
David Nadlinger eb14970fd0 Minor nested context doc comment improval. 2013-06-14 17:10:50 +02:00
David Nadlinger 349305cd1d Fix array op argument evaluation order regression.
Fixes DMD testcase 'arrayop'.
2013-06-14 17:02:58 +02:00