Chromium Code Reviews| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 DisablePhiEdgeSplit("no-phi-edge-split", | 102 DisablePhiEdgeSplit("no-phi-edge-split", |
| 103 cl::desc("Disable edge splitting for Phi lowering")); | 103 cl::desc("Disable edge splitting for Phi lowering")); |
| 104 | 104 |
| 105 static cl::opt<NaClFileFormat> InputFileFormat( | 105 static cl::opt<NaClFileFormat> InputFileFormat( |
| 106 "bitcode-format", cl::desc("Define format of input file:"), | 106 "bitcode-format", cl::desc("Define format of input file:"), |
| 107 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"), | 107 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"), |
| 108 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"), | 108 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"), |
| 109 clEnumValEnd), | 109 clEnumValEnd), |
| 110 cl::init(LLVMFormat)); | 110 cl::init(LLVMFormat)); |
| 111 | 111 |
| 112 static cl::opt<std::string> DefaultGlobalPrefix( | |
| 113 "default-global-prefix", | |
| 114 cl::desc("Define default global prefix for naming " | |
| 115 "unnamed globals/funtions"), | |
|
Jim Stichnoth
2014/09/11 22:08:19
functions
Karl
2014/09/12 16:29:06
Done.
| |
| 116 cl::init("")); | |
|
jvoung (off chromium)
2014/09/11 22:16:43
Should this have a default?
At least llc has a de
Karl
2014/09/12 16:29:06
Good point. Changing default for globals to "Globa
| |
| 117 | |
| 112 static cl::opt<bool> | 118 static cl::opt<bool> |
| 113 BuildOnRead("build-on-read", | 119 BuildOnRead("build-on-read", |
| 114 cl::desc("Build ICE instructions when reading bitcode"), | 120 cl::desc("Build ICE instructions when reading bitcode"), |
| 115 cl::init(false)); | 121 cl::init(false)); |
| 116 | 122 |
| 117 int main(int argc, char **argv) { | 123 int main(int argc, char **argv) { |
| 118 | 124 |
| 119 cl::ParseCommandLineOptions(argc, argv); | 125 cl::ParseCommandLineOptions(argc, argv); |
| 120 | 126 |
| 121 Ice::VerboseMask VMask = Ice::IceV_None; | 127 Ice::VerboseMask VMask = Ice::IceV_None; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 136 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); | 142 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); |
| 137 Ls->SetUnbuffered(); | 143 Ls->SetUnbuffered(); |
| 138 | 144 |
| 139 Ice::ClFlags Flags; | 145 Ice::ClFlags Flags; |
| 140 Flags.DisableInternal = DisableInternal; | 146 Flags.DisableInternal = DisableInternal; |
| 141 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 147 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
| 142 Flags.DisableTranslation = DisableTranslation; | 148 Flags.DisableTranslation = DisableTranslation; |
| 143 Flags.DisableGlobals = DisableGlobals; | 149 Flags.DisableGlobals = DisableGlobals; |
| 144 Flags.FunctionSections = FunctionSections; | 150 Flags.FunctionSections = FunctionSections; |
| 145 Flags.UseSandboxing = UseSandboxing; | 151 Flags.UseSandboxing = UseSandboxing; |
| 152 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | |
| 146 | 153 |
| 147 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 154 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
| 148 Flags); | 155 Flags); |
| 149 | 156 |
| 150 if (BuildOnRead) { | 157 if (BuildOnRead) { |
| 151 Ice::PNaClTranslator Translator(&Ctx, Flags); | 158 Ice::PNaClTranslator Translator(&Ctx, Flags); |
| 152 Translator.translate(IRFilename); | 159 Translator.translate(IRFilename); |
| 153 return Translator.getErrorStatus(); | 160 return Translator.getErrorStatus(); |
| 154 } else { | 161 } else { |
| 155 // Parse the input LLVM IR file into a module. | 162 // Parse the input LLVM IR file into a module. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 166 if (!Mod) { | 173 if (!Mod) { |
| 167 Err.print(argv[0], errs()); | 174 Err.print(argv[0], errs()); |
| 168 return 1; | 175 return 1; |
| 169 } | 176 } |
| 170 | 177 |
| 171 Ice::Converter Converter(Mod, &Ctx, Flags); | 178 Ice::Converter Converter(Mod, &Ctx, Flags); |
| 172 Converter.convertToIce(); | 179 Converter.convertToIce(); |
| 173 return Converter.getErrorStatus(); | 180 return Converter.getErrorStatus(); |
| 174 } | 181 } |
| 175 } | 182 } |
| OLD | NEW |