| 1 |
//===------------------ InterpBuiltinBitCast.h ------------------*- C++ -*-===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H |
| 10 |
#define LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H |
| 11 |
|
| 12 |
#include "BitcastBuffer.h" |
| 13 |
#include <cstddef> |
| 14 |
|
| 15 |
namespace clang { |
| 16 |
namespace interp { |
| 17 |
class Pointer; |
| 18 |
class InterpState; |
| 19 |
class CodePtr; |
| 20 |
class Context; |
| 21 |
|
| 22 |
inline static void swapBytes(std::byte *M, size_t N) { |
| 23 |
for (size_t I = 0; I != (N / 2); ++I) |
| 24 |
std::swap(M[I], M[N - 1 - I]); |
| 25 |
} |
| 26 |
|
| 27 |
bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr, |
| 28 |
std::byte *Buff, Bits BitWidth, Bits FullBitWidth, |
| 29 |
bool &HasIndeterminateBits); |
| 30 |
bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr, |
| 31 |
Pointer &ToPtr); |
| 32 |
bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr, |
| 33 |
Pointer &ToPtr, size_t Size); |
| 34 |
bool readPointerToBuffer(const Context &Ctx, const Pointer &FromPtr, |
| 35 |
BitcastBuffer &Buffer, bool ReturnOnUninit); |
| 36 |
|
| 37 |
bool DoMemcpy(InterpState &S, CodePtr OpPC, const Pointer &SrcPtr, |
| 38 |
const Pointer &DestPtr, Bits Size); |
| 39 |
|
| 40 |
} // namespace interp |
| 41 |
} // namespace clang |
| 42 |
|
| 43 |
#endif |