22 Limit.MaxLength = MaxLength;
23 Limit.BeginOffset = getCurrentOffset();
47 int PaddingBytes = 4 -
Align;
48 while (PaddingBytes > 0) {
49 char Pad =
static_cast<uint8_t
>(LF_PAD0 + PaddingBytes);
70 std::optional<uint32_t> Min = Limits.
front().bytesRemaining(
Offset);
71 for (
auto X :
ArrayRef(Limits).drop_front()) {
72 std::optional<uint32_t> ThisMin =
X.bytesRemaining(
Offset);
74 Min = Min ? std::min(*Min, *ThisMin) : *ThisMin;
76 assert(Min &&
"Every field must have a maximum length!");
93 uint8_t Leaf = Reader->
peek();
98 unsigned BytesToAdvance = Leaf & 0x0F;
99 return Reader->
skip(BytesToAdvance);
103 const Twine &Comment) {
105 emitComment(Comment);
107 incrStreamedLen(Bytes.
size());
119 const Twine &Comment) {
124 Bytes.assign(BytesRef.
begin(), BytesRef.
end());
131 std::string TypeNameStr = Streamer->
getTypeName(TypeInd);
132 if (!TypeNameStr.empty())
133 emitComment(Comment +
": " + TypeNameStr);
135 emitComment(Comment);
137 incrStreamedLen(
sizeof(TypeInd.
getIndex()));
151 const Twine &Comment) {
154 emitEncodedUnsignedInteger(
static_cast<uint64_t>(
Value), Comment);
156 emitEncodedSignedInteger(
Value, Comment);
159 if (
auto EC = writeEncodedUnsignedInteger(
static_cast<uint64_t>(
Value)))
162 if (
auto EC = writeEncodedSignedInteger(
Value))
176 const Twine &Comment) {
178 emitEncodedUnsignedInteger(
Value, Comment);
180 if (
auto EC = writeEncodedUnsignedInteger(
Value))
195 if (
Value.isSigned())
196 emitEncodedSignedInteger(
Value.getSExtValue(), Comment);
198 emitEncodedUnsignedInteger(
Value.getZExtValue(), Comment);
200 if (
Value.isSigned())
201 return writeEncodedSignedInteger(
203 return writeEncodedUnsignedInteger(
Value.getLimitedValue());
212 emitComment(Comment);
213 Streamer->
emitBytes(NullTerminatedString);
214 incrStreamedLen(NullTerminatedString.size());
232 StringRef((
reinterpret_cast<const char *
>(&Guid)), GuidSize);
233 emitComment(Comment);
235 incrStreamedLen(GuidSize);
247 if (
auto EC = Reader->
readBytes(GuidBytes, GuidSize))
249 memcpy(Guid.
Guid, GuidBytes.
data(), GuidSize);
255 const Twine &Comment) {
258 emitComment(Comment);
259 for (
auto V :
Value) {
263 uint8_t FinalZero = 0;
279void CodeViewRecordIO::emitEncodedSignedInteger(
const int64_t &
Value,
280 const Twine &Comment) {
284 if (Value < LF_NUMERIC && Value >= 0) {
285 emitComment(Comment);
288 }
else if (
Value >= std::numeric_limits<int8_t>::min() &&
289 Value <= std::numeric_limits<int8_t>::max()) {
291 emitComment(Comment);
294 }
else if (
Value >= std::numeric_limits<int16_t>::min() &&
295 Value <= std::numeric_limits<int16_t>::max()) {
297 emitComment(Comment);
300 }
else if (
Value >= std::numeric_limits<int32_t>::min() &&
301 Value <= std::numeric_limits<int32_t>::max()) {
303 emitComment(Comment);
308 emitComment(Comment);
314void CodeViewRecordIO::emitEncodedUnsignedInteger(
const uint64_t &
Value,
315 const Twine &Comment) {
316 if (
Value < LF_NUMERIC) {
317 emitComment(Comment);
320 }
else if (
Value <= std::numeric_limits<uint16_t>::max()) {
322 emitComment(Comment);
325 }
else if (
Value <= std::numeric_limits<uint32_t>::max()) {
327 emitComment(Comment);
333 emitComment(Comment);
339Error CodeViewRecordIO::writeEncodedSignedInteger(
const int64_t &
Value) {
340 if (Value < LF_NUMERIC && Value >= 0) {
343 }
else if (
Value >= std::numeric_limits<int8_t>::min() &&
344 Value <= std::numeric_limits<int8_t>::max()) {
349 }
else if (
Value >= std::numeric_limits<int16_t>::min() &&
350 Value <= std::numeric_limits<int16_t>::max()) {
355 }
else if (
Value >= std::numeric_limits<int32_t>::min() &&
356 Value <= std::numeric_limits<int32_t>::max()) {
371 if (
Value < LF_NUMERIC) {
374 }
else if (
Value <= std::numeric_limits<uint16_t>::max()) {
379 }
else if (
Value <= std::numeric_limits<uint32_t>::max()) {
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
An arbitrary precision integer that knows its signedness.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
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 ...
uint8_t peek() const
Examine the next byte of the underlying stream without advancing the stream's offset.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t bytesRemaining() const
Error padToAlignment(uint32_t Align)
Error skip(uint64_t Amount)
Advance the stream's offset by Amount bytes.
Error writeCString(StringRef Str)
Write the string Str to the underlying stream followed by a null terminator.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
Error padToAlignment(uint32_t Align)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Error padToAlignment(uint32_t Align)
Error mapInteger(TypeIndex &TypeInd, const Twine &Comment="")
Error mapGuid(GUID &Guid, const Twine &Comment="")
Error mapStringZVectorZ(std::vector< StringRef > &Value, const Twine &Comment="")
Error mapStringZ(StringRef &Value, const Twine &Comment="")
uint64_t getStreamedLen()
Error mapEncodedInteger(int64_t &Value, const Twine &Comment="")
Error beginRecord(std::optional< uint32_t > MaxLength)
Error mapByteVectorTail(ArrayRef< uint8_t > &Bytes, const Twine &Comment="")
uint32_t maxFieldLength() const
virtual void emitBytes(StringRef Data)=0
virtual void emitIntValue(uint64_t Value, unsigned Size)=0
virtual void emitBinaryData(StringRef Data)=0
virtual std::string getTypeName(TypeIndex TI)=0
void setIndex(uint32_t I)
uint32_t getIndex() const
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This represents the 'GUID' type from windows.h.