Commit graph

233 commits

Author SHA1 Message Date
liushuyu
9967a87d36 gen/dibuilder.cpp: use the newer debug record API 2024-11-26 08:46:15 -07:00
Nicholas Wilson
fbc88d1155 Fix some compilation errors for LLVM19/20 2024-11-26 08:46:15 -07:00
Martin Kinkelin
e7091dd0c7 Drop support for LLVM < 14
LLVM 14 is the first version supporting both new pass manager and
opaque IR pointers.
2024-05-12 03:53:03 +02:00
liushuyu
b8a96faf92 tree-wide: port LDC to LLVM 18 2024-03-26 14:45:35 -06:00
Martin Kinkelin
9041c0bf67 Adapt to free functions in dmd C++ namespace now 2024-03-03 19:14:00 +01:00
Martin Kinkelin
d435c8a451 Merge fix: Adapt to changed mangleToBuffer() signature 2023-11-06 01:10:16 +01:00
Martin Kinkelin
8fc096e4c6 Adapt to Loc::filename now being a function 2023-08-26 15:56:33 +02:00
Martin Kinkelin
ae52da1bfa Adapt to Loc::linnum and Loc::charnum now being functions 2023-08-26 15:56:02 +02:00
Martin Kinkelin
81ea49db13 Merge remote-tracking branch 'origin/master' into llvm16-2 2023-08-12 14:37:01 +02:00
Martin Kinkelin
9ce57807c0 Drop support for LLVM 9 and LLVM 10 2023-07-29 01:12:43 +02:00
Martin Kinkelin
67b73a55f0 [slightly simplify dibuilder.cpp again] 2023-06-11 17:42:36 +02:00
Ikey Doherty
ad71070369
For LLVM >= 16, use std::optional APIs
Unfortunately when building with LLVM < 15, we're using C++-11,
so the std::optional bits are only available in C++-17.

Even more unfortunately we can't really override this, rather
inherit the fact of using C++-17 when using LLVM > 16.

Thus, we add a slightly messy conditional compilation situation
to allow usage of LDC on older LLVM versions, and with newer
LLVM/libcxx.

Signed-off-by: Ikey Doherty <ikey@serpentos.com>
2023-06-03 22:07:24 +01:00
Martin Kinkelin
e0bc077e69 Adapt to renamed VarDeclaration.aliasTuple (from aliassym) 2023-03-12 20:45:40 +01:00
Martin Kinkelin
5c5de9c2f8 Fix debuginfo regression for tuple-field globals as static aggregate members
Fixes assertions hit by dmd-testsuite's runnable/{test23010,variadic}.d,
caused by a different tuples handling in the frontend.
2022-11-19 21:16:17 +01:00
Nicholas Wilson
1c3b55d19e
Remove usage of getPointerElementType in dibuilder.cpp (#4020) 2022-08-13 10:16:07 +00:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Nicholas Wilson
4349388563
Prepare for LLVM15: Headers, attributes (#3936)
`llvm::AttrBuilder` was changed to require an LLVMContext in its constructor, and can no longer be copied.

declare `DEBIG_TYPE` after includes for the GC2Stack pass as `llvm/Support/GenericDomTreeConstruction.h `(included from `llvm/IR/Dominators.h` `#define`s and `#undef`s it.

`llvm::DIBuilder::createExpression` now takes an `ArrayRef<uint64_t>` instead of `int64_t`. EmitLocalVariable has similarly changed
2022-03-11 16:38:49 +01:00
Martin Kinkelin
0fd5c6ec16
Merge pull request #3873 from kinke/no_reverse
Don't reverse parameters order for extern(D)
2022-03-08 17:03:17 +01:00
Martin Kinkelin
4e061791b4
Merge pull request #3868 from kinke/di_ptr
DI: Don't emit explicit alignment for pointer types
2022-02-26 14:36:57 +01:00
Brian Callahan
5a28329e2f
Use d_size_t in dibuilder.cpp (#3877) 2021-11-24 16:21:13 +00:00
Luís Ferreira
3701684d6f
DI: delegate context pointer should be .ptr instead of .context (#3866)
According to the ABI specification, when describing the delegates memory
layout, the context pointer is named .ptr .

https://dlang.org/spec/abi.html#delegates

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-11-09 15:59:29 +01:00
Martin Kinkelin
f5ccd0789e Support noreturn-typed global variables
By representing them as a dummy 0 byte.

Fixes a recent addition in dmd-testsuite's compilable/noreturn1.d.
2021-10-18 18:00:38 +02:00
Martin Kinkelin
c280c3d31a Skip noreturn-typed fields for aggregate debuginfos
Fixes an ICE for a new test in dmd-testsuite's runnable/noreturn1.d.
2021-10-11 12:04:27 +02:00
Martin Kinkelin
9858cfb01c Simplify dmd/ldcbindings.{d,h} 2021-09-17 03:49:28 +02:00
Martin Kinkelin
369cfd13ce Adapt to TY enum class 2021-09-07 16:51:19 +02:00
Martin Kinkelin
1e00f63045 Adapt to upstream global.params.* -> target.* shuffling 2021-05-29 00:19:22 +02:00
Martin Kinkelin
c9b6c8a488 DI: Try switching module parent from CU to source file
As the CU parent seems to be reset to null in the final IR for some
reason, at least in some cases.
2021-05-21 05:27:18 +02:00
Martin Kinkelin
c50036e2ff DI: Don't use a forward declaration for base class inheritance info
Instead, resolve it to the actual derived type. I've noticed this
while investigating the tests/debuginfo/classtypes_gdb.d failure.
2021-05-21 05:27:18 +02:00
Martin Kinkelin
3ca48d7ac6 DI: Streamline file path components ('filename', 'directory') with clang
This resolves #3687.
2021-05-20 19:14:08 +02:00
Martin Kinkelin
f39371a32d Merge remote-tracking branch 'origin/master' into merge-2.096
Conflicts:
	gen/dibuilder.cpp
2021-04-10 15:57:21 +02:00
Martin Kinkelin
4db0954067 DI: Remove 2 more superfluous helpers 2021-04-06 04:00:40 +02:00
Martin Kinkelin
84832c937d DI: Fix up a few names 2021-04-06 04:00:40 +02:00
Martin Kinkelin
06d51e36f4 Remove superfluous DIBuilder::CreateCompositeTypeDescription 2021-04-06 01:35:46 +02:00
Martin Kinkelin
f8ef4cd863 DI: Emit enums with floating-point base type as typedefs
In the VS debugger, this means that the displayed type is the floating-
point one instead of the enum, but the enum value is displayed
correctly - it was previously re-interpreted as integer of matching
size.
2021-04-05 22:18:27 +02:00
Martin Kinkelin
eb4fcf26b1 DI: Emit delegate funcptr member as function *pointer*
This is at least required when debugging in VS on Windows.
2021-04-05 22:07:06 +02:00
Martin Kinkelin
3b7e00a768 Fix overzealous toBasetype'ing for debuginfo types
Resolves #3688.
2021-04-05 22:07:06 +02:00
Martin Kinkelin
44daef934a Add support for 'noreturn' type
It's apparently already in the AST, e.g., for core.internal.abort.
2021-02-28 18:57:45 +01:00
Martin Kinkelin
879c8ba465 Upgrade frontend & libs to v2.096.0-beta.1+ (dlang/dmd@0c2d8bd2ab) 2021-02-28 17:40:11 +01:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00
Martin Kinkelin
079858f3b2 Upgrade frontend & libs to early v2.095.0 (dlang/dmd@a4274b3c39) 2020-11-27 17:45:13 +01: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
246b783119
Win64 ABI: Pass/return delegates like slices - in (up to) 2 GP registers (#3609)
I expect this to be slightly more performant than the previous behavior,
where a delegate was treated like a corresponding struct, passed via
hidden pointer and returned via sret.

The primary motivation is a smooth preparation for PR #3578 - in order
to allow people to experiment with `-preview=in` without recompiling
druntime and Phobos, `in` slices and delegates must not be passed by-ref
with `-preview=in` (see dlang/dmd#11828). This would have required a
special case for delegates on Win64, which is IMO better handled this
way.
2020-11-11 21:04:05 +01:00
Martin Kinkelin
1d969cfcca Revise IRScope refactoring
LLVM already provides suited RAII helper types to restore the IRBuilder
state. [They sadly aren't movable, so I've had to wrap them in a
unique_ptr.]

While at it, also minimally revise debuginfo generation for functions.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
9c42dfd9d0 LLVM 11: Adapt debuginfos wrt. static array and vector lengths
To overcome a new assertion, complaining that subranges with lower
bounds (always 0) aren't supported for CodeView.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
877ce6fe4c
Add -gdwarf CLI option to emit DWARF debuginfos for MSVC targets (#3533)
Analogous to clang.
2020-08-11 10:30:31 +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
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
22bf484ccf
Don't emit any column infos for CodeView by default (like clang) & add -gcolumn-info (#3388)
Fixes #3102; see https://reviews.llvm.org/D23720.
2020-03-30 14:37:45 +02:00
Martin Kinkelin
7a6c536fe9 Merge remote-tracking branch 'origin/master' into merge-2090 2020-01-12 15:49:04 +01:00