10 Commits

Author SHA1 Message Date
Timm Baeder
0611fdd320
[clang][bytecode] Add simple __builtin_memcpy implementation (#118278)
Not handling all the special- and error cases yet. Just making sure the
bitcast code can be used for this as well.
2024-12-02 13:11:22 +01:00
Timm Baeder
31bde711c4
[clang][bytecode] Support __builtin_reduce_add (#117672) 2024-12-01 17:39:11 +01:00
c8ef
332ac18e31
[clang] constexpr built-in abs function. (#112539)
According to [P0533R9](https://wg21.link/P0533R9), the C++ standard
library functions corresponding to the C macros in `[c.math.abs]` are
now `constexpr`.

To implement this feature in libc++, we must make the built-in abs
function `constexpr`. This patch adds the implementation of a
`constexpr` abs function for the current constant evaluator and the new
bytecode interpreter.

It is important to note that in 2's complement systems, the absolute
value of the most negative value is out of range. In gcc, it will result
in an out-of-range error and will not be evaluated as constants. We
follow the same approach here.
2024-10-18 19:03:50 +08:00
Timm Baeder
fed8695bb8
[clang][bytecode] Emit better diagnostic for invalid shufflevector index (#111643) 2024-10-09 09:56:37 +02:00
Richard Smith
d8a2815903
[clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (#109208)
Track the identity of each string literal object produced by evaluation
with a global version number. Accept comparisons between literals of the
same version, and between literals of different versions that cannot
possibly be placed in overlapping storage. Treat the remaining
comparisons as non-constant.

---------

Co-authored-by: Timm Baeder <tbaeder@redhat.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-09-26 15:56:33 -07:00
Timm Baeder
d03822d888
[clang][bytecode] Fix lookup of source locations in implicit ctors (#107992)
Implicit functions may still have a body. The !hasBody() check is
enough.
2024-09-11 07:21:49 +02:00
Timm Baeder
9626e84fae
[clang][bytecode][NFC] Simplify builtin-functions.cpp (#107118)
The effect is the same, but this version doesn't take as long to
evaluate.
2024-09-03 18:41:01 +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
Mital Ashok
f1b642775f
[Clang][test] Add bytecode interpreter tests for floating comparison functions (#104703)
See also: #94118, 71801707e33c235656b172fa7dfb8662473a95c2
2024-08-20 11:45:33 +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