LLVM  15.0.0git
BitstreamReader.cpp
Go to the documentation of this file.
1 //===- BitstreamReader.cpp - BitstreamReader implementation ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/StringRef.h"
11 #include <cassert>
12 #include <string>
13 
14 using namespace llvm;
15 
16 //===----------------------------------------------------------------------===//
17 // BitstreamCursor implementation
18 //===----------------------------------------------------------------------===//
19 //
20 static Error error(const char *Message) {
21  return createStringError(std::errc::illegal_byte_sequence, Message);
22 }
23 
24 /// Having read the ENTER_SUBBLOCK abbrevid, enter the block.
25 Error BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
26  // Save the current block's state on BlockScope.
27  BlockScope.push_back(Block(CurCodeSize));
28  BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
29 
30  // Add the abbrevs specific to this block to the CurAbbrevs list.
31  if (BlockInfo) {
33  BlockInfo->getBlockInfo(BlockID)) {
34  llvm::append_range(CurAbbrevs, Info->Abbrevs);
35  }
36  }
37 
38  // Get the codesize of this block.
40  if (!MaybeVBR)
41  return MaybeVBR.takeError();
42  CurCodeSize = MaybeVBR.get();
43 
44  if (CurCodeSize > MaxChunkSize)
46  std::errc::illegal_byte_sequence,
47  "can't read more than %zu at a time, trying to read %u", +MaxChunkSize,
48  CurCodeSize);
49 
52  if (!MaybeNum)
53  return MaybeNum.takeError();
54  word_t NumWords = MaybeNum.get();
55  if (NumWordsP)
56  *NumWordsP = NumWords;
57 
58  if (CurCodeSize == 0)
60  std::errc::illegal_byte_sequence,
61  "can't enter sub-block: current code size is 0");
62  if (AtEndOfStream())
64  std::errc::illegal_byte_sequence,
65  "can't enter sub block: already at end of stream");
66 
67  return Error::success();
68 }
69 
71  const BitCodeAbbrevOp &Op) {
72  assert(!Op.isLiteral() && "Not to be used with literals!");
73 
74  // Decode the value as we are commanded.
75  switch (Op.getEncoding()) {
78  llvm_unreachable("Should not reach here");
80  assert((unsigned)Op.getEncodingData() <= Cursor.MaxChunkSize);
81  return Cursor.Read((unsigned)Op.getEncodingData());
83  assert((unsigned)Op.getEncodingData() <= Cursor.MaxChunkSize);
84  return Cursor.ReadVBR64((unsigned)Op.getEncodingData());
86  if (Expected<unsigned> Res = Cursor.Read(6))
87  return BitCodeAbbrevOp::DecodeChar6(Res.get());
88  else
89  return Res.takeError();
90  }
91  llvm_unreachable("invalid abbreviation encoding");
92 }
93 
94 /// skipRecord - Read the current record and discard it.
96  // Skip unabbreviated records by reading past their entries.
97  if (AbbrevID == bitc::UNABBREV_RECORD) {
98  Expected<uint32_t> MaybeCode = ReadVBR(6);
99  if (!MaybeCode)
100  return MaybeCode.takeError();
101  unsigned Code = MaybeCode.get();
102  Expected<uint32_t> MaybeVBR = ReadVBR(6);
103  if (!MaybeVBR)
104  return MaybeVBR.takeError();
105  unsigned NumElts = MaybeVBR.get();
106  for (unsigned i = 0; i != NumElts; ++i)
107  if (Expected<uint64_t> Res = ReadVBR64(6))
108  ; // Skip!
109  else
110  return Res.takeError();
111  return Code;
112  }
113 
114  Expected<const BitCodeAbbrev *> MaybeAbbv = getAbbrev(AbbrevID);
115  if (!MaybeAbbv)
116  return MaybeAbbv.takeError();
117 
118  const BitCodeAbbrev *Abbv = MaybeAbbv.get();
119  const BitCodeAbbrevOp &CodeOp = Abbv->getOperandInfo(0);
120  unsigned Code;
121  if (CodeOp.isLiteral())
122  Code = CodeOp.getLiteralValue();
123  else {
124  if (CodeOp.getEncoding() == BitCodeAbbrevOp::Array ||
127  std::errc::illegal_byte_sequence,
128  "Abbreviation starts with an Array or a Blob");
129  Expected<uint64_t> MaybeCode = readAbbreviatedField(*this, CodeOp);
130  if (!MaybeCode)
131  return MaybeCode.takeError();
132  Code = MaybeCode.get();
133  }
134 
135  for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i < e; ++i) {
136  const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
137  if (Op.isLiteral())
138  continue;
139 
140  if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
141  Op.getEncoding() != BitCodeAbbrevOp::Blob) {
142  if (Expected<uint64_t> MaybeField = readAbbreviatedField(*this, Op))
143  continue;
144  else
145  return MaybeField.takeError();
146  }
147 
148  if (Op.getEncoding() == BitCodeAbbrevOp::Array) {
149  // Array case. Read the number of elements as a vbr6.
150  Expected<uint32_t> MaybeNum = ReadVBR(6);
151  if (!MaybeNum)
152  return MaybeNum.takeError();
153  unsigned NumElts = MaybeNum.get();
154 
155  // Get the element encoding.
156  assert(i+2 == e && "array op not second to last?");
157  const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
158 
159  // Read all the elements.
160  // Decode the value as we are commanded.
161  switch (EltEnc.getEncoding()) {
162  default:
163  return error("Array element type can't be an Array or a Blob");
165  assert((unsigned)EltEnc.getEncodingData() <= MaxChunkSize);
166  if (Error Err =
167  JumpToBit(GetCurrentBitNo() + static_cast<uint64_t>(NumElts) *
168  EltEnc.getEncodingData()))
169  return std::move(Err);
170  break;
172  assert((unsigned)EltEnc.getEncodingData() <= MaxChunkSize);
173  for (; NumElts; --NumElts)
174  if (Expected<uint64_t> Res =
175  ReadVBR64((unsigned)EltEnc.getEncodingData()))
176  ; // Skip!
177  else
178  return Res.takeError();
179  break;
181  if (Error Err = JumpToBit(GetCurrentBitNo() + NumElts * 6))
182  return std::move(Err);
183  break;
184  }
185  continue;
186  }
187 
188  assert(Op.getEncoding() == BitCodeAbbrevOp::Blob);
189  // Blob case. Read the number of bytes as a vbr6.
190  Expected<uint32_t> MaybeNum = ReadVBR(6);
191  if (!MaybeNum)
192  return MaybeNum.takeError();
193  unsigned NumElts = MaybeNum.get();
194  SkipToFourByteBoundary(); // 32-bit alignment
195 
196  // Figure out where the end of this blob will be including tail padding.
197  const size_t NewEnd = GetCurrentBitNo() + alignTo(NumElts, 4) * 8;
198 
199  // If this would read off the end of the bitcode file, just set the
200  // record to empty and return.
201  if (!canSkipToPos(NewEnd/8)) {
202  skipToEnd();
203  break;
204  }
205 
206  // Skip over the blob.
207  if (Error Err = JumpToBit(NewEnd))
208  return std::move(Err);
209  }
210  return Code;
211 }
212 
215  StringRef *Blob) {
216  if (AbbrevID == bitc::UNABBREV_RECORD) {
217  Expected<uint32_t> MaybeCode = ReadVBR(6);
218  if (!MaybeCode)
219  return MaybeCode.takeError();
220  uint32_t Code = MaybeCode.get();
221  Expected<uint32_t> MaybeNumElts = ReadVBR(6);
222  if (!MaybeNumElts)
223  return error(
224  ("Failed to read size: " + toString(MaybeNumElts.takeError()))
225  .c_str());
226  uint32_t NumElts = MaybeNumElts.get();
227  if (!isSizePlausible(NumElts))
228  return error("Size is not plausible");
229  Vals.reserve(Vals.size() + NumElts);
230 
231  for (unsigned i = 0; i != NumElts; ++i)
232  if (Expected<uint64_t> MaybeVal = ReadVBR64(6))
233  Vals.push_back(MaybeVal.get());
234  else
235  return MaybeVal.takeError();
236  return Code;
237  }
238 
239  Expected<const BitCodeAbbrev *> MaybeAbbv = getAbbrev(AbbrevID);
240  if (!MaybeAbbv)
241  return MaybeAbbv.takeError();
242  const BitCodeAbbrev *Abbv = MaybeAbbv.get();
243 
244  // Read the record code first.
245  assert(Abbv->getNumOperandInfos() != 0 && "no record code in abbreviation?");
246  const BitCodeAbbrevOp &CodeOp = Abbv->getOperandInfo(0);
247  unsigned Code;
248  if (CodeOp.isLiteral())
249  Code = CodeOp.getLiteralValue();
250  else {
251  if (CodeOp.getEncoding() == BitCodeAbbrevOp::Array ||
253  return error("Abbreviation starts with an Array or a Blob");
254  if (Expected<uint64_t> MaybeCode = readAbbreviatedField(*this, CodeOp))
255  Code = MaybeCode.get();
256  else
257  return MaybeCode.takeError();
258  }
259 
260  for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) {
261  const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
262  if (Op.isLiteral()) {
263  Vals.push_back(Op.getLiteralValue());
264  continue;
265  }
266 
267  if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
268  Op.getEncoding() != BitCodeAbbrevOp::Blob) {
269  if (Expected<uint64_t> MaybeVal = readAbbreviatedField(*this, Op))
270  Vals.push_back(MaybeVal.get());
271  else
272  return MaybeVal.takeError();
273  continue;
274  }
275 
276  if (Op.getEncoding() == BitCodeAbbrevOp::Array) {
277  // Array case. Read the number of elements as a vbr6.
278  Expected<uint32_t> MaybeNumElts = ReadVBR(6);
279  if (!MaybeNumElts)
280  return error(
281  ("Failed to read size: " + toString(MaybeNumElts.takeError()))
282  .c_str());
283  uint32_t NumElts = MaybeNumElts.get();
284  if (!isSizePlausible(NumElts))
285  return error("Size is not plausible");
286  Vals.reserve(Vals.size() + NumElts);
287 
288  // Get the element encoding.
289  if (i + 2 != e)
290  return error("Array op not second to last");
291  const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
292  if (!EltEnc.isEncoding())
293  return error(
294  "Array element type has to be an encoding of a type");
295 
296  // Read all the elements.
297  switch (EltEnc.getEncoding()) {
298  default:
299  return error("Array element type can't be an Array or a Blob");
301  for (; NumElts; --NumElts)
303  Read((unsigned)EltEnc.getEncodingData()))
304  Vals.push_back(MaybeVal.get());
305  else
306  return MaybeVal.takeError();
307  break;
309  for (; NumElts; --NumElts)
310  if (Expected<uint64_t> MaybeVal =
311  ReadVBR64((unsigned)EltEnc.getEncodingData()))
312  Vals.push_back(MaybeVal.get());
313  else
314  return MaybeVal.takeError();
315  break;
317  for (; NumElts; --NumElts)
319  Vals.push_back(BitCodeAbbrevOp::DecodeChar6(MaybeVal.get()));
320  else
321  return MaybeVal.takeError();
322  }
323  continue;
324  }
325 
326  assert(Op.getEncoding() == BitCodeAbbrevOp::Blob);
327  // Blob case. Read the number of bytes as a vbr6.
328  Expected<uint32_t> MaybeNumElts = ReadVBR(6);
329  if (!MaybeNumElts)
330  return MaybeNumElts.takeError();
331  uint32_t NumElts = MaybeNumElts.get();
332  SkipToFourByteBoundary(); // 32-bit alignment
333 
334  // Figure out where the end of this blob will be including tail padding.
335  size_t CurBitPos = GetCurrentBitNo();
336  const size_t NewEnd = CurBitPos + alignTo(NumElts, 4) * 8;
337 
338  // Make sure the bitstream is large enough to contain the blob.
339  if (!canSkipToPos(NewEnd/8))
340  return error("Blob ends too soon");
341 
342  // Otherwise, inform the streamer that we need these bytes in memory. Skip
343  // over tail padding first, in case jumping to NewEnd invalidates the Blob
344  // pointer.
345  if (Error Err = JumpToBit(NewEnd))
346  return std::move(Err);
347  const char *Ptr = (const char *)getPointerToBit(CurBitPos, NumElts);
348 
349  // If we can return a reference to the data, do so to avoid copying it.
350  if (Blob) {
351  *Blob = StringRef(Ptr, NumElts);
352  } else {
353  // Otherwise, unpack into Vals with zero extension.
354  auto *UPtr = reinterpret_cast<const unsigned char *>(Ptr);
355  Vals.append(UPtr, UPtr + NumElts);
356  }
357  }
358 
359  return Code;
360 }
361 
363  auto Abbv = std::make_shared<BitCodeAbbrev>();
364  Expected<uint32_t> MaybeNumOpInfo = ReadVBR(5);
365  if (!MaybeNumOpInfo)
366  return MaybeNumOpInfo.takeError();
367  unsigned NumOpInfo = MaybeNumOpInfo.get();
368  for (unsigned i = 0; i != NumOpInfo; ++i) {
369  Expected<word_t> MaybeIsLiteral = Read(1);
370  if (!MaybeIsLiteral)
371  return MaybeIsLiteral.takeError();
372  bool IsLiteral = MaybeIsLiteral.get();
373  if (IsLiteral) {
374  Expected<uint64_t> MaybeOp = ReadVBR64(8);
375  if (!MaybeOp)
376  return MaybeOp.takeError();
377  Abbv->Add(BitCodeAbbrevOp(MaybeOp.get()));
378  continue;
379  }
380 
381  Expected<word_t> MaybeEncoding = Read(3);
382  if (!MaybeEncoding)
383  return MaybeEncoding.takeError();
384  if (!BitCodeAbbrevOp::isValidEncoding(MaybeEncoding.get()))
385  return error("Invalid encoding");
386 
388  (BitCodeAbbrevOp::Encoding)MaybeEncoding.get();
390  Expected<uint64_t> MaybeData = ReadVBR64(5);
391  if (!MaybeData)
392  return MaybeData.takeError();
393  uint64_t Data = MaybeData.get();
394 
395  // As a special case, handle fixed(0) (i.e., a fixed field with zero bits)
396  // and vbr(0) as a literal zero. This is decoded the same way, and avoids
397  // a slow path in Read() to have to handle reading zero bits.
399  Data == 0) {
400  Abbv->Add(BitCodeAbbrevOp(0));
401  continue;
402  }
403 
405  Data > MaxChunkSize)
406  return error("Fixed or VBR abbrev record with size > MaxChunkData");
407 
408  Abbv->Add(BitCodeAbbrevOp(E, Data));
409  } else
410  Abbv->Add(BitCodeAbbrevOp(E));
411  }
412 
413  if (Abbv->getNumOperandInfos() == 0)
414  return error("Abbrev record with no operands");
415  CurAbbrevs.push_back(std::move(Abbv));
416 
417  return Error::success();
418 }
419 
421 BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
423  return std::move(Err);
424 
425  BitstreamBlockInfo NewBlockInfo;
426 
428  BitstreamBlockInfo::BlockInfo *CurBlockInfo = nullptr;
429 
430  // Read all the records for this module.
431  while (true) {
432  Expected<BitstreamEntry> MaybeEntry =
434  if (!MaybeEntry)
435  return MaybeEntry.takeError();
436  BitstreamEntry Entry = MaybeEntry.get();
437 
438  switch (Entry.Kind) {
439  case llvm::BitstreamEntry::SubBlock: // Handled for us already.
441  return None;
443  return std::move(NewBlockInfo);
445  // The interesting case.
446  break;
447  }
448 
449  // Read abbrev records, associate them with CurBID.
450  if (Entry.ID == bitc::DEFINE_ABBREV) {
451  if (!CurBlockInfo) return None;
452  if (Error Err = ReadAbbrevRecord())
453  return std::move(Err);
454 
455  // ReadAbbrevRecord installs the abbrev in CurAbbrevs. Move it to the
456  // appropriate BlockInfo.
457  CurBlockInfo->Abbrevs.push_back(std::move(CurAbbrevs.back()));
458  CurAbbrevs.pop_back();
459  continue;
460  }
461 
462  // Read a record.
463  Record.clear();
464  Expected<unsigned> MaybeBlockInfo = readRecord(Entry.ID, Record);
465  if (!MaybeBlockInfo)
466  return MaybeBlockInfo.takeError();
467  switch (MaybeBlockInfo.get()) {
468  default:
469  break; // Default behavior, ignore unknown content.
471  if (Record.size() < 1)
472  return None;
473  CurBlockInfo = &NewBlockInfo.getOrCreateBlockInfo((unsigned)Record[0]);
474  break;
476  if (!CurBlockInfo)
477  return None;
478  if (!ReadBlockInfoNames)
479  break; // Ignore name.
480  CurBlockInfo->Name = std::string(Record.begin(), Record.end());
481  break;
482  }
484  if (!CurBlockInfo) return None;
485  if (!ReadBlockInfoNames)
486  break; // Ignore name.
487  CurBlockInfo->RecordNames.emplace_back(
488  (unsigned)Record[0], std::string(Record.begin() + 1, Record.end()));
489  break;
490  }
491  }
492  }
493 }
i
i
Definition: README.txt:29
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:156
llvm::BitCodeAbbrev::getNumOperandInfos
unsigned getNumOperandInfos() const
Definition: BitCodes.h:112
readAbbreviatedField
static Expected< uint64_t > readAbbreviatedField(BitstreamCursor &Cursor, const BitCodeAbbrevOp &Op)
Definition: BitstreamReader.cpp:70
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
StringRef.h
llvm::SimpleBitstreamCursor::ReadVBR64
Expected< uint64_t > ReadVBR64(const unsigned NumBits)
Definition: BitstreamReader.h:264
llvm::BitCodeAbbrevOp::Fixed
@ Fixed
Definition: BitCodes.h:39
llvm::BitstreamBlockInfo
This class maintains the abbreviations read from a block info block.
Definition: BitstreamReader.h:36
llvm::SmallVector< uint64_t, 64 >
llvm::BitstreamBlockInfo::getBlockInfo
const BlockInfo * getBlockInfo(unsigned BlockID) const
If there is block info for the specified ID, return it, otherwise return null.
Definition: BitstreamReader.h:53
llvm::bitc::DEFINE_ABBREV
@ DEFINE_ABBREV
DEFINE_ABBREV - Defines an abbrev for the current block.
Definition: BitCodeEnums.h:53
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:329
llvm::SimpleBitstreamCursor::getPointerToBit
const uint8_t * getPointerToBit(uint64_t BitNo, uint64_t NumBytes)
Get a pointer into the bitstream at the specified bit offset.
Definition: BitstreamReader.h:155
llvm::SimpleBitstreamCursor::JumpToBit
Error JumpToBit(uint64_t BitNo)
Reset the stream to the specified bit number.
Definition: BitstreamReader.h:127
llvm::BitstreamCursor
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
Definition: BitstreamReader.h:358
llvm::BitstreamEntry::Record
@ Record
Definition: BitstreamReader.h:331
llvm::bitc::BLOCKINFO_BLOCK_ID
@ BLOCKINFO_BLOCK_ID
BLOCKINFO_BLOCK is used to define metadata about blocks, for example, standard abbrevs that should be...
Definition: BitCodeEnums.h:69
llvm::BitstreamBlockInfo::BlockInfo::RecordNames
std::vector< std::pair< unsigned, std::string > > RecordNames
Definition: BitstreamReader.h:44
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
size_t
llvm::BitstreamCursor::AF_DontAutoprocessAbbrevs
@ AF_DontAutoprocessAbbrevs
If this flag is used, abbrev entries are returned just like normal records.
Definition: BitstreamReader.h:414
llvm::BitCodeAbbrevOp::hasEncodingData
bool hasEncodingData() const
Definition: BitCodes.h:67
llvm::BitCodeAbbrevOp::Char6
@ Char6
Definition: BitCodes.h:42
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::SmallVectorImpl::append
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:667
llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME
@ BLOCKINFO_CODE_SETRECORDNAME
Definition: BitCodeEnums.h:83
llvm::SimpleBitstreamCursor::AtEndOfStream
bool AtEndOfStream()
Definition: BitstreamReader.h:112
llvm::BitstreamCursor::ReadAbbrevRecord
Error ReadAbbrevRecord()
Definition: BitstreamReader.cpp:362
llvm::SimpleBitstreamCursor::ReadVBR
Expected< uint32_t > ReadVBR(const unsigned NumBits)
Definition: BitstreamReader.h:229
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::BitCodeAbbrevOp::Blob
@ Blob
Definition: BitCodes.h:43
llvm::None
const NoneType None
Definition: None.h:24
llvm::BitstreamCursor::EnterSubBlock
Error EnterSubBlock(unsigned BlockID, unsigned *NumWordsP=nullptr)
Having read the ENTER_SUBBLOCK abbrevid, and enter the block.
Definition: BitstreamReader.cpp:25
llvm::BitstreamCursor::ReadVBR64
Expected< uint64_t > ReadVBR64(const unsigned NumBits)
Definition: BitstreamReader.h:264
llvm::BitCodeAbbrevOp::getEncoding
Encoding getEncoding() const
Definition: BitCodes.h:61
llvm::BitCodeAbbrevOp::Encoding
Encoding
Definition: BitCodes.h:38
BitstreamReader.h
llvm::BitCodeAbbrevOp::isEncoding
bool isEncoding() const
Definition: BitCodes.h:55
uint64_t
llvm::bitc::BlockSizeWidth
@ BlockSizeWidth
Definition: BitCodeEnums.h:39
llvm::BitstreamCursor::Read
Expected< word_t > Read(unsigned NumBits)
Definition: BitstreamReader.h:186
move
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
Definition: README.txt:546
llvm::BitstreamBlockInfo::getOrCreateBlockInfo
BlockInfo & getOrCreateBlockInfo(unsigned BlockID)
Definition: BitstreamReader.h:65
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::BitstreamBlockInfo::BlockInfo
This contains information emitted to BLOCKINFO_BLOCK blocks.
Definition: BitstreamReader.h:40
llvm::BitstreamCursor::advanceSkippingSubblocks
Expected< BitstreamEntry > advanceSkippingSubblocks(unsigned Flags=0)
This is a convenience function for clients that don't expect any subblocks.
Definition: BitstreamReader.h:457
llvm::SimpleBitstreamCursor::Read
Expected< word_t > Read(unsigned NumBits)
Definition: BitstreamReader.h:186
llvm::BitCodeAbbrevOp::VBR
@ VBR
Definition: BitCodes.h:40
llvm::BitCodeAbbrevOp::Array
@ Array
Definition: BitCodes.h:41
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::BitstreamEntry::EndBlock
@ EndBlock
Definition: BitstreamReader.h:328
llvm::BitstreamCursor::MaxChunkSize
static const size_t MaxChunkSize
Definition: BitstreamReader.h:379
llvm::BitstreamBlockInfo::BlockInfo::Name
std::string Name
Definition: BitstreamReader.h:43
llvm::BitstreamCursor::ReadBlockInfoBlock
Expected< Optional< BitstreamBlockInfo > > ReadBlockInfoBlock(bool ReadBlockInfoNames=false)
Read and return a block info block from the bitstream.
Definition: BitstreamReader.cpp:421
llvm::BitCodeAbbrevOp::getEncodingData
uint64_t getEncodingData() const
Definition: BitCodes.h:62
llvm::BitCodeAbbrevOp::isValidEncoding
static bool isValidEncoding(uint64_t E)
Definition: BitCodes.h:46
llvm::Record
Definition: Record.h:1543
llvm::bitc::BLOCKINFO_CODE_SETBID
@ BLOCKINFO_CODE_SETBID
Definition: BitCodeEnums.h:81
llvm::BitstreamCursor::readRecord
Expected< unsigned > readRecord(unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr)
Definition: BitstreamReader.cpp:213
llvm::BitstreamBlockInfo::BlockInfo::Abbrevs
std::vector< std::shared_ptr< BitCodeAbbrev > > Abbrevs
Definition: BitstreamReader.h:42
llvm::bitc::BLOCKINFO_CODE_BLOCKNAME
@ BLOCKINFO_CODE_BLOCKNAME
Definition: BitCodeEnums.h:82
llvm::BitCodeAbbrev::getOperandInfo
const BitCodeAbbrevOp & getOperandInfo(unsigned N) const
Definition: BitCodes.h:115
llvm::BitstreamEntry::Error
@ Error
Definition: BitstreamReader.h:327
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition: Error.h:567
uint32_t
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1823
llvm::BitstreamEntry::SubBlock
@ SubBlock
Definition: BitstreamReader.h:330
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1239
llvm::SmallVectorImpl::swap
void swap(SmallVectorImpl &RHS)
Definition: SmallVector.h:958
llvm::bitc::UNABBREV_RECORD
@ UNABBREV_RECORD
Definition: BitCodeEnums.h:57
llvm::BitstreamEntry
When advancing through a bitstream cursor, each advance can discover a few different kinds of entries...
Definition: BitstreamReader.h:325
llvm::BitCodeAbbrevOp::getLiteralValue
uint64_t getLiteralValue() const
Definition: BitCodes.h:58
llvm::toString
const char * toString(DWARFSectionKind Kind)
Definition: DWARFUnitIndex.h:67
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::SimpleBitstreamCursor::isSizePlausible
bool isSizePlausible(size_t Size) const
Check whether a reservation of Size elements is plausible.
Definition: BitstreamReader.h:316
llvm::BitCodeAbbrevOp
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
Definition: BitCodes.h:33
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:597
llvm::BitCodeAbbrevOp::isLiteral
bool isLiteral() const
Definition: BitCodes.h:54
llvm::BitCodeAbbrev
BitCodeAbbrev - This class represents an abbreviation record.
Definition: BitCodes.h:103
llvm::SimpleBitstreamCursor::SkipToFourByteBoundary
void SkipToFourByteBoundary()
Definition: BitstreamReader.h:296
llvm::SimpleBitstreamCursor::GetCurrentBitNo
uint64_t GetCurrentBitNo() const
Return the bit # of the bit we are reading.
Definition: BitstreamReader.h:117
llvm::SmallVectorImpl< uint64_t >
llvm::BitstreamCursor::skipRecord
Expected< unsigned > skipRecord(unsigned AbbrevID)
Read the current record and discard it, returning the code for the record.
Definition: BitstreamReader.cpp:95
error
static Error error(const char *Message)
Definition: BitstreamReader.cpp:20
llvm::bitc::CodeLenWidth
@ CodeLenWidth
Definition: BitCodeEnums.h:38
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:644
llvm::SimpleBitstreamCursor::canSkipToPos
bool canSkipToPos(size_t pos) const
Definition: BitstreamReader.h:107
llvm::SimpleBitstreamCursor::skipToEnd
void skipToEnd()
Skip to the end of the file.
Definition: BitstreamReader.h:313
llvm::BitCodeAbbrevOp::DecodeChar6
static char DecodeChar6(unsigned V)
Definition: BitCodes.h:92
llvm::BitstreamCursor::getAbbrev
Expected< const BitCodeAbbrev * > getAbbrev(unsigned AbbrevID)
Return the abbreviation for the specified AbbrevId.
Definition: BitstreamReader.h:543