| OLD | NEW |
| 1 //===--- Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp - Bitcode Writer -------===// | 1 //===--- Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp - Bitcode Writer -------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 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 // Bitcode writer implementation. | 10 // Bitcode writer implementation. |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 688 |
| 689 Code = naclbitc::FUNC_CODE_INST_SWITCH; | 689 Code = naclbitc::FUNC_CODE_INST_SWITCH; |
| 690 const SwitchInst &SI = cast<SwitchInst>(I); | 690 const SwitchInst &SI = cast<SwitchInst>(I); |
| 691 | 691 |
| 692 Vals64.push_back(VE.getTypeID(SI.getCondition()->getType())); | 692 Vals64.push_back(VE.getTypeID(SI.getCondition()->getType())); |
| 693 pushValue64(SI.getCondition(), InstID, Vals64, VE, Stream); | 693 pushValue64(SI.getCondition(), InstID, Vals64, VE, Stream); |
| 694 Vals64.push_back(VE.getValueID(SI.getDefaultDest())); | 694 Vals64.push_back(VE.getValueID(SI.getDefaultDest())); |
| 695 Vals64.push_back(SI.getNumCases()); | 695 Vals64.push_back(SI.getNumCases()); |
| 696 for (SwitchInst::ConstCaseIt i = SI.case_begin(), e = SI.case_end(); | 696 for (SwitchInst::ConstCaseIt i = SI.case_begin(), e = SI.case_end(); |
| 697 i != e; ++i) { | 697 i != e; ++i) { |
| 698 // This check will go away when we merge upstream's r190328, | |
| 699 // which removes all case range support. | |
| 700 if (!i.getCaseValueEx().isSingleNumber()) | |
| 701 report_fatal_error("Case ranges are not supported in PNaCl bitcode"); | |
| 702 | |
| 703 // The PNaCl bitcode format has vestigial support for case | 698 // The PNaCl bitcode format has vestigial support for case |
| 704 // ranges, but we no longer support reading or writing them, | 699 // ranges, but we no longer support reading or writing them, |
| 705 // so the next two fields always have the same values. | 700 // so the next two fields always have the same values. |
| 706 // See https://code.google.com/p/nativeclient/issues/detail?id=3758 | 701 // See https://code.google.com/p/nativeclient/issues/detail?id=3758 |
| 707 Vals64.push_back(1/*NumItems = 1*/); | 702 Vals64.push_back(1/*NumItems = 1*/); |
| 708 Vals64.push_back(true/*IsSingleNumber = true*/); | 703 Vals64.push_back(true/*IsSingleNumber = true*/); |
| 709 | 704 |
| 710 emitSignedInt64(Vals64, i.getCaseValue()->getSExtValue()); | 705 emitSignedInt64(Vals64, i.getCaseValue()->getSExtValue()); |
| 711 Vals64.push_back(VE.getValueID(i.getCaseSuccessor())); | 706 Vals64.push_back(VE.getValueID(i.getCaseSuccessor())); |
| 712 } | 707 } |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 NaClWriteHeader(Header, Stream); | 1226 NaClWriteHeader(Header, Stream); |
| 1232 } | 1227 } |
| 1233 | 1228 |
| 1234 // Emit the module. | 1229 // Emit the module. |
| 1235 WriteModule(M, Stream); | 1230 WriteModule(M, Stream); |
| 1236 } | 1231 } |
| 1237 | 1232 |
| 1238 // Write the generated bitstream to "Out". | 1233 // Write the generated bitstream to "Out". |
| 1239 Out.write((char*)&Buffer.front(), Buffer.size()); | 1234 Out.write((char*)&Buffer.front(), Buffer.size()); |
| 1240 } | 1235 } |
| OLD | NEW |