clang 20.0.0git
|
Track what bits have been initialized to known values and which ones have indeterminate value. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/BitcastBuffer.h"
Public Member Functions | |
BitcastBuffer (Bits FinalBitSize) | |
Bits | size () const |
Returns the buffer size in bits. | |
Bytes | byteSize () const |
bool | allInitialized () const |
Returns true if all bits in the buffer have been initialized. | |
void | markInitialized (Bits Start, Bits Length) |
Marks the bits in the given range as initialized. | |
bool | rangeInitialized (Bits Offset, Bits Length) const |
void | pushData (const std::byte *In, Bits BitOffset, Bits BitWidth, Endian TargetEndianness) |
Push BitWidth bits at BitOffset from In into the buffer. | |
std::unique_ptr< std::byte[]> | copyBits (Bits BitOffset, Bits BitWidth, Bits FullBitWidth, Endian TargetEndianness) const |
Copy BitWidth bits at offset BitOffset from the buffer. | |
Public Attributes | |
Bits | FinalBitSize |
std::unique_ptr< std::byte[]> | Data |
llvm::SmallVector< BitRange > | InitializedBits |
Track what bits have been initialized to known values and which ones have indeterminate value.
Definition at line 81 of file BitcastBuffer.h.
|
inline |
Definition at line 86 of file BitcastBuffer.h.
References Data, FinalBitSize, clang::interp::Bits::isFullByte(), and clang::interp::Bits::roundToBytes().
bool BitcastBuffer::allInitialized | ( | ) | const |
Returns true
if all bits in the buffer have been initialized.
Definition at line 64 of file BitcastBuffer.cpp.
References FinalBitSize, rangeInitialized(), and clang::interp::Bits::zero().
|
inline |
Definition at line 94 of file BitcastBuffer.h.
References FinalBitSize, and clang::interp::Bits::toBytes().
Referenced by clang::interp::interp__builtin_memcmp().
std::unique_ptr< std::byte[]> BitcastBuffer::copyBits | ( | Bits | BitOffset, |
Bits | BitWidth, | ||
Bits | FullBitWidth, | ||
Endian | TargetEndianness | ||
) | const |
Copy BitWidth
bits at offset BitOffset
from the buffer.
TargetEndianness
is the endianness of the target we're compiling for.
The returned output holds exactly (FullBitWidth
/ 8) bytes.
Definition at line 39 of file BitcastBuffer.cpp.
References bitof(), Data, clang::interp::Bits::getOffsetInByte(), clang::interp::Bits::getQuantity(), clang::interp::Bits::isFullByte(), clang::interp::Little, clang::interp::Bits::roundToBytes(), and size().
Referenced by clang::interp::DoBitCast(), and clang::interp::DoBitCastPtr().
Marks the bits in the given range as initialized.
FIXME: Can we do this automatically in pushData()?
Definition at line 68 of file BitcastBuffer.cpp.
References InitializedBits.
Referenced by clang::interp::readPointerToBuffer().
void BitcastBuffer::pushData | ( | const std::byte * | In, |
Bits | BitOffset, | ||
Bits | BitWidth, | ||
Endian | TargetEndianness | ||
) |
Push BitWidth
bits at BitOffset
from In
into the buffer.
TargetEndianness
is the endianness of the target we're compiling for. In
must hold at least BitWidth
many bits.
Definition at line 20 of file BitcastBuffer.cpp.
References bitof(), Data, clang::interp::Bits::getOffsetInByte(), clang::interp::Bits::getQuantity(), clang::interp::Little, clang::interp::Bits::roundToBytes(), and size().
Referenced by clang::interp::readPointerToBuffer().
Definition at line 110 of file BitcastBuffer.cpp.
References InitializedBits, and Range.
Referenced by allInitialized(), clang::interp::DoBitCast(), and clang::interp::DoBitCastPtr().
|
inline |
Returns the buffer size in bits.
Definition at line 93 of file BitcastBuffer.h.
References FinalBitSize.
Referenced by copyBits(), clang::interp::DoBitCastPtr(), pushData(), and clang::interp::readPointerToBuffer().
std::unique_ptr<std::byte[]> clang::interp::BitcastBuffer::Data |
Definition at line 83 of file BitcastBuffer.h.
Referenced by BitcastBuffer(), copyBits(), clang::interp::interp__builtin_memcmp(), and pushData().
Bits clang::interp::BitcastBuffer::FinalBitSize |
Definition at line 82 of file BitcastBuffer.h.
Referenced by allInitialized(), BitcastBuffer(), byteSize(), and size().
llvm::SmallVector<BitRange> clang::interp::BitcastBuffer::InitializedBits |
Definition at line 84 of file BitcastBuffer.h.
Referenced by markInitialized(), and rangeInitialized().