clang 20.0.0git
|
#include "InterpBuiltinBitCast.h"
#include "BitcastBuffer.h"
#include "Boolean.h"
#include "Context.h"
#include "Floating.h"
#include "Integral.h"
#include "InterpState.h"
#include "MemberPointer.h"
#include "Pointer.h"
#include "Record.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/TargetInfo.h"
Go to the source code of this file.
Macros | |
#define | BITCAST_TYPE_SWITCH(Expr, B) |
#define | BITCAST_TYPE_SWITCH_FIXED_SIZE(Expr, B) |
Typedefs | |
using | DataFunc = llvm::function_ref< bool(const Pointer &P, PrimType Ty, Bits BitOffset, Bits FullBitWidth, bool PackedBools)> |
Implement __builtin_bit_cast and related operations. | |
Functions | |
static bool | enumerateData (const Pointer &P, const Context &Ctx, Bits Offset, Bits BitsToRead, DataFunc F) |
We use this to recursively iterate over all fields and elements of a pointer and extract relevant data for a bitcast. | |
static bool | enumeratePointerFields (const Pointer &P, const Context &Ctx, Bits BitsToRead, DataFunc F) |
static bool | CheckBitcastType (InterpState &S, CodePtr OpPC, QualType T, bool IsToType) |
#define BITCAST_TYPE_SWITCH | ( | Expr, | |
B | |||
) |
Definition at line 40 of file InterpBuiltinBitCast.cpp.
#define BITCAST_TYPE_SWITCH_FIXED_SIZE | ( | Expr, | |
B | |||
) |
Definition at line 59 of file InterpBuiltinBitCast.cpp.
using DataFunc = llvm::function_ref<bool(const Pointer &P, PrimType Ty, Bits BitOffset, Bits FullBitWidth, bool PackedBools)> |
Implement __builtin_bit_cast and related operations.
Since our internal representation for data is more complex than something we can simply memcpy or memcmp, we first bitcast all the data into a buffer, which we then later use to copy the data into the target. Used to iterate over pointer fields.
Definition at line 36 of file InterpBuiltinBitCast.cpp.
|
static |
Definition at line 170 of file InterpBuiltinBitCast.cpp.
References CheckBitcastType(), E, clang::Type::getAs(), clang::Type::getAsRecordDecl(), clang::Sema::getASTContext(), clang::ASTContext::getBaseElementType(), clang::ASTContext::getCharWidth(), clang::ASTContext::getFloatTypeSemantics(), clang::Stmt::getSourceRange(), clang::ASTContext::getTypeSize(), clang::Type::isArrayType(), clang::Type::isExtVectorBoolType(), clang::Type::isMemberPointerType(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::Type::isUnionType(), and clang::T.
Referenced by CheckBitcastType(), clang::interp::DoBitCast(), and clang::interp::DoBitCastPtr().
|
static |
We use this to recursively iterate over all fields and elements of a pointer and extract relevant data for a bitcast.
Definition at line 78 of file InterpBuiltinBitCast.cpp.
References clang::interp::Record::bases(), clang::interp::Context::classify(), clang::interp::Descriptor::ElemRecord, enumerateData(), clang::interp::Record::fields(), clang::interp::Context::getASTContext(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::interp::Record::getDecl(), clang::interp::Descriptor::getElemQualType(), clang::ASTRecordLayout::getFieldOffset(), clang::interp::Descriptor::getNumElems(), clang::interp::Descriptor::getPrimType(), clang::interp::Descriptor::getType(), clang::ASTContext::getTypeSize(), clang::interp::Pointer::initialize(), clang::interp::Descriptor::isCompositeArray(), clang::Type::isExtVectorBoolType(), clang::interp::Descriptor::isPrimitive(), clang::interp::Descriptor::isPrimitiveArray(), clang::interp::Descriptor::isRecord(), Ok, P, and clang::ASTContext::toBits().
Referenced by enumerateData(), and enumeratePointerFields().
|
static |
Definition at line 155 of file InterpBuiltinBitCast.cpp.
References enumerateData(), P, and clang::interp::Bits::zero().
Referenced by clang::interp::DoBitCastPtr(), clang::interp::DoMemcpy(), and clang::interp::readPointerToBuffer().