| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 static cl::opt<std::string> | 118 static cl::opt<std::string> |
| 119 DefaultFunctionPrefix("default-function-prefix", | 119 DefaultFunctionPrefix("default-function-prefix", |
| 120 cl::desc("Define default function prefix for naming " | 120 cl::desc("Define default function prefix for naming " |
| 121 "unnamed functions"), | 121 "unnamed functions"), |
| 122 cl::init("Function")); | 122 cl::init("Function")); |
| 123 | 123 |
| 124 static cl::opt<bool> | 124 static cl::opt<bool> |
| 125 BuildOnRead("build-on-read", | 125 BuildOnRead("build-on-read", |
| 126 cl::desc("Build ICE instructions when reading bitcode"), | 126 cl::desc("Build ICE instructions when reading bitcode"), |
| 127 cl::init(false)); | 127 cl::init(false)); |
| 128 static cl::opt<bool> |
| 129 UseIntegratedAssembler("integrated-as", |
| 130 cl::desc("Use integrated assembler (default yes)"), |
| 131 cl::init(true)); |
| 128 | 132 |
| 129 int main(int argc, char **argv) { | 133 int main(int argc, char **argv) { |
| 130 | 134 |
| 131 cl::ParseCommandLineOptions(argc, argv); | 135 cl::ParseCommandLineOptions(argc, argv); |
| 132 | 136 |
| 133 Ice::VerboseMask VMask = Ice::IceV_None; | 137 Ice::VerboseMask VMask = Ice::IceV_None; |
| 134 for (unsigned i = 0; i != VerboseList.size(); ++i) | 138 for (unsigned i = 0; i != VerboseList.size(); ++i) |
| 135 VMask |= VerboseList[i]; | 139 VMask |= VerboseList[i]; |
| 136 | 140 |
| 137 std::ofstream Ofs; | 141 std::ofstream Ofs; |
| 138 if (OutputFilename != "-") { | 142 if (OutputFilename != "-") { |
| 139 Ofs.open(OutputFilename.c_str(), std::ofstream::out); | 143 Ofs.open(OutputFilename.c_str(), std::ofstream::out); |
| 140 } | 144 } |
| 141 raw_os_ostream *Os = | 145 raw_os_ostream *Os = |
| 142 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); | 146 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); |
| 143 Os->SetUnbuffered(); | 147 Os->SetUnbuffered(); |
| 144 std::ofstream Lfs; | 148 std::ofstream Lfs; |
| 145 if (LogFilename != "-") { | 149 if (LogFilename != "-") { |
| 146 Lfs.open(LogFilename.c_str(), std::ofstream::out); | 150 Lfs.open(LogFilename.c_str(), std::ofstream::out); |
| 147 } | 151 } |
| 148 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); | 152 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); |
| 149 Ls->SetUnbuffered(); | 153 Ls->SetUnbuffered(); |
| 150 | 154 |
| 151 Ice::ClFlags Flags; | 155 Ice::ClFlags Flags; |
| 152 Flags.DisableInternal = DisableInternal; | 156 Flags.DisableInternal = DisableInternal; |
| 153 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 157 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
| 154 Flags.DisableTranslation = DisableTranslation; | 158 Flags.DisableTranslation = DisableTranslation; |
| 155 Flags.DisableGlobals = DisableGlobals; | 159 Flags.DisableGlobals = DisableGlobals; |
| 156 Flags.FunctionSections = FunctionSections; | 160 Flags.FunctionSections = FunctionSections; |
| 161 Flags.UseIntegratedAssembler = UseIntegratedAssembler; |
| 157 Flags.UseSandboxing = UseSandboxing; | 162 Flags.UseSandboxing = UseSandboxing; |
| 158 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 163 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
| 159 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 164 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
| 160 | 165 |
| 161 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 166 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
| 162 Flags); | 167 Flags); |
| 163 | 168 |
| 164 if (BuildOnRead) { | 169 if (BuildOnRead) { |
| 165 Ice::PNaClTranslator Translator(&Ctx, Flags); | 170 Ice::PNaClTranslator Translator(&Ctx, Flags); |
| 166 Translator.translate(IRFilename); | 171 Translator.translate(IRFilename); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 180 if (!Mod) { | 185 if (!Mod) { |
| 181 Err.print(argv[0], errs()); | 186 Err.print(argv[0], errs()); |
| 182 return 1; | 187 return 1; |
| 183 } | 188 } |
| 184 | 189 |
| 185 Ice::Converter Converter(Mod, &Ctx, Flags); | 190 Ice::Converter Converter(Mod, &Ctx, Flags); |
| 186 Converter.convertToIce(); | 191 Converter.convertToIce(); |
| 187 return Converter.getErrorStatus(); | 192 return Converter.getErrorStatus(); |
| 188 } | 193 } |
| 189 } | 194 } |
| OLD | NEW |