16 Commits

Author SHA1 Message Date
Timm Bäder
773a6a9cc8 Revert "[clang][bytecode] Allocate InitMaps via Program/InterpState allocators (#170272)"
This reverts commit 8fe38c4c9c71c7a86ecdba476ee5bae4c02c0dfe.

This breaks the clang-armv7-2stage build bot:
https://lab.llvm.org/buildbot/#/builders/79/builds/2531
2025-12-09 06:19:09 +01:00
Timm Baeder
8fe38c4c9c
[clang][bytecode] Allocate InitMaps via Program/InterpState allocators (#170272)
Save them as a pointer intead of using a shared_ptr. This we we can use
the pointer integer value to differentiate the "no initmap yet" and "all
values initialzed" cases.

This regresses one test case in const-eval.c, but as it turns out, that
only worked coincidentally before.
2025-12-06 06:37:45 +01:00
Timm Baeder
0de12bb4e1
[clang][bytecode] Only block pointers can be partially initialized (#160075)
So ignore the rest in `checkFullyInitialized()`.

Fixes #160071
2025-09-23 11:22:27 +02:00
Timm Baeder
168308325d
[clang][bytecode] Simplify and optimize EvaluationResult (#155772)
Remove support for saving a `Pointer` in the `EvaluationResult` since
that was unused. Add `stealAPValue()` which moves the `APValue` out of
the `EvaluationResult` to avoid a copy at the end of the evaluation.
2025-08-28 10:06:04 +02:00
Timm Baeder
839916c8c9
[clang][bytecode] Speed up EvaluationResult::CheckArrayInitialized() (#155756)
For large primitive arrays, avoid creating a new `Pointer` for every
element (via `Pointer::isElementInitialized()`) or avoid iterating over
the array altogether (via `Pointer::allElementsInitialized()`).
2025-08-28 09:14:22 +02:00
Timm Baeder
da65685893
[clang][bytecode][NFC] Remove FunctionPointer leftovers (#155761)
from EvaluationResult. `setFunctionPointer()` is unused.
2025-08-28 08:53:45 +02:00
Timm Baeder
07b2ba2600
Reapply "[clang][bytecode] Fix incorrect offset in elem() (#155157)" (#155276)
This reverts commit 9642aadf7064192164d1687378d28d6bda1978c9.

Since elem() only works on primitive arrays anyway, we don't have to do
the isArrayRoot() check at all.
2025-08-26 05:24:18 +02:00
Timm Bäder
9642aadf70 Revert "[clang][bytecode] Fix incorrect offset in elem() (#155157)"
This reverts commit 0f4db1a7955e511844d7a685103aa32617fc279d.

This breaks the armv8-quick builder:
https://lab.llvm.org/buildbot/#/builders/154/builds/20676
2025-08-25 15:00:02 +02:00
Timm Baeder
0f4db1a795
[clang][bytecode] Fix incorrect offset in elem() (#155157)
We need to use the base offset in both cases.
Also, add additional assertions to make sure we don't miss this case
again.

Fixes #155132
2025-08-25 14:09:59 +02:00
Timm Baeder
5b0935f1f0
[clang][bytecode] Reintroduce Pointer::elem() (#149693)
As a way of writing atIndex(I).deref<T>(), which creates an intermediate
Pointer, which in turn adds (and removes) that pointer from the pointer
list of the Block. This way we can avoid that.
2025-07-20 10:59:50 +02:00
Timm Baeder
a1bcc8f757
[clang][bytecode] Diagnose heap-allocated array elem pointers... (#137523)
...  as "pointer to subobject".
2025-04-27 18:01:19 +02:00
Kazu Hirata
3f07af93dc
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123283)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Source to be nonnull.
2025-01-17 08:46:16 -08:00
Kazu Hirata
dec6324cb0
[AST] Remove unused includes (NFC) (#116549)
Identified with misc-include-cleaner.
2024-11-17 09:36:48 -08:00
Timm Baeder
208584d91a
[clang][bytecode] Fix source range of uncalled base dtor (#111683)
Make this emit the same source range as the current interpreter.
2024-10-09 20:00:33 +02:00
Timm Baeder
35f7cfb224
[clang][bytecode] Check for Pointer dereference in EvaluationResult (#108207)
We will deref<>() it later, so this is the right check.
2024-09-11 16:14:41 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00