Commit graph

57 commits

Author SHA1 Message Date
Johan Engelen
63887f662f Fix typo. 2016-07-02 17:08:48 +02:00
Johan Engelen
0eb8689006 Implement cross-module inlining (with and without pragma). 2016-07-02 17:08:47 +02:00
Kai Nacke
802923c06b Add new extern(C++, class) and extern(C++, struct) declarations.
VS has different name manglings for classes and structs. With the
new extern(C++, class) and extern(C++, struct) declarations, the
name mangling algorithm is changed to use a mangling different
from the used D entity.

A common use case is to map a value type modeled as class in C++ to
a struct in D.

This is backport of https://github.com/dlang/dmd/pull/5875.
2016-06-25 14:39:39 +02:00
Johan Engelen
e0d9c58443 [PGO] Add PGO to LDC. Supported for LLVM >= 3.7
Add the commandline options -fprofile-instr-generate[=filename] and -profile-instr-use=filename
-fprofile-instr-generate
-- Add instrumentation on branches, switches, and function entry; uses LLVM's InstrProf pass.
-- Link to profile runtime that writes instrumentation counters to a file.
-fprofile-instr-use
-- Read profile data from a file and apply branch weights to branches and switches, and annotate functions with entrycount in LLVM IR.
-- Functions with low or high entrycount are marked with 'cold' or 'inlinehint'.

The only statement type without PGO yet is "try-finally".

A new pragma, `pragma(LDC_profile_instr, [ true | false ])`, is added to selectively disable/enable instrumentation of functions (granularity = whole functions).

The runtime library ldc-profile-rt is a copy of LLVM compiler-rt lib/profile. It has to be exactly in-sync with the LLVM version, and thus we need a copy for each PGO-supported LLVM (>=3.7).
import ldc.profile for a D interface to ldc-profile-rt (for example to reset execution counts after a program startup phase).

The instrumentation data is mainly passed on to LLVM: function-entry counts and branch counts/probabilities. LDC marks functions as hot when "execution count is 30% of the maximum function execution count", and marks functions as cold if their count is 1% of maximum function execution count.

The source of LLVM's llvm-profdata tool is hereby included in LDCs repository (different source for each LLVM version), and the binary is included in the install bin folder.
The executable is named "ldc-profdata" to avoid clashing with llvm-profdata on the same machine. This is needed because profdata executable has to be in-sync with the LLVM version used to build LDC.

Maintenance burden: for trunk LLVM, we have to keep ldc-profile-rt and llvm-profdata in sync. There is no diff with upstream; but because of active development there are the occasional API changes.
2016-06-20 17:28:22 +02:00
Pursche
9e953d46f1 Add PS4 version identifier
Add the identifiers that just got added to upstream DMD.
2016-06-13 11:41:17 +02:00
Johan Engelen
d9b012bbb0 Merge pull request #1434 from JohanEngelen/target_traits
Add LDC-specific traits for CTFE information about the target machine.
2016-06-06 20:15:03 +02:00
Johan Engelen
1ff1f1dba6 Remove Boost license from ddmd folder.
(The Boost license is already present in the LICENSE file)
2016-06-06 14:51:35 +02:00
Johan Engelen
5ffd34f7b6 Add LDC-specific traits for CTFE information about the target machine.
__traits(targetCPU) == "broadwell"
__traits(targetHasFeature, "sse2") == bool
2016-06-06 11:19:07 +02:00
Johan Engelen
51d40baa01 Add hook for vendor-specific __traits 2016-06-06 10:43:54 +02:00
Johan Engelen
d9b267a4be Accept LLVM bitcode files (*.bc) on the commandline and add the code to the first source file on the cmdline (the first emitted module). 2016-06-05 16:07:14 +02:00
Johan Engelen
cb523089bd Merge pull request #1537 from ldc-developers/merge-2.071
Merge tag 'v2.071.1-b2'
2016-06-03 18:03:02 +02:00
Kai Nacke
3fd299ad59 Remove license files in ddmd/ folder.
All licenses are collected in the LICENSE file.
2016-06-03 07:34:41 +02:00
Johan Engelen
53106f294d Merge branch 'master' into merge-2.071 2016-06-01 18:28:36 +02:00
Johan Engelen
28487120dc Merge DMD tag 'v2.071.1-b2' 2016-05-30 11:08:00 +02:00
Johan Engelen
04b89e642c Windows: Move the prepending of 0x1 to C++ mangled functions from frontend to the backend.
Windows x64 ABI: remove unnecessary \01 from mangled symbol name.

This removes the 0x1 byte from `.mangleof` accessible from user code.
Resolves issue #1519

Also let mangleForLLVM take a std::string, to enable C++11's moves.
2016-05-30 10:18:39 +02:00
Johan Engelen
c07f0d0511 Fix warnings. 2016-05-29 18:19:53 +02:00
Johan Engelen
776e32d801 Add experimental -hash-threshold option to hash very long symbol names. 2016-05-24 11:39:08 +02:00
David Nadlinger
4460a18396 Work around invalid AST produced by issue 15839 fix
The fix for 15839 (accessing this.outer from a member function
inside a nested class) in bb5f550 produces a ThisExp that
refers to the 'this' VarDecl in an outer scope, leading to the
latter being referenced from the nested scope without that being
added to its nestedRefs. Subsequently, the VarDecl is also not
present in the outer FuncDecls closureVars.

This is a weird construct, and outside the AST invariants that
would previously hold. This commit properly at least properly
registers the nested reference, but using a ThisExp in this
manner might not be the cleanest way in the first place.

This is a back-port of DMD commit a117c87a8a (#5741),
and fixes runnable/inner.d.
2016-05-09 09:23:21 +01:00
David Nadlinger
7e49c49c8f Update frontend to the final 2.071 release
There were no druntime/Phobos changes between b1 and the final version.
2016-05-08 21:54:22 +01:00
David Nadlinger
2ba4d45a0a Remove TupleDeclaration.semantic3
It was added ages ago to work around an issue with tuples not being
expanded in function arguments and/or variable declarations, but
it doesn't seem to be required anymore.
2016-05-06 22:41:06 +01:00
Rainer Schuetze
9abf85ab1a fix test failure in runnable/arrayop
manual merge of the actual fix in 66376051a4
2016-04-18 08:32:40 +02:00
Rainer Schuetze
c74d4c2231 Merge remote-tracking branch 'remotes/origin/master' into merge-2.071
# Conflicts:
#	runtime/druntime
#	tests/d2/dmd-testsuite
2016-04-17 21:24:56 +02:00
Rainer Schuetze
1395c7f47d fix inconsistency between dsymbol.h and dsymbol.d
this is a manual port of dmd commit 14543fd32118ef945151d353cb997f1f21ace517
see also https://github.com/dlang/dmd/pull/5674
2016-04-17 17:48:30 +02:00
Rainer Schuetze
3def45a1db remove introducing const from overriding functions
manual port of dmd commit c838a96a47b783c5a7e08abbd5761f14e19b6233
see https://github.com/dlang/dmd/pull/5673
2016-04-17 17:46:28 +02:00
Dan Olson
67878049a3 Merge pull request #1419 from ldc-developers/objc-wip
Add Objective-C Support
2016-04-11 23:50:54 -07:00
Dan Olson
4644dec78c Merge pull request #1349 from smolt/alternate-reality
Use build host D real type [was ARM/AArch64 updates to master (support 64-bit/128-bit real type)]
2016-04-10 21:54:47 -07:00
Dan Olson
61bb66bccd Use build host D compiler real type
D needs to compile itself on non-x86 hosts where real type might be
something other than 80-bit extended precision.  The simplest approach
is to use the existing D compiler real type as it must already have
correct real.nan and snan intializer.

Note this does not work for cross-compiling to alternate targets and is
only intended as transitional until that capability is added.

Upstream commit: a776514edc914e2e09bd4298fb07f2ac99e86f45
2016-04-10 19:55:47 -07:00
Johan Engelen
05963f04a1 Fix type of char parameters for Windows call. (already fixed upstream) 2016-04-10 22:38:48 +02:00
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00
Johan Engelen
0330a71b80 Enable the DDMD overides for memory allocation when LDC+@weak is detected. 2016-04-05 14:18:11 +02:00
David Nadlinger
9f998a398d Initial merge of upstream v2.071.0-b2
Notably, the glue layer side of the changed multiple interface
inheritance layout (DMD a54e89d) has not been implemented yet.

This corresponds to DMD commit 3f6a763c0589dd03c1c206eafd434b593702564e.
2016-04-03 15:15:14 +01:00
Martin
c02f4e7d08 Merge branch 'master' into merge-2.070
Conflicts:
	CMakeLists.txt
	runtime/druntime
	runtime/phobos
	tests/d2/dmd-testsuite
2016-03-28 22:28:01 +02:00
Johan Engelen
72b5ab7642 Instead of using the C++-linker, use the D compiler to link LDC2 and LDMD.
This removes the need for the CMake logic to figure out what linker flags to pass the C++linker to link D code (50 lines of flaky cmake script).
2016-03-25 12:31:01 +01:00
Kai Nacke
763b196a72 Merge remote-tracking branch 'origin/master' into merge-2.070 2016-03-24 22:40:31 +01:00
Kai Nacke
191e35701d Fix mangling error on AArch64 platform.
There is no platform which uses `__float128` for `real` data type.
On AArch64 the wrong mangling is choosen. Just remove support for
`__float128`.
2016-03-22 08:49:37 +01:00
Johan Engelen
9b078aed67 Merge frontend tag 'v2.070.2' 2016-03-16 10:35:34 +01:00
Johan Engelen
8ed4b51d54 Merge branch 'master' into merge-2.070
(no merge conflicts)
2016-03-15 20:21:17 +01:00
Dan Olson
8ee456e224 Objective-C support based on target triple
Currently supports major Darwin triples except for PPC.  New
global.params.hasObjectiveC is set based on decision.
2016-03-07 23:59:21 -08:00
Kai Nacke
24adf155ff Revert "Revert "Merge branch 'ltsmaster'""
This reverts commit 1653911600.
2016-03-03 21:12:53 +01:00
Kai Nacke
1653911600 Revert "Merge branch 'ltsmaster'"
This reverts commit dcb781004b, reversing
changes made to 3c6f09faf0.
2016-03-03 13:14:39 +01:00
Kai Nacke
dcb781004b Merge branch 'ltsmaster' 2016-03-03 07:50:17 +01:00
Dan Olson
98a608e925 First proof -of-concept for objc support
This at least shows a path forward.  Pretty much a kludge to at this
point, but passes the tests.
2016-03-02 00:30:58 -08:00
David Nadlinger
4e45bef490 Merge frontend tag v2.070.1-b1 2016-02-25 20:07:07 +01:00
Kai Nacke
dccbe96c00 Merge branch 'master' into merge-2.070 2016-02-23 06:57:30 +01:00
Johan Engelen
9e687f31d0 Remove redundant file. 2016-02-21 15:33:43 +01:00
Kai Nacke
556f64c502 Merge branch 'merge-2.069' into merge-2.070 2016-02-20 18:46:41 +01:00
Martin
5c5bc580df Fix complex_t for MSVC builds using 64-bit reals 2016-02-18 00:03:31 +01:00
David Nadlinger
2ec740061e Add ddmd.gluelayer stub for LDC 2016-02-14 19:35:40 +01:00
David Nadlinger
c15df303d2 Lexer.initLexer no longer exists 2016-02-14 19:35:40 +01:00
David Nadlinger
1a6c2f9248 Comment out some ddmd.gluelayer imports. Will need to be fixed. 2016-02-14 19:35:40 +01:00