Commit graph

101 commits

Author SHA1 Message Date
Martin Kinkelin
2463fe9949 Merge remote-tracking branch 'origin/master' into merge-2.110 2024-08-02 19:15:45 +02:00
Martin Kinkelin
d5af843ba9 Remove getNullPtr() parameter 2024-07-18 22:33:20 +02:00
Martin Kinkelin
c9ac30c236 Adapt to free-standing size(Type*) function 2024-07-16 16:22:35 +02:00
Martin Kinkelin
4eff49437c Adapt to somewhat simpler global-var-replacement for mismatching initializers
We don't have any constant pointer-bitcasts anymore for these, but can
use the helper global directly.
2024-05-20 18:49:46 +02:00
Martin Kinkelin
a37c2ab5f0 Get rid of now unused variables 2024-05-20 17:48:59 +02:00
Martin Kinkelin
4818101c3e Get rid of some superfluous GEPs with (0, 0) indices 2024-05-20 17:30:02 +02:00
Martin Kinkelin
1ea2ba1df7 Get rid of base flag in DtoTypeInfoOf() 2024-05-20 17:30:01 +02:00
Martin Kinkelin
4c74f64a9c Get rid of D type param in DtoConstSlice() 2024-05-20 17:30:01 +02:00
Martin Kinkelin
d140f2a283 Skip superfluous IR pointer bitcasts, now that they are always opaque 2024-05-20 16:45:09 +02: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
Martin Kinkelin
b514c6b448
Replace invalid getTypeStoreSize() with getTypeAllocSize() (#4647) 2024-05-10 23:11:21 +02:00
liushuyu
b8a96faf92 tree-wide: port LDC to LLVM 18 2024-03-26 14:45:35 -06: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
8c685903cc Fix C++ header regressions 2024-01-13 03:21:07 +01:00
Martin Kinkelin
4abf1d3265 Restore a does-not-access-parent-context check for constant delegates
LDC does need it (`runnable/funclit.d` regressed after removing the check).
Checking `outerVars` should be much better than the previous check,
which only allowed module-level lambdas.
2023-11-06 20:13:09 +01:00
Martin Kinkelin
4f463fa7f2 Enable static initialization of associative arrays
To make the tests compile, I had to additionally remove the dubious
check for static delegates. I haven't found any such check in DMD's
glue layer.
2023-11-06 01:10:16 +01:00
Martin Kinkelin
d6d79187e6 Merge fix: Adapt to removed error/warning members 2023-11-06 01:10:16 +01: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
Martin Kinkelin
60e44659f1
Fix corner cases for pointer offset codegen (#4365)
Fixes #4362.
2023-04-16 19:01:18 +02:00
Martin Kinkelin
09411d9b7a Improve error msg for static AA initialization
Fixes fail_compilation/issue12652.d.
2023-01-21 19:55:04 +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
Nicholas Wilson
a433746018
Remove getContainedType from toconstelem.cpp (#4158) 2022-09-13 20:50:39 +08:00
Nicholas Wilson
3c2b8906b0
Use typed gep in toconstelem.cpp (#4089) 2022-09-01 15:51:55 +08:00
Nicholas Wilson
1128981d55
Use typed GEP in toconstelem.cpp (#4073) 2022-08-29 06:54:44 +08:00
Nicholas Wilson
3c87630097
Remove getPointeeType from ToConstElem (#4027) 2022-08-21 10:24:14 +08: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
b3e7fc89fe Handle importC SymOffExp quirk
Fixes dmd-testsuite's compilable/test22929.c.
2022-04-30 21:06:05 +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
8527b3f9c8 Work around llvm::PointerType::getElementType() being deprecated in LLVM 14 2022-03-30 19:53:47 +02:00
Martin Kinkelin
4bd8dcd91b Adapt to new TOK and EXP enum classes 2022-02-16 20:52:07 +01:00
Martin Kinkelin
4e74ee272f Ignore void initializers for literal fields
This fixes an LDC ICE, complaining about `void is not a constant`.
2022-02-12 02:40:50 +01:00
Martin Kinkelin
fe146c41e8 Enable toConstElem for some SliceExp
Porting dlang/dmd#13358 to fix dmd-testsuite's compilable/test21414.d.
2021-12-21 04:07:06 +01:00
Martin Kinkelin
e8997308f9 Always specify a pointee type for llvm::ConstantExpr::getGetElementPtr()
As required by LLVM 13.
2021-10-11 19:21:37 +02:00
Martin Kinkelin
6b3929597e
Fix regression in recent toConstElem refactoring (#3837)
Fixes #3836 by fixing an oversight in 598b615e77.
2021-09-25 14:26:16 +02:00
Martin Kinkelin
50fb6c8638 Add support for StringExp typed as pointer to static array
E.g., "456" typed as `char[4]*` encountered in dmd-testsuite's
runnable/test22070_2.c, and a similar constant case in
compilable/testcstuff1.c.
2021-09-10 21:56:45 +02:00
Martin Kinkelin
598b615e77 Fix switch case with const runtime variable assuming a *constant* initializer
As the initializer might just as well not be computable at compile-time.
Fixes such a case in `bug6985()` in dmd-testsuite's
`compilable/interpret3.d`.
2021-09-08 17:56:23 +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
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00
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