Commit graph

567 commits

Author SHA1 Message Date
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
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
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
Martin Kinkelin
4bd8dcd91b Adapt to new TOK and EXP enum classes 2022-02-16 20:52:07 +01:00
Martin Kinkelin
72224f0df3 Fix unused-variable warning 2021-10-19 14:23:13 +02: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
65fe0cb9f2 Merge upstream stable (dlang/dmd@58e4db9880) 2021-10-18 17:50:28 +02:00
Martin Kinkelin
0694563d1c Fix ICE for noreturn-typed locals
Tested by dmd-testsuite's compilable/noreturn1.d.
2021-10-11 12:07:41 +02:00
Martin Kinkelin
5e8490d69e
Merge pull request #3821 from kinke/merge-2.098
Upgrade frontend & libs to early v2.098.0
2021-09-11 20:12:55 +02:00
Martin Kinkelin
86f430c039 Slightly revise frontend diff
E.g., preferring local imports for less merge conflict potential.
2021-09-11 17:34:51 +02:00
Martin Kinkelin
16b9eab374
-dllimport=defaultLibsOnly: Avoid -linkonce-templates requirement (#3816)
Via a sorts-of '-linkonce-templates light', only defining all *data*
symbols instantiated from druntime/Phobos templates in each
referencing CU.
2021-09-11 04:53:21 +02:00
Martin Kinkelin
067fbafd59 ImportC: Gracefully terminate when encountering C initializer lists
Instead of ICE'ing; e.g., for dmd-testsuite's runnable/cstuff2.c.
See #3825.
2021-09-10 22:32:14 +02:00
Martin Kinkelin
db4867d437 Handle new extern(C) structs with size 0
The linkage now (2.098) also affects the size of empty structs - e.g.,
1 for extern(C++), 0 for Posix extern(C), 4 for MSVC extern(C).

This also affects beauties like `extern(C) struct S { double[0] a; }`,
as tested by dmd-testsuite's runnable/ldc_cabi1.d, which is hereby
fixed for Posix - don't try to GEP into an empty LL struct.
2021-09-09 01:32:24 +02:00
Martin Kinkelin
369cfd13ce Adapt to TY enum class 2021-09-07 16:51:19 +02:00
Martin Kinkelin
c6096a7d27
Add __traits(initSymbol, <aggregate type>) (#3774)
A clean way of directly accessing struct and class init symbols. It
yields a `const(void[])` slice; the length reflecting the struct/class
instance size, and the pointer either pointing to the init symbol or
being null for zero-initialized structs.

Paves the way for resolving #3773 in druntime as well as accessing class
init symbols without `TypeInfo_Class.initializer()` indirection, and so
with -betterC as well.
2021-06-28 18:40:28 +02:00
Martin Kinkelin
db4faf336a Refactoring: Add little dllimportSymbol() helper 2021-06-18 22:31:35 +02:00
Martin Kinkelin
faced52b5b isDefaultLibSymbol(): Add ugly special case for std.io dub package 2021-06-16 01:20:54 +02:00
Martin Kinkelin
8f45c22d21 isDefaultLibSymbol(): Exclude all instantiated symbols with -linkonce-templates 2021-06-15 23:13:26 +02:00
Martin Kinkelin
67c8ee6603 isDefaultLibSymbol(): Recognize std.package module as Phobos module 2021-06-15 23:12:07 +02:00
Martin Kinkelin
9865e459d1 Windows: Make implicit dllimport more selective
* Newly require `-link-defaultlib-shared` for implicit dllimport.
  E.g., this enables to compile druntime DLL with `-fvisibility=public`
  for pure exports and no (local) imports (such as builtin TypeInfos).
* `-link-defaultlib-shared` alone now only implicitly imports symbols
  from druntime/Phobos.
  This simplifies building complex DLLs linked against a bunch of
  static libs (dub only supports static lib dependencies!); the static
  libs don't need to be compiled with `-fvisibility=public` anymore
  (if the DLL itself isn't either), `-link-defaultlib-shared` is
  sufficient.
  This is mainly useful for existing DLLs with explicit exports, to make
  them link against *shared* druntime/Phobos and so end up with a single
  druntime/Phobos for the whole process.
2021-06-14 17:47:32 +02:00
Martin Kinkelin
724f3b8157 Support type noreturn in ternary expressions (CondExp)
Fixes runnable/noreturn1.d.
2021-06-01 15:28:27 +02:00
Martin Kinkelin
49caa9e8a0 Windows: Dllimport aggregate globals too
Init symbols, TypeInfos (classes only) & vtables - unless defined in a
root module. For explicitly exported aggregates, or, with
`-fvisibility=public`, all aggregates.
2021-04-29 17:22:12 +02:00
Martin Kinkelin
52bcbcc566 Fix ICE for ref/out params of opaque structs
Fixes dmd-testsuite's new compilable/test21668.d.
2021-03-01 13:10:16 +01:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00