OLD | NEW |
1 //===- unittest/IceParseInstsTest.cpp - test instruction errors -----------===// | 1 //===- unittest/IceParseInstsTest.cpp - test instruction errors -----------===// |
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 #include <string> | 10 #include <string> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 "Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n", | 63 "Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n", |
64 DumpMunger.getLinesWithSubstring("66:4")); | 64 DumpMunger.getLinesWithSubstring("66:4")); |
65 | 65 |
66 // Show that we get appropriate error when parsing in Subzero. | 66 // Show that we get appropriate error when parsing in Subzero. |
67 IceTest::SubzeroBitcodeMunger Munger(ARRAY_TERM(BitcodeRecords)); | 67 IceTest::SubzeroBitcodeMunger Munger(ARRAY_TERM(BitcodeRecords)); |
68 EXPECT_FALSE(Munger.runTest(ParseError)); | 68 EXPECT_FALSE(Munger.runTest(ParseError)); |
69 EXPECT_EQ("Error(66:4): Invalid function record: <34 0 4 2 100>\n", | 69 EXPECT_EQ("Error(66:4): Invalid function record: <34 0 4 2 100>\n", |
70 Munger.getTestResults()); | 70 Munger.getTestResults()); |
71 | 71 |
72 // Show that we generate a fatal error when not allowing error recovery. | 72 // Show that we generate a fatal error when not allowing error recovery. |
73 Munger.Flags.setAllowErrorRecovery(false); | 73 Ice::ClFlags::Flags.setAllowErrorRecovery(false); |
74 EXPECT_DEATH(Munger.runTest(ParseError), ".*ERROR: Unable to continue.*"); | 74 EXPECT_DEATH(Munger.runTest(ParseError), ".*ERROR: Unable to continue.*"); |
75 } | 75 } |
76 | 76 |
77 /// Test how we recognize alignments in alloca instructions. | 77 /// Test how we recognize alignments in alloca instructions. |
78 TEST(IceParseInstsTests, AllocaAlignment) { | 78 TEST(IceParseInstsTests, AllocaAlignment) { |
79 const uint64_t BitcodeRecords[] = { | 79 const uint64_t BitcodeRecords[] = { |
80 1, naclbitc::BLK_CODE_ENTER, naclbitc::MODULE_BLOCK_ID, 2, Terminator, | 80 1, naclbitc::BLK_CODE_ENTER, naclbitc::MODULE_BLOCK_ID, 2, Terminator, |
81 1, naclbitc::BLK_CODE_ENTER, naclbitc::TYPE_BLOCK_ID_NEW, 2, Terminator, | 81 1, naclbitc::BLK_CODE_ENTER, naclbitc::TYPE_BLOCK_ID_NEW, 2, Terminator, |
82 3, naclbitc::TYPE_CODE_NUMENTRY, 4, Terminator, | 82 3, naclbitc::TYPE_CODE_NUMENTRY, 4, Terminator, |
83 3, naclbitc::TYPE_CODE_INTEGER, 32, Terminator, | 83 3, naclbitc::TYPE_CODE_INTEGER, 32, Terminator, |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 31>\n", | 395 EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 31>\n", |
396 Munger.getTestResults()); | 396 Munger.getTestResults()); |
397 EXPECT_FALSE(DumpMunger.runTestForAssembly(ARRAY(Align30))); | 397 EXPECT_FALSE(DumpMunger.runTestForAssembly(ARRAY(Align30))); |
398 EXPECT_EQ( | 398 EXPECT_EQ( |
399 " store float %p1, float* %p0, align 0;\n" | 399 " store float %p1, float* %p0, align 0;\n" |
400 "Error(62:4): store: Illegal alignment for float. Expects: 1 or 4\n", | 400 "Error(62:4): store: Illegal alignment for float. Expects: 1 or 4\n", |
401 DumpMunger.getLinesWithSubstring("store")); | 401 DumpMunger.getLinesWithSubstring("store")); |
402 } | 402 } |
403 | 403 |
404 } // end of anonymous namespace | 404 } // end of anonymous namespace |
OLD | NEW |