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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Flags.DisableGlobals = DisableGlobals; | 159 Flags.DisableGlobals = DisableGlobals; |
160 Flags.FunctionSections = FunctionSections; | 160 Flags.FunctionSections = FunctionSections; |
161 Flags.UseSandboxing = UseSandboxing; | 161 Flags.UseSandboxing = UseSandboxing; |
162 Flags.DumpStats = DumpStats; | 162 Flags.DumpStats = DumpStats; |
163 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 163 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
164 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 164 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
165 | 165 |
166 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 166 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
167 Flags); | 167 Flags); |
168 | 168 |
| 169 int ErrorStatus = 0; |
169 if (BuildOnRead) { | 170 if (BuildOnRead) { |
170 Ice::PNaClTranslator Translator(&Ctx, Flags); | 171 Ice::PNaClTranslator Translator(&Ctx, Flags); |
171 Translator.translate(IRFilename); | 172 Translator.translate(IRFilename); |
172 return Translator.getErrorStatus(); | 173 ErrorStatus = Translator.getErrorStatus(); |
173 } else { | 174 } else { |
174 // Parse the input LLVM IR file into a module. | 175 // Parse the input LLVM IR file into a module. |
175 SMDiagnostic Err; | 176 SMDiagnostic Err; |
176 Ice::Timer T; | 177 Ice::Timer T; |
177 Module *Mod = | 178 Module *Mod = |
178 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 179 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); |
179 | 180 |
180 if (SubzeroTimingEnabled) { | 181 if (SubzeroTimingEnabled) { |
181 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() | 182 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() |
182 << " sec\n"; | 183 << " sec\n"; |
183 } | 184 } |
184 | 185 |
185 if (!Mod) { | 186 if (!Mod) { |
186 Err.print(argv[0], errs()); | 187 Err.print(argv[0], errs()); |
187 return 1; | 188 return 1; |
188 } | 189 } |
189 | 190 |
190 Ice::Converter Converter(Mod, &Ctx, Flags); | 191 Ice::Converter Converter(Mod, &Ctx, Flags); |
191 Converter.convertToIce(); | 192 Converter.convertToIce(); |
192 return Converter.getErrorStatus(); | 193 ErrorStatus = Converter.getErrorStatus(); |
193 } | 194 } |
| 195 const bool FinalStats = true; |
| 196 Ctx.dumpStats("_FINAL_", FinalStats); |
| 197 return ErrorStatus; |
194 } | 198 } |
OLD | NEW |