aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode
AgeCommit message (Collapse)AuthorFilesLines
22 hours [clang][x86][bytecode] Refactor BMI intrinsic wrappers to use ↵jiang19971-93/+52
interp__builtin_elementwise_int_binop (#160362) Fixes #160281
28 hours[clang][bytecode] Pointer::isZero - fix MSVC "not all control paths return a ↵Simon Pilgrim1-0/+1
value" warning. NFC. (#161168)
2 days[clang][bytecode] Diagnose volatile writes (#160350)Timm Baeder7-10/+44
3 days[clang][bytecode][NFC] Simplify a few builtin implementations (#160910)Timm Baeder1-56/+31
4 days[clang][bytecode][NFC] Simplify align_up/down implementation (#160880)Timm Baeder1-7/+5
Fix a double assignment to a local variable and use the new popToAPSInt() overload.
4 days[clang][bytecode][NFC] Use switches for pointer type distinction (#160879)Timm Baeder2-26/+36
In the important places. They are all fully covered switch statements so we know where to add code when adding a new pointer type.
4 days[clang][bytecode] Remove Program include from InterpFrame.h (#160843)Timm Baeder3-4/+7
Program itself is unused in that file, so just include the needed headers.
5 days[clang][bytecode] Use in `Expr::tryEvaluateString` (#160118)Timm Baeder2-0/+50
Fixes #157492
6 days[AST] Fix a warningKazu Hirata1-1/+2
This patch fixes: clang/lib/AST/ByteCode/InterpBuiltin.cpp:2603:15: error: unused variable 'VT1' [-Werror,-Wunused-variable]
6 days[clang][bytecode] Use existing Descriptor local in InitElem op (#160535)Timm Baeder1-4/+4
Instead of going the way through `Pointer::isUnknownSizeArray()`.
6 days[Headers][X86] VectorExprEvaluator::VisitCallExpr - allow SSE/AVX2/AVX512 ↵woruyu1-0/+68
pack intrinsics to be used in constexpr (#156003) Fixes #154283
6 days[clang][bytecode] Don't crash on a null Descriptor (#160506)Timm Baeder1-0/+3
... for dynamic memory allocation. This happens when the requested array size is too large. Fixes #152951
6 days[clang][bytecode] Use stack offsets for This/RVO ptrs (#160285)Timm Baeder4-44/+47
Instead of keeping the `Pointer`s itself in `InterpFrame`, just save them as offsets and use stackRef<>() when we need them.
7 days[z.OS] fix strnlen() usage in Context.cpp available on z/OS (#160339)Zibi Sarbinowski1-0/+1
On z/OS `strnlen()` is not available by default so we use the wrapper header `zOSSupport.h` to make it visible. This will fix the following error: ``` clang/lib/AST/ByteCode/Context.cpp:250:16: error: use of undeclared identifier 'strnlen' 250 | Result = strnlen(reinterpret_cast<const char *>(Ptr.getRawAddress()), N); | ^~~~~~~ 1 error generated. ```
7 days[clang][x86][bytecode] Replace interp__builtin_knot with static bool ↵fennecJ1-11/+2
interp__builtin_elementwise_int_unaryop callback (#160332) Fix #160287
7 days[clang][byte] Add callback mechanism to handle constexpr for unary integer ↵Simon Pilgrim1-28/+26
ops (#160280) Add interp__builtin_elementwise_int_unaryop - similar to what we already have with interp__builtin_elementwise_int_binop to handle binops Update x86 lzcnt/tzcnt intrinsics to use with a suitable callback I'll add vector handling in a future patch when we add x86 vector intrinsics that can use it
7 days[clang][bytecode] Fix unknown size arrays crash in clang bytecode (#160015)Osama Abdelkader1-0/+3
Fixes #153948 Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
7 days[clang][bytecode] Remove bogus Initializing special case (#159933)Timm Baeder1-7/+2
This doesn't seem to be needed anymore and causes problems. Fixes #159787
7 days[Headers][X86] Allow basic AVX512 predicate ops to be used in constexpr ↵fennecJ1-0/+64
(#159998) Fixes #158646
7 days[clang][bytecode] Only block pointers can be partially initialized (#160075)Timm Baeder1-0/+2
So ignore the rest in `checkFullyInitialized()`. Fixes #160071
7 days[clang][bytecode] Load value of non-lvalue ArraySubscriptExpr (#160024)Timm Baeder1-1/+6
As happens in C. Fixes #158482
7 days[clang][bytecode] Print dummy-status of global variables (#160240)Timm Baeder1-0/+2
in Program::dump().
11 days[clang][bytecode] Typecheck called function pointers more thorougly (#159757)Timm Baeder2-5/+10
Fix two older FIXME items from the `functions.cpp` test.
11 days[Clang] Rename elementwise builtins to `clzg` and `ctzg` (#157128)Joseph Huber1-4/+4
Summary: The added bit counting builtins for vectors used `cttz` and `ctlz`, which is consistent with the LLVM naming convention. However, these are clang builtins and implement exactly the `__builtin_ctzg` and `__builtin_clzg` behavior. It is confusing to people familiar with other other builtins that these are the only bit counting intrinsics named differently. This includes the additional operation for the undefined zero case, which was added as a `clzg` extension.
11 days[clang][bytecode] Move generic lambda handling to Compiler (#159733)Timm Baeder2-18/+18
So the static invoker's Function still points to the static invoker instead of the call operator of the lambda record. This is important for a later commit.
12 days[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow ↵Aditya Chaudhari1-0/+60
AVX/AVX512 subvector insertion intrinsics to be used in constexpr #157709 (#158778) AVX/AVX512 vector insert intrinsics now support constexpr evaluation in both the AST evaluator and bytecode interpreter paths. FIXES: #157709
12 days[clang][bytecode] Optimize InterpStack (#159400)Timm Baeder2-33/+43
Replace `StackChunk::End` with `StackChunk::Size`, mark the allocating code paths as unlikely and move `grow()` into the header, which allows us to template this for the `Size` parameter. Since we only push our primitive types on the stack and all the sizes are aligned to pointer size multiples, this only results in a few instantiations.
12 days[clang][bytecode] Pass `SourceInfo` objects by value (#159532)Timm Baeder4-11/+11
They are only pointer-sized and copying them is cheaper than taking the const ref.
13 days[clang][ExprConst] Move getLangOpts() to interp::State subclasses (#159280)Timm Baeder3-6/+3
Instead of having `State::getLangOpts()`, which does a virtual call to `getASTContext()` to call `getLangOpts()` on that, just move `getLangOpts()` to the subclasses so we can do that without the virtual call. We never call `getLangOpts()` in `State.cpp`, so it's not needed in the base class.
13 days[clang][ExprConst] Assert that EvaluateAsInitializer has non-null VD (#159274)Timm Baeder1-8/+5
Both the expression (the initializer) as well as the VarDecl can't be null here. Assert that.
13 days[clang][bytecode] Remove InterpFrame::IsBottom flag (#159279)Timm Baeder2-4/+3
The bottom frame is the one without a parent. No need to save that information separately.
13 days[clang][bytecode][NFC] Add some popToAPSInt convenience API (#159252)Timm Baeder1-62/+39
Add a variant that takes a QualType and one that takes an expression. That way we don't have to repeat the clunky classify() calls all over the place.
13 days[clang][bytecode] Optimize InitElem{,Pop} (#159084)Timm Baeder3-36/+65
Try harder to avoid creating a new `Pointer` for the element.
2025-09-16[clang][bytecode][NFC] InterpState: get ASTContext from interp::Context ↵Timm Baeder1-1/+1
(#158852) Access the Parent state one less time.
2025-09-16[clang][bytecode] Create InterpState allocator on demand (#158802)Timm Baeder1-2/+4
We often don't need it (especially in C), so make this optional and create it only when we first allocate something.
2025-09-16[clang][bytecode] Improve error detection in BitCastPrim op (#158575)Timm Baeder3-5/+17
Reject bitcasts to pointer types unless it's to `nullptr_t` and always reject bitcasts to member pointer types. Fixes #156174
2025-09-16[clang][ExprConst] Reject unary vector shuffles (#158589)Timm Baeder1-0/+4
This is not implemented at compile time and asserts in assertion builds, so reject it here. Fixed the coding style in `BuiltinShuffleVector` at the same time. Fixes #158471
2025-09-16[clang][bytecode][NFC] Remove BlockScope (#158656)Timm Baeder2-13/+5
Unused these days.
2025-09-15[X86][bytecode] Allow SSE/AVX BLEND imm intrinsics to be used in constexpr ↵Brandon1-0/+44
(#157776) This marks the following builtins as constexpr, which allows their corresponding intrinsics to be used in constexprs. | Intrinsics | X86 Builtins | CPUID Flags | Header | | -------------------- | --------------------------- | ----------- | ----------- | | `_mm_blend_pd` | `__builtin_ia32_blendpd` | SSE4.1 | smmintrin.h | | `_mm256_blend_pd` | `__builtin_ia32_blendpd256` | AVX | immintrin.h | | `_mm_blend_ps` | `__builtin_ia32_blendps` | SSE4.1 | smmintrin.h | | `_mm256_blend_ps` | `__builtin_ia32_blendps256` | AVX | immintrin.h | | `_mm_blend_epi16` | `__builtin_ia32_pblendw128` | SSE4.1 | smmintrin.h | | `_mm256_blend_epi16` | `__builtin_ia32_pblendw256` | AVX2 | immintrin.h | | `_mm_blend_epi32` | `__builtin_ia32_pblendd128` | AVX2 | immintrin.h | | `_mm256_blend_epi32` | `__builtin_ia32_pblendd256` | AVX2 | immintrin.h | Fixes #157065 --------- Co-authored-by: Timm Baeder <tbaeder@redhat.com> Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-09-15[clang][bytecode][NFC] Surround Pointer diagram in \verbatim (#158550)Timm Baeder1-1/+2
See if this fixes the documentation.
2025-09-15[clang][bytecode] Check for dummy pointers in CopyArray op (#158543)Timm Baeder1-0/+3
They can't be written to or read from. Fixes #158535
2025-09-15[clang][bytecode] Fix bit casts to IntAP types (#158509)Timm Baeder1-7/+21
They were left out. Fixes #153920
2025-09-15[clang][bytecode] Pass initializer along in `evaluateAsInitializer()` (#158056)Timm Baeder7-22/+28
We just called `getInit()`, which isn't always correct and used the wrong initializer in the module test case.
2025-09-12[clang][bytecode] Compile the definition, not the most recent decl (#158093)Timm Baeder3-9/+11
2025-09-11[clang][bytecode] Use bytecode interpreter in EvaluateAsLValue (#158038)Timm Baeder2-0/+6
Set the EvalMode on InterpState and abort when initalizing a global temporary, like the current interpreter does. The rest is just plumbing in EvaluateAsLValue. Fixes #157497
2025-09-11[clang][bytecode] Don't update temporary in InitGlobalTemp* (#158022)Timm Baeder2-30/+16
We can save ourselves the conversion to an APValue here since we will do that later in updateGlobalTemporaries() anyway.
2025-09-11[clang][ExprConst][NFC] Move EvalMode enum to State (#157988)Timm Baeder1-0/+23
Make it an enum class and move the enum to State.h as well as the `EvalMode` member to `State`. This is in preparation of using the evaluation mode from `InterpState` as well.
2025-09-11[clang][bytecode] Implement C23 named loops (#156856)Timm Baeder2-68/+130
2025-09-11[clang][bytecode][NFC] Remove an else after a return (#157999)Timm Baeder1-11/+9
2025-09-11[clang][bytecode] Check builtin carryops for dummy pointers (#157490)Timm Baeder1-0/+3
Fixes #157422