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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 switch (Kind) { | 93 switch (Kind) { |
94 case ExtendedType::Undefined: | 94 case ExtendedType::Undefined: |
95 Stream << "Undefined"; | 95 Stream << "Undefined"; |
96 break; | 96 break; |
97 case ExtendedType::Simple: | 97 case ExtendedType::Simple: |
98 Stream << "Simple"; | 98 Stream << "Simple"; |
99 break; | 99 break; |
100 case ExtendedType::FuncSig: | 100 case ExtendedType::FuncSig: |
101 Stream << "FuncSig"; | 101 Stream << "FuncSig"; |
102 break; | 102 break; |
103 default: | |
104 Stream << "??"; | |
105 break; | |
106 } | 103 } |
107 return Stream; | 104 return Stream; |
108 } | 105 } |
109 | 106 |
110 // Models an ICE type as an extended type. | 107 // Models an ICE type as an extended type. |
111 class SimpleExtendedType : public ExtendedType { | 108 class SimpleExtendedType : public ExtendedType { |
112 SimpleExtendedType(const SimpleExtendedType &) = delete; | 109 SimpleExtendedType(const SimpleExtendedType &) = delete; |
113 SimpleExtendedType &operator=(const SimpleExtendedType &) = delete; | 110 SimpleExtendedType &operator=(const SimpleExtendedType &) = delete; |
114 public: | 111 public: |
115 Ice::Type getType() const { return Signature.getReturnType(); } | 112 Ice::Type getType() const { return Signature.getReturnType(); } |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 VectorIndexNotInRange, | 1424 VectorIndexNotInRange, |
1428 VectorIndexNotI32, | 1425 VectorIndexNotI32, |
1429 VectorIndexValid | 1426 VectorIndexValid |
1430 }; | 1427 }; |
1431 | 1428 |
1432 void dumpVectorIndexCheckValue(raw_ostream &Stream, | 1429 void dumpVectorIndexCheckValue(raw_ostream &Stream, |
1433 VectorIndexCheckValue Value) const { | 1430 VectorIndexCheckValue Value) const { |
1434 if (!ALLOW_DUMP) | 1431 if (!ALLOW_DUMP) |
1435 return; | 1432 return; |
1436 switch (Value) { | 1433 switch (Value) { |
1437 default: | |
1438 report_fatal_error("Unknown VectorIndexCheckValue"); | |
1439 break; | |
1440 case VectorIndexNotVector: | 1434 case VectorIndexNotVector: |
1441 Stream << "Vector index on non vector"; | 1435 Stream << "Vector index on non vector"; |
1442 break; | 1436 break; |
1443 case VectorIndexNotConstant: | 1437 case VectorIndexNotConstant: |
1444 Stream << "Vector index not integer constant"; | 1438 Stream << "Vector index not integer constant"; |
1445 break; | 1439 break; |
1446 case VectorIndexNotInRange: | 1440 case VectorIndexNotInRange: |
1447 Stream << "Vector index not in range of vector"; | 1441 Stream << "Vector index not in range of vector"; |
1448 break; | 1442 break; |
1449 case VectorIndexNotI32: | 1443 case VectorIndexNotI32: |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 // Add parameters. | 2476 // Add parameters. |
2483 for (Ice::SizeT ParamIndex = 0; ParamIndex < NumParams; ++ParamIndex) { | 2477 for (Ice::SizeT ParamIndex = 0; ParamIndex < NumParams; ++ParamIndex) { |
2484 Inst->addArg( | 2478 Inst->addArg( |
2485 getRelativeOperand(Values[ParamsStartIndex + ParamIndex], BaseIndex)); | 2479 getRelativeOperand(Values[ParamsStartIndex + ParamIndex], BaseIndex)); |
2486 } | 2480 } |
2487 | 2481 |
2488 // If intrinsic call, validate call signature. | 2482 // If intrinsic call, validate call signature. |
2489 if (IntrinsicInfo) { | 2483 if (IntrinsicInfo) { |
2490 Ice::SizeT ArgIndex = 0; | 2484 Ice::SizeT ArgIndex = 0; |
2491 switch (IntrinsicInfo->validateCall(Inst, ArgIndex)) { | 2485 switch (IntrinsicInfo->validateCall(Inst, ArgIndex)) { |
2492 default: | |
2493 Error("Unknown validation error for intrinsic call"); | |
2494 // TODO(kschimpf) Remove error recovery once implementation complete. | |
2495 break; | |
2496 case Ice::Intrinsics::IsValidCall: | 2486 case Ice::Intrinsics::IsValidCall: |
2497 break; | 2487 break; |
2498 case Ice::Intrinsics::BadReturnType: { | 2488 case Ice::Intrinsics::BadReturnType: { |
2499 std::string Buffer; | 2489 std::string Buffer; |
2500 raw_string_ostream StrBuf(Buffer); | 2490 raw_string_ostream StrBuf(Buffer); |
2501 StrBuf << "Intrinsic call expects return type " | 2491 StrBuf << "Intrinsic call expects return type " |
2502 << IntrinsicInfo->getReturnType() | 2492 << IntrinsicInfo->getReturnType() |
2503 << ". Found: " << Inst->getReturnType(); | 2493 << ". Found: " << Inst->getReturnType(); |
2504 Error(StrBuf.str()); | 2494 Error(StrBuf.str()); |
2505 // TODO(kschimpf) Remove error recovery once implementation complete. | 2495 // TODO(kschimpf) Remove error recovery once implementation complete. |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2999 | 2989 |
3000 if (TopLevelBlocks != 1) { | 2990 if (TopLevelBlocks != 1) { |
3001 errs() << IRFilename | 2991 errs() << IRFilename |
3002 << ": Contains more than one module. Found: " << TopLevelBlocks | 2992 << ": Contains more than one module. Found: " << TopLevelBlocks |
3003 << "\n"; | 2993 << "\n"; |
3004 ErrorStatus = true; | 2994 ErrorStatus = true; |
3005 } | 2995 } |
3006 } | 2996 } |
3007 | 2997 |
3008 } // end of namespace Ice | 2998 } // end of namespace Ice |
OLD | NEW |