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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1387963002: Make sure that all globals are internal, except for "start" functions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Merge in new tests from master Created 5 years, 2 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
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 return getTranslator().getContext()->getConstantExternSym(Name); 468 return getTranslator().getContext()->getConstantExternSym(Name);
469 } else { 469 } else {
470 const Ice::RelocOffsetT Offset = 0; 470 const Ice::RelocOffsetT Offset = 0;
471 return getTranslator().getContext()->getConstantSym(Offset, Name, 471 return getTranslator().getContext()->getConstantSym(Offset, Name,
472 SuppressMangling); 472 SuppressMangling);
473 } 473 }
474 } 474 }
475 475
476 // Converts function declarations into constant value IDs. 476 // Converts function declarations into constant value IDs.
477 void createValueIDsForFunctions() { 477 void createValueIDsForFunctions() {
478 Ice::GlobalContext *Ctx = getTranslator().getContext();
478 for (const Ice::FunctionDeclaration *Func : FunctionDeclarations) { 479 for (const Ice::FunctionDeclaration *Func : FunctionDeclarations) {
480 if (!Func->verifyLinkageCorrect(Ctx)) {
481 std::string Buffer;
482 raw_string_ostream StrBuf(Buffer);
483 StrBuf << "Bad linkage for function " << Func->getName();
484 Error(StrBuf.str());
485 continue;
486 }
479 Ice::Constant *C = nullptr; 487 Ice::Constant *C = nullptr;
480 if (!isIRGenerationDisabled()) { 488 if (!isIRGenerationDisabled()) {
481 C = getConstantSym(Func->getName(), Func->getSuppressMangling(), 489 C = getConstantSym(Func->getName(), Func->getSuppressMangling(),
482 Func->isProto()); 490 Func->isProto());
483 } 491 }
484 ValueIDConstants.push_back(C); 492 ValueIDConstants.push_back(C);
485 } 493 }
486 } 494 }
487 495
488 // Converts global variable declarations into constant value IDs. 496 // Converts global variable declarations into constant value IDs.
489 void createValueIDsForGlobalVars() { 497 void createValueIDsForGlobalVars() {
498 Ice::GlobalContext *Ctx = getTranslator().getContext();
490 for (const Ice::VariableDeclaration *Decl : *VariableDeclarations) { 499 for (const Ice::VariableDeclaration *Decl : *VariableDeclarations) {
500 if (!Decl->verifyLinkageCorrect(Ctx)) {
501 std::string Buffer;
502 raw_string_ostream StrBuf(Buffer);
503 StrBuf << "Bad linkage for global " << Decl->getName();
504 Error(StrBuf.str());
505 }
491 Ice::Constant *C = nullptr; 506 Ice::Constant *C = nullptr;
492 if (!isIRGenerationDisabled()) { 507 if (!isIRGenerationDisabled()) {
493 C = getConstantSym(Decl->getName(), Decl->getSuppressMangling(), 508 C = getConstantSym(Decl->getName(), Decl->getSuppressMangling(),
494 !Decl->hasInitializer()); 509 !Decl->hasInitializer());
495 } 510 }
496 ValueIDConstants.push_back(C); 511 ValueIDConstants.push_back(C);
497 } 512 }
498 } 513 }
499 514
500 // Reports that type ID is undefined, or not of the WantedType. 515 // Reports that type ID is undefined, or not of the WantedType.
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 raw_string_ostream StrBuf(Buffer); 3295 raw_string_ostream StrBuf(Buffer);
3281 StrBuf << IRFilename << ": Does not contain a module!"; 3296 StrBuf << IRFilename << ": Does not contain a module!";
3282 llvm::report_fatal_error(StrBuf.str()); 3297 llvm::report_fatal_error(StrBuf.str());
3283 } 3298 }
3284 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3299 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3285 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3300 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3286 } 3301 }
3287 } 3302 }
3288 3303
3289 } // end of namespace Ice 3304 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698