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 /// \file | 10 /// \file |
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 if (Ty == Ice::IceType_void) | 2030 if (Ty == Ice::IceType_void) |
2031 return; | 2031 return; |
2032 Ice::Variable *Var = getNextInstVar(Ty); | 2032 Ice::Variable *Var = getNextInstVar(Ty); |
2033 CurrentNode->appendInst(Ice::InstAssign::create(Func.get(), Var, Var)); | 2033 CurrentNode->appendInst(Ice::InstAssign::create(Func.get(), Var, Var)); |
2034 } | 2034 } |
2035 | 2035 |
2036 Ice::Operand *reportGetOperandUndefined(NaClBcIndexSize_t Index) { | 2036 Ice::Operand *reportGetOperandUndefined(NaClBcIndexSize_t Index) { |
2037 std::string Buffer; | 2037 std::string Buffer; |
2038 raw_string_ostream StrBuf(Buffer); | 2038 raw_string_ostream StrBuf(Buffer); |
2039 StrBuf << "Value index " << Index << " not defined!"; | 2039 StrBuf << "Value index " << Index << " not defined!"; |
2040 Fatal(StrBuf.str()); | 2040 Error(StrBuf.str()); |
| 2041 // Recover and return some value. |
| 2042 if (!LocalOperands.empty()) |
| 2043 return LocalOperands.front(); |
| 2044 return Context->getGlobalConstantByID(0); |
2041 } | 2045 } |
2042 }; | 2046 }; |
2043 | 2047 |
2044 void FunctionParser::ExitBlock() { | 2048 void FunctionParser::ExitBlock() { |
2045 // Check if the last instruction in the function was terminating. | 2049 // Check if the last instruction in the function was terminating. |
2046 if (!InstIsTerminating) { | 2050 if (!InstIsTerminating) { |
2047 Error("Last instruction in function not terminator"); | 2051 Error("Last instruction in function not terminator"); |
2048 if (isIRGenerationDisabled()) | 2052 if (isIRGenerationDisabled()) |
2049 return; | 2053 return; |
2050 // Recover by inserting an unreachable instruction. | 2054 // Recover by inserting an unreachable instruction. |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 std::string Buffer; | 2285 std::string Buffer; |
2282 raw_string_ostream StrBuf(Buffer); | 2286 raw_string_ostream StrBuf(Buffer); |
2283 dumpVectorIndexCheckValue(StrBuf, IndexCheckValue); | 2287 dumpVectorIndexCheckValue(StrBuf, IndexCheckValue); |
2284 StrBuf << ": insertelement " << VecType << " " << *Vec << ", " | 2288 StrBuf << ": insertelement " << VecType << " " << *Vec << ", " |
2285 << Elt->getType() << " " << *Elt << ", " << Index->getType() << " " | 2289 << Elt->getType() << " " << *Elt << ", " << Index->getType() << " " |
2286 << *Index; | 2290 << *Index; |
2287 Error(StrBuf.str()); | 2291 Error(StrBuf.str()); |
2288 appendErrorInstruction(Elt->getType()); | 2292 appendErrorInstruction(Elt->getType()); |
2289 return; | 2293 return; |
2290 } | 2294 } |
| 2295 if (Ice::typeElementType(VecType) != Elt->getType()) { |
| 2296 std::string Buffer; |
| 2297 raw_string_ostream StrBuf(Buffer); |
| 2298 StrBuf << "Insertelement: Element type " |
| 2299 << Ice::typeString(Elt->getType()) << " doesn't match vector type " |
| 2300 << Ice::typeString(VecType); |
| 2301 Error(StrBuf.str()); |
| 2302 appendErrorInstruction(Elt->getType()); |
| 2303 return; |
| 2304 } |
2291 CurrentNode->appendInst(Ice::InstInsertElement::create( | 2305 CurrentNode->appendInst(Ice::InstInsertElement::create( |
2292 Func.get(), getNextInstVar(VecType), Vec, Elt, Index)); | 2306 Func.get(), getNextInstVar(VecType), Vec, Elt, Index)); |
2293 return; | 2307 return; |
2294 } | 2308 } |
2295 case naclbitc::FUNC_CODE_INST_CMP2: { | 2309 case naclbitc::FUNC_CODE_INST_CMP2: { |
2296 // CMP2: [opval, opval, pred] | 2310 // CMP2: [opval, opval, pred] |
2297 if (!isValidRecordSize(3, "compare")) | 2311 if (!isValidRecordSize(3, "compare")) |
2298 return; | 2312 return; |
2299 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex); | 2313 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex); |
2300 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex); | 2314 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex); |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 } | 3283 } |
3270 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3284 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
3271 ErrStream | 3285 ErrStream |
3272 << IRFilename | 3286 << IRFilename |
3273 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; | 3287 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; |
3274 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); | 3288 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); |
3275 } | 3289 } |
3276 } | 3290 } |
3277 | 3291 |
3278 } // end of namespace Ice | 3292 } // end of namespace Ice |
OLD | NEW |