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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1738443002: Subzero. Performance tweaks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments -- all of them Created 4 years, 10 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 | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if (TimeThisFunction) { 1348 if (TimeThisFunction) {
1349 TimerID = getTranslator().getContext()->getTimerID(StackID, 1349 TimerID = getTranslator().getContext()->getTimerID(StackID,
1350 FuncDecl->getName()); 1350 FuncDecl->getName());
1351 getTranslator().getContext()->pushTimer(TimerID, StackID); 1351 getTranslator().getContext()->pushTimer(TimerID, StackID);
1352 } 1352 }
1353 1353
1354 // Note: The Cfg is created, even when IR generation is disabled. This is 1354 // Note: The Cfg is created, even when IR generation is disabled. This is
1355 // done to install a CfgLocalAllocator for various internal containers. 1355 // done to install a CfgLocalAllocator for various internal containers.
1356 Func = Ice::Cfg::create(getTranslator().getContext(), 1356 Func = Ice::Cfg::create(getTranslator().getContext(),
1357 getTranslator().getNextSequenceNumber()); 1357 getTranslator().getNextSequenceNumber());
1358 Ice::Cfg::setCurrentCfg(Func.get()); 1358 bool ParserResult;
1359 {
1360 Ice::CfgLocalAllocatorScope _(Func.get());
1359 1361
1360 // TODO(kschimpf) Clean up API to add a function signature to a CFG. 1362 // TODO(kschimpf) Clean up API to add a function signature to a CFG.
1361 const Ice::FuncSigType &Signature = FuncDecl->getSignature(); 1363 const Ice::FuncSigType &Signature = FuncDecl->getSignature();
1362 1364
1363 Func->setFunctionName(FuncDecl->getName()); 1365 Func->setFunctionName(FuncDecl->getName());
1364 Func->setReturnType(Signature.getReturnType()); 1366 Func->setReturnType(Signature.getReturnType());
1365 Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage); 1367 Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage);
1366 CurrentNode = installNextBasicBlock(); 1368 CurrentNode = installNextBasicBlock();
1367 Func->setEntryNode(CurrentNode); 1369 Func->setEntryNode(CurrentNode);
1368 for (Ice::Type ArgType : Signature.getArgList()) { 1370 for (Ice::Type ArgType : Signature.getArgList()) {
1369 Func->addArg(getNextInstVar(ArgType)); 1371 Func->addArg(getNextInstVar(ArgType));
1372 }
1373
1374 ParserResult = ParseThisBlock();
1375
1376 // Temporarily end per-function timing, which will be resumed by the
1377 // translator function. This is because translation may be done
1378 // asynchronously in a separate thread.
1379 if (TimeThisFunction)
1380 getTranslator().getContext()->popTimer(TimerID, StackID);
1381
1382 // Note: Once any errors have been found, we turn off all translation of
1383 // all remaining functions. This allows successive parsing errors to be
1384 // reported, without adding extra checks to the translator for such
1385 // parsing errors.
1370 } 1386 }
1371
1372 bool ParserResult = ParseThisBlock();
1373
1374 // Temporarily end per-function timing, which will be resumed by the
1375 // translator function. This is because translation may be done
1376 // asynchronously in a separate thread.
1377 if (TimeThisFunction)
1378 getTranslator().getContext()->popTimer(TimerID, StackID);
1379
1380 Ice::Cfg::setCurrentCfg(nullptr);
1381 // Note: Once any errors have been found, we turn off all translation of
1382 // all remaining functions. This allows successive parsing errors to be
1383 // reported, without adding extra checks to the translator for such parsing
1384 // errors.
1385 if (Context->getNumErrors() == 0 && Func) { 1387 if (Context->getNumErrors() == 0 && Func) {
1386 getTranslator().translateFcn(std::move(Func)); 1388 getTranslator().translateFcn(std::move(Func));
1387 // The translator now has ownership of Func. 1389 // The translator now has ownership of Func.
1388 } else { 1390 } else {
1389 Func.reset(); 1391 Func.reset();
1390 } 1392 }
1391 1393
1392 return ParserResult; 1394 return ParserResult;
1393 } 1395 }
1394 1396
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 raw_string_ostream StrBuf(Buffer); 3205 raw_string_ostream StrBuf(Buffer);
3204 StrBuf << IRFilename << ": Does not contain a module!"; 3206 StrBuf << IRFilename << ": Does not contain a module!";
3205 llvm::report_fatal_error(StrBuf.str()); 3207 llvm::report_fatal_error(StrBuf.str());
3206 } 3208 }
3207 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3209 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3208 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3210 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3209 } 3211 }
3210 } 3212 }
3211 3213
3212 } // end of namespace Ice 3214 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698