Commit graph

584 commits

Author SHA1 Message Date
Martin Kinkelin
6264d45199 Get rid of superfluous LDC-specific TypeBasic.alignment() override
16 is LLVM's default alignment for x87 floats and x86_64 targets
(verified for Linux and macOS).
2019-04-13 20:41:02 +02:00
Martin Kinkelin
c62b760263
Support templated LLVM intrinsics with vector arguments (#2971)
Fixes #2962.
2019-01-21 22:22:36 +01:00
Martin Kinkelin
33cadfaca6 Remove ldc.arrayinit & streamline _d_array_slice_copy/_d_arraycast_len with upstream 2019-01-07 15:54:26 +01:00
Martin Kinkelin
04e9910ad2 Support ptr -> AA casts 2018-12-18 20:39:44 +01:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
bc24e53565
Declare extern const/immutable globals as IR constants (issue #2849) (#2852) 2018-09-27 00:02:49 +02:00
Martin Kinkelin
9fe95daeea Improve diagnostics for multiple function decls with IR type mismatch 2018-08-18 20:41:41 +02:00
Martin Kinkelin
5557278ba2 Adapt to refactored defaultInit() (method => free-standing) 2018-08-17 21:34:46 +02:00
Martin Kinkelin
d534d370a8
No context ptr for nested non-extern(D) functions (#2809) 2018-08-13 22:45:53 +02:00
Martin Kinkelin
64f4ee92a6 Emit debuginfo for NRVO/result variables
It may likely show up as garbage, as it's not a real local variable
(allocated by caller, address mostly passed in a register); e.g., this
happens on Win64 with the VS debugger ('expression is not an address' or
something along these lines), but at least output *some* DI.

We may be able to fix this and similar issues with LLVM 7 and new
intrinsic llvm.dbg.addr().
2018-06-24 02:14:38 +02:00
Martin Kinkelin
ef1e655767 Handle new special vtbl symbol
There's a new need to access a class' vtable symbol, see dlang/dmd#8362.

Use it as alias to the actual vtable symbol with different type (dummy:
`i8*`, actual: `[N x i8*]`) and mangled name.

I tried matching the special symbol's mangled name and using an
appropriate static array front-end type for it, but then casting the
symbol address for the assignment leads to issues if the ctor is @safe.
So I decided to handle it in DtoSymbolAddress().

Unfortunately, this seems not to solve the extern(C++) issues exposed by
LDC self-compilation yet.
2018-06-23 15:47:01 +02:00
Martin Kinkelin
6dfaebb33e Adapt to new special-ref result variables in out contracts
The AST now features special-ref result variables (storage classes:
ref, temp, result) after rewriting out contracts; from dmd/func.d:

/*   out(id1) { statements1... }
 *   out(id2) { statements2... }
 *   ...
 * becomes:
 *   out(__result) { { ref id1 = __result; { statements1... } }
 *                   { ref id2 = __result; { statements2... } } ... }
 */

We are talking about the `id1` and `id2` variables here.
There's an existing assertion that we don't set a special-ref variable's
lvalue (T**) to the sret pointer (T*) which was already triggered when
compiling Phobos without unittests.
2018-06-20 21:31:52 +02:00
Martin
05839a784f Adapt LDC to dropped floating-point comparison operators 2018-04-25 01:00:46 +02:00
Martin
2dea0e96ee Account for special case of builtin TypeInfos (rt.typeinfo.*)
And aid in debugging by outputting the IR type names if there are type
mismatches when declaring global variables.
2018-04-10 22:13:00 +02:00
Martin
8d5a94c7b8 Only emit interface vtables in the module declaring the class type 2018-04-10 22:13:00 +02:00
Martin
f38a7972a5 Split up getOrCreateGlobal() in {declare,define}Global()
Making it obvious which of the two operations is performed, reducing
call args and making sure a global isn't defined multiple times via
`defineGlobal()`.

The only [intended] functional change is in gen/trycatchfinally.cpp,
where I inserted a check for an existing __cpp_type_info_ptr global when
emitting a catch for C++ exceptions.
2018-04-10 22:13:00 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
2018-04-04 19:59:10 +02:00
Martin
b144fe1123 Merge branch 'master' into merge-2.079
Conflicts:
	runtime/druntime
	runtime/phobos
2018-03-30 00:06:01 +02:00
joakim-noah
04cd029bb9 Pull in Musl's assert function for betterC mode. (#2604) 2018-03-04 20:48:07 +01:00
Martin
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Oleg Nykytenko
907dae171a Solaris: fix assert for betterC build. (#2566)
* Solaris: fix assert for betterC build.

* Added parens to avoid relying on operator precedence rules.
2018-02-09 16:07:07 +00:00
Martin Kinkelin
6dc59c78e0
Account for AST binop quirks (#2540)
This fixes issue #2537.
2018-01-30 20:31:37 +01:00
Martin
1b860e70d7 Merge branch 'master' into merge-2.078 2018-01-26 18:52:49 +01:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Martin
1941ea0b7b Refactoring: Make DtoAllocaDump(DValue*) overloads handle DLValues 2018-01-14 22:42:27 +01:00
Martin
27deb2ff8c Get rid of obsolete gen/llvmcompat.h
Not needed anymore since C++11.
2018-01-12 20:20:47 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Martin
eb8b150be0 Windows: Map export to DLL storage classes for data too
Not just functions. Fixes issue #2437.
2017-12-08 19:26:29 +00:00
Martin
b59849ab28 Android: Use proper C assert function signature 2017-11-19 18:56:21 +01:00
Ivan
c839e9dfd0 Rename functions 2017-11-09 21:59:26 +03:00
Ivan
5426ffbd3d rename compiler files 2017-11-09 21:51:13 +03:00
Ivan
33c6cbb807 Renaming 2017-11-09 21:29:32 +03:00
Ivan
eb370e1e6a Rename attributes 2017-11-09 21:05:45 +03:00
Ivan
ae4db7d3b3 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-11-01 22:24:27 +03:00
Martin
c7fbdb1a5c Small harmless refactoring 2017-10-25 00:38:05 +02:00
Martin
30b858781b -betterC: Use C assert function
Instead of druntime's _d_assert[_msg], _d_arraybounds and
_d_switch_error.

Tested by dmd-testsuite's runnable/cassert and compilable/betterCarray.
2017-10-25 00:38:05 +02:00
Ivan
dc78564bf4 Merge remote-tracking branch 'origin/master' into runtime_compile_v5 2017-10-14 12:28:32 +03:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +02:00
Ivan
42f283c221 D dynamic compilation support 2017-08-27 17:42:55 +03:00
Martin
b085be1404 Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
	runtime/phobos
2017-08-12 18:21:21 +02:00
kinke
ab37d5ba99 Fix issue #2235 - IR struct packedness (#2247)
Unnaturally aligned aggregates were potentially not marked as packed,
leading to LLVM inserting additional padding and screwing up the memory
layout.
2017-08-11 19:05:09 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
kinke
151e83dc6b Fix C++ warnings (#2140) 2017-05-26 13:45:15 +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
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
Johan Engelen
64df1687a8 Fix LLVM 5.0 compilation. 2017-04-14 12:55:19 +02:00