[PATCH] D134859: [clang][Interp] Implement basic support for floating point values
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 27 23:22:30 PDT 2022
tbaeder added inline comments.
================
Comment at: clang/lib/AST/Interp/PrimType.h:39
PT_Bool,
+ PT_Float,
PT_Ptr,
----------------
sepavloff wrote:
> tbaeder wrote:
> > sepavloff wrote:
> > > In contrast to other members of this enumeration, `PT_Float` does not designate a concrete type, and it must creates problems. For example, how function `primSize(PrimType Type)` can be implemented?
> > Yes, floats are a bit special, see also the special case in `getCtorPrim()` in `Descriptor.cpp`. But I don't think it's a problem for `primSize()` since that only uses `sizeof()`.
> `sizeof` in `primSize()` would return `sizeof(clang::interp::Floating)`, which is `sizeof(APFloat)`. This value is not the same as `sizeof(float)` or `sizeof(double)`.
I am aware, but `primSize()` is not used to implement `sizeof()` or anything like that, it's used on the host side to do memory allocation, e.g. `Descriptor` uses it to allocate `NumElems * primSize(T)` bytes for primitive arrays.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134859/new/
https://reviews.llvm.org/D134859
More information about the cfe-commits
mailing list