Commit graph

101 commits

Author SHA1 Message Date
Johan Engelen
a72c318cb3 Add explicit casts to llvm::MaybeAlign for setAlignment to use the new LLVM trunk API (silences deprecation messages of old API) 2019-10-18 00:16:24 +02:00
Martin Kinkelin
8fd69da8fb Make all DtoGEP helpers use implicit inbounds
Single functional change: always emit inbounds when computing the base
pointer of a SliceExp.
2019-09-10 22:36:25 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
79a22f734b
Cache struct literal constants per compilation unit, not globally (#2992)
Fixes #2990.
2019-02-15 18:16:59 +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
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
7e9db717ce
Fix issue #2859 (#2860)
I assume a DotVar expression making it here implies its address is not constant.
2018-09-29 17:29:00 +02:00
Martin
73036990ac Re-implement module-scope initialized delegates (#2508) 2018-02-14 20:01:31 +01:00
Martin
33dcdb98de Revert "DMD issue 17899 (#2508)"
This reverts commit b22d8cccf3.
2018-02-14 19:56:53 +01:00
Nicholas Wilson
b22d8cccf3
DMD issue 17899 (#2508)
Enable module scope initialised delegates
2018-02-12 09:11:33 +00:00
Martin
ef78d63bf5 Small refactoring wrt. CTFE typeid() expressions
There's a functional change here: previously, the direct calls to
`TypeInfo...Declaration_codegen()` bypassed the check whether the
TypeInfo can be omitted due to the described type being speculative,
which is performed for normal `Declaration_codegen()` calls only.
The latter is used by `DtoTypeInfoOf()`.
2017-10-25 00:38:05 +02:00
kinke
d1b30d627c Backport fix for issue #2357 (#2366)
Improve robustness for TypeInfos of speculative types by only eliding
their TypeInfo definition, not the declaration of the LL global
altogether.

`DtoTypeInfoOf()` expects the LL global to be created and otherwise
fails with an assertion or segfault (e.g., issue #2357). So now only
linker errors should result in case the TypeInfo definition is missing.

Also normalize the calls to `DtoTypeInfoOf()` and revise the following
pointer bitcasts, as the LL type of forward-declared TypeInfo globals
may be opaque.
2017-10-18 20:47: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
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Martin
b07feb296e Refactoring: Introduce IRState::setGlobalVarInitializer() 2017-06-17 20:45:06 +02:00
Martin
7790376096 Make sure LL globals for struct/class literals match their type's LL type
I.e., a global may be a cast pointer to a helper global's payload in case
the initializer doesn't match the struct/class LL type (unions).
2017-06-17 20:01:32 +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
c26bfcbdaa toconstelem: Implement array literal VectorExps
Previously, we would always try to splat the given expression across the
whole vector. This hasn't been noticed earlier as DMD mostly generates
ArrayInitializers when initializing vectors to array literals (but
notably not when explicitly assigning VectorType.init).

GitHub: Fixes #2101.
2017-05-09 23:13:07 +01:00
David Nadlinger
f58fa7576d toconstelem: clang-format again [nfc] 2017-05-07 01:59:57 +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
10b0261200 Zext i1 constants for scalar Boolean struct fields to i8 2016-10-23 17:31:02 +02:00
David Nadlinger
52445d617b gen: Prefer nullptr [nfc] 2016-09-03 14:38:10 +01:00
Martin
a843bbf2e8 Fix issue #1723
Errors are gagged while trying to create a constant initializer for an
associative array literal. So don't die with an assertion if the cast
source is a NewExp (or something else than a supported ClassReferenceExp),
emit a gaggable error instead.
2016-08-28 20:11:05 +02:00
Martin
df34beb59b Refactor binops and binassigns 2016-07-16 16:42:23 +02:00
Rainer Schuetze
f9995b1883 fix build against LLVM trunk svn rev 273030 2016-06-18 10:54:23 +02:00
Johan Engelen
1b4b9a07c9 Fix typo: typeinf.h --> typinf.h [NFC] 2016-06-08 10:40:00 +02:00
Johan Engelen
d7ed918766 Fix codegen for static initialization with typeid(A). Resolves issue 1540. 2016-06-08 10:40:00 +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
David Nadlinger
90c213b52e Adapt to changed StringExp API
Not tested yet. There is also quite a bit of potential for
further cleanup of the glue layer string manipulation code.
2016-02-14 19:35:40 +01:00
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
05d45350aa clang-tidy: Add readability-else-after-return 2015-11-02 11:30:40 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 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
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
05c10d9107 Introduce DtoAlignment() and overload DtoAlloca() for VarDeclarations
Trying to get the alignment right by using the first non-default one
in the following order of descending priority:

VarDeclaration::alignment [variables only of course]
Type::alignment()
Type::alignsize()

This fixes `align(x) struct S { ... }`.
2015-10-18 14:38:09 +02:00
Martin
cda8a12112 Merge branch 'master' into merge-2.068
Conflicts:
	dmd2/root/man.c
	tests/d2/dmd-testsuite
2015-10-05 22:56:36 +02:00
Martin
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
David Nadlinger
852947b08c Implement toConstElem for TypeidExp
The TypeInfo code could really use some refactoring
2015-08-29 03:09:18 +02:00
David Nadlinger
6215acc15a Merge pull request #1030 from klickverbot/cfg-rewrite
EH/cleanup codegen rewrite
2015-08-20 15:30:15 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +02:00
David Nadlinger
f3a79f1215 llvm::StringMap is available in 3.1 just fine? 2015-08-16 22:59:41 +02:00
Martin
5fbbd3257d LLVM 3.7+: fix toConstElem(SymOffExp*).
The new type parameter for `llvm::ConstantExpr::getGetElementPtr()` is
checked for being the pointee of the provided base (or more precisely,
the pointee of the base's scalar type).
So for the 'ugly' GEP, i8* as type for an i8* base was clearly wrong,
and the 'nice' GEP with the fixed i8 type would only work for i8* bases.

This fixes dmd-testsuite issues on Win64, e.g., runnable/test11.d.
2015-08-16 15:49:00 +02:00
David Nadlinger
0922254dd1 Directly emit IR into same llvm::Module instead of using Linker
GitHub: Fixes #970.
2015-06-14 21:36:35 +02:00
Dmitri Makarov
efa96d69d8 Cache global variables for string literals. 2015-04-15 09:56:02 +02:00
Kai Nacke
a4924c50e1 LLVM 3.7: llvm::ConstantExpr::getElementPtr() wants element type.
This is the same change like the one on the GEP instruction.
2015-04-04 01:37:14 +02:00
kai
024b14cd7f Fix some warnings.
These are easy to solve and reduce the noise in the Travis build.
2014-12-26 15:59:23 +01:00
Alexey Prokhin
66a392a5c2 Rename Type::irtype to ctype for consistency with dmd and gdc 2014-10-05 16:55:12 +04:00
Kai Nacke
d4c72414c7 Make IrDsymbol a typesafe union in gen/toconstelem.cpp, too. 2014-09-13 23:28:17 +02:00