| 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 // This file implements the PNaCl bitcode file to Ice, to machine code | 10 // This file implements the PNaCl bitcode file to Ice, to machine code |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 TopLevelParser &operator=(const TopLevelParser &) = delete; | 159 TopLevelParser &operator=(const TopLevelParser &) = delete; |
| 160 | 160 |
| 161 public: | 161 public: |
| 162 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; | 162 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; |
| 163 | 163 |
| 164 TopLevelParser(Ice::Translator &Translator, NaClBitcodeHeader &Header, | 164 TopLevelParser(Ice::Translator &Translator, NaClBitcodeHeader &Header, |
| 165 NaClBitstreamCursor &Cursor, bool &ErrorStatus) | 165 NaClBitstreamCursor &Cursor, bool &ErrorStatus) |
| 166 : NaClBitcodeParser(Cursor), Translator(Translator), Header(Header), | 166 : NaClBitcodeParser(Cursor), Translator(Translator), Header(Header), |
| 167 ErrorStatus(ErrorStatus), NumErrors(0), NumFunctionIds(0), | 167 ErrorStatus(ErrorStatus), NumErrors(0), NumFunctionIds(0), |
| 168 NumFunctionBlocks(0), BlockParser(nullptr) { | 168 NumFunctionBlocks(0), BlockParser(nullptr) { |
| 169 // Note: This gives the reader uncontrolled access to the dump |
| 170 // stream, which it can then use without locking. TODO(kschimpf): |
| 171 // Consider reworking the LLVM side to use e.g. a callback for |
| 172 // errors. |
| 173 Ice::OstreamLocker L(Translator.getContext()); |
| 169 setErrStream(Translator.getContext()->getStrDump()); | 174 setErrStream(Translator.getContext()->getStrDump()); |
| 170 } | 175 } |
| 171 | 176 |
| 172 ~TopLevelParser() override {} | 177 ~TopLevelParser() override {} |
| 173 | 178 |
| 174 Ice::Translator &getTranslator() { return Translator; } | 179 Ice::Translator &getTranslator() { return Translator; } |
| 175 | 180 |
| 176 void setBlockParser(BlockParserBaseClass *NewBlockParser) { | 181 void setBlockParser(BlockParserBaseClass *NewBlockParser) { |
| 177 BlockParser = NewBlockParser; | 182 BlockParser = NewBlockParser; |
| 178 } | 183 } |
| (...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 } | 2812 } |
| 2808 | 2813 |
| 2809 void installDeclarationName(Ice::Translator &Trans, | 2814 void installDeclarationName(Ice::Translator &Trans, |
| 2810 Ice::GlobalDeclaration *Decl, | 2815 Ice::GlobalDeclaration *Decl, |
| 2811 const Ice::IceString &Prefix, const char *Context, | 2816 const Ice::IceString &Prefix, const char *Context, |
| 2812 uint32_t &NameIndex) { | 2817 uint32_t &NameIndex) { |
| 2813 if (!Decl->hasName()) { | 2818 if (!Decl->hasName()) { |
| 2814 Decl->setName(Trans.createUnnamedName(Prefix, NameIndex)); | 2819 Decl->setName(Trans.createUnnamedName(Prefix, NameIndex)); |
| 2815 ++NameIndex; | 2820 ++NameIndex; |
| 2816 } else { | 2821 } else { |
| 2817 Trans.checkIfUnnamedNameSafe(Decl->getName(), Context, Prefix, | 2822 Trans.checkIfUnnamedNameSafe(Decl->getName(), Context, Prefix); |
| 2818 Trans.getContext()->getStrDump()); | |
| 2819 } | 2823 } |
| 2820 } | 2824 } |
| 2821 | 2825 |
| 2822 bool ParseBlock(unsigned BlockID) override; | 2826 bool ParseBlock(unsigned BlockID) override; |
| 2823 | 2827 |
| 2824 void ExitBlock() override { | 2828 void ExitBlock() override { |
| 2825 InstallGlobalNamesAndGlobalVarInitializers(); | 2829 InstallGlobalNamesAndGlobalVarInitializers(); |
| 2826 getTranslator().emitConstants(); | 2830 getTranslator().emitConstants(); |
| 2827 } | 2831 } |
| 2828 | 2832 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3001 | 3005 |
| 3002 if (TopLevelBlocks != 1) { | 3006 if (TopLevelBlocks != 1) { |
| 3003 errs() << IRFilename | 3007 errs() << IRFilename |
| 3004 << ": Contains more than one module. Found: " << TopLevelBlocks | 3008 << ": Contains more than one module. Found: " << TopLevelBlocks |
| 3005 << "\n"; | 3009 << "\n"; |
| 3006 ErrorStatus = true; | 3010 ErrorStatus = true; |
| 3007 } | 3011 } |
| 3008 } | 3012 } |
| 3009 | 3013 |
| 3010 } // end of namespace Ice | 3014 } // end of namespace Ice |
| OLD | NEW |