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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 int FlagValue; | 45 int FlagValue; |
46 } ConditionalBuildAttributes[] = { | 46 } ConditionalBuildAttributes[] = { |
47 {"dump", BuildDefs::dump()}, | 47 {"dump", BuildDefs::dump()}, |
48 {"disable_ir_gen", BuildDefs::disableIrGen()}, | 48 {"disable_ir_gen", BuildDefs::disableIrGen()}, |
49 {"llvm_cl", BuildDefs::llvmCl()}, | 49 {"llvm_cl", BuildDefs::llvmCl()}, |
50 {"llvm_ir", BuildDefs::llvmIr()}, | 50 {"llvm_ir", BuildDefs::llvmIr()}, |
51 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()}, | 51 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()}, |
52 {"minimal_build", BuildDefs::minimal()}, | 52 {"minimal_build", BuildDefs::minimal()}, |
53 {"browser_mode", PNACL_BROWSER_TRANSLATOR}}; | 53 {"browser_mode", PNACL_BROWSER_TRANSLATOR}}; |
54 | 54 |
55 // Validates values of build attributes. Prints them to Stream if | 55 // Validates values of build attributes. Prints them to Stream if Stream is |
56 // Stream is non-null. | 56 // non-null. |
57 void validateAndGenerateBuildAttributes(Ostream *Stream) { | 57 void validateAndGenerateBuildAttributes(Ostream *Stream) { |
58 // List the supported targets. | 58 // List the supported targets. |
59 if (Stream) { | 59 if (Stream) { |
60 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n"; | 60 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n"; |
61 #include "llvm/Config/SZTargets.def" | 61 #include "llvm/Config/SZTargets.def" |
62 } | 62 } |
63 | 63 |
64 for (size_t i = 0; i < llvm::array_lengthof(ConditionalBuildAttributes); | 64 for (size_t i = 0; i < llvm::array_lengthof(ConditionalBuildAttributes); |
65 ++i) { | 65 ++i) { |
66 switch (ConditionalBuildAttributes[i].FlagValue) { | 66 switch (ConditionalBuildAttributes[i].FlagValue) { |
(...skipping 26 matching lines...) Expand all Loading... |
93 if (ExtraFlags.getGenerateBuildAtts()) | 93 if (ExtraFlags.getGenerateBuildAtts()) |
94 return Ctx.getErrorStatus()->assign(EC_None); | 94 return Ctx.getErrorStatus()->assign(EC_None); |
95 | 95 |
96 if (!BuildDefs::disableIrGen() && Ctx.getFlags().getDisableIRGeneration()) { | 96 if (!BuildDefs::disableIrGen() && Ctx.getFlags().getDisableIRGeneration()) { |
97 Ctx.getStrError() << "Error: Build doesn't allow --no-ir-gen when not " | 97 Ctx.getStrError() << "Error: Build doesn't allow --no-ir-gen when not " |
98 << "ALLOW_DISABLE_IR_GEN!\n"; | 98 << "ALLOW_DISABLE_IR_GEN!\n"; |
99 return Ctx.getErrorStatus()->assign(EC_Args); | 99 return Ctx.getErrorStatus()->assign(EC_Args); |
100 } | 100 } |
101 | 101 |
102 // The Minimal build (specifically, when dump()/emit() are not implemented) | 102 // The Minimal build (specifically, when dump()/emit() are not implemented) |
103 // allows only --filetype=obj. Check here to avoid cryptic error messages | 103 // allows only --filetype=obj. Check here to avoid cryptic error messages |
104 // downstream. | 104 // downstream. |
105 if (!BuildDefs::dump() && Ctx.getFlags().getOutFileType() != FT_Elf) { | 105 if (!BuildDefs::dump() && Ctx.getFlags().getOutFileType() != FT_Elf) { |
106 // TODO(stichnot): Access the actual command-line argument via | 106 // TODO(stichnot): Access the actual command-line argument via |
107 // llvm::Option.ArgStr and .ValueStr . | 107 // llvm::Option.ArgStr and .ValueStr . |
108 Ctx.getStrError() | 108 Ctx.getStrError() |
109 << "Error: only --filetype=obj is supported in this build.\n"; | 109 << "Error: only --filetype=obj is supported in this build.\n"; |
110 return Ctx.getErrorStatus()->assign(EC_Args); | 110 return Ctx.getErrorStatus()->assign(EC_Args); |
111 } | 111 } |
112 | 112 |
113 // Force -build-on-read=0 for .ll files. | 113 // Force -build-on-read=0 for .ll files. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 if (Ctx.getFlags().getTimeEachFunction()) { | 183 if (Ctx.getFlags().getTimeEachFunction()) { |
184 const bool DumpCumulative = false; | 184 const bool DumpCumulative = false; |
185 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); | 185 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); |
186 } | 186 } |
187 constexpr bool FinalStats = true; | 187 constexpr bool FinalStats = true; |
188 Ctx.dumpStats("_FINAL_", FinalStats); | 188 Ctx.dumpStats("_FINAL_", FinalStats); |
189 } | 189 } |
190 | 190 |
191 } // end of namespace Ice | 191 } // end of namespace Ice |
OLD | NEW |