Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: src/IceCompiler.cpp

Issue 1514193003: Clean up remnants of direct use of PNACL_BROWSER_TRANSLATOR (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 /// \brief Defines a driver for translating PNaCl bitcode into native code. 11 /// \brief Defines a driver for translating PNaCl bitcode into native code.
12 /// 12 ///
13 /// The driver can either directly parse the binary bitcode file, or use LLVM 13 /// The driver can either directly parse the binary bitcode file, or use LLVM
14 /// routines to parse a textual bitcode file into LLVM IR and then convert LLVM 14 /// routines to parse a textual bitcode file into LLVM IR and then convert LLVM
15 /// IR into ICE. In either case, the high-level ICE is then compiled down to 15 /// IR into ICE. In either case, the high-level ICE is then compiled down to
16 /// native code, as either an ELF object file or a textual asm file. 16 /// native code, as either an ELF object file or a textual asm file.
17 /// 17 ///
18 //===----------------------------------------------------------------------===// 18 //===----------------------------------------------------------------------===//
19 19
20 #include "IceCompiler.h" 20 #include "IceCompiler.h"
21 21
22 #include "IceBuildDefs.h"
22 #include "IceCfg.h" 23 #include "IceCfg.h"
23 #include "IceClFlags.h" 24 #include "IceClFlags.h"
24 #include "IceClFlagsExtra.h" 25 #include "IceClFlagsExtra.h"
25 #include "IceConverter.h" 26 #include "IceConverter.h"
26 #include "IceELFObjectWriter.h" 27 #include "IceELFObjectWriter.h"
27 #include "PNaClTranslator.h" 28 #include "PNaClTranslator.h"
28 29
29 #pragma clang diagnostic push 30 #pragma clang diagnostic push
30 #pragma clang diagnostic ignored "-Wunused-parameter" 31 #pragma clang diagnostic ignored "-Wunused-parameter"
31 #include "llvm/ADT/STLExtras.h" 32 #include "llvm/ADT/STLExtras.h"
(...skipping 12 matching lines...) Expand all
44 struct { 45 struct {
45 const char *FlagName; 46 const char *FlagName;
46 int FlagValue; 47 int FlagValue;
47 } ConditionalBuildAttributes[] = { 48 } ConditionalBuildAttributes[] = {
48 {"dump", BuildDefs::dump()}, 49 {"dump", BuildDefs::dump()},
49 {"disable_ir_gen", BuildDefs::disableIrGen()}, 50 {"disable_ir_gen", BuildDefs::disableIrGen()},
50 {"llvm_cl", BuildDefs::llvmCl()}, 51 {"llvm_cl", BuildDefs::llvmCl()},
51 {"llvm_ir", BuildDefs::llvmIr()}, 52 {"llvm_ir", BuildDefs::llvmIr()},
52 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()}, 53 {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()},
53 {"minimal_build", BuildDefs::minimal()}, 54 {"minimal_build", BuildDefs::minimal()},
54 {"browser_mode", PNACL_BROWSER_TRANSLATOR}}; 55 {"browser_mode", BuildDefs::browser()}};
55 56
56 // Validates values of build attributes. Prints them to Stream if Stream is 57 // Validates values of build attributes. Prints them to Stream if Stream is
57 // non-null. 58 // non-null.
58 void validateAndGenerateBuildAttributes(Ostream *Stream) { 59 void validateAndGenerateBuildAttributes(Ostream *Stream) {
59 // List the supported targets. 60 // List the supported targets.
60 if (Stream) { 61 if (Stream) {
61 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n"; 62 #define SUBZERO_TARGET(TARGET) *Stream << "target_" #TARGET << "\n";
62 #include "llvm/Config/SZTargets.def" 63 #include "llvm/Config/SZTargets.def"
63 } 64 }
64 65
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 Ctx.startWorkerThreads(); 127 Ctx.startWorkerThreads();
127 128
128 std::unique_ptr<Translator> Translator; 129 std::unique_ptr<Translator> Translator;
129 if (BuildOnRead) { 130 if (BuildOnRead) {
130 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx)); 131 std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx));
131 std::unique_ptr<llvm::StreamingMemoryObject> MemObj( 132 std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
132 new llvm::StreamingMemoryObjectImpl(InputStream.release())); 133 new llvm::StreamingMemoryObjectImpl(InputStream.release()));
133 PTranslator->translate(IRFilename, std::move(MemObj)); 134 PTranslator->translate(IRFilename, std::move(MemObj));
134 Translator.reset(PTranslator.release()); 135 Translator.reset(PTranslator.release());
135 } else if (BuildDefs::llvmIr()) { 136 } else if (BuildDefs::llvmIr()) {
136 if (PNACL_BROWSER_TRANSLATOR) { 137 if (BuildDefs::browser()) {
137 Ctx.getStrError() 138 Ctx.getStrError()
138 << "non BuildOnRead is not supported w/ PNACL_BROWSER_TRANSLATOR\n"; 139 << "non BuildOnRead is not supported w/ PNACL_BROWSER_TRANSLATOR\n";
139 return Ctx.getErrorStatus()->assign(EC_Args); 140 return Ctx.getErrorStatus()->assign(EC_Args);
140 } 141 }
141 // Parse the input LLVM IR file into a module. 142 // Parse the input LLVM IR file into a module.
142 llvm::SMDiagnostic Err; 143 llvm::SMDiagnostic Err;
143 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); 144 TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
144 llvm::DiagnosticHandlerFunction DiagnosticHandler = 145 llvm::DiagnosticHandlerFunction DiagnosticHandler =
145 ExtraFlags.getLLVMVerboseErrors() 146 ExtraFlags.getLLVMVerboseErrors()
146 ? redirectNaClDiagnosticToStream(llvm::errs()) 147 ? redirectNaClDiagnosticToStream(llvm::errs())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 184
184 if (Ctx.getFlags().getTimeEachFunction()) { 185 if (Ctx.getFlags().getTimeEachFunction()) {
185 constexpr bool DumpCumulative = false; 186 constexpr bool DumpCumulative = false;
186 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative); 187 Ctx.dumpTimers(GlobalContext::TSK_Funcs, DumpCumulative);
187 } 188 }
188 constexpr bool FinalStats = true; 189 constexpr bool FinalStats = true;
189 Ctx.dumpStats("_FINAL_", FinalStats); 190 Ctx.dumpStats("_FINAL_", FinalStats);
190 } 191 }
191 192
192 } // end of namespace Ice 193 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698