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

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

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 //===- NaClBitcodeReader.cpp ----------------------------------------------===// 1 //===- NaClBitcodeReader.cpp ----------------------------------------------===//
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 namespace { 336 namespace {
337 337
338 // Class to process globals in two passes. In the first pass, build 338 // Class to process globals in two passes. In the first pass, build
339 // the corresponding global variables with no initializers. In the 339 // the corresponding global variables with no initializers. In the
340 // second pass, add initializers. The purpose of putting off 340 // second pass, add initializers. The purpose of putting off
341 // initializers is to make sure that we don't need to generate 341 // initializers is to make sure that we don't need to generate
342 // placeholders for relocation records, and the corresponding cost 342 // placeholders for relocation records, and the corresponding cost
343 // of duplicating initializers when these placeholders are replaced. 343 // of duplicating initializers when these placeholders are replaced.
344 class ParseGlobalsHandler { 344 class ParseGlobalsHandler {
345 ParseGlobalsHandler(const ParseGlobalsHandler &H) LLVM_DELETED_FUNCTION; 345 ParseGlobalsHandler(const ParseGlobalsHandler &H) = delete;
346 void operator=(const ParseGlobalsHandler &H) LLVM_DELETED_FUNCTION; 346 void operator=(const ParseGlobalsHandler &H) = delete;
347 347
348 NaClBitcodeReader &Reader; 348 NaClBitcodeReader &Reader;
349 NaClBitcodeReaderValueList &ValueList; 349 NaClBitcodeReaderValueList &ValueList;
350 NaClBitstreamCursor &Stream; 350 NaClBitstreamCursor &Stream;
351 LLVMContext &Context; 351 LLVMContext &Context;
352 Module *TheModule; 352 Module *TheModule;
353 353
354 // Holds read data record. 354 // Holds read data record.
355 SmallVector<uint64_t, 64> Record; 355 SmallVector<uint64_t, 64> Record;
356 // True when processing a global variable. Stays true until all records 356 // True when processing a global variable. Stays true until all records
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 if (!I->first->use_empty()) 1823 if (!I->first->use_empty())
1824 I->first->replaceAllUsesWith(I->second); 1824 I->first->replaceAllUsesWith(I->second);
1825 I->first->eraseFromParent(); 1825 I->first->eraseFromParent();
1826 } 1826 }
1827 } 1827 }
1828 std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics); 1828 std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics);
1829 1829
1830 return std::error_code(); 1830 return std::error_code();
1831 } 1831 }
1832 1832
1833 std::vector<StructType *> NaClBitcodeReader::getIdentifiedStructTypes() const {
1834 // MERGETODO(dschuff): does this need to contain anything for TypeFinder?
jvoung (off chromium) 2015/05/26 20:39:45 can this TODO be removed now -- replace with comme
Derek Schuff 2015/05/26 22:01:32 Done.
1835 return std::vector<StructType *>();
1836 }
1837
1833 std::error_code NaClBitcodeReader::InitStream() { 1838 std::error_code NaClBitcodeReader::InitStream() {
1834 if (LazyStreamer) 1839 if (LazyStreamer)
1835 return InitLazyStream(); 1840 return InitLazyStream();
1836 return InitStreamFromBuffer(); 1841 return InitStreamFromBuffer();
1837 } 1842 }
1838 1843
1839 std::error_code NaClBitcodeReader::InitStreamFromBuffer() { 1844 std::error_code NaClBitcodeReader::InitStreamFromBuffer() {
1840 const unsigned char *BufPtr = (const unsigned char*)Buffer->getBufferStart(); 1845 const unsigned char *BufPtr = (const unsigned char*)Buffer->getBufferStart();
1841 const unsigned char *BufEnd = BufPtr+Buffer->getBufferSize(); 1846 const unsigned char *BufEnd = BufPtr+Buffer->getBufferSize();
1842 1847
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 if (std::error_code EC = M->materializeAllPermanently()) { 1939 if (std::error_code EC = M->materializeAllPermanently()) {
1935 delete M; 1940 delete M;
1936 return EC; 1941 return EC;
1937 } 1942 }
1938 1943
1939 // TODO: Restore the use-lists to the in-memory state when the bitcode was 1944 // TODO: Restore the use-lists to the in-memory state when the bitcode was
1940 // written. We must defer until the Module has been fully materialized. 1945 // written. We must defer until the Module has been fully materialized.
1941 1946
1942 return M; 1947 return M;
1943 } 1948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698