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

Side by Side Diff: lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h

Issue 14813032: Make abbreviations explicit in pnacl-freeze/thaw. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Small cleanups suggested by Jan in CL. Created 7 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 //===- NaClBitcodeReader.h ------------------------------------*- C++ -*-===// 1 //===- NaClBitcodeReader.h ------------------------------------*- C++ -*-===//
2 // Internal NaClBitcodeReader implementation 2 // Internal NaClBitcodeReader implementation
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const char *getErrorString() const { return ErrorString; } 230 const char *getErrorString() const { return ErrorString; }
231 231
232 /// @brief Main interface to parsing a bitcode buffer. 232 /// @brief Main interface to parsing a bitcode buffer.
233 /// @returns true if an error occurred. 233 /// @returns true if an error occurred.
234 bool ParseBitcodeInto(Module *M); 234 bool ParseBitcodeInto(Module *M);
235 235
236 /// @brief Cheap mechanism to just extract module triple 236 /// @brief Cheap mechanism to just extract module triple
237 /// @returns true if an error occurred. 237 /// @returns true if an error occurred.
238 bool ParseTriple(std::string &Triple); 238 bool ParseTriple(std::string &Triple);
239 239
240 static uint64_t decodeSignRotatedValue(uint64_t V);
241
242 private: 240 private:
243 Type *getTypeByID(unsigned ID); 241 Type *getTypeByID(unsigned ID);
244 Value *getFnValueByID(unsigned ID, Type *Ty) { 242 Value *getFnValueByID(unsigned ID, Type *Ty) {
245 if (Ty && Ty->isMetadataTy()) 243 if (Ty && Ty->isMetadataTy())
246 return MDValueList.getValueFwdRef(ID); 244 return MDValueList.getValueFwdRef(ID);
247 return ValueList.getValueFwdRef(ID, Ty); 245 return ValueList.getValueFwdRef(ID, Ty);
248 } 246 }
249 BasicBlock *getBasicBlock(unsigned ID) const { 247 BasicBlock *getBasicBlock(unsigned ID) const {
250 if (ID >= FunctionBBs.size()) return 0; // Invalid ID 248 if (ID >= FunctionBBs.size()) return 0; // Invalid ID
251 return FunctionBBs[ID]; 249 return FunctionBBs[ID];
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // Adjust the ValNo, if it was encoded relative to the InstNum. 306 // Adjust the ValNo, if it was encoded relative to the InstNum.
309 if (UseRelativeIDs) 307 if (UseRelativeIDs)
310 ValNo = InstNum - ValNo; 308 ValNo = InstNum - ValNo;
311 return getFnValueByID(ValNo, Ty); 309 return getFnValueByID(ValNo, Ty);
312 } 310 }
313 311
314 /// getValueSigned -- Like getValue, but decodes signed VBRs. 312 /// getValueSigned -- Like getValue, but decodes signed VBRs.
315 Value *getValueSigned(SmallVector<uint64_t, 64> &Record, unsigned Slot, 313 Value *getValueSigned(SmallVector<uint64_t, 64> &Record, unsigned Slot,
316 unsigned InstNum, Type *Ty) { 314 unsigned InstNum, Type *Ty) {
317 if (Slot == Record.size()) return 0; 315 if (Slot == Record.size()) return 0;
318 unsigned ValNo = (unsigned)decodeSignRotatedValue(Record[Slot]); 316 unsigned ValNo = (unsigned) NaClDecodeSignRotatedValue(Record[Slot]);
319 // Adjust the ValNo, if it was encoded relative to the InstNum. 317 // Adjust the ValNo, if it was encoded relative to the InstNum.
320 if (UseRelativeIDs) 318 if (UseRelativeIDs)
321 ValNo = InstNum - ValNo; 319 ValNo = InstNum - ValNo;
322 return getFnValueByID(ValNo, Ty); 320 return getFnValueByID(ValNo, Ty);
323 } 321 }
324 322
325 bool ParseModule(bool Resume); 323 bool ParseModule(bool Resume);
326 bool ParseAttributeBlock(); 324 bool ParseAttributeBlock();
327 bool ParseAttributeGroupBlock(); 325 bool ParseAttributeGroupBlock();
328 bool ParseTypeTable(); 326 bool ParseTypeTable();
(...skipping 12 matching lines...) Expand all
341 bool InitStream(); 339 bool InitStream();
342 bool InitStreamFromBuffer(); 340 bool InitStreamFromBuffer();
343 bool InitLazyStream(); 341 bool InitLazyStream();
344 bool FindFunctionInStream(Function *F, 342 bool FindFunctionInStream(Function *F,
345 DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator); 343 DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator);
346 }; 344 };
347 345
348 } // End llvm namespace 346 } // End llvm namespace
349 347
350 #endif 348 #endif
OLDNEW
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitstreamWriter.h ('k') | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698