OLD | NEW |
1 //===- subzero/src/IceCompiler.cpp - Driver for bitcode translation -------===// | 1 //===- subzero/src/IceCompiler.cpp - Driver for bitcode translation -------===// |
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 defines a driver for translating PNaCl bitcode into native code. | 10 // This file defines a driver for translating PNaCl bitcode into native code. |
(...skipping 28 matching lines...) Expand all Loading... |
39 } ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP}, | 39 } ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP}, |
40 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}, | 40 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}, |
41 {"llvm_cl", ALLOW_LLVM_CL}, | 41 {"llvm_cl", ALLOW_LLVM_CL}, |
42 {"llvm_ir", ALLOW_LLVM_IR}, | 42 {"llvm_ir", ALLOW_LLVM_IR}, |
43 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, | 43 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, |
44 {"minimal_build", ALLOW_MINIMAL_BUILD}, | 44 {"minimal_build", ALLOW_MINIMAL_BUILD}, |
45 {"browser_mode", PNACL_BROWSER_TRANSLATOR}}; | 45 {"browser_mode", PNACL_BROWSER_TRANSLATOR}}; |
46 | 46 |
47 // Validates values of build attributes. Prints them to Stream if | 47 // Validates values of build attributes. Prints them to Stream if |
48 // Stream is non-null. | 48 // Stream is non-null. |
49 void ValidateAndGenerateBuildAttributes(const ClFlags &Flags, Ostream *Stream) { | 49 void validateAndGenerateBuildAttributes(Ostream *Stream) { |
50 // List the supported targets. | 50 // List the supported targets. |
51 if (Stream) { | 51 if (Stream) { |
52 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n"; | 52 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n"; |
53 #include "llvm/Config/SZTargets.def" | 53 #include "llvm/Config/SZTargets.def" |
54 } | 54 } |
55 | 55 |
56 for (size_t i = 0; i < llvm::array_lengthof(ConditionalBuildAttributes); | 56 for (size_t i = 0; i < llvm::array_lengthof(ConditionalBuildAttributes); |
57 ++i) { | 57 ++i) { |
58 switch (ConditionalBuildAttributes[i].FlagValue) { | 58 switch (ConditionalBuildAttributes[i].FlagValue) { |
59 case 0: | 59 case 0: |
(...skipping 13 matching lines...) Expand all Loading... |
73 llvm::report_fatal_error(StrBuf.str()); | 73 llvm::report_fatal_error(StrBuf.str()); |
74 } | 74 } |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 } // end of anonymous namespace | 79 } // end of anonymous namespace |
80 | 80 |
81 void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx, | 81 void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx, |
82 std::unique_ptr<llvm::DataStreamer> &&InputStream) { | 82 std::unique_ptr<llvm::DataStreamer> &&InputStream) { |
83 ValidateAndGenerateBuildAttributes( | 83 validateAndGenerateBuildAttributes( |
84 Ctx.getFlags(), | |
85 ExtraFlags.getGenerateBuildAtts() ? &Ctx.getStrDump() : nullptr); | 84 ExtraFlags.getGenerateBuildAtts() ? &Ctx.getStrDump() : nullptr); |
86 if (ExtraFlags.getGenerateBuildAtts()) | 85 if (ExtraFlags.getGenerateBuildAtts()) |
87 return Ctx.getErrorStatus()->assign(EC_None); | 86 return Ctx.getErrorStatus()->assign(EC_None); |
88 | 87 |
89 if (!ALLOW_DISABLE_IR_GEN && Ctx.getFlags().getDisableIRGeneration()) { | 88 if (!ALLOW_DISABLE_IR_GEN && Ctx.getFlags().getDisableIRGeneration()) { |
90 Ctx.getStrDump() << "Error: Build doesn't allow --no-ir-gen when not " | 89 Ctx.getStrDump() << "Error: Build doesn't allow --no-ir-gen when not " |
91 << "ALLOW_DISABLE_IR_GEN!\n"; | 90 << "ALLOW_DISABLE_IR_GEN!\n"; |
92 return Ctx.getErrorStatus()->assign(EC_Args); | 91 return Ctx.getErrorStatus()->assign(EC_Args); |
93 } | 92 } |
94 | 93 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 Ctx.dumpTimers(); | 157 Ctx.dumpTimers(); |
159 if (Ctx.getFlags().getTimeEachFunction()) { | 158 if (Ctx.getFlags().getTimeEachFunction()) { |
160 const bool DumpCumulative = false; | 159 const bool DumpCumulative = false; |
161 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); | 160 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); |
162 } | 161 } |
163 const bool FinalStats = true; | 162 const bool FinalStats = true; |
164 Ctx.dumpStats("_FINAL_", FinalStats); | 163 Ctx.dumpStats("_FINAL_", FinalStats); |
165 } | 164 } |
166 | 165 |
167 } // end of namespace Ice | 166 } // end of namespace Ice |
OLD | NEW |