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

Side by Side Diff: src/llvm2ice.cpp

Issue 476323004: Start adding an integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: simplify Created 6 years, 3 months 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
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 "bitcode-format", cl::desc("Define format of input file:"), 101 "bitcode-format", cl::desc("Define format of input file:"),
102 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"), 102 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"),
103 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"), 103 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"),
104 clEnumValEnd), 104 clEnumValEnd),
105 cl::init(LLVMFormat)); 105 cl::init(LLVMFormat));
106 106
107 static cl::opt<bool> 107 static cl::opt<bool>
108 BuildOnRead("build-on-read", 108 BuildOnRead("build-on-read",
109 cl::desc("Build ICE instructions when reading bitcode"), 109 cl::desc("Build ICE instructions when reading bitcode"),
110 cl::init(false)); 110 cl::init(false));
111 static cl::opt<bool>
112 DisableIntegratedAssembler("no-integrated-as",
Jim Stichnoth 2014/09/04 20:57:48 Can the sense of this be reversed for better clari
jvoung (off chromium) 2014/09/08 21:39:00 Done. I started with UseIntegratedAssembler cl::i
113 cl::desc("Do not use integrated assembler"));
111 114
112 int main(int argc, char **argv) { 115 int main(int argc, char **argv) {
113 116
114 cl::ParseCommandLineOptions(argc, argv); 117 cl::ParseCommandLineOptions(argc, argv);
115 118
116 Ice::VerboseMask VMask = Ice::IceV_None; 119 Ice::VerboseMask VMask = Ice::IceV_None;
117 for (unsigned i = 0; i != VerboseList.size(); ++i) 120 for (unsigned i = 0; i != VerboseList.size(); ++i)
118 VMask |= VerboseList[i]; 121 VMask |= VerboseList[i];
119 122
120 std::ofstream Ofs; 123 std::ofstream Ofs;
(...skipping 10 matching lines...) Expand all
131 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); 134 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs);
132 Ls->SetUnbuffered(); 135 Ls->SetUnbuffered();
133 136
134 Ice::ClFlags Flags; 137 Ice::ClFlags Flags;
135 Flags.DisableInternal = DisableInternal; 138 Flags.DisableInternal = DisableInternal;
136 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; 139 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled;
137 Flags.DisableTranslation = DisableTranslation; 140 Flags.DisableTranslation = DisableTranslation;
138 Flags.DisableGlobals = DisableGlobals; 141 Flags.DisableGlobals = DisableGlobals;
139 Flags.FunctionSections = FunctionSections; 142 Flags.FunctionSections = FunctionSections;
140 Flags.UseSandboxing = UseSandboxing; 143 Flags.UseSandboxing = UseSandboxing;
144 Flags.UseIntegratedAssembler = !DisableIntegratedAssembler;
141 145
142 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, 146 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix,
143 Flags); 147 Flags);
144 148
145 if (BuildOnRead) { 149 if (BuildOnRead) {
146 Ice::PNaClTranslator Translator(&Ctx, Flags); 150 Ice::PNaClTranslator Translator(&Ctx, Flags);
147 Translator.translate(IRFilename); 151 Translator.translate(IRFilename);
148 return Translator.getErrorStatus(); 152 return Translator.getErrorStatus();
149 } else { 153 } else {
150 // Parse the input LLVM IR file into a module. 154 // Parse the input LLVM IR file into a module.
(...skipping 10 matching lines...) Expand all
161 if (!Mod) { 165 if (!Mod) {
162 Err.print(argv[0], errs()); 166 Err.print(argv[0], errs());
163 return 1; 167 return 1;
164 } 168 }
165 169
166 Ice::Converter Converter(Mod, &Ctx, Flags); 170 Ice::Converter Converter(Mod, &Ctx, Flags);
167 Converter.convertToIce(); 171 Converter.convertToIce();
168 return Converter.getErrorStatus(); 172 return Converter.getErrorStatus();
169 } 173 }
170 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698