| 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 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3036 | 3036 |
| 3037 private: | 3037 private: |
| 3038 Ice::TimerMarker Timer; | 3038 Ice::TimerMarker Timer; |
| 3039 const char *getTableKind() const final { return "Module"; } | 3039 const char *getTableKind() const final { return "Module"; } |
| 3040 void setValueName(NaClBcIndexSize_t Index, StringType &Name) final; | 3040 void setValueName(NaClBcIndexSize_t Index, StringType &Name) final; |
| 3041 void setBbName(NaClBcIndexSize_t Index, StringType &Name) final; | 3041 void setBbName(NaClBcIndexSize_t Index, StringType &Name) final; |
| 3042 }; | 3042 }; |
| 3043 | 3043 |
| 3044 void ModuleValuesymtabParser::setValueName(NaClBcIndexSize_t Index, | 3044 void ModuleValuesymtabParser::setValueName(NaClBcIndexSize_t Index, |
| 3045 StringType &Name) { | 3045 StringType &Name) { |
| 3046 Context->getGlobalDeclarationByID(Index) | 3046 Ice::GlobalDeclaration *Decl = Context->getGlobalDeclarationByID(Index); |
| 3047 ->setName(StringRef(Name.data(), Name.size())); | 3047 if (llvm::isa<Ice::VariableDeclaration>(Decl) && |
| 3048 Decl->isPNaClABIExternalName(Name.str())) { |
| 3049 // Force linkage of (specific) Global Variables be external for the PNaCl |
| 3050 // ABI. PNaCl bitcode has a linkage field for Functions, but not for |
| 3051 // GlobalVariables (because the latter is not needed for pexes, so it has |
| 3052 // been removed). |
| 3053 Decl->setLinkage(llvm::GlobalValue::ExternalLinkage); |
| 3054 } |
| 3055 |
| 3056 Decl->setName(StringRef(Name.data(), Name.size())); |
| 3048 } | 3057 } |
| 3049 | 3058 |
| 3050 void ModuleValuesymtabParser::setBbName(NaClBcIndexSize_t Index, | 3059 void ModuleValuesymtabParser::setBbName(NaClBcIndexSize_t Index, |
| 3051 StringType &Name) { | 3060 StringType &Name) { |
| 3052 reportUnableToAssign("Basic block", Index, Name); | 3061 reportUnableToAssign("Basic block", Index, Name); |
| 3053 } | 3062 } |
| 3054 | 3063 |
| 3055 bool ModuleParser::ParseBlock(unsigned BlockID) { | 3064 bool ModuleParser::ParseBlock(unsigned BlockID) { |
| 3056 switch (BlockID) { | 3065 switch (BlockID) { |
| 3057 case naclbitc::BLOCKINFO_BLOCK_ID: | 3066 case naclbitc::BLOCKINFO_BLOCK_ID: |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 raw_string_ostream StrBuf(Buffer); | 3211 raw_string_ostream StrBuf(Buffer); |
| 3203 StrBuf << IRFilename << ": Does not contain a module!"; | 3212 StrBuf << IRFilename << ": Does not contain a module!"; |
| 3204 llvm::report_fatal_error(StrBuf.str()); | 3213 llvm::report_fatal_error(StrBuf.str()); |
| 3205 } | 3214 } |
| 3206 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3215 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
| 3207 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); | 3216 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); |
| 3208 } | 3217 } |
| 3209 } | 3218 } |
| 3210 | 3219 |
| 3211 } // end of namespace Ice | 3220 } // end of namespace Ice |
| OLD | NEW |