Commit graph

467 commits

Author SHA1 Message Date
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
kinke
94f04216d0 Don't crash when trying to repaint static arrays (#2034)
Fixes issue #2033.
2017-03-18 14:21:25 +01:00
Martin
9d4961ae27 Fix detection of special reference variables
D2.072 apparently doesn't set the STCforeach storage class for each
special reference anymore. So let's consider all references which aren't
parameters, i.e., all locals with STCref, as special references.

By-ref parameters are different as we simply use the LL pointer parameter as
lvalue for the variable, no extra alloca required. Special references are
automatically dereferenced pointers and as such occupy a dedicated alloca for
the address.
2017-02-01 22:52:43 +01:00
Ivan Butygin
a26bfc1223 Refactor code to hide direct IrFunction->func usage and add convenient functions (#1911) 2017-01-17 22:40:32 +01:00
Martin
0de021fe32 Fix check if nested function can access outer function frame
The previous check wouldn't check intermediate aggregates for static-ness,
that was one problem. The other was the assertion that the outer function
can be reached as long as there are no static functions inbetween, which
isn't always the case, as issue #1864 clearly shows, which is resolved by
this.
2016-11-18 18:05:56 +01:00
Martin
67d5fe5624 Map export visibility to LLVM DLL storage classes
Compatible with DMD, but restricted to Windows and functions only.

`export` functions with bodies get the dllexport attribute and will be
exported if the containing object is pulled in when linking.

Body-less `export` functions get the dllimport attribute and will be
accessed via an import table indirection, set up at runtime by the OS.

This is a temporary solution, the proper fix is a pending DMD PR, after
which LDC will need to be adapted.
2016-11-15 21:15:56 +01:00
Rainer Schuetze
08e1c496dc fix build against current LLVM master @ 9b4e8286785f538e73d2e3eaa96f88c3d98b9960 2016-10-27 08:08:19 +02:00
Martin
10b0261200 Zext i1 constants for scalar Boolean struct fields to i8 2016-10-23 17:31:02 +02:00
Martin
ab1432ed06 Use the regular LL type for all init symbols and most globals
There's no <Type>_init type for aggregates (structs and classes) anymore,
effectively eliminating a *lot* of named LLVM types, some bitcasts as well
as replacements of globals etc.

To get there, it was even required to use the regular type for compatible
literals too, otherwise structs embedded as fields in other aggregates had
an anonymous type (well, the LLVM constant for the field initializer had)
and so the container initializer wasn't compatible with the regular type
anymore.

What was also necessary was a fix wrt. static arrays of bools (LLVM
constant of type `[N x i1]` vs. `[N x i8]` for regular type).
I also had to change the initializer for `char[2][3] x = 0xff` from
`[6 x i8]` to `[3 x [2 x i8]]`, i.e., NOT flattening multi-dimensional
inits from a scalar.

So only literals with overlapping (union) fields and an explicit
initializer initializing dominated non-alias union fields should still
have a mismatching anonymous type - i.e., very, very few cases.
2016-10-23 02:52:51 +02:00
Johan Engelen
8d06f23635 Merge pull request #1825 from JohanEngelen/align1
Allow alignment below sizeof(void*).
2016-10-13 21:38:52 +02:00
Rainer Schuetze
0b55bd21d2 fix build against LLVM master: clEnumValEnd removed 2016-10-12 23:55:59 +02:00
Johan Engelen
7e572e6f03 Allow align(1) for global variables.
This reverts a39997d326, and fixes the invalid tests in std.conv.
2016-10-12 12:18:46 +02:00
Rainer Schuetze
8f0f29c239 fix building against recent LLVM 4.0 2016-10-03 10:58:21 +02:00
David Nadlinger
8a9c7cf463 gen: Remove some redundant elses [nfc] 2016-09-03 14:38:10 +01:00
David Nadlinger
53cdc9a68e gen: Const-ify a loc parameter [nfc] 2016-08-18 16:27:34 +02:00
Martin
7d15ab9ffc Reduce ScopeStack to JumpTargets
Add some comments after this more or less clean separation, and move
callOrInvoke() to FuncGenState.
2016-08-07 21:29:47 +02:00
David Nadlinger
6cc93bc8ba gen/ir: Move function body codegen state into separate class
Previously, the transitory state only needed and valid during
generation of the LLVM IR for the function body was conflated
with the general codegen metadata for the function declaration
in IrFunction.

There is further potential for cleanup regarding the use of
gIR->func() and so on all over the code base, but this is out
of scope of this commit, which is only concerned with those
IrFunction members moved to FuncGenState.

GitHub: Fixes #1661.
2016-08-03 21:07:18 +01:00
David Nadlinger
566923b407 Merge pull request #1609 from kinke/sliceAssign
Fix issue #1608
2016-07-29 17:07:50 +01:00