Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Side by Side Diff: include/llvm/Bitcode/NaCl/NaClBitstreamReader.h

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- NaClBitstreamReader.h -----------------------------------*- C++ -*-===// 1 //===- NaClBitstreamReader.h -----------------------------------*- C++ -*-===//
2 // Low-level bitstream reader interface 2 // Low-level bitstream reader interface
3 // 3 //
4 // The LLVM Compiler Infrastructure 4 // The LLVM Compiler Infrastructure
5 // 5 //
6 // This file is distributed under the University of Illinois Open Source 6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details. 7 // License. See LICENSE.TXT for details.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 std::unique_ptr<MemoryObject> BitcodeBytes; 67 std::unique_ptr<MemoryObject> BitcodeBytes;
68 68
69 std::vector<BlockInfo> BlockInfoRecords; 69 std::vector<BlockInfo> BlockInfoRecords;
70 70
71 /// \brief Holds the offset of the first byte after the header. 71 /// \brief Holds the offset of the first byte after the header.
72 size_t InitialAddress; 72 size_t InitialAddress;
73 73
74 // True if filler should be added to byte align records. 74 // True if filler should be added to byte align records.
75 bool AlignBitcodeRecords = false; 75 bool AlignBitcodeRecords = false;
76 NaClBitstreamReader(const NaClBitstreamReader&) = delete;
77 void operator=(const NaClBitstreamReader&) = delete;
76 78
77 NaClBitstreamReader(const NaClBitstreamReader&) LLVM_DELETED_FUNCTION;
78 void operator=(const NaClBitstreamReader&) LLVM_DELETED_FUNCTION;
79 79
80 void initFromHeader(NaClBitcodeHeader &Header) { 80 void initFromHeader(NaClBitcodeHeader &Header) {
81 InitialAddress = Header.getHeaderSize(); 81 InitialAddress = Header.getHeaderSize();
82 AlignBitcodeRecords = Header.getAlignBitcodeRecords(); 82 AlignBitcodeRecords = Header.getAlignBitcodeRecords();
83 } 83 }
84 84
85 public: 85 public:
86 /// Read stream from sequence of bytes [Start .. End) after parsing 86 /// Read stream from sequence of bytes [Start .. End) after parsing
87 /// the given bitcode header. 87 /// the given bitcode header.
88 NaClBitstreamReader(const unsigned char *Start, const unsigned char *End, 88 NaClBitstreamReader(const unsigned char *Start, const unsigned char *End,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 /// NaClBitcodeParser to listen to record details when processing 191 /// NaClBitcodeParser to listen to record details when processing
192 /// abbreviations. The major reason for using a listener is that the 192 /// abbreviations. The major reason for using a listener is that the
193 /// NaCl bitcode reader would require a major rewrite (including the 193 /// NaCl bitcode reader would require a major rewrite (including the
194 /// introduction of more overhead) if we were to lift abbreviations up 194 /// introduction of more overhead) if we were to lift abbreviations up
195 /// to the bitcode reader. That is, not only would we have to lift the 195 /// to the bitcode reader. That is, not only would we have to lift the
196 /// block processing up into the readers (i.e. many blocks in 196 /// block processing up into the readers (i.e. many blocks in
197 /// NaClBitcodeReader and NaClBitcodeParser), but add many new API's 197 /// NaClBitcodeReader and NaClBitcodeParser), but add many new API's
198 /// to allow the readers to update internals of the bit stream reader 198 /// to allow the readers to update internals of the bit stream reader
199 /// appropriately. 199 /// appropriately.
200 class NaClAbbrevListener { 200 class NaClAbbrevListener {
201 NaClAbbrevListener(const NaClAbbrevListener&) LLVM_DELETED_FUNCTION; 201 NaClAbbrevListener(const NaClAbbrevListener&) = delete;
202 void operator=(const NaClAbbrevListener&) LLVM_DELETED_FUNCTION; 202 void operator=(const NaClAbbrevListener&) = delete;
203 public: 203 public:
204 NaClAbbrevListener() {} 204 NaClAbbrevListener() {}
205 virtual ~NaClAbbrevListener() {} 205 virtual ~NaClAbbrevListener() {}
206 206
207 /// Called to process the read abbreviation. 207 /// Called to process the read abbreviation.
208 virtual void ProcessAbbreviation(NaClBitCodeAbbrev *Abbrev, 208 virtual void ProcessAbbreviation(NaClBitCodeAbbrev *Abbrev,
209 bool IsLocal) = 0; 209 bool IsLocal) = 0;
210 210
211 /// Called after entering block. NumWords is the number of words 211 /// Called after entering block. NumWords is the number of words
212 /// in the block. 212 /// in the block.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 NaClBitcodeSelectorAbbrev PrevCodeSize; 287 NaClBitcodeSelectorAbbrev PrevCodeSize;
288 std::vector<NaClBitCodeAbbrev*> PrevAbbrevs; 288 std::vector<NaClBitCodeAbbrev*> PrevAbbrevs;
289 Block() : PrevCodeSize() {} 289 Block() : PrevCodeSize() {}
290 explicit Block(const NaClBitcodeSelectorAbbrev& PCS) 290 explicit Block(const NaClBitcodeSelectorAbbrev& PCS)
291 : PrevCodeSize(PCS) {} 291 : PrevCodeSize(PCS) {}
292 }; 292 };
293 293
294 /// This tracks the codesize of parent blocks. 294 /// This tracks the codesize of parent blocks.
295 SmallVector<Block, 8> BlockScope; 295 SmallVector<Block, 8> BlockScope;
296 296
297 NaClBitstreamCursor(const NaClBitstreamCursor &) LLVM_DELETED_FUNCTION; 297 NaClBitstreamCursor(const NaClBitstreamCursor &) = delete;
298 NaClBitstreamCursor &operator=(const NaClBitstreamCursor &) LLVM_DELETED_FUNCT ION; 298 NaClBitstreamCursor &operator=(const NaClBitstreamCursor &) = delete;
299 299
300 public: 300 public:
301 NaClBitstreamCursor() : ErrHandler(new ErrorHandler(*this)) { 301 NaClBitstreamCursor() : ErrHandler(new ErrorHandler(*this)) {
302 init(nullptr); 302 init(nullptr);
303 } 303 }
304 304
305 explicit NaClBitstreamCursor(NaClBitstreamReader &R) 305 explicit NaClBitstreamCursor(NaClBitstreamReader &R)
306 : ErrHandler(new ErrorHandler(*this)) { init(&R); } 306 : ErrHandler(new ErrorHandler(*this)) { init(&R); }
307 307
308 void init(NaClBitstreamReader *R) { 308 void init(NaClBitstreamReader *R) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // Skips over an abbreviation record. Duplicates code of ReadAbbrevRecord, 679 // Skips over an abbreviation record. Duplicates code of ReadAbbrevRecord,
680 // except that no abbreviation is built. 680 // except that no abbreviation is built.
681 void SkipAbbrevRecord(); 681 void SkipAbbrevRecord();
682 682
683 bool ReadBlockInfoBlock(NaClAbbrevListener *Listener); 683 bool ReadBlockInfoBlock(NaClAbbrevListener *Listener);
684 }; 684 };
685 685
686 } // End llvm namespace 686 } // End llvm namespace
687 687
688 #endif 688 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698