| OLD | NEW |
| 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// | 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// |
| 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 that uses LLVM capabilities to parse a | 10 // This file defines a driver that uses LLVM capabilities to parse a |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 static cl::opt<bool> | 129 static cl::opt<bool> |
| 130 BuildOnRead("build-on-read", | 130 BuildOnRead("build-on-read", |
| 131 cl::desc("Build ICE instructions when reading bitcode"), | 131 cl::desc("Build ICE instructions when reading bitcode"), |
| 132 cl::init(false)); | 132 cl::init(false)); |
| 133 | 133 |
| 134 static cl::opt<bool> | 134 static cl::opt<bool> |
| 135 UseIntegratedAssembler("integrated-as", | 135 UseIntegratedAssembler("integrated-as", |
| 136 cl::desc("Use integrated assembler (default yes)"), | 136 cl::desc("Use integrated assembler (default yes)"), |
| 137 cl::init(true)); | 137 cl::init(true)); |
| 138 |
| 138 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), | 139 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), |
| 139 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); | 140 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); |
| 140 | 141 |
| 142 static cl::opt<bool> AlwaysExitSuccess( |
| 143 "exit-success", cl::desc("Exit with success status, even if errors found"), |
| 144 cl::init(false)); |
| 145 |
| 146 static int GetReturnValue(int Val) { |
| 147 if (AlwaysExitSuccess) |
| 148 return 0; |
| 149 return Val; |
| 150 } |
| 151 |
| 141 int main(int argc, char **argv) { | 152 int main(int argc, char **argv) { |
| 142 | 153 |
| 143 cl::ParseCommandLineOptions(argc, argv); | 154 cl::ParseCommandLineOptions(argc, argv); |
| 144 | 155 |
| 145 Ice::VerboseMask VMask = Ice::IceV_None; | 156 Ice::VerboseMask VMask = Ice::IceV_None; |
| 146 for (unsigned i = 0; i != VerboseList.size(); ++i) | 157 for (unsigned i = 0; i != VerboseList.size(); ++i) |
| 147 VMask |= VerboseList[i]; | 158 VMask |= VerboseList[i]; |
| 148 | 159 |
| 149 std::ofstream Ofs; | 160 std::ofstream Ofs; |
| 150 if (OutputFilename != "-") { | 161 if (OutputFilename != "-") { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } else { | 196 } else { |
| 186 // Parse the input LLVM IR file into a module. | 197 // Parse the input LLVM IR file into a module. |
| 187 SMDiagnostic Err; | 198 SMDiagnostic Err; |
| 188 static Ice::TimerIdT IDparse = Ice::GlobalContext::getTimerID("parse"); | 199 static Ice::TimerIdT IDparse = Ice::GlobalContext::getTimerID("parse"); |
| 189 Ice::TimerMarker T1(IDparse, &Ctx); | 200 Ice::TimerMarker T1(IDparse, &Ctx); |
| 190 Module *Mod = | 201 Module *Mod = |
| 191 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 202 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); |
| 192 | 203 |
| 193 if (!Mod) { | 204 if (!Mod) { |
| 194 Err.print(argv[0], errs()); | 205 Err.print(argv[0], errs()); |
| 195 return 1; | 206 return GetReturnValue(1); |
| 196 } | 207 } |
| 197 | 208 |
| 198 Ice::Converter Converter(Mod, &Ctx, Flags); | 209 Ice::Converter Converter(Mod, &Ctx, Flags); |
| 199 Converter.convertToIce(); | 210 Converter.convertToIce(); |
| 200 ErrorStatus = Converter.getErrorStatus(); | 211 ErrorStatus = Converter.getErrorStatus(); |
| 201 } | 212 } |
| 202 if (SubzeroTimingEnabled) | 213 if (SubzeroTimingEnabled) |
| 203 Ctx.dumpTimers(); | 214 Ctx.dumpTimers(); |
| 204 const bool FinalStats = true; | 215 const bool FinalStats = true; |
| 205 Ctx.dumpStats("_FINAL_", FinalStats); | 216 Ctx.dumpStats("_FINAL_", FinalStats); |
| 206 return ErrorStatus; | 217 return GetReturnValue(ErrorStatus); |
| 207 } | 218 } |
| OLD | NEW |