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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1345293002: Don't allow multiple symbol tables in the module block. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/dup-module-vst.tbc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 2943
2944 ~ModuleParser() override = default; 2944 ~ModuleParser() override = default;
2945 2945
2946 const char *getBlockName() const override { return "module"; } 2946 const char *getBlockName() const override { return "module"; }
2947 2947
2948 private: 2948 private:
2949 Ice::TimerMarker Timer; 2949 Ice::TimerMarker Timer;
2950 // True if we have already installed names for unnamed global declarations, 2950 // True if we have already installed names for unnamed global declarations,
2951 // and have generated global constant initializers. 2951 // and have generated global constant initializers.
2952 bool GlobalDeclarationNamesAndInitializersInstalled = false; 2952 bool GlobalDeclarationNamesAndInitializersInstalled = false;
2953 // True if we have already processed the symbol table for the module.
2954 bool FoundValuesymtab = false;
2953 2955
2954 // Generates names for unnamed global addresses (i.e. functions and global 2956 // Generates names for unnamed global addresses (i.e. functions and global
2955 // variables). Then lowers global variable declaration initializers to the 2957 // variables). Then lowers global variable declaration initializers to the
2956 // target. May be called multiple times. Only the first call will do the 2958 // target. May be called multiple times. Only the first call will do the
2957 // installation. 2959 // installation.
2958 void installGlobalNamesAndGlobalVarInitializers() { 2960 void installGlobalNamesAndGlobalVarInitializers() {
2959 if (!GlobalDeclarationNamesAndInitializersInstalled) { 2961 if (!GlobalDeclarationNamesAndInitializersInstalled) {
2960 Context->installGlobalNames(); 2962 Context->installGlobalNames();
2961 Context->createValueIDs(); 2963 Context->createValueIDs();
2962 getTranslator().lowerGlobals(Context->getGlobalVariables()); 2964 std::unique_ptr<Ice::VariableDeclarationList> Globals =
2965 Context->getGlobalVariables();
2966 if (Globals)
2967 getTranslator().lowerGlobals(std::move(Globals));
2963 GlobalDeclarationNamesAndInitializersInstalled = true; 2968 GlobalDeclarationNamesAndInitializersInstalled = true;
2964 } 2969 }
2965 } 2970 }
2966 bool ParseBlock(unsigned BlockID) override; 2971 bool ParseBlock(unsigned BlockID) override;
2967 2972
2968 void ExitBlock() override { installGlobalNamesAndGlobalVarInitializers(); } 2973 void ExitBlock() override { installGlobalNamesAndGlobalVarInitializers(); }
2969 2974
2970 void ProcessRecord() override; 2975 void ProcessRecord() override;
2971 }; 2976 };
2972 2977
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 return NaClBitcodeParser::ParseBlock(BlockID); 3015 return NaClBitcodeParser::ParseBlock(BlockID);
3011 case naclbitc::TYPE_BLOCK_ID_NEW: { 3016 case naclbitc::TYPE_BLOCK_ID_NEW: {
3012 TypesParser Parser(BlockID, this); 3017 TypesParser Parser(BlockID, this);
3013 return Parser.ParseThisBlock(); 3018 return Parser.ParseThisBlock();
3014 } 3019 }
3015 case naclbitc::GLOBALVAR_BLOCK_ID: { 3020 case naclbitc::GLOBALVAR_BLOCK_ID: {
3016 GlobalsParser Parser(BlockID, this); 3021 GlobalsParser Parser(BlockID, this);
3017 return Parser.ParseThisBlock(); 3022 return Parser.ParseThisBlock();
3018 } 3023 }
3019 case naclbitc::VALUE_SYMTAB_BLOCK_ID: { 3024 case naclbitc::VALUE_SYMTAB_BLOCK_ID: {
3025 if (FoundValuesymtab)
3026 Fatal("Duplicate valuesymtab in module");
3027
3028 FoundValuesymtab = true;
3020 ModuleValuesymtabParser Parser(BlockID, this); 3029 ModuleValuesymtabParser Parser(BlockID, this);
3021 return Parser.ParseThisBlock(); 3030 return Parser.ParseThisBlock();
3022 } 3031 }
3023 case naclbitc::FUNCTION_BLOCK_ID: { 3032 case naclbitc::FUNCTION_BLOCK_ID: {
3024 installGlobalNamesAndGlobalVarInitializers(); 3033 installGlobalNamesAndGlobalVarInitializers();
3025 FunctionParser Parser(BlockID, this); 3034 FunctionParser Parser(BlockID, this);
3026 return Parser.convertFunction(); 3035 return Parser.convertFunction();
3027 } 3036 }
3028 default: 3037 default:
3029 return BlockParserBaseClass::ParseBlock(BlockID); 3038 return BlockParserBaseClass::ParseBlock(BlockID);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 } 3155 }
3147 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3156 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3148 ErrStream 3157 ErrStream
3149 << IRFilename 3158 << IRFilename
3150 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; 3159 << ": Bitcode stream should be a multiple of 4 bytes in length.\n";
3151 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3160 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3152 } 3161 }
3153 } 3162 }
3154 3163
3155 } // end of namespace Ice 3164 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/dup-module-vst.tbc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698