Timm Baeder
defead4d2d
[clang][bytecode] Implement fixed-point add ( #110405 )
2024-09-29 07:13:17 +02:00
Timm Baeder
3a5b9da115
[clang][bytecode] Implement fixed-point-to-float casts ( #110369 )
2024-09-28 19:11:49 +02:00
Timm Baeder
6cbd8a3094
[clang][bytecode] Implement floating-to-fixed-point casts ( #110361 )
2024-09-28 17:24:28 +02:00
Timm Baeder
6b62e04e30
[clang][bytecode] Implement (N)EQ between fixed point and integral ( #110358 )
...
Convert the non-fixed-point side to a fixed-point type before doing the
comparison.
2024-09-28 15:38:33 +02:00
Timm Baeder
641b4d5370
[clang][bytecode] Implement integral-to-fixed-point casts ( #110350 )
2024-09-28 13:10:23 +02:00
Timm Baeder
6fd870bf35
[clang][bytecode] Implement zero-init for fixed point types ( #110257 )
2024-09-27 18:29:34 +02:00
Timm Baeder
581c015ed0
[clang][bytecode] Implement fixed point negation ( #110237 )
2024-09-27 13:29:14 +02:00
Timm Baeder
048bc67276
[clang][bytecode] Start implementing fixed point types ( #110216 )
...
Add the primitive type and implement to-bool casts.
2024-09-27 11:32:43 +02:00
Timm Baeder
3ea55d3cb0
[clang][bytecode] Add a source location to destructor calls ( #110121 )
...
The added test case is still diagnosed differently, but I'm not sure
which version is better.
2024-09-26 16:50:56 +02:00
Timm Baeder
82ce8296b8
[clang][bytecode] Don't call dtors of anonymous unions ( #110087 )
2024-09-26 12:50:53 +02:00
yronglin
1cdcec5884
[clang][bytecode] Handle vector comma op ( #109827 )
...
Currently we were not handle comma op for vector operands, after this
patch, we handle the comma op for vector operands with common way.
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-25 14:09:06 +08:00
Timm Baeder
679c9717df
[clang][bytecode] Fix vector shifts on big-endian systems ( #109800 )
...
For shifts, the LHS and RHS element types might be different. The
variable naming here could probably use some love now, but I'm trying to
fix this as fast as possible.
See the discussion in https://github.com/llvm/llvm-project/pull/108949
2024-09-24 18:07:18 +02:00
Timm Baeder
4b96400240
[clang][bytecode] Allow placement-new in std functions pre-C++26 ( #109753 )
2024-09-24 10:28:54 +02:00
Timm Baeder
e4d34261f8
[clang][bytecode] Ignore CPointerToObjCPointerCasts ( #109760 )
2024-09-24 10:18:33 +02:00
Timm Baeder
c712ab829b
[clang][bytecode] Implement placement-new ( #107033 )
...
If we have a placement-new destination already, use that instead of
allocating a new one.
Tests are partially based on
`test/SemaCXX/cxx2c-constexpr-placement-new.cpp`.
2024-09-23 13:26:49 +02:00
Timm Baeder
f86050de73
[clang][bytecode] Don't call checkLiteralType() in visitInitializer() ( #109530 )
...
We were calling checkLiteralType() too many time and rejecting some
things we shouldn't. Add The calls manually when handling
MaterializeTemporaryExprs. Maybe we should call it in other places as
well, but adding more calls is easier than removing them from a generic
code path.
2024-09-21 20:01:21 +02:00
yronglin
f5a65d8752
[clang][bytecode] Implement arithmetic, bitwise and compound assignment operator ( #108949 )
...
Implement `+`, `-`, `*`, `/` , `%`, `&`, `|`, `^`, `<<`, `>>` and
compound assignment operator.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-21 17:05:24 +08:00
Timm Baeder
5b4c80f123
[clang][bytecode] Create dummy pointers for ObjCStringLiterals ( #109520 )
...
We need to have the final APValue point to the ObjCStringLiteral
expression, not the StringLiteral itself.
2024-09-21 10:33:02 +02:00
Timm Baeder
0bc8168070
[clang][bytecode] Fix reinterpret_casts from pointer to non-pointers ( #108811 )
...
We need to be a little more careful here with whether or nor we are able
to do the cast at all or not.
2024-09-16 17:35:38 +02:00
Timm Baeder
fbf0a80153
[clang][bytecode] Implement HLSLVectorTruncation casts ( #108499 )
2024-09-13 11:32:12 +02:00
Timm Baeder
bd8d432d7b
[clang][bytecode] Add support for creating dummies for expressions ( #108394 )
...
And use that to fix VisitObjCBoxedExprs.
2024-09-12 17:25:40 +02:00
Timm Baeder
3928edecfb
[clang][bytecode] Fix local destructor order ( #107951 )
...
Add appropriate scopes and use reverse-order iteration in
LocalScope::emitDestructors().
2024-09-10 06:26:46 +02:00
Timm Baeder
6f67c38684
[clang][bytecode] Fix a variable scope problem with continue/break jumps ( #107738 )
...
Cleaning up _all_ the scopes is a little too much. Only clean up until
the point here we started the scope relevant for the break/continue
statement.
2024-09-08 19:22:18 +02:00
yronglin
cf11eb62e1
[clang][bytecode] Implement logical operators for vector type ( #107678 )
...
Implement `&&`, `||` logical operators for vector type.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-08 14:04:00 +08:00
Timm Baeder
d6d60707ec
[clang][bytecode] Fix two-pointer-style std::initializer_lists ( #107682 )
...
The first pointer needs to point to the first element of the underlying
array. This requires some changes to how we handle array expansion
2024-09-07 14:27:09 +02:00
Timm Baeder
78cf9b830c
[clang][bytecode] Implement using operator new/operator delete ( #107679 )
...
Reuse the __builtin_operator_{new,delete} implementations.
2024-09-07 12:17:54 +02:00
Timm Baeder
83fea8b809
[clang][bytecode] Allow continuing when discarded MemberExpr Base fails ( #107231 )
...
We don't need the value in this case, since we're discarding it anyway.
Allow continuing the interpretation but note the side effect.
2024-09-07 09:33:27 +02:00
Timm Baeder
eef8116be1
[clang][bytecode] Only visit local variables if they have constant init ( #107576 )
...
See the comment I added for why this is weird. We might want to have a
different mechanism for this in the future.
Fixes https://github.com/llvm/llvm-project/issues/101801
2024-09-07 06:36:21 +02:00
Timm Baeder
60eb9b214c
[clang][bytecode] Fix reinterpret casts of two non-primitive types ( #107564 )
...
We don't want to allow e.g. cast from a record to an array or the other
way arround.
2024-09-07 06:16:02 +02:00
yronglin
67f9183c11
[clang][bytecode] Implement comparsion operators for vector type ( #107258 )
...
Implement ==, !=, <, <=, >, >= comparsion operators for vector type.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-06 20:27:11 +08:00
Timm Baeder
0f5f440f24
[clang][bytecode] Pass FPOptions to floating point ops ( #107063 )
...
So we don't have to retrieve them from the InterpFrame, which is slow.
2024-09-03 14:24:11 +02:00
Timm Baeder
a9006bffa9
[clang][bytecode] Fix zero-init of first union member ( #106962 )
...
... if done via a ImplicitValueInitExpr.
We were already doing this later in visitZeroRecordInitializer().
2024-09-02 13:51:01 +02:00
Timm Baeder
e4f3b56dae
[clang][bytecode] Fix diagnosing reads from temporaries ( #106868 )
...
Fix the DeclID not being set in global temporaries and use the same
strategy for deciding if a temporary is readable as the current
interpreter.
2024-09-01 07:40:43 +02:00
Timm Baeder
360e4abfc8
[clang][bytecode] Diagnose comparisons with literals ( #106734 )
...
This requires adding a new opcode for PointerToBoolean casts, since we
otherwise emit too many diagnostics. But that fixes an older problem
when casting weak pointers to bool.
2024-08-31 06:24:36 +02:00
yronglin
b294951e39
[clang][bytecode] Fix the handling of address of a vector ( #106558 )
...
The PR https://github.com/llvm/llvm-project/pull/105996 broke taking the
address of a vector:
**compound-literal.c**
```C
typedef int v4i32 __attribute((vector_size(16)));
v4i32 *y = &(v4i32){1,2,3,4};
```
That because the current interpreter handle vector unary operator as a
fallback when the generic code path fail. but the new interpreter was
not. we need to handle `UO_AddrOf` in
`Compiler<Emitter>::VisitVectorUnaryOperator`.
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-08-30 17:34:00 +08:00
yronglin
ee0d706338
[clang][bytecode] Implement constexpr vector unary operators +, -, ~, ! ( #105996 )
...
Implement constexpr vector unary operators +, -, ~ and ! .
- Follow the current constant interpreter. All of our boolean operations
on vector types should be '-1' for the 'truth' type.
- Move the following functions from `Sema` to `ASTContext`, because we
used it in new interpreter.
```C++
QualType GetSignedVectorType(QualType V);
QualType GetSignedSizelessVectorType(QualType V);
```
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
2024-08-29 06:10:30 +08:00
Timm Baeder
2f144ac5a1
[clang][bytecode][NFC] Remove containsErrors check from visitInitializer ( #105811 )
2024-08-23 14:28:52 +02:00
Timm Baeder
7b4b85b75d
[clang][bytecode] Reject void InitListExpr differently ( #105802 )
...
This reverts c79d1fa540390f6e37e1ea326153559eeadd0de6 and
125aa10b3d645bd26523a1bc321bb2e6b1cf04e1
Instead, use the previous approach but allow void-typed InitListExprs
with 0 initializers.
2024-08-23 11:56:42 +02:00
Timm Baeder
38b8e54682
[clang][bytecode][NFC] Remove containsErrors() check from delegate ( #105804 )
...
This check was removed a while ago from visit(), remove it from
delegate() as well.
2024-08-23 11:55:30 +02:00
Timm Baeder
b9c4c4ccf9
[clang][bytecode] Fix 'if consteval' in non-constant contexts ( #104707 )
...
The previous code made this a compile-time decision but it's not.
2024-08-22 19:06:09 +02:00
Timm Baeder
db94852b9b
[clang][bytecode] Allow adding offsets to function pointers ( #105641 )
...
Convert them to Pointers, do the offset calculation and then convert
them back to function pointers.
2024-08-22 15:23:50 +02:00
Timm Baeder
125aa10b3d
[clang][bytecode] Fix void unary * operators ( #105640 )
...
Discard the subexpr.
2024-08-22 14:05:17 +02:00
Timm Baeder
c79d1fa540
[clang][bytecode] Don't discard all void-typed expressions ( #105625 )
...
For void-types InitListExprs, we need to diagnose them as invalid. But
only if we are _not_ discarding.
2024-08-22 09:51:16 +02:00
Timm Baeder
a14c730990
[clang][bytecode] Fix diagnostic in final ltor cast ( #105292 )
...
Don't diagnose volatile reads but diagnose a few other accesses earlier.
2024-08-21 08:08:32 +02:00
Timm Baeder
c99347a9f5
[clang][bytecode] Fix discarding CompoundLiteralExprs ( #104909 )
2024-08-20 12:41:13 +02:00
Timm Baeder
ba7dadf0e9
[clang][bytecode] Fix initializing base casts ( #104901 )
...
Use delegate() there. To fix a follow-up problem, abort when a cast ends
up on a valid Pointer that isn't a base class.
2024-08-20 11:44:30 +02:00
Timm Baeder
ca148b2150
[clang][bytecode] Support ObjC blocks ( #104551 )
...
I started out by adding a new pointer type for blocks, and I was fully
prepared to compile their AST to bytecode and later call them.
... then I found out that the current interpreter doesn't support
calling blocks at all. So we reuse `Function` to support sources other
than `FunctionDecl`s and classify `BlockPointerType` as `PT_FnPtr`.
2024-08-20 06:08:53 +02:00
Timm Baeder
d27278a835
[clang][bytecode] Discard NullToPointer cast SubExpr ( #104782 )
...
So we still properly abort if they fail.
2024-08-19 17:51:27 +02:00
Timm Bäder
d082f1f37d
[clang][bytecode] Only booleans can be inverted
...
No need to have the Inv() function be templated.
2024-08-18 16:02:32 +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