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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 619893002: Subzero: Auto-awesome iterators. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make some iterator element names more uniform Created 6 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
« src/IceRegAlloc.cpp ('K') | « src/IceTypeConverter.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 // 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 FcnId(Context->getNextFunctionBlockValueID()), 838 FcnId(Context->getNextFunctionBlockValueID()),
839 LLVMFunc(cast<Function>(Context->getGlobalValueByID(FcnId))), 839 LLVMFunc(cast<Function>(Context->getGlobalValueByID(FcnId))),
840 CachedNumGlobalValueIDs(Context->getNumGlobalValueIDs()), 840 CachedNumGlobalValueIDs(Context->getNumGlobalValueIDs()),
841 NextLocalInstIndex(Context->getNumGlobalValueIDs()), 841 NextLocalInstIndex(Context->getNumGlobalValueIDs()),
842 InstIsTerminating(false) { 842 InstIsTerminating(false) {
843 Func->setFunctionName(LLVMFunc->getName()); 843 Func->setFunctionName(LLVMFunc->getName());
844 Func->setReturnType(Context->convertToIceType(LLVMFunc->getReturnType())); 844 Func->setReturnType(Context->convertToIceType(LLVMFunc->getReturnType()));
845 Func->setInternal(LLVMFunc->hasInternalLinkage()); 845 Func->setInternal(LLVMFunc->hasInternalLinkage());
846 CurrentNode = InstallNextBasicBlock(); 846 CurrentNode = InstallNextBasicBlock();
847 Func->setEntryNode(CurrentNode); 847 Func->setEntryNode(CurrentNode);
848 for (Function::const_arg_iterator ArgI = LLVMFunc->arg_begin(), 848 for (auto ArgI = LLVMFunc->arg_begin(), ArgE = LLVMFunc->arg_end();
849 ArgE = LLVMFunc->arg_end();
850 ArgI != ArgE; ++ArgI) { 849 ArgI != ArgE; ++ArgI) {
851 Func->addArg(getNextInstVar(Context->convertToIceType(ArgI->getType()))); 850 Func->addArg(getNextInstVar(Context->convertToIceType(ArgI->getType())));
852 } 851 }
853 } 852 }
854 853
855 ~FunctionParser() override {}; 854 ~FunctionParser() override {};
856 855
857 // Set the next constant ID to the given constant C. 856 // Set the next constant ID to the given constant C.
858 void setNextConstantID(Ice::Constant *C) { 857 void setNextConstantID(Ice::Constant *C) {
859 setOperand(NextLocalInstIndex++, C); 858 setOperand(NextLocalInstIndex++, C);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 raw_string_ostream StrBuf(Buffer); 1378 raw_string_ostream StrBuf(Buffer);
1380 StrBuf << "Binary opcode " << Opcode << "not understood for type " << Ty; 1379 StrBuf << "Binary opcode " << Opcode << "not understood for type " << Ty;
1381 Error(StrBuf.str()); 1380 Error(StrBuf.str());
1382 } 1381 }
1383 1382
1384 void FunctionParser::ExitBlock() { 1383 void FunctionParser::ExitBlock() {
1385 // Before translating, check for blocks without instructions, and 1384 // Before translating, check for blocks without instructions, and
1386 // insert unreachable. This shouldn't happen, but be safe. 1385 // insert unreachable. This shouldn't happen, but be safe.
1387 unsigned Index = 0; 1386 unsigned Index = 0;
1388 const Ice::NodeList &Nodes = Func->getNodes(); 1387 const Ice::NodeList &Nodes = Func->getNodes();
1389 for (std::vector<Ice::CfgNode *>::const_iterator Iter = Nodes.begin(), 1388 for (auto Iter = Nodes.begin(), IterEnd = Nodes.end(); Iter != IterEnd;
1390 IterEnd = Nodes.end(); 1389 ++Iter, ++Index) {
1391 Iter != IterEnd; ++Iter, ++Index) {
1392 Ice::CfgNode *Node = *Iter; 1390 Ice::CfgNode *Node = *Iter;
1393 if (Node->getInsts().size() == 0) { 1391 if (Node->getInsts().size() == 0) {
1394 std::string Buffer; 1392 std::string Buffer;
1395 raw_string_ostream StrBuf(Buffer); 1393 raw_string_ostream StrBuf(Buffer);
1396 StrBuf << "Basic block " << Index << " contains no instructions"; 1394 StrBuf << "Basic block " << Index << " contains no instructions";
1397 Error(StrBuf.str()); 1395 Error(StrBuf.str());
1398 // TODO(kschimpf) Remove error recovery once implementation complete. 1396 // TODO(kschimpf) Remove error recovery once implementation complete.
1399 Node->appendInst(Ice::InstUnreachable::create(Func)); 1397 Node->appendInst(Ice::InstUnreachable::create(Func));
1400 } 1398 }
1401 } 1399 }
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 2419
2422 if (TopLevelBlocks != 1) { 2420 if (TopLevelBlocks != 1) {
2423 errs() << IRFilename 2421 errs() << IRFilename
2424 << ": Contains more than one module. Found: " << TopLevelBlocks 2422 << ": Contains more than one module. Found: " << TopLevelBlocks
2425 << "\n"; 2423 << "\n";
2426 ErrorStatus = true; 2424 ErrorStatus = true;
2427 } 2425 }
2428 } 2426 }
2429 2427
2430 } // end of namespace Ice 2428 } // end of namespace Ice
OLDNEW
« src/IceRegAlloc.cpp ('K') | « src/IceTypeConverter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698