[PATCH] D144943: [clang][Interp] Implement bitcasts (WIP)

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 23:25:00 PST 2023


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:92
+  // FIXME: Diagnostics.
+  if (*ToT == PT_Ptr)
+    return false;
----------------
One of the problems here is that right now, //all// diagnostics are emitted during interpretation time.


================
Comment at: clang/lib/AST/Interp/Interp.h:1366
+  size_t BuffSize = APFloat::semanticsSizeInBits(*Sem) / 8;
+  std::byte Buff[BuffSize];
+
----------------
This is a variable sized array. That needs to go of course, but is the best way to heap allocate? Or can we actually use `alloca` in clang code?


================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:33
 
+struct Foo {
+  std::byte *Buff;
----------------
This needs to be renamed obviously, but I was wondering if this already exists somewhere in the llvm/clang codebase...


================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:81
+/// Rotate things around for big endian targets.
+static void fiddleMemory(std::byte *M, size_t N) {
+  for (size_t I = 0; I != (N / 2); ++I)
----------------
Same here, I feel like this should already be available?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144943/new/

https://reviews.llvm.org/D144943



More information about the cfe-commits mailing list