Chromium Code Reviews| Index: src/PNaClTranslator.cpp |
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
| index fcebeac05538052584630d7a32fc0c0ae8f9eb09..0078b53348983910cd5d185a5afa8c976a410bdb 100644 |
| --- a/src/PNaClTranslator.cpp |
| +++ b/src/PNaClTranslator.cpp |
| @@ -1010,7 +1010,7 @@ private: |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| StrBuf << InstructionName << " address not " << PtrType |
| - << ". Found: " << Op; |
| + << ". Found: " << *Op; |
| Error(StrBuf.str()); |
| return false; |
| } |
| @@ -1423,15 +1423,16 @@ void FunctionParser::ProcessRecord() { |
| typeNumElements(ThenType) != typeNumElements(CondType)) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Select condition " << CondType |
| - << " not allowed for values of type " << ThenType; |
| + StrBuf << "Select condition type " << CondType |
| + << "not allowed for values of type " << ThenType; |
|
Jim Stichnoth
2014/09/16 20:16:31
Did you mean to delete the space before 'not'?
Karl
2014/09/16 20:35:54
Yes. Added.
|
| Error(StrBuf.str()); |
| return; |
| } |
| } else if (CondVal->getType() != Ice::IceType_i1) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Select condition not type i1. Found: " << CondVal->getType(); |
| + StrBuf << "Select condition " << CondVal << " not type i1. Found: " |
| + << CondVal->getType(); |
| Error(StrBuf.str()); |
| return; |
| } |
| @@ -1448,14 +1449,15 @@ void FunctionParser::ProcessRecord() { |
| if (!Ice::isVectorType(VecType)) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Extractelement not on vector. Found: " << Vec; |
| + StrBuf << "Extractelement not on vector. Found: " << *Vec; |
| Error(StrBuf.str()); |
| } |
| Ice::Operand *Index = getRelativeOperand(Values[1], BaseIndex); |
| if (Index->getType() != Ice::IceType_i32) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Extractelement index not i32. Found: " << Index; |
| + StrBuf << "Extractelement index " << *Index << " not i32. Found: " |
| + << Index->getType(); |
| Error(StrBuf.str()); |
| } |
| // TODO(kschimpf): Restrict index to a legal constant index (once |
| @@ -1473,7 +1475,7 @@ void FunctionParser::ProcessRecord() { |
| if (!Ice::isVectorType(VecType)) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Insertelement not on vector. Found: " << Vec; |
| + StrBuf << "Insertelement not on vector. Found: " << *Vec; |
| Error(StrBuf.str()); |
| } |
| Ice::Operand *Elt = getRelativeOperand(Values[1], BaseIndex); |
| @@ -1481,15 +1483,17 @@ void FunctionParser::ProcessRecord() { |
| if (EltType != typeElementType(VecType)) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Insertelement element not " << typeElementType(VecType) |
| - << ". Found: " << Elt; |
| + StrBuf << "Insertelement element " << *Elt << " not type " |
| + << typeElementType(VecType) |
| + << ". Found: " << EltType; |
| Error(StrBuf.str()); |
| } |
| Ice::Operand *Index = getRelativeOperand(Values[2], BaseIndex); |
| if (Index->getType() != Ice::IceType_i32) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Insertelement index not i32. Found: " << Index; |
| + StrBuf << "Insertelement index " << *Index << " not i32. Found: " |
| + << Index->getType(); |
| Error(StrBuf.str()); |
| } |
| // TODO(kschimpf): Restrict index to a legal constant index (once |
| @@ -1588,7 +1592,7 @@ void FunctionParser::ProcessRecord() { |
| if (Cond->getType() != Ice::IceType_i1) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Branch condition not i1"; |
| + StrBuf << "Branch condition " << *Cond << " not i1"; |
|
Jim Stichnoth
2014/09/16 20:16:31
Print the actual operand type as well as the opera
Karl
2014/09/16 20:35:54
Done.
|
| Error(StrBuf.str()); |
| return; |
| } |
| @@ -1627,7 +1631,8 @@ void FunctionParser::ProcessRecord() { |
| if (Op->getType() != Ty) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Phi instruction expects type " << Ty << " but found: " << Op; |
| + StrBuf << "Value " << *Op << " not type " << Ty |
| + << " in phi instruction"; |
|
Jim Stichnoth
2014/09/16 20:16:31
Print actual operand type?
Karl
2014/09/16 20:35:54
Done.
|
| Error(StrBuf.str()); |
| return; |
| } |
| @@ -1644,7 +1649,7 @@ void FunctionParser::ProcessRecord() { |
| if (ByteCount->getType() != Ice::IceType_i32) { |
| std::string Buffer; |
| raw_string_ostream StrBuf(Buffer); |
| - StrBuf << "Alloca on non-i32 value. Found: " << ByteCount; |
| + StrBuf << "Alloca on non-i32 value. Found: " << *ByteCount; |
| Error(StrBuf.str()); |
| return; |
| } |
| @@ -1671,6 +1676,15 @@ void FunctionParser::ProcessRecord() { |
| Ice::InstLoad::create(Func, getNextInstVar(Ty), Address, Alignment)); |
| break; |
| } |
| + case naclbitc::FUNC_CODE_INST_UNREACHABLE: { |
|
Jim Stichnoth
2014/09/16 20:16:31
Would you mind explicitly enumerating all the curr
Karl
2014/09/16 20:35:54
Done.
|
| + // UNREACHABLE: [] |
| + if (!isValidRecordSize(0, "function block unreachable")) |
| + return; |
| + CurrentNode->appendInst( |
| + Ice::InstUnreachable::create(Func)); |
| + InstIsTerminating = true; |
| + break; |
| + } |
| case naclbitc::FUNC_CODE_INST_STORE: { |
| // STORE: [address, value, align] |
| if (!isValidRecordSize(3, "function block store")) |