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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 737513008: Subzero: Simplify the constant pools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Better fix for the int8/uint8 tests Created 6 years, 1 month 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 | « src/IceTargetLoweringX8632.cpp ('k') | src/assembler_ia32.cpp » ('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 // 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } else { 318 } else {
319 std::string Buffer; 319 std::string Buffer;
320 raw_string_ostream StrBuf(Buffer); 320 raw_string_ostream StrBuf(Buffer);
321 StrBuf << "Reference to global not defined: " << ID; 321 StrBuf << "Reference to global not defined: " << ID;
322 Error(StrBuf.str()); 322 Error(StrBuf.str());
323 // TODO(kschimpf) Remove error recovery once implementation complete. 323 // TODO(kschimpf) Remove error recovery once implementation complete.
324 Name = "??"; 324 Name = "??";
325 SuppressMangling = false; 325 SuppressMangling = false;
326 } 326 }
327 const Ice::RelocOffsetT Offset = 0; 327 const Ice::RelocOffsetT Offset = 0;
328 C = getTranslator().getContext()->getConstantSym( 328 C = getTranslator().getContext()->getConstantSym(Offset, Name,
329 getIcePointerType(), Offset, Name, SuppressMangling); 329 SuppressMangling);
330 ValueIDConstants[ID] = C; 330 ValueIDConstants[ID] = C;
331 return C; 331 return C;
332 } 332 }
333 333
334 /// Returns the number of function declarations in the bitcode file. 334 /// Returns the number of function declarations in the bitcode file.
335 unsigned getNumFunctionIDs() const { return NumFunctionIds; } 335 unsigned getNumFunctionIDs() const { return NumFunctionIds; }
336 336
337 /// Returns the number of global declarations (i.e. IDs) defined in 337 /// Returns the number of global declarations (i.e. IDs) defined in
338 /// the bitcode file. 338 /// the bitcode file.
339 unsigned getNumGlobalIDs() const { 339 unsigned getNumGlobalIDs() const {
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 // Returns whether the given vector index (for insertelement and 1433 // Returns whether the given vector index (for insertelement and
1434 // extractelement instructions) is valid. 1434 // extractelement instructions) is valid.
1435 VectorIndexCheckValue validateVectorIndex(const Ice::Operand *Vec, 1435 VectorIndexCheckValue validateVectorIndex(const Ice::Operand *Vec,
1436 const Ice::Operand *Index) const { 1436 const Ice::Operand *Index) const {
1437 Ice::Type VecType = Vec->getType(); 1437 Ice::Type VecType = Vec->getType();
1438 if (!Ice::isVectorType(VecType)) 1438 if (!Ice::isVectorType(VecType))
1439 return VectorIndexNotVector; 1439 return VectorIndexNotVector;
1440 const auto *C = dyn_cast<Ice::ConstantInteger32>(Index); 1440 const auto *C = dyn_cast<Ice::ConstantInteger32>(Index);
1441 if (C == nullptr) 1441 if (C == nullptr)
1442 return VectorIndexNotConstant; 1442 return VectorIndexNotConstant;
1443 if (C->getValue() >= typeNumElements(VecType)) 1443 if (static_cast<size_t>(C->getValue()) >= typeNumElements(VecType))
1444 return VectorIndexNotInRange; 1444 return VectorIndexNotInRange;
1445 if (Index->getType() != Ice::IceType_i32) 1445 if (Index->getType() != Ice::IceType_i32)
1446 return VectorIndexNotI32; 1446 return VectorIndexNotI32;
1447 return VectorIndexValid; 1447 return VectorIndexValid;
1448 } 1448 }
1449 1449
1450 // Reports that the given binary Opcode, for the given type Ty, 1450 // Reports that the given binary Opcode, for the given type Ty,
1451 // is not understood. 1451 // is not understood.
1452 void ReportInvalidBinopOpcode(unsigned Opcode, Ice::Type Ty); 1452 void ReportInvalidBinopOpcode(unsigned Opcode, Ice::Type Ty);
1453 1453
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 case naclbitc::CST_CODE_INTEGER: { 2489 case naclbitc::CST_CODE_INTEGER: {
2490 // INTEGER: [intval] 2490 // INTEGER: [intval]
2491 if (!isValidRecordSize(1, "constants block integer")) 2491 if (!isValidRecordSize(1, "constants block integer"))
2492 return; 2492 return;
2493 if (!isValidNextConstantType()) 2493 if (!isValidNextConstantType())
2494 return; 2494 return;
2495 if (isIRGenerationDisabled()) { 2495 if (isIRGenerationDisabled()) {
2496 FuncParser->setNextConstantID(nullptr); 2496 FuncParser->setNextConstantID(nullptr);
2497 return; 2497 return;
2498 } 2498 }
2499 if (IntegerType *IType = dyn_cast<IntegerType>( 2499 if (auto IType = dyn_cast<IntegerType>(
2500 Context->convertToLLVMType(NextConstantType))) { 2500 Context->convertToLLVMType(NextConstantType))) {
2501 APInt Value(IType->getBitWidth(), NaClDecodeSignRotatedValue(Values[0])); 2501 APInt Value(IType->getBitWidth(), NaClDecodeSignRotatedValue(Values[0]));
2502 Ice::Constant *C = (NextConstantType == Ice::IceType_i64) 2502 if (Ice::Constant *C = getContext()->getConstantInt(
2503 ? getContext()->getConstantInt64( 2503 NextConstantType, Value.getSExtValue())) {
2504 NextConstantType, Value.getSExtValue()) 2504 FuncParser->setNextConstantID(C);
2505 : getContext()->getConstantInt32( 2505 return;
2506 NextConstantType, Value.getSExtValue()); 2506 }
2507 FuncParser->setNextConstantID(C);
2508 return;
2509 } 2507 }
2510 std::string Buffer; 2508 std::string Buffer;
2511 raw_string_ostream StrBuf(Buffer); 2509 raw_string_ostream StrBuf(Buffer);
2512 StrBuf << "constant block integer record for non-integer type " 2510 StrBuf << "constant block integer record for non-integer type "
2513 << NextConstantType; 2511 << NextConstantType;
2514 Error(StrBuf.str()); 2512 Error(StrBuf.str());
2515 return; 2513 return;
2516 } 2514 }
2517 case naclbitc::CST_CODE_FLOAT: { 2515 case naclbitc::CST_CODE_FLOAT: {
2518 // FLOAT: [fpval] 2516 // FLOAT: [fpval]
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2872 2870
2873 if (TopLevelBlocks != 1) { 2871 if (TopLevelBlocks != 1) {
2874 errs() << IRFilename 2872 errs() << IRFilename
2875 << ": Contains more than one module. Found: " << TopLevelBlocks 2873 << ": Contains more than one module. Found: " << TopLevelBlocks
2876 << "\n"; 2874 << "\n";
2877 ErrorStatus = true; 2875 ErrorStatus = true;
2878 } 2876 }
2879 } 2877 }
2880 2878
2881 } // end of namespace Ice 2879 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/assembler_ia32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698