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 wild access to the stream. | |
jvoung (off chromium)
2015/01/15 18:20:40
What does "wild" access mean? =)
Jim Stichnoth
2015/01/17 18:44:17
Clarified the comment - it means the stream is bei
| |
170 Ice::OstreamLocker L(Translator.getContext()); | |
169 setErrStream(Translator.getContext()->getStrDump()); | 171 setErrStream(Translator.getContext()->getStrDump()); |
170 } | 172 } |
171 | 173 |
172 ~TopLevelParser() override {} | 174 ~TopLevelParser() override {} |
173 | 175 |
174 Ice::Translator &getTranslator() { return Translator; } | 176 Ice::Translator &getTranslator() { return Translator; } |
175 | 177 |
176 void setBlockParser(BlockParserBaseClass *NewBlockParser) { | 178 void setBlockParser(BlockParserBaseClass *NewBlockParser) { |
177 BlockParser = NewBlockParser; | 179 BlockParser = NewBlockParser; |
178 } | 180 } |
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2807 } | 2809 } |
2808 | 2810 |
2809 void installDeclarationName(Ice::Translator &Trans, | 2811 void installDeclarationName(Ice::Translator &Trans, |
2810 Ice::GlobalDeclaration *Decl, | 2812 Ice::GlobalDeclaration *Decl, |
2811 const Ice::IceString &Prefix, const char *Context, | 2813 const Ice::IceString &Prefix, const char *Context, |
2812 uint32_t &NameIndex) { | 2814 uint32_t &NameIndex) { |
2813 if (!Decl->hasName()) { | 2815 if (!Decl->hasName()) { |
2814 Decl->setName(Trans.createUnnamedName(Prefix, NameIndex)); | 2816 Decl->setName(Trans.createUnnamedName(Prefix, NameIndex)); |
2815 ++NameIndex; | 2817 ++NameIndex; |
2816 } else { | 2818 } else { |
2817 Trans.checkIfUnnamedNameSafe(Decl->getName(), Context, Prefix, | 2819 Trans.checkIfUnnamedNameSafe(Decl->getName(), Context, Prefix); |
2818 Trans.getContext()->getStrDump()); | |
2819 } | 2820 } |
2820 } | 2821 } |
2821 | 2822 |
2822 bool ParseBlock(unsigned BlockID) override; | 2823 bool ParseBlock(unsigned BlockID) override; |
2823 | 2824 |
2824 void ExitBlock() override { | 2825 void ExitBlock() override { |
2825 InstallGlobalNamesAndGlobalVarInitializers(); | 2826 InstallGlobalNamesAndGlobalVarInitializers(); |
2826 getTranslator().emitConstants(); | 2827 getTranslator().emitConstants(); |
2827 } | 2828 } |
2828 | 2829 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3001 | 3002 |
3002 if (TopLevelBlocks != 1) { | 3003 if (TopLevelBlocks != 1) { |
3003 errs() << IRFilename | 3004 errs() << IRFilename |
3004 << ": Contains more than one module. Found: " << TopLevelBlocks | 3005 << ": Contains more than one module. Found: " << TopLevelBlocks |
3005 << "\n"; | 3006 << "\n"; |
3006 ErrorStatus = true; | 3007 ErrorStatus = true; |
3007 } | 3008 } |
3008 } | 3009 } |
3009 | 3010 |
3010 } // end of namespace Ice | 3011 } // end of namespace Ice |
OLD | NEW |