Commit graph

94 commits

Author SHA1 Message Date
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
David Nadlinger
747f7a3dfa clang-format files touched in d01a91f7 [nfc]
Some housekeeping on files that recently saw large changes anyway.
2017-05-24 21:35:40 +01:00
Nicholas Wilson
ae6ff33fc1 [dcomptue] codegen (#2126)
* code generation

* simplify logic

* apply clang-format

* Undo completely inane choice by clang-format

* Guard the use of the command line args.
2017-05-24 08:55:32 +08:00
Martin
d01a91f755 Allow multiple occurrences for almost all command-line flags
Except for `-sanitize` and `-cache-prune*`.
2017-05-23 20:53:57 +02:00
kinke
f3144a74f3 Merge pull request #2091 from JohanEngelen/saveoptrecord
Implement -fsave-optimization-record
2017-05-16 20:38:47 +02:00
Adrian Matoga
aafd6541c7 Add switch '-Xcc <ccflag>'. Fix #2093. (#2104) 2017-05-16 20:23:02 +02:00
Johan Engelen
3fd99eb207 Add -fsave-optimization-record option.
Resolves issue #2089
2017-05-04 11:07:16 +02:00
Martin
97188a1a27 Merge branch 'master' into merge-2.073
Conflicts:
	tests/d2/dmd-testsuite
2017-03-09 01:11:03 +01:00
Martin
647e3b6fb2 Require CMake >= 2.8.9 and update Travis' CMake
The POSITION_INDEPENDENT_CODE target property seems to be supported since
CMake 2.8.9, and Ubuntu 12.04 uses 2.8.7.
2017-03-08 19:47:04 +01:00
Martin
9a1c4adbbc Add hidden -ldmd option when invoking LDC via LDMD
Thus providing a generic way to slightly alter some command-line semantics
in DMD compatibility mode.
2017-03-08 19:47:04 +01:00
Martin
162c264450 Merge branch 'master' into merge-2.073
Conflicts:
	runtime/phobos
2017-03-04 23:30:04 +01:00
Martin
0b03cda379 Add new switch -mv=<package.module>=<filespec> 2017-02-19 03:02:02 +01:00
Martin
8648b9305a Add new switch -dip1000 2017-02-18 22:59:29 +01:00
kinke
99ea4103ef Micro-optimization 2017-02-18 20:54:23 +01:00
David Nadlinger
ea61df26da driver/cl_options: Hide more internal flags for LLVM 3.9.1 2017-02-18 20:54:15 +01:00
David Nadlinger
fabab3f7a8 driver/cl_options: clang-format [nfc] 2017-02-18 20:54:05 +01:00
David Nadlinger
d3b553bba5 driver/cl_options: Use array instead of a gazillion hide() function calls [nfc] 2017-02-18 20:52:45 +01:00
Martin
84e74e3932 Rework LDMD command-line translation and add -verrors-spec
Simplify LDMD quite a bit by translating the few different command-line
options directly in-place. This puts some more stress onto LDC's
command-line parsing, especially due to multiple occurrences of a single
Boolean option (e.g., '-o-') or mixtures of `-m64` and `-m32` etc. for
dmd-testsuite.

Also add new command-line option `-verrors-spec` showing gagged errors
(DMD's equivalent is `-verrors=<spec|limit>`) and sync the usage text with
DMD. LDMD now also recognizes `-h` (and `/?` on Windows).
2017-02-06 01:17:09 +01:00
Martin
dca21939e1 Merge 2.072.2 front-end
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.

This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).

Some other changes:

* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
2017-01-29 15:48:03 +01:00
Martin
29d52f0362 Sync command-line options and descriptions with DMD 2016-12-20 22:08:23 +01:00
Johan Engelen
cd3ae57d14 Implement -ffast-math.
Resolves #1874.
2016-12-14 12:27:45 +01:00
Johan Engelen
b78f62c533 Refactor the machinery to add commandline options that clash with LLVM's options. This generalizes the piece of code that adds the "enable-color" option, such that it is easier to add other LLVM-clashing options (such as -ffast-math). [NFC] 2016-12-14 12:18:58 +01:00
Johan Engelen
f6b4bc29b9 Improve the -fprofile-instr-generate cmdline option description. 2016-12-04 12:57:47 +01:00
LemonBoy
62a2252028 Implement the betterC switch like DMD does.
Namely, don't emit the ModuleInfo.
2016-11-25 17:40:35 +01:00
Remi Thebault
3b63effd3f Implement -gline-tables-only (PR #1861)
As per ldc-developers/ldc#1844 .
2016-11-12 20:16:41 +01:00
Johan Engelen
bb24fb2816 Add LTO support (full and thin), with -flto=thin|full.
LTO needs linker support: I am only aware of support on OS X and Linux (through the LLVMgold plugin).

Resolves #693
2016-11-09 14:30:13 +01:00
LemonBoy
596fc82254 Implement -finstrument-functions.
Closes #1839.
2016-11-06 23:17:04 +01:00
kinke
86d11c8ace Merge pull request #1830 from kinke/dub
Create static libs in -od directory for LDMD only
2016-10-20 00:04:52 +02:00
Johan Engelen
9dad1609db Merge pull request #1812 from JohanEngelen/rename-ir2obj
Rename "ir2obj-cache" to "cache"
2016-10-16 16:27:06 +02:00
Martin
141310c77c Introduce (hidden) command-line option -cleanup-obj
Removing all generated object files on success.
2016-10-15 23:53:30 +02:00
Rainer Schuetze
0b55bd21d2 fix build against LLVM master: clEnumValEnd removed 2016-10-12 23:55:59 +02:00
Johan Engelen
e0c78fa198 Rename -ir2obj-cache-* cmdline flags to -cache-*, because the cache can be used for more things than just ir2obj caching.
Rename "ir2obj" namespace to "cache".
2016-10-12 18:58:01 +02:00
Johan Engelen
f6919e3fb6 ir2obj cache: Add all cmdline args to the hash, unless we are certain they can safely be ignored for ir2obj hashing. 2016-10-06 12:03:44 +02:00
Rainer Schuetze
5bcfb49b1b Enable gdb tests in dmd-testsuite (#1784)
Introduce a hidden `-dwarf-version=<uint>` switch to support old gdb versions
used by Travis. Older versions only supporting DWARF-2 and/or not supporting
TLS correctly are detected in dmd-testsuite's CMakefile.
2016-09-27 01:26:15 +02:00
Martin
c748eb9ed0 Replace global.params.singleObj by global.params.oneobj
singleObj was LDC-specific.
2016-09-07 09:53:35 +02:00
Martin
aed881350a Refactor output filename generation/validation 2016-09-07 09:53:35 +02:00
David Nadlinger
fa2080d80e driver: CoverageParser::parse ArgName is unused [nfc] 2016-09-03 00:52:03 +01:00
David Nadlinger
49e16239f6 CoverageParser: Mark constructor as explicit [nfc] 2016-09-02 23:30:40 +01:00
Martin
16b2c8942f Support parameterless '-deps' command-line option
In both LDC (undocumented) and LDMD. This should fix issue #1626.
2016-08-28 02:43:48 +02:00
Johan Engelen
c7e0486205 Add IR-to-Objectcode caching with -ir2obj-cache=<cache dir>. 2016-06-23 19:48:59 +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
Johan Engelen
776e32d801 Add experimental -hash-threshold option to hash very long symbol names. 2016-05-24 11:39:08 +02:00
Kai Nacke
de296b90ec LLVM 3.9: llvm::Reloc::Default was removed.
The value is now optional as there is nothing like a default relocation.
2016-05-20 21:17:20 +02:00
Rainer Schuetze
a2c5f15955 implement -transition=* 2016-04-20 23:03:20 +02:00
David Nadlinger
51afced357 Also clang-tidy driver/ 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Martin
54c9661b30 Merge branch 'master' into merge-2.068 2015-10-18 13:57:30 +02:00
Kai Nacke
c06e2ad7ea Handle command line option color.
There is a LLVM 3.7 command line option named color. This option is
only available if ldc is linked against shared LLVM libraries.

Because the LDC color option uses a FlagParser simple renaming does
not work. The solution is now:

- Rename LLVM option `color` to `llvm-color` and hide this option
- Dynamically create the LDC option `color`

This finally enables building with shared LLVM libraries.
2015-10-11 17:24:29 +02:00
David Nadlinger
9fd1e8d2a6 Merge frontend tag v2.068.0
Kept idgen as C++ program for now. We'll tackle build system integration
once we actually switch to DDMD.
2015-08-29 03:09:17 +02:00