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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 /// given Index. | 344 /// given Index. |
345 Ice::GlobalDeclaration *getGlobalDeclarationByID(size_t Index) { | 345 Ice::GlobalDeclaration *getGlobalDeclarationByID(size_t Index) { |
346 size_t NumFunctionIds = FunctionDeclarationList.size(); | 346 size_t NumFunctionIds = FunctionDeclarationList.size(); |
347 if (Index < NumFunctionIds) | 347 if (Index < NumFunctionIds) |
348 return getFunctionByID(Index); | 348 return getFunctionByID(Index); |
349 else | 349 else |
350 return getGlobalVariableByID(Index - NumFunctionIds); | 350 return getGlobalVariableByID(Index - NumFunctionIds); |
351 } | 351 } |
352 | 352 |
353 /// Returns the list of parsed global variable declarations. | 353 /// Returns the list of parsed global variable declarations. |
354 const Ice::Translator::VariableDeclarationListType &getGlobalVariables() { | 354 const Ice::VariableDeclarationList &getGlobalVariables() { |
355 return VariableDeclarations; | 355 return VariableDeclarations; |
356 } | 356 } |
357 | 357 |
358 private: | 358 private: |
359 // The translator associated with the parser. | 359 // The translator associated with the parser. |
360 Ice::Translator &Translator; | 360 Ice::Translator &Translator; |
361 // The bitcode header. | 361 // The bitcode header. |
362 NaClBitcodeHeader &Header; | 362 NaClBitcodeHeader &Header; |
363 // The exit status that should be set to true if an error occurs. | 363 // The exit status that should be set to true if an error occurs. |
364 Ice::ErrorCode &ErrorStatus; | 364 Ice::ErrorCode &ErrorStatus; |
365 // The number of errors reported. | 365 // The number of errors reported. |
366 unsigned NumErrors; | 366 unsigned NumErrors; |
367 // The types associated with each type ID. | 367 // The types associated with each type ID. |
368 std::vector<ExtendedType> TypeIDValues; | 368 std::vector<ExtendedType> TypeIDValues; |
369 // The set of functions (prototype and defined). | 369 // The set of functions (prototype and defined). |
370 FunctionDeclarationListType FunctionDeclarationList; | 370 FunctionDeclarationListType FunctionDeclarationList; |
371 // The ID of the next possible defined function ID in | 371 // The ID of the next possible defined function ID in |
372 // FunctionDeclarationList. FunctionDeclarationList is filled | 372 // FunctionDeclarationList. FunctionDeclarationList is filled |
373 // first. It's the set of functions (either defined or isproto). Then | 373 // first. It's the set of functions (either defined or isproto). Then |
374 // function definitions are encountered/parsed and | 374 // function definitions are encountered/parsed and |
375 // NextDefiningFunctionID is incremented to track the next | 375 // NextDefiningFunctionID is incremented to track the next |
376 // actually-defined function. | 376 // actually-defined function. |
377 size_t NextDefiningFunctionID; | 377 size_t NextDefiningFunctionID; |
378 // The set of global variables. | 378 // The set of global variables. |
379 Ice::Translator::VariableDeclarationListType VariableDeclarations; | 379 Ice::VariableDeclarationList VariableDeclarations; |
380 // Relocatable constants associated with global declarations. | 380 // Relocatable constants associated with global declarations. |
381 std::vector<Ice::Constant *> ValueIDConstants; | 381 std::vector<Ice::Constant *> ValueIDConstants; |
382 // Error recovery value to use when getFuncSigTypeByID fails. | 382 // Error recovery value to use when getFuncSigTypeByID fails. |
383 Ice::FuncSigType UndefinedFuncSigType; | 383 Ice::FuncSigType UndefinedFuncSigType; |
384 // The block parser currently being applied. Used for error | 384 // The block parser currently being applied. Used for error |
385 // reporting. | 385 // reporting. |
386 BlockParserBaseClass *BlockParser; | 386 BlockParserBaseClass *BlockParser; |
387 | 387 |
388 bool ParseBlock(unsigned BlockID) override; | 388 bool ParseBlock(unsigned BlockID) override; |
389 | 389 |
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2973 | 2973 |
2974 if (TopLevelBlocks != 1) { | 2974 if (TopLevelBlocks != 1) { |
2975 errs() << IRFilename | 2975 errs() << IRFilename |
2976 << ": Contains more than one module. Found: " << TopLevelBlocks | 2976 << ": Contains more than one module. Found: " << TopLevelBlocks |
2977 << "\n"; | 2977 << "\n"; |
2978 ErrorStatus.assign(EC_Bitcode); | 2978 ErrorStatus.assign(EC_Bitcode); |
2979 } | 2979 } |
2980 } | 2980 } |
2981 | 2981 |
2982 } // end of namespace Ice | 2982 } // end of namespace Ice |
OLD | NEW |