LLVM: lib/Support/BinaryStreamWriter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10
15
16using namespace llvm;
17
19 : Stream(Ref) {}
20
22 : Stream(Stream) {}
23
27
30 return EC;
33}
34
36 uint8_t EncodedBytes[10] = {0};
39}
40
42 uint8_t EncodedBytes[10] = {0};
45}
46
49 return EC;
51 return EC;
52
54}
55
57
58 return writeBytes(arrayRefFromStringRef(Str));
59}
60
63}
64
67
68
69
70
71
75 return EC;
77 return EC;
78 }
80}
81
82std::pair<BinaryStreamWriter, BinaryStreamWriter>
85
87
92 return std::make_pair(W1, W2);
93}
94
97 const uint64_t ZerosSize = 64;
98 static constexpr char Zeros[ZerosSize] = {};
99 while (Offset < NewOffset)
102 return E;
104}
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Provides read only access to a subclass of BinaryStream.
uint64_t bytesRemaining() const
Error readLongestContiguousChunk(ArrayRef< uint8_t > &Buffer)
Read as much as possible from the underlying string at the current offset without invoking a copy,...
RefType drop_front(uint64_t N) const
Return a new BinaryStreamRef with the first N elements removed.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Provides write only access to a subclass of WritableBinaryStream.
Error writeCString(StringRef Str)
Write the string Str to the underlying stream followed by a null terminator.
Error writeArray(ArrayRef< T > Array)
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
Error writeSLEB128(int64_t Value)
Write the unsigned integer Value to the underlying stream using ULEB128 encoding.
BinaryStreamWriter()=default
std::pair< BinaryStreamWriter, BinaryStreamWriter > split(uint64_t Off) const
Splits the Writer into two Writers at a given offset.
Error writeStreamRef(BinaryStreamRef Ref)
Efficiently reads all data from Ref, and writes it to this stream.
Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
uint64_t getLength() const
Error writeFixedString(StringRef Str)
Write the string Str to the underlying stream without a null terminator.
Error writeULEB128(uint64_t Value)
Write the unsigned integer Value to the underlying stream using ULEB128 encoding.
WritableBinaryStreamRef Stream
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
Error padToAlignment(uint32_t Align)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
Error writeBytes(uint64_t Offset, ArrayRef< uint8_t > Data) const
Given an Offset into this WritableBinaryStreamRef and some input data, writes the data to the underly...
A BinaryStream which can be read from as well as written to.
This is an optimization pass for GlobalISel generic memory operations.
@ Ref
The access may reference the value stored in memory.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
This struct is a compact representation of a valid (non-zero power of two) alignment.