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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 136 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
137 Flags.DisableTranslation = DisableTranslation; | 137 Flags.DisableTranslation = DisableTranslation; |
138 Flags.DisableGlobals = DisableGlobals; | 138 Flags.DisableGlobals = DisableGlobals; |
139 Flags.FunctionSections = FunctionSections; | 139 Flags.FunctionSections = FunctionSections; |
140 Flags.UseSandboxing = UseSandboxing; | 140 Flags.UseSandboxing = UseSandboxing; |
141 | 141 |
142 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 142 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
143 Flags); | 143 Flags); |
144 | 144 |
145 if (BuildOnRead) { | 145 if (BuildOnRead) { |
146 Ice::PNaClTranslator Translator(&Ctx); | 146 Ice::PNaClTranslator Translator(&Ctx, Flags); |
147 Translator.translate(IRFilename); | 147 Translator.translate(IRFilename); |
148 return Translator.getErrorStatus(); | 148 return Translator.getErrorStatus(); |
149 } else { | 149 } else { |
150 // Parse the input LLVM IR file into a module. | 150 // Parse the input LLVM IR file into a module. |
151 SMDiagnostic Err; | 151 SMDiagnostic Err; |
152 Ice::Timer T; | 152 Ice::Timer T; |
153 Module *Mod = | 153 Module *Mod = |
154 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 154 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); |
155 | 155 |
156 if (SubzeroTimingEnabled) { | 156 if (SubzeroTimingEnabled) { |
157 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() | 157 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() |
158 << " sec\n"; | 158 << " sec\n"; |
159 } | 159 } |
160 | 160 |
161 if (!Mod) { | 161 if (!Mod) { |
162 Err.print(argv[0], errs()); | 162 Err.print(argv[0], errs()); |
163 return 1; | 163 return 1; |
164 } | 164 } |
165 | 165 |
166 Ice::Converter Converter(&Ctx); | 166 Ice::Converter Converter(Mod, &Ctx, Flags); |
167 Converter.convertToIce(Mod); | 167 Converter.convertToIce(); |
168 return Converter.getErrorStatus(); | 168 return Converter.getErrorStatus(); |
169 } | 169 } |
170 } | 170 } |
OLD | NEW |