2024-10-31 18:09:40 +01:00
|
|
|
//===------------------ InterpBuiltinBitCast.h ------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2024-12-12 08:59:35 +01:00
|
|
|
#ifndef LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H
|
|
|
|
#define LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H
|
2024-10-31 18:09:40 +01:00
|
|
|
|
2024-12-08 18:54:08 +01:00
|
|
|
#include "BitcastBuffer.h"
|
2024-10-31 18:09:40 +01:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace interp {
|
|
|
|
class Pointer;
|
|
|
|
class InterpState;
|
|
|
|
class CodePtr;
|
2024-12-12 08:59:35 +01:00
|
|
|
class Context;
|
2024-10-31 18:09:40 +01:00
|
|
|
|
2024-12-13 12:19:27 +01:00
|
|
|
inline static void swapBytes(std::byte *M, size_t N) {
|
|
|
|
for (size_t I = 0; I != (N / 2); ++I)
|
|
|
|
std::swap(M[I], M[N - 1 - I]);
|
|
|
|
}
|
|
|
|
|
2024-10-31 18:09:40 +01:00
|
|
|
bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
|
2024-12-08 18:54:08 +01:00
|
|
|
std::byte *Buff, Bits BitWidth, Bits FullBitWidth,
|
|
|
|
bool &HasIndeterminateBits);
|
2024-11-04 15:10:10 +01:00
|
|
|
bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr,
|
|
|
|
Pointer &ToPtr);
|
2024-12-05 06:55:18 +01:00
|
|
|
bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr,
|
|
|
|
Pointer &ToPtr, size_t Size);
|
2024-12-12 08:59:35 +01:00
|
|
|
bool readPointerToBuffer(const Context &Ctx, const Pointer &FromPtr,
|
|
|
|
BitcastBuffer &Buffer, bool ReturnOnUninit);
|
2024-12-19 16:38:58 +01:00
|
|
|
|
|
|
|
bool DoMemcpy(InterpState &S, CodePtr OpPC, const Pointer &SrcPtr,
|
|
|
|
const Pointer &DestPtr, Bits Size);
|
|
|
|
|
2024-10-31 18:09:40 +01:00
|
|
|
} // namespace interp
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif
|