Commit graph

320 commits

Author SHA1 Message Date
Martin Kinkelin
9041c0bf67 Adapt to free functions in dmd C++ namespace now 2024-03-03 19:14:00 +01:00
Martin Kinkelin
a3aadfcce8 Adapt to new multi-dimensional array allocation lowering
Fixes runnable/test28.d.
2024-01-19 19:42:17 +01:00
Martin Kinkelin
ae52da1bfa Adapt to Loc::linnum and Loc::charnum now being functions 2023-08-26 15:56:02 +02:00
Martin Kinkelin
c8857e8cb8 Fix some LLVM 16 deprecations wrt. DataLayout::getABITypeAlignment() and llvm::makeArrayRef() 2023-08-13 19:10:57 +02:00
Martin Kinkelin
67885a8ef7 Adapt to new _d_arraycatnTX template lowering 2023-07-16 13:46:34 +02:00
Martin Kinkelin
a6dc3fa73a Adapt to new _d_arraysetlengthT template lowering 2023-07-16 13:43:00 +02:00
Martin Kinkelin
1e9f3a7be7 Merge remote-tracking branch 'origin/master' into pre-monorepo
Conflicts:
	runtime/druntime
2022-11-19 19:08:06 +01:00
Johan Engelen
f213aa7f65 Opaque pointers: fix type comparison based on pointers for array copy. (don't compare pointers, because with opaque pointers they are always the same) 2022-11-15 01:48:22 +01:00
Martin Kinkelin
b81c2b5510 Adapt to new array-append frontend lowerings 2022-09-15 21:00:53 +02:00
Martin Kinkelin
6998886e89 Adapt to removed _d_array[set]ctor druntime hooks (replaced by templated lowerings) 2022-09-15 19:00:21 +02:00
Nicholas Wilson
af51b700be
Rename DtoAggrPaint to DtoSlicePaint (#4174)
It only does two elements and is exclusively used for slices
2022-09-15 20:44:28 +08:00
Nicholas Wilson
6617daa45b
Fix issue 4134 (#4136) 2022-09-15 18:00:49 +08:00
Nicholas Wilson
a94262f509
Remove getContainedType from DtoArrayAssign (#4165) 2022-09-14 18:58:25 +08:00
Nicholas Wilson
4f35ff0b78
Remove getContainedType from callMemcmp (#4160) 2022-09-14 14:20:59 +08:00
Nicholas Wilson
c228ef51eb
Remove getContainedType from DtoSlice (#4161) 2022-09-13 20:18:35 +00:00
Nicholas Wilson
838146be71
Remove getContainedType from DtoMemSetZero (#4157) 2022-09-13 21:39:05 +08:00
Nicholas Wilson
f1a3ed5ede
Remove getContainedType from DtoSetArray (#4144) 2022-09-13 20:12:16 +08:00
Nicholas Wilson
ccd24cc09a
Use typed gep in arrays.cpp (#4098) 2022-09-03 05:32:40 +08:00
Nicholas Wilson
dc5caeb19d
Use typed gep in arrays.cpp (#4093) 2022-09-01 20:09:35 +08:00
Nicholas Wilson
f2155c6dd9
Use type gep in initializeArrayLiteral (#4092) 2022-09-01 17:14:57 +08:00
Nicholas Wilson
bd3d562d2a
Use typed gep in arrays.cpp (#4083) 2022-08-31 13:54:32 +08:00
Nicholas Wilson
beddcfd3ad
Use typed gep in arrays.cpp (#4075) 2022-08-31 11:50:41 +08:00
Nicholas Wilson
37aca9c940
Use typed load in arrays.cpp (#4055) 2022-08-29 10:24:05 +08:00
Nicholas Wilson
308d39cea0
Use typed load in arrays.cpp (#4064) 2022-08-28 17:24:35 +08:00
Nicholas Wilson
6daf215b3c
Remove getPointeeType from DtoSetArrayToNull (#4032) 2022-08-21 13:15:30 +08:00
Nicholas Wilson
842593f75b
Remove use of getPointerElementType in gen/arrays.cpp (#4021) 2022-08-21 10:39:00 +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
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
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
f4ea32e496 ImportC: No bounds checks for 'incomplete' static arrays
Fixes dmd-testsuite's runnable/test22326.c.
2021-09-25 18:59:17 +02:00
Martin Kinkelin
fab82436dd Use new druntime hooks _d_arraybounds_{slice,index} for more informative RangeErrors
Fixing dmd-testsuite's runnable/testbounds.d.
2021-09-09 17:37:38 +02:00
Martin Kinkelin
369cfd13ce Adapt to TY enum class 2021-09-07 16:51:19 +02:00
Martin Kinkelin
d3574b9835 DtoTypeInfoOf(): Make Loc param mandatory and move to 1st position 2020-12-13 15:15:37 +01:00
Martin Kinkelin
a9aafac862 Glue layer: Make all mutable Loc & params const 2020-12-13 15:01:19 +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
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
69269f3bd9 Refactor IRScope handling
Replace the stack of IRScopes, each with its own IRBuilder, by directly
tampering with the state of a single IRBuilder.

This seems like the most feasible way to account for a breaking change
in LLVM 11, disallowing IRBuilder from being copied.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
7be38fd220
Try to use memcmp for (in)equality of non-mutable static arrays and mutable slices (#3401)
Fixes #3400. The frontend pre-casts the static array operand to the
slice type for cases like `bool[4] == bool[]`, but that's not possible
in case the static array is non-mutable but the slice type is mutable.

So check the element types for equivalence, not the array types, as
static arrays and slices are NOT equivalent.
2020-04-17 22:09:55 +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
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
9469c6b5b8 Fix array casts with constant source lengths
The `__ArrayCast` lowering isn't (always?) done when casting a static
array to a slice with different element size.
So exploit constant source lengths and compute the target length at
compile-time.

This fixes compilable/ldc_github_421.d - a float[16] can be cast to a
float4[] with constant length 4.
2019-04-25 00:57:46 +02:00
Martin Kinkelin
3817ab0595 Upgrade front-end & libs to v2.086.0-beta.1 2019-04-23 22:13:13 +02:00
Martin Kinkelin
ec72854739
Propagate well-known length of newly allocated arrays (#3042)
For better optimizability, as the length information is lost when using
the slice returned by the druntime hooks directly. Resolves #3041.
2019-04-06 00:41:59 +02:00
Martin Kinkelin
2fb5098f48 Optimize some slice copies
Cache length & ptr in DSliceValue, so that e.g. a pair constructed from
a constant length and some ptr keeps returning a constant length instead
of an extractvalue instruction every time the length is needed.

This enables checking for matching constant lengths when copying slices
and makes `test1()` in runnable/betterc.d work (memcpy instead of
_d_array_slice_copy call):

```
int[10] a1 = void;
int[10] a2 = void;
a1[] = a2[];
```

(more or less equivalent to `a1 = a2`, which is already optimized)
2019-01-09 23:50:44 +01:00
Martin Kinkelin
33cadfaca6 Remove ldc.arrayinit & streamline _d_array_slice_copy/_d_arraycast_len with upstream 2019-01-07 15:54:26 +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