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 // 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 public: | 836 public: |
837 FunctionParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) | 837 FunctionParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) |
838 : BlockParserBaseClass(BlockID, EnclosingParser), | 838 : BlockParserBaseClass(BlockID, EnclosingParser), |
839 Func(new Ice::Cfg(getTranslator().getContext())), CurrentBbIndex(0), | 839 Func(new Ice::Cfg(getTranslator().getContext())), CurrentBbIndex(0), |
840 FcnId(Context->getNextFunctionBlockValueID()), | 840 FcnId(Context->getNextFunctionBlockValueID()), |
841 LLVMFunc(cast<Function>(Context->getGlobalValueByID(FcnId))), | 841 LLVMFunc(cast<Function>(Context->getGlobalValueByID(FcnId))), |
842 CachedNumGlobalValueIDs(Context->getNumGlobalValueIDs()), | 842 CachedNumGlobalValueIDs(Context->getNumGlobalValueIDs()), |
843 NextLocalInstIndex(Context->getNumGlobalValueIDs()), | 843 NextLocalInstIndex(Context->getNumGlobalValueIDs()), |
844 InstIsTerminating(false) { | 844 InstIsTerminating(false) { |
845 Func->setFunctionName(LLVMFunc->getName()); | 845 Func->setFunctionName(LLVMFunc->getName()); |
| 846 if (getFlags().TimeEachFunction) |
| 847 getTranslator().getContext()->pushTimer( |
| 848 getTranslator().getContext()->getTimerID( |
| 849 Ice::GlobalContext::TSK_Funcs, Func->getFunctionName()), |
| 850 Ice::GlobalContext::TSK_Funcs); |
846 Func->setReturnType(Context->convertToIceType(LLVMFunc->getReturnType())); | 851 Func->setReturnType(Context->convertToIceType(LLVMFunc->getReturnType())); |
847 Func->setInternal(LLVMFunc->hasInternalLinkage()); | 852 Func->setInternal(LLVMFunc->hasInternalLinkage()); |
848 CurrentNode = InstallNextBasicBlock(); | 853 CurrentNode = InstallNextBasicBlock(); |
849 Func->setEntryNode(CurrentNode); | 854 Func->setEntryNode(CurrentNode); |
850 for (auto ArgI = LLVMFunc->arg_begin(), ArgE = LLVMFunc->arg_end(); | 855 for (auto ArgI = LLVMFunc->arg_begin(), ArgE = LLVMFunc->arg_end(); |
851 ArgI != ArgE; ++ArgI) { | 856 ArgI != ArgE; ++ArgI) { |
852 Func->addArg(getNextInstVar(Context->convertToIceType(ArgI->getType()))); | 857 Func->addArg(getNextInstVar(Context->convertToIceType(ArgI->getType()))); |
853 } | 858 } |
854 } | 859 } |
855 | 860 |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 } | 1402 } |
1398 ++Index; | 1403 ++Index; |
1399 } | 1404 } |
1400 Func->computePredecessors(); | 1405 Func->computePredecessors(); |
1401 // Note: Once any errors have been found, we turn off all | 1406 // Note: Once any errors have been found, we turn off all |
1402 // translation of all remaining functions. This allows use to see | 1407 // translation of all remaining functions. This allows use to see |
1403 // multiple errors, without adding extra checks to the translator | 1408 // multiple errors, without adding extra checks to the translator |
1404 // for such parsing errors. | 1409 // for such parsing errors. |
1405 if (Context->getNumErrors() == 0) | 1410 if (Context->getNumErrors() == 0) |
1406 getTranslator().translateFcn(Func); | 1411 getTranslator().translateFcn(Func); |
| 1412 if (getFlags().TimeEachFunction) |
| 1413 getTranslator().getContext()->popTimer( |
| 1414 getTranslator().getContext()->getTimerID(Ice::GlobalContext::TSK_Funcs, |
| 1415 Func->getFunctionName()), |
| 1416 Ice::GlobalContext::TSK_Funcs); |
1407 } | 1417 } |
1408 | 1418 |
1409 void FunctionParser::ReportInvalidBinaryOp(Ice::InstArithmetic::OpKind Op, | 1419 void FunctionParser::ReportInvalidBinaryOp(Ice::InstArithmetic::OpKind Op, |
1410 Ice::Type OpTy) { | 1420 Ice::Type OpTy) { |
1411 std::string Buffer; | 1421 std::string Buffer; |
1412 raw_string_ostream StrBuf(Buffer); | 1422 raw_string_ostream StrBuf(Buffer); |
1413 StrBuf << "Invalid operator type for " << Ice::InstArithmetic::getOpName(Op) | 1423 StrBuf << "Invalid operator type for " << Ice::InstArithmetic::getOpName(Op) |
1414 << ". Found " << OpTy; | 1424 << ". Found " << OpTy; |
1415 Error(StrBuf.str()); | 1425 Error(StrBuf.str()); |
1416 } | 1426 } |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 | 2427 |
2418 if (TopLevelBlocks != 1) { | 2428 if (TopLevelBlocks != 1) { |
2419 errs() << IRFilename | 2429 errs() << IRFilename |
2420 << ": Contains more than one module. Found: " << TopLevelBlocks | 2430 << ": Contains more than one module. Found: " << TopLevelBlocks |
2421 << "\n"; | 2431 << "\n"; |
2422 ErrorStatus = true; | 2432 ErrorStatus = true; |
2423 } | 2433 } |
2424 } | 2434 } |
2425 | 2435 |
2426 } // end of namespace Ice | 2436 } // end of namespace Ice |
OLD | NEW |