24 BlockScope.
back().PrevAbbrevs.swap(CurAbbrevs);
30 CurAbbrevs.insert(CurAbbrevs.end(),
Info->Abbrevs.begin(),
39 CurCodeSize = MaybeVBR.
get();
43 std::errc::illegal_byte_sequence,
44 "can't read more than %zu at a time, trying to read %u", +
MaxChunkSize,
53 *NumWordsP = NumWords;
57 std::errc::illegal_byte_sequence,
58 "can't enter sub-block: current code size is 0");
61 std::errc::illegal_byte_sequence,
62 "can't enter sub block: already at end of stream");
86 return Res.takeError();
98 unsigned Code = MaybeCode.
get();
101 return MaybeVBR.
get();
102 unsigned NumElts = MaybeVBR.
get();
103 for (
unsigned i = 0; i != NumElts; ++i)
107 return Res.takeError();
120 std::errc::illegal_byte_sequence,
121 "Abbreviation starts with an Array or a Blob");
125 Code = MaybeCode.
get();
138 return MaybeField.takeError();
146 unsigned NumElts = MaybeNum.
get();
149 assert(i+2 == e &&
"array op not second to last?");
161 return std::move(Err);
165 for (; NumElts; --NumElts)
170 return Res.takeError();
174 return std::move(Err);
184 return MaybeNum.takeError();
185 unsigned NumElts = MaybeNum.get();
200 return std::move(Err);
218 for (
unsigned i = 0; i != NumElts; ++i)
222 return MaybeVal.takeError();
232 if (CodeOp.isLiteral())
233 Code = CodeOp.getLiteralValue();
239 Code = MaybeCode.get();
241 return MaybeCode.takeError();
256 return MaybeVal.takeError();
273 "Array element type has to be an encoding of a type");
280 for (; NumElts; --NumElts)
285 return MaybeVal.takeError();
288 for (; NumElts; --NumElts)
293 return MaybeVal.takeError();
296 for (; NumElts; --NumElts)
300 return MaybeVal.takeError();
309 return MaybeNumElts.takeError();
310 uint32_t NumElts = MaybeNumElts.get();
315 size_t NewEnd = CurBitPos+((NumElts+3)&~3)*8;
329 return std::move(Err);
337 for (; NumElts; --NumElts)
346 auto Abbv = std::make_shared<BitCodeAbbrev>();
349 return MaybeNumOpInfo.takeError();
350 unsigned NumOpInfo = MaybeNumOpInfo.get();
351 for (
unsigned i = 0; i != NumOpInfo; ++i) {
355 bool IsLiteral = MaybeIsLiteral.
get();
373 uint64_t
Data = MaybeData.
get();
387 "Fixed or VBR abbrev record with size > MaxChunkData");
394 if (Abbv->getNumOperandInfos() == 0)
396 CurAbbrevs.push_back(std::move(Abbv));
404 return std::move(Err);
419 switch (Entry.
Kind) {
424 return std::move(NewBlockInfo);
432 if (!CurBlockInfo)
return None;
434 return std::move(Err);
438 CurBlockInfo->
Abbrevs.push_back(std::move(CurAbbrevs.back()));
439 CurAbbrevs.pop_back();
448 switch (MaybeBlockInfo.
get()) {
452 if (Record.
size() < 1)
459 if (!ReadBlockInfoNames)
462 for (
unsigned i = 0,
e = Record.size(); i !=
e; ++i)
463 Name += (
char)Record[i];
468 if (!CurBlockInfo)
return None;
469 if (!ReadBlockInfoNames)
472 for (
unsigned i = 1,
e = Record.size(); i !=
e; ++i)
473 Name += (
char)Record[i];
474 CurBlockInfo->
RecordNames.push_back(std::make_pair((
unsigned)Record[0],
static Expected< uint64_t > readAbbreviatedField(BitstreamCursor &Cursor, const BitCodeAbbrevOp &Op)
Encoding getEncoding() const
This contains information emitted to BLOCKINFO_BLOCK blocks.
const BitCodeAbbrev * getAbbrev(unsigned AbbrevID)
Return the abbreviation for the specified AbbrevId.
BLOCKINFO_BLOCK is used to define metadata about blocks, for example, standard abbrevs that should be...
BlockInfo & getOrCreateBlockInfo(unsigned BlockID)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
uint64_t GetCurrentBitNo() const
Return the bit # of the bit we are reading.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void push_back(const T &Elt)
BitCodeAbbrev - This class represents an abbreviation record.
static const size_t MaxChunkSize
const uint8_t * getPointerToBit(uint64_t BitNo, uint64_t NumBytes)
Get a pointer into the bitstream at the specified bit offset.
Expected< uint32_t > ReadVBR(unsigned NumBits)
Error takeError()
Take ownership of the stored error.
std::vector< std::pair< unsigned, std::string > > RecordNames
uint64_t getLiteralValue() const
bool canSkipToPos(size_t pos) const
Tagged union holding either a T or a Error.
If this flag is used, abbrev entries are returned just like normal records.
void skipToEnd()
Skip to the end of the file.
Expected< unsigned > skipRecord(unsigned AbbrevID)
Read the current record and discard it, returning the code for the record.
const BitCodeAbbrevOp & getOperandInfo(unsigned N) const
Analysis containing CSE Info
void SkipToFourByteBoundary()
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
Expected< uint64_t > ReadVBR64(unsigned NumBits)
Expected< Optional< BitstreamBlockInfo > > ReadBlockInfoBlock(bool ReadBlockInfoNames=false)
Read and return a block info block from the bitstream.
const BlockInfo * getBlockInfo(unsigned BlockID) const
If there is block info for the specified ID, return it, otherwise return null.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::vector< std::shared_ptr< BitCodeAbbrev > > Abbrevs
Error JumpToBit(uint64_t BitNo)
Reset the stream to the specified bit number.
Expected< unsigned > readRecord(unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr)
static ErrorSuccess success()
Create a success value.
When advancing through a bitstream cursor, each advance can discover a few different kinds of entries...
This class maintains the abbreviations read from a block info block.
reference get()
Returns a reference to the stored T value.
DEFINE_ABBREV - Defines an abbrev for the current block.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
unsigned getNumOperandInfos() const
uint64_t getEncodingData() const
Error EnterSubBlock(unsigned BlockID, unsigned *NumWordsP=nullptr)
Having read the ENTER_SUBBLOCK abbrevid, and enter the block.
static char DecodeChar6(unsigned V)
Expected< BitstreamEntry > advanceSkippingSubblocks(unsigned Flags=0)
This is a convenience function for clients that don't expect any subblocks.
bool hasEncodingData() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
enum llvm::BitstreamEntry::@159 Kind
Expected< word_t > Read(unsigned NumBits)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.