Go to the documentation of this file.
24 : Stream(
Data, Endian) {}
27 : Stream(
Data, Endian) {}
52 EncodedBytes.push_back(NextByte[0]);
53 }
while (NextByte[0] & 0x80);
55 Dest =
decodeULEB128(EncodedBytes.begin(),
nullptr, EncodedBytes.end());
67 EncodedBytes.push_back(NextByte[0]);
68 }
while (NextByte[0] & 0x80);
70 Dest =
decodeSLEB128(EncodedBytes.begin(),
nullptr, EncodedBytes.end());
83 size_t Pos =
S.find_first_of(
'\0');
85 FoundOffset = Pos + ThisOffset;
89 assert(FoundOffset >= OriginalOffset);
92 size_t Length = FoundOffset - OriginalOffset;
163 assert(!EC &&
"Cannot peek an empty buffer!");
168 std::pair<BinaryStreamReader, BinaryStreamReader>
178 return std::make_pair(W1, W2);
std::pair< BinaryStreamReader, BinaryStreamReader > split(uint64_t Offset) const
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Error readLongestContiguousChunk(uint64_t Offset, ArrayRef< uint8_t > &Buffer) const
Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could ...
void setOffset(uint64_t Off)
Error readSLEB128(int64_t &Dest)
Read a signed LEB128 encoded value.
An interface for accessing data in a stream-like format, but which discourages copying.
This is an optimization pass for GlobalISel generic memory operations.
Error readBytes(ArrayRef< uint8_t > &Buffer, uint32_t Size)
Read Size bytes from the underlying stream at the current offset and and set Buffer to the resulting ...
static constexpr size_t npos
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Error skip(uint64_t Amount)
Advance the stream's offset by Amount bytes.
Error readLongestContiguousChunk(ArrayRef< uint8_t > &Buffer)
Read as much as possible from the underlying string at the current offset without invoking a copy,...
static ErrorSuccess success()
Create a success value.
uint64_t bytesRemaining() const
uint64_t getLength() const
BinaryStreamReader()=default
void consumeError(Error Err)
Consume a Error without doing anything.
uint64_t decodeULEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a ULEB128 value.
@ Ref
The access may reference the value stored in memory.
uint64_t getOffset() const
(vector float) vec_cmpeq(*A, *B) C
into llvm powi allowing the code generator to produce balanced multiplication trees First
Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length)
Read Length bytes from the underlying stream into Ref.
Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Error padToAlignment(uint32_t Align)
Error readULEB128(uint64_t &Dest)
Read an unsigned LEB128 encoded value.
Provides read only access to a subclass of BinaryStream.
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
StringRef - Represent a constant reference to a string, i.e.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Error readWideString(ArrayRef< UTF16 > &Dest)
Similar to readCString, however read a null-terminated UTF16 string instead.
RefType slice(uint64_t Offset, uint64_t Len) const
Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elemen...
Error readFixedString(StringRef &Dest, uint32_t Length)
Read a Length byte string into Dest.
Lightweight error class with error context and mandatory checking.
Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer) const
Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.
int64_t decodeSLEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a SLEB128 value.
uint8_t peek() const
Examine the next byte of the underlying stream without advancing the stream's offset.
size_t size() const
size - Get the array size.
#define LLVM_LIKELY(EXPR)
RefType drop_front(uint64_t N) const
Return a new BinaryStreamRef with the first N elements removed.
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.