clang 20.0.0git
Public Member Functions | Public Attributes | List of all members
clang::interp::BitcastBuffer Struct Reference

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< BitRangeInitializedBits
 

Detailed Description

Track what bits have been initialized to known values and which ones have indeterminate value.

Definition at line 81 of file BitcastBuffer.h.

Constructor & Destructor Documentation

◆ BitcastBuffer()

clang::interp::BitcastBuffer::BitcastBuffer ( Bits  FinalBitSize)
inline

Member Function Documentation

◆ allInitialized()

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().

◆ byteSize()

Bytes clang::interp::BitcastBuffer::byteSize ( ) const
inline

Definition at line 94 of file BitcastBuffer.h.

References FinalBitSize, and clang::interp::Bits::toBytes().

Referenced by clang::interp::interp__builtin_memcmp().

◆ copyBits()

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().

◆ markInitialized()

void BitcastBuffer::markInitialized ( Bits  Start,
Bits  Length 
)

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().

◆ pushData()

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().

◆ rangeInitialized()

bool BitcastBuffer::rangeInitialized ( Bits  Offset,
Bits  Length 
) const

Definition at line 110 of file BitcastBuffer.cpp.

References InitializedBits, and Range.

Referenced by allInitialized(), clang::interp::DoBitCast(), and clang::interp::DoBitCastPtr().

◆ size()

Bits clang::interp::BitcastBuffer::size ( ) const
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().

Member Data Documentation

◆ Data

std::unique_ptr<std::byte[]> clang::interp::BitcastBuffer::Data

◆ FinalBitSize

Bits clang::interp::BitcastBuffer::FinalBitSize

Definition at line 82 of file BitcastBuffer.h.

Referenced by allInitialized(), BitcastBuffer(), byteSize(), and size().

◆ InitializedBits

llvm::SmallVector<BitRange> clang::interp::BitcastBuffer::InitializedBits

Definition at line 84 of file BitcastBuffer.h.

Referenced by markInitialized(), and rangeInitialized().


The documentation for this struct was generated from the following files: