OLD | NEW |
1 //===- BitcodeMunge.cpp - Subzero Bitcode Munger ----------------*- C++ -*-===// | 1 //===- BitcodeMunge.cpp - Subzero Bitcode Munger ----------------*- C++ -*-===// |
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 // Test harness for testing malformed bitcode files in Subzero. | 10 // Test harness for testing malformed bitcode files in Subzero. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "BitcodeMunge.h" | 14 #include "BitcodeMunge.h" |
15 #include "IceCfg.h" | 15 #include "IceCfg.h" |
16 #include "IceClFlags.h" | 16 #include "IceClFlags.h" |
17 #include "PNaClTranslator.h" | 17 #include "PNaClTranslator.h" |
18 #include "IceTypes.h" | 18 #include "IceTypes.h" |
19 | 19 |
20 namespace IceTest { | 20 namespace IceTest { |
21 | 21 |
22 void IceTest::SubzeroBitcodeMunger::resetMungeFlags() { | 22 void IceTest::SubzeroBitcodeMunger::resetMungeFlags() { |
23 Flags.setAllowErrorRecovery(true); | 23 Ice::ClFlags::Flags.setAllowErrorRecovery(true); |
24 Flags.setGenerateUnitTestMessages(true); | 24 Ice::ClFlags::Flags.setDisableTranslation(false); |
25 Flags.setOptLevel(Ice::Opt_m1); | 25 Ice::ClFlags::Flags.setGenerateUnitTestMessages(true); |
26 Flags.setOutFileType(Ice::FT_Iasm); | 26 Ice::ClFlags::Flags.setOptLevel(Ice::Opt_m1); |
27 Flags.setTargetArch(Ice::Target_X8632); | 27 Ice::ClFlags::Flags.setOutFileType(Ice::FT_Iasm); |
28 Flags.setNumTranslationThreads(0); | 28 Ice::ClFlags::Flags.setTargetArch(Ice::Target_X8632); |
29 Flags.setParseParallel(false); | 29 Ice::ClFlags::Flags.setNumTranslationThreads(0); |
| 30 Ice::ClFlags::Flags.setParseParallel(false); |
30 } | 31 } |
31 | 32 |
32 bool IceTest::SubzeroBitcodeMunger::runTest(const uint64_t Munges[], | 33 bool IceTest::SubzeroBitcodeMunger::runTest(const uint64_t Munges[], |
33 size_t MungeSize, | 34 size_t MungeSize, |
34 bool DisableTranslation) { | 35 bool DisableTranslation) { |
35 const bool AddHeader = true; | 36 const bool AddHeader = true; |
36 setupTest(Munges, MungeSize, AddHeader); | 37 setupTest(Munges, MungeSize, AddHeader); |
37 Ice::GlobalContext Ctx(DumpStream, DumpStream, DumpStream, nullptr); | 38 Ice::GlobalContext Ctx(DumpStream, DumpStream, DumpStream, nullptr); |
38 Ctx.startWorkerThreads(); | 39 Ctx.startWorkerThreads(); |
39 Ice::PNaClTranslator Translator(&Ctx); | 40 Ice::PNaClTranslator Translator(&Ctx); |
40 const char *BufferName = "Test"; | 41 const char *BufferName = "Test"; |
41 Flags.setDisableTranslation(DisableTranslation); | 42 Ice::ClFlags::Flags.setDisableTranslation(DisableTranslation); |
42 Translator.translateBuffer(BufferName, MungedInput.get()); | 43 Translator.translateBuffer(BufferName, MungedInput.get()); |
43 Ctx.waitForWorkerThreads(); | 44 Ctx.waitForWorkerThreads(); |
44 | 45 |
45 cleanupTest(); | 46 cleanupTest(); |
46 return Translator.getErrorStatus().value() == 0; | 47 return Translator.getErrorStatus().value() == 0; |
47 } | 48 } |
48 | 49 |
49 } // end of namespace IceTest | 50 } // end of namespace IceTest |
OLD | NEW |