| 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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 raw_string_ostream StrBuf(Buffer); | 1630 raw_string_ostream StrBuf(Buffer); |
| 1631 StrBuf << "Binary opcode " << Opcode << "not understood for type " << Ty; | 1631 StrBuf << "Binary opcode " << Opcode << "not understood for type " << Ty; |
| 1632 Error(StrBuf.str()); | 1632 Error(StrBuf.str()); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 void FunctionParser::ExitBlock() { | 1635 void FunctionParser::ExitBlock() { |
| 1636 // Before translating, check for blocks without instructions, and | 1636 // Before translating, check for blocks without instructions, and |
| 1637 // insert unreachable. This shouldn't happen, but be safe. | 1637 // insert unreachable. This shouldn't happen, but be safe. |
| 1638 unsigned Index = 0; | 1638 unsigned Index = 0; |
| 1639 for (Ice::CfgNode *Node : Func->getNodes()) { | 1639 for (Ice::CfgNode *Node : Func->getNodes()) { |
| 1640 if (Node->getInsts().size() == 0) { | 1640 if (Node->getInsts().empty()) { |
| 1641 std::string Buffer; | 1641 std::string Buffer; |
| 1642 raw_string_ostream StrBuf(Buffer); | 1642 raw_string_ostream StrBuf(Buffer); |
| 1643 StrBuf << "Basic block " << Index << " contains no instructions"; | 1643 StrBuf << "Basic block " << Index << " contains no instructions"; |
| 1644 Error(StrBuf.str()); | 1644 Error(StrBuf.str()); |
| 1645 // TODO(kschimpf) Remove error recovery once implementation complete. | 1645 // TODO(kschimpf) Remove error recovery once implementation complete. |
| 1646 Node->appendInst(Ice::InstUnreachable::create(Func)); | 1646 Node->appendInst(Ice::InstUnreachable::create(Func)); |
| 1647 } | 1647 } |
| 1648 ++Index; | 1648 ++Index; |
| 1649 } | 1649 } |
| 1650 Func->computePredecessors(); | 1650 Func->computePredecessors(); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 Error(StrBuf.str()); | 1901 Error(StrBuf.str()); |
| 1902 appendErrorInstruction(DestType); | 1902 appendErrorInstruction(DestType); |
| 1903 return; | 1903 return; |
| 1904 } | 1904 } |
| 1905 return; | 1905 return; |
| 1906 } | 1906 } |
| 1907 case naclbitc::FUNC_CODE_INST_RET: { | 1907 case naclbitc::FUNC_CODE_INST_RET: { |
| 1908 // RET: [opval?] | 1908 // RET: [opval?] |
| 1909 if (!isValidRecordSizeInRange(0, 1, "function block ret")) | 1909 if (!isValidRecordSizeInRange(0, 1, "function block ret")) |
| 1910 return; | 1910 return; |
| 1911 if (Values.size() == 0) { | 1911 if (Values.empty()) { |
| 1912 CurrentNode->appendInst(Ice::InstRet::create(Func)); | 1912 CurrentNode->appendInst(Ice::InstRet::create(Func)); |
| 1913 } else { | 1913 } else { |
| 1914 CurrentNode->appendInst( | 1914 CurrentNode->appendInst( |
| 1915 Ice::InstRet::create(Func, getRelativeOperand(Values[0], BaseIndex))); | 1915 Ice::InstRet::create(Func, getRelativeOperand(Values[0], BaseIndex))); |
| 1916 } | 1916 } |
| 1917 InstIsTerminating = true; | 1917 InstIsTerminating = true; |
| 1918 return; | 1918 return; |
| 1919 } | 1919 } |
| 1920 case naclbitc::FUNC_CODE_INST_BR: { | 1920 case naclbitc::FUNC_CODE_INST_BR: { |
| 1921 if (Values.size() == 1) { | 1921 if (Values.size() == 1) { |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 | 2682 |
| 2683 if (TopLevelBlocks != 1) { | 2683 if (TopLevelBlocks != 1) { |
| 2684 errs() << IRFilename | 2684 errs() << IRFilename |
| 2685 << ": Contains more than one module. Found: " << TopLevelBlocks | 2685 << ": Contains more than one module. Found: " << TopLevelBlocks |
| 2686 << "\n"; | 2686 << "\n"; |
| 2687 ErrorStatus = true; | 2687 ErrorStatus = true; |
| 2688 } | 2688 } |
| 2689 } | 2689 } |
| 2690 | 2690 |
| 2691 } // end of namespace Ice | 2691 } // end of namespace Ice |
| OLD | NEW |