Commit graph

588 commits

Author SHA1 Message Date
Martin Kinkelin
078f0532ca Don't forward-declare magic intrinsics mapping to instructions
It's ugly in general, and apparently causes LTO issues on Windows.

This required a larger refactoring.
2024-03-16 16:28:09 +01:00
Martin Kinkelin
0a69a8451a Add support for new ulong[] hex string literals 2024-03-09 02:19:38 +01:00
Martin Kinkelin
9041c0bf67 Adapt to free functions in dmd C++ namespace now 2024-03-03 19:14:00 +01:00
Martin Kinkelin
d6d79187e6 Merge fix: Adapt to removed error/warning members 2023-11-06 01:10:16 +01:00
Martin Kinkelin
12286284cd Allow member function address as constant initializer
This is allowed since D v2.105. Fixes dmd-testsuite's
runnable/test20687.d. Kindly got a heads-up early:
https://github.com/dlang/dmd/pull/10958#issuecomment-1471147790
2023-08-26 22:35:03 +02:00
Martin Kinkelin
c5704c764d Adapt to new _d_newitemT template lowering for heap-allocations of structs 2023-08-26 16:48:04 +02: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
5d3ded9eeb Remove legacy LL[Maybe]Align 2023-07-29 02:09:35 +02:00
Martin Kinkelin
9ce57807c0 Drop support for LLVM 9 and LLVM 10 2023-07-29 01:12:43 +02:00
Johan Engelen
ed429d4524
Silence unused variable warning when assert is disabled. [NFC] (#4446) 2023-07-20 00:17:54 +02:00
Johan Engelen
ef0719f36b
Implement -femit-local-var-lifetime which adds local (stack) variable… (#4395)
Implement -femit-local-var-lifetime which adds local (stack) variable lifetime annotation to LLVM IR, which enables sharing stack space for variables whose lifetimes do not overlap.
Resolves issue #2227

This is not enabled by default yet, to prevent miscompilation due to bugs (should be enabled in future for optimization levels > 0, and when sanitizers are enabled).
2023-06-01 22:45:56 +00:00
Martin Kinkelin
422555a4d0 Merge remote-tracking branch 'origin/master' into merge-2.103 2023-04-21 15:25:14 +02:00
Hiroki Noda
d001a7cdb8
Fix C assert calls for newlib (#4351) 2023-04-13 15:42:41 +02:00
Martin Kinkelin
e0bc077e69 Adapt to renamed VarDeclaration.aliasTuple (from aliassym) 2023-03-12 20:45:40 +01:00
Martin Kinkelin
ef8ba481e3 Support GC closures with alignment > 16
Tested by tests/dmd/runnable/test16098.d.
2023-02-19 01:43:09 +01:00
Martin Kinkelin
5f46c65ab5
Fix v1.31 regression wrt. unresolved IrAggr (#4312)
And use `IrTypeClass::getVtblType()` to get the vtable LLVM array
type, instead of deriving it from the `IrClass::getVtblSymbol()`
global (invoking that function may define the vtable!).

I've hit some compiler crashes for the Symmetry code base, on
Windows only. I guess the problem surfaced due to
`-link-defaultlib-shared`, which on Windows causes some vtables of
instantiated classes to be defined whenever accessing the vtable
symbol. I don't have a reduced test case unfortunately.
2023-02-06 17:02:07 +01:00
Martin Kinkelin
14759a744e ImportC: Account for StringExp typed as static array with length > string length
Fixes dmd-testsuite's compilable/test23066.c.
2022-10-07 00:04:46 +02:00
Martin Kinkelin
e040d28745 Merge remote-tracking branch 'origin/master' into pre-monorepo 2022-10-04 14:19:56 +02:00
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
Nicholas Wilson
6b38ad0eff
Move gen/cl_helpers.* to driver/ (#4191) 2022-09-21 19:36:24 +08:00
Martin Kinkelin
dd5f696d2e Merge remote-tracking branch 'origin/master' into pre-monorepo
Conflicts:
	gen/toir.cpp
	runtime/druntime
2022-09-15 14:56:49 +02:00
Nicholas Wilson
4c7a714b4b
Remove getContainedType in DtoMemCpy (#4162) 2022-09-14 08:36:24 +08:00
Nicholas Wilson
a37e701f63
Remove getContainedType from llvmhelpers.cpp (#4154) 2022-09-13 20:07:56 +08:00
Nicholas Wilson
b5bc517249
Remove final use of getPointerElementType (#4143) 2022-09-13 15:16:46 +08:00
Martin Kinkelin
b7624aa625 Upgrade frontend & libs to pre-DMD-monorepo state (dlang/dmd@20bd0cacbd) 2022-09-12 16:14:16 +02:00
Martin Kinkelin
78fdc135e4 Merge remote-tracking branch 'origin/master' into bitfields
Conflicts:
	gen/dvalue.cpp
	gen/llvmhelpers.cpp
	gen/structs.cpp
	gen/toir.cpp
	ir/irtypeaggr.cpp
2022-09-10 16:25:59 +02:00
Nicholas Wilson
8781a8f1ca
Version out inexpressible assert using getPointerElementType() (#4106) 2022-09-05 11:54:48 +08:00
Nicholas Wilson
7d8638c27a
Make DtoIndexAggregate return a DLValue (#4112) 2022-09-04 21:34:31 +08:00
Nicholas Wilson
78c37450d6
Change IrTypeAggr::getMemberLocation to indicate field of byte offest (#4110)
The previous API of returning two `unsigned`s was ambiguous when accessing the second member of a union that is the first member of a struct, where both output were set to zero.

It now returns one `unsigned` and an output `bool` to determine if it should be used as either a field or byte offset.
2022-09-04 16:02:00 +08:00
Nicholas Wilson
b0f9ba2b5d
Use typed GEP in llvmhelpers.cpp (#4071) 2022-09-03 11:44:32 +08:00
Nicholas Wilson
39561e74f2
Remove one use of getPointerElementType from DtoAllocaDump (#4037) 2022-08-21 14:45:47 +08:00
Martin Kinkelin
37894dd3d0 Refactor via new DBitFieldLValue type
This enables BinAssignExp with bit fields as left-hand-sides and
should generally be more robust.
2022-08-05 15:15:44 +02:00
Martin Kinkelin
ac1a6c1722 [revert to lval semantics for DtoIndexAggregate] 2022-08-04 17:13:09 +02:00
Martin Kinkelin
91ab504554 Support bit fields in DtoIndexAggregate()
For read access only (returning an rvalue).
2022-08-04 15:04:44 +02:00
Martin Kinkelin
372d6b4983 [fix: handle unsized IR field types] 2022-08-04 00:29:25 +02:00
Martin Kinkelin
aee1bedacb WIP: Bit fields 2022-08-01 20:25:39 +02:00
Martin Kinkelin
aa59b5a2a2
Revise DValue repainting (#3991)
Fixes #3990.
2022-07-12 13:40:02 +02:00
Martin Kinkelin
06737d895d Handle assignments to noreturn left-hand-sides in DtoAssign()
Tested by dmd-testsuite's runnable/noreturn1.d.
2022-07-01 18:13:44 +02:00
Martin Kinkelin
be9d5817a1 Adapt glue layer to renamed/changed Declaration::linkage 2022-05-06 19:42:18 +02:00
Martin Kinkelin
be20833b22 codegen: Support {Not,Logical,Identity,Cmp}Exp with non-bool type (for importC AST)
Fixing failing LDC assertions.
2022-04-30 23:46:47 +02:00
Martin Kinkelin
4b1f5516fd Pass isCfile parameter for all defaultInit() calls, for some extra importC zero-init
Fixes dmd-testsuite's runnable/test22994.c.
2022-04-30 19:54:20 +02:00
Martin Kinkelin
b7b8e59043 Upgrade frontend & libs to v2.100.0-beta.1+ (dlang/dmd@c0cff59c79) 2022-04-26 23:01:13 +02:00
Martin Kinkelin
8527b3f9c8 Work around llvm::PointerType::getElementType() being deprecated in LLVM 14 2022-03-30 19:53:47 +02:00
Martin Kinkelin
f068482026
Revert to previous define-on-declare solution for -dllimport=defaultLibsOnly (#3932)
See #3931 for context.
2022-03-03 19:39:01 +01:00
Martin Kinkelin
4cbaebd965
Make -linkonce-templates less aggressive by default & add -linkonce-templates-aggressive (#3924)
Make -linkonce-templates *not* tamper with the general template
emission algorithm anymore (so on top of default non-allinst or
-allinst modes), and keep those tweaks as experimental
-linkonce-templates-aggressive.

Compiling the druntime/Phobos unittests is only marginally slowed
down compared to the more aggressive variant (~1.5% for debug,
~2.5% for release). It does show some rough 10% increase in required
memory, but that's in line with non-linkonce-templates.

The more aggressive variant has the advantage of skipping
needsCodegen() and potentially codegen'ing less symbols. The problem
is that if an instantiated symbol isn't explicitly referenced, for
instance a CRT ctor, it might not be codegen'd at all.
2022-03-01 00:10:34 +01:00
Martin Kinkelin
f2a6fefb7b
Merge pull request #3923 from kinke/fix3916
Fix #3916 - undefined symbols with `-dllimport=all` on Windows
2022-02-28 22:19:02 +01:00
Martin Kinkelin
e82c0d91e6 [undo superfluous recent change] 2022-02-25 02:19:16 +01:00
Martin Kinkelin
22a544f48a Adapt getParentFunc() to extern(C++) delegates
This fixes dmd-testsuite's runnable_cxx/test7925.d.
2022-02-20 00:52:28 +01:00
Martin Kinkelin
5c9f1e5fd6 Handle new throw expressions 2022-02-19 19:28:08 +01:00