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 /// \file | 10 /// \file |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 namespace Ice { | 41 namespace Ice { |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 struct { | 45 struct { |
46 const char *FlagName; | 46 const char *FlagName; |
47 int FlagValue; | 47 int FlagValue; |
48 } ConditionalBuildAttributes[] = { | 48 } ConditionalBuildAttributes[] = { |
49 {"dump", BuildDefs::dump()}, | 49 {"dump", BuildDefs::dump()}, |
50 {"disable_ir_gen", BuildDefs::disableIrGen()}, | |
51 {"llvm_cl", BuildDefs::llvmCl()}, | 50 {"llvm_cl", BuildDefs::llvmCl()}, |
52 {"llvm_ir", BuildDefs::llvmIr()}, | 51 {"llvm_ir", BuildDefs::llvmIr()}, |
53 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()}, | 52 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()}, |
54 {"minimal_build", BuildDefs::minimal()}, | 53 {"minimal_build", BuildDefs::minimal()}, |
55 {"browser_mode", BuildDefs::browser()}}; | 54 {"browser_mode", BuildDefs::browser()}}; |
56 | 55 |
57 // Validates values of build attributes. Prints them to Stream if Stream is | 56 // Validates values of build attributes. Prints them to Stream if Stream is |
58 // non-null. | 57 // non-null. |
59 void validateAndGenerateBuildAttributes(Ostream *Stream) { | 58 void validateAndGenerateBuildAttributes(Ostream *Stream) { |
60 // List the supported targets. | 59 // List the supported targets. |
(...skipping 27 matching lines...) Expand all Loading... |
88 | 87 |
89 } // end of anonymous namespace | 88 } // end of anonymous namespace |
90 | 89 |
91 void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx, | 90 void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx, |
92 std::unique_ptr<llvm::DataStreamer> &&InputStream) { | 91 std::unique_ptr<llvm::DataStreamer> &&InputStream) { |
93 validateAndGenerateBuildAttributes( | 92 validateAndGenerateBuildAttributes( |
94 ExtraFlags.getGenerateBuildAtts() ? &Ctx.getStrDump() : nullptr); | 93 ExtraFlags.getGenerateBuildAtts() ? &Ctx.getStrDump() : nullptr); |
95 if (ExtraFlags.getGenerateBuildAtts()) | 94 if (ExtraFlags.getGenerateBuildAtts()) |
96 return Ctx.getErrorStatus()->assign(EC_None); | 95 return Ctx.getErrorStatus()->assign(EC_None); |
97 | 96 |
98 if (!BuildDefs::disableIrGen() && Ctx.getFlags().getDisableIRGeneration()) { | |
99 Ctx.getStrError() << "Error: Build doesn't allow --no-ir-gen when not " | |
100 << "ALLOW_DISABLE_IR_GEN!\n"; | |
101 return Ctx.getErrorStatus()->assign(EC_Args); | |
102 } | |
103 | |
104 // The Minimal build (specifically, when dump()/emit() are not implemented) | 97 // The Minimal build (specifically, when dump()/emit() are not implemented) |
105 // allows only --filetype=obj. Check here to avoid cryptic error messages | 98 // allows only --filetype=obj. Check here to avoid cryptic error messages |
106 // downstream. | 99 // downstream. |
107 if (!BuildDefs::dump() && Ctx.getFlags().getOutFileType() != FT_Elf) { | 100 if (!BuildDefs::dump() && Ctx.getFlags().getOutFileType() != FT_Elf) { |
108 // TODO(stichnot): Access the actual command-line argument via | 101 // TODO(stichnot): Access the actual command-line argument via |
109 // llvm::Option.ArgStr and .ValueStr . | 102 // llvm::Option.ArgStr and .ValueStr . |
110 Ctx.getStrError() | 103 Ctx.getStrError() |
111 << "Error: only --filetype=obj is supported in this build.\n"; | 104 << "Error: only --filetype=obj is supported in this build.\n"; |
112 return Ctx.getErrorStatus()->assign(EC_Args); | 105 return Ctx.getErrorStatus()->assign(EC_Args); |
113 } | 106 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 177 |
185 if (Ctx.getFlags().getTimeEachFunction()) { | 178 if (Ctx.getFlags().getTimeEachFunction()) { |
186 constexpr bool DumpCumulative = false; | 179 constexpr bool DumpCumulative = false; |
187 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); | 180 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); |
188 } | 181 } |
189 constexpr bool FinalStats = true; | 182 constexpr bool FinalStats = true; |
190 Ctx.dumpStats("_FINAL_", FinalStats); | 183 Ctx.dumpStats("_FINAL_", FinalStats); |
191 } | 184 } |
192 | 185 |
193 } // end of namespace Ice | 186 } // end of namespace Ice |
OLD | NEW |