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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1357273004: Check that element type correct in vector insert element. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/insertelt-wrong-type.tbc » ('j') | 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 /// \file 10 /// \file
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 << "Element type " << Ice::typeString(Elt->getType())
Jim Stichnoth 2015/09/21 21:39:54 May want to use the string "insertelement" in the
Karl 2015/09/21 22:32:46 Done.
2299 << " doesn't match vector type: " << Ice::typeString(VecType);
2300 Error(StrBuf.str());
2301 appendErrorInstruction(Elt->getType());
2302 return;
2303 }
2291 CurrentNode->appendInst(Ice::InstInsertElement::create( 2304 CurrentNode->appendInst(Ice::InstInsertElement::create(
2292 Func.get(), getNextInstVar(VecType), Vec, Elt, Index)); 2305 Func.get(), getNextInstVar(VecType), Vec, Elt, Index));
2293 return; 2306 return;
2294 } 2307 }
2295 case naclbitc::FUNC_CODE_INST_CMP2: { 2308 case naclbitc::FUNC_CODE_INST_CMP2: {
2296 // CMP2: [opval, opval, pred] 2309 // CMP2: [opval, opval, pred]
2297 if (!isValidRecordSize(3, "compare")) 2310 if (!isValidRecordSize(3, "compare"))
2298 return; 2311 return;
2299 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex); 2312 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex);
2300 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex); 2313 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex);
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 } 3282 }
3270 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3283 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3271 ErrStream 3284 ErrStream
3272 << IRFilename 3285 << IRFilename
3273 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; 3286 << ": 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"); 3287 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3275 } 3288 }
3276 } 3289 }
3277 3290
3278 } // end of namespace Ice 3291 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/insertelt-wrong-type.tbc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698