| 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> |
| 113 DefaultGlobalPrefix("default-global-prefix", |
| 114 cl::desc("Define default global prefix for naming " |
| 115 "unnamed globals"), |
| 116 cl::init("Global")); |
| 117 |
| 118 static cl::opt<std::string> |
| 119 DefaultFunctionPrefix("default-function-prefix", |
| 120 cl::desc("Define default function prefix for naming " |
| 121 "unnamed functions"), |
| 122 cl::init("Function")); |
| 123 |
| 112 static cl::opt<bool> | 124 static cl::opt<bool> |
| 113 BuildOnRead("build-on-read", | 125 BuildOnRead("build-on-read", |
| 114 cl::desc("Build ICE instructions when reading bitcode"), | 126 cl::desc("Build ICE instructions when reading bitcode"), |
| 115 cl::init(false)); | 127 cl::init(false)); |
| 116 | 128 |
| 117 int main(int argc, char **argv) { | 129 int main(int argc, char **argv) { |
| 118 | 130 |
| 119 cl::ParseCommandLineOptions(argc, argv); | 131 cl::ParseCommandLineOptions(argc, argv); |
| 120 | 132 |
| 121 Ice::VerboseMask VMask = Ice::IceV_None; | 133 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); | 148 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); |
| 137 Ls->SetUnbuffered(); | 149 Ls->SetUnbuffered(); |
| 138 | 150 |
| 139 Ice::ClFlags Flags; | 151 Ice::ClFlags Flags; |
| 140 Flags.DisableInternal = DisableInternal; | 152 Flags.DisableInternal = DisableInternal; |
| 141 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 153 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
| 142 Flags.DisableTranslation = DisableTranslation; | 154 Flags.DisableTranslation = DisableTranslation; |
| 143 Flags.DisableGlobals = DisableGlobals; | 155 Flags.DisableGlobals = DisableGlobals; |
| 144 Flags.FunctionSections = FunctionSections; | 156 Flags.FunctionSections = FunctionSections; |
| 145 Flags.UseSandboxing = UseSandboxing; | 157 Flags.UseSandboxing = UseSandboxing; |
| 158 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
| 159 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
| 146 | 160 |
| 147 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 161 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
| 148 Flags); | 162 Flags); |
| 149 | 163 |
| 150 if (BuildOnRead) { | 164 if (BuildOnRead) { |
| 151 Ice::PNaClTranslator Translator(&Ctx, Flags); | 165 Ice::PNaClTranslator Translator(&Ctx, Flags); |
| 152 Translator.translate(IRFilename); | 166 Translator.translate(IRFilename); |
| 153 return Translator.getErrorStatus(); | 167 return Translator.getErrorStatus(); |
| 154 } else { | 168 } else { |
| 155 // Parse the input LLVM IR file into a module. | 169 // Parse the input LLVM IR file into a module. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 166 if (!Mod) { | 180 if (!Mod) { |
| 167 Err.print(argv[0], errs()); | 181 Err.print(argv[0], errs()); |
| 168 return 1; | 182 return 1; |
| 169 } | 183 } |
| 170 | 184 |
| 171 Ice::Converter Converter(Mod, &Ctx, Flags); | 185 Ice::Converter Converter(Mod, &Ctx, Flags); |
| 172 Converter.convertToIce(); | 186 Converter.convertToIce(); |
| 173 return Converter.getErrorStatus(); | 187 return Converter.getErrorStatus(); |
| 174 } | 188 } |
| 175 } | 189 } |
| OLD | NEW |