Commit graph

60 commits

Author SHA1 Message Date
Martin Kinkelin
d3574b9835 DtoTypeInfoOf(): Make Loc param mandatory and move to 1st position 2020-12-13 15:15:37 +01:00
DaveP1776
3f9d05ac16 Fix missing location information for error reporting of TypeInfo in betterC
This fixes an issue where any instantiation of TypeInfo in the final
output would lead to a cryptic error with no file or line information.
This change brings ldc in line with dmd's reporting of the same error,
which at least gives file and line information to discover the problem.
2020-12-12 22:41:21 -05:00
Martin Kinkelin
3f716ff75e Refactoring: Introduce getIrType()
As *the* way to access the IrType associated with a Type via its `ctype`
field. Most importantly, it makes sure all access is redirected to the
*unqualified* type's `ctype`, which allows to get rid of the 'multiple
types' workaround for aggregates in DtoType(). Those were e.g. hit for
`shared struct SpinLock`, where the struct's type includes the `shared`
modifier...
2020-11-13 15:43:18 +01:00
Martin Kinkelin
a765bf8901 Refactoring: Move IR global declaration & definition to IrGlobal 2020-10-24 19:55:38 +02:00
Martin Kinkelin
96b9cde428 Add support for LLVM 11
One major change is the removal of llvm::CallSite, which I've replaced
by llvm::CallBase*.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
49affcffb2
Fix issue #3496 - missing IR declarations for some fwd-declared functions (#3503)
Whenever we need an IR function, we'd better make sure it exists. Handle
that in DtoCallee(), by invoking DtoDeclareFunction() by default,
instead of the previous DtoResolveFunction() + DtoCallee() combo.
DtoResolveFunction() usually declares the function, but somehow doesn't
for abstract and body-less functions.
2020-07-13 21:49:41 +02:00
looked-at-me
1b5b40556a
Refactor and improve string literal emission (#3492)
Fixes #3490 by avoiding unnecessary extra key allocations for the literals cache etc.
Also gets rid of code duplication and improves IRState encapsulation.
2020-07-11 01:06:10 +02:00
Martin Kinkelin
26673c174f
Refactoring: Replace Expression::op check followed by static cast to Expression::is<ExpressionType> (#3141)
This may negatively impact performance, as the (final, i.e.,
non-virtual) Expression::is... family is implemented in D and not
available inline in the C++ headers.
2020-01-15 12:54:05 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00
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