| OLD | NEW |
| 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// | 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 // for unit tests. | 775 // for unit tests. |
| 776 if (getFlags().getGenerateUnitTestMessages()) { | 776 if (getFlags().getGenerateUnitTestMessages()) { |
| 777 StrBuf << "Invalid " << getBlockName() << " record: <" << Record.GetCode(); | 777 StrBuf << "Invalid " << getBlockName() << " record: <" << Record.GetCode(); |
| 778 for (const uint64_t Val : Record.GetValues()) { | 778 for (const uint64_t Val : Record.GetValues()) { |
| 779 StrBuf << " " << Val; | 779 StrBuf << " " << Val; |
| 780 } | 780 } |
| 781 StrBuf << ">"; | 781 StrBuf << ">"; |
| 782 } else { | 782 } else { |
| 783 StrBuf << Message; | 783 StrBuf << Message; |
| 784 } | 784 } |
| 785 return Context->ErrorAt(Level, Bit, StrBuf.str()); | 785 return Context->ErrorAt(Level, Record.GetCursor().getErrorBitNo(Bit), |
| 786 StrBuf.str()); |
| 786 } | 787 } |
| 787 | 788 |
| 788 void BlockParserBaseClass::reportRecordSizeError(size_t ExpectedSize, | 789 void BlockParserBaseClass::reportRecordSizeError(size_t ExpectedSize, |
| 789 const char *RecordName, | 790 const char *RecordName, |
| 790 const char *ContextMessage) { | 791 const char *ContextMessage) { |
| 791 std::string Buffer; | 792 std::string Buffer; |
| 792 raw_string_ostream StrBuf(Buffer); | 793 raw_string_ostream StrBuf(Buffer); |
| 793 const char *BlockName = getBlockName(); | 794 const char *BlockName = getBlockName(); |
| 794 const char FirstChar = toupper(*BlockName); | 795 const char FirstChar = toupper(*BlockName); |
| 795 StrBuf << FirstChar << (BlockName + 1) << " " << RecordName | 796 StrBuf << FirstChar << (BlockName + 1) << " " << RecordName |
| (...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 // TODO(kschimpf): Fix this issue. | 3108 // TODO(kschimpf): Fix this issue. |
| 3108 ModuleParser *ModParser; | 3109 ModuleParser *ModParser; |
| 3109 const std::unique_ptr<uint8_t[]> Buffer; | 3110 const std::unique_ptr<uint8_t[]> Buffer; |
| 3110 const uintptr_t BufferSize; | 3111 const uintptr_t BufferSize; |
| 3111 const uint64_t StartBit; | 3112 const uint64_t StartBit; |
| 3112 const uint32_t SeqNumber; | 3113 const uint32_t SeqNumber; |
| 3113 }; | 3114 }; |
| 3114 | 3115 |
| 3115 std::unique_ptr<Ice::Cfg> CfgParserWorkItem::getParsedCfg() { | 3116 std::unique_ptr<Ice::Cfg> CfgParserWorkItem::getParsedCfg() { |
| 3116 NaClBitstreamCursor &OldCursor(ModParser->getCursor()); | 3117 NaClBitstreamCursor &OldCursor(ModParser->getCursor()); |
| 3117 llvm::NaClBitstreamReader Reader(Buffer.get(), Buffer.get() + BufferSize, | 3118 llvm::NaClBitstreamReader Reader(OldCursor.getStartWordByteForBit(StartBit), |
| 3119 Buffer.get(), Buffer.get() + BufferSize, |
| 3118 OldCursor.getBitStreamReader()); | 3120 OldCursor.getBitStreamReader()); |
| 3119 NaClBitstreamCursor NewCursor(Reader); | 3121 NaClBitstreamCursor NewCursor(Reader); |
| 3120 NewCursor.JumpToBit(NewCursor.getWordBitNo(StartBit)); | 3122 NewCursor.JumpToBit(NewCursor.getWordBitNo(StartBit)); |
| 3121 FunctionParser Parser(BlockID, ModParser, FcnId, NewCursor); | 3123 FunctionParser Parser(BlockID, ModParser, FcnId, NewCursor); |
| 3122 return Parser.parseFunction(SeqNumber); | 3124 return Parser.parseFunction(SeqNumber); |
| 3123 } | 3125 } |
| 3124 | 3126 |
| 3125 bool ModuleParser::ParseBlock(unsigned BlockID) { | 3127 bool ModuleParser::ParseBlock(unsigned BlockID) { |
| 3126 switch (BlockID) { | 3128 switch (BlockID) { |
| 3127 case naclbitc::BLOCKINFO_BLOCK_ID: | 3129 case naclbitc::BLOCKINFO_BLOCK_ID: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 raw_string_ostream StrBuf(Buffer); | 3303 raw_string_ostream StrBuf(Buffer); |
| 3302 StrBuf << IRFilename << ": Does not contain a module!"; | 3304 StrBuf << IRFilename << ": Does not contain a module!"; |
| 3303 llvm::report_fatal_error(StrBuf.str()); | 3305 llvm::report_fatal_error(StrBuf.str()); |
| 3304 } | 3306 } |
| 3305 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3307 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
| 3306 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); | 3308 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); |
| 3307 } | 3309 } |
| 3308 } | 3310 } |
| 3309 | 3311 |
| 3310 } // end of namespace Ice | 3312 } // end of namespace Ice |
| OLD | NEW |