| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 cl::init(""), cl::value_desc("prefix")); | 81 cl::init(""), cl::value_desc("prefix")); |
| 82 static cl::opt<bool> | 82 static cl::opt<bool> |
| 83 DisableInternal("external", | 83 DisableInternal("external", |
| 84 cl::desc("Disable 'internal' linkage type for testing")); | 84 cl::desc("Disable 'internal' linkage type for testing")); |
| 85 static cl::opt<bool> | 85 static cl::opt<bool> |
| 86 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); | 86 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); |
| 87 | 87 |
| 88 static cl::opt<bool> SubzeroTimingEnabled( | 88 static cl::opt<bool> SubzeroTimingEnabled( |
| 89 "timing", cl::desc("Enable breakdown timing of Subzero translation")); | 89 "timing", cl::desc("Enable breakdown timing of Subzero translation")); |
| 90 | 90 |
| 91 static cl::opt<bool> |
| 92 DisableGlobals("disable-globals", |
| 93 cl::desc("Disable global initializer translation")); |
| 94 |
| 91 static cl::opt<NaClFileFormat> InputFileFormat( | 95 static cl::opt<NaClFileFormat> InputFileFormat( |
| 92 "bitcode-format", cl::desc("Define format of input file:"), | 96 "bitcode-format", cl::desc("Define format of input file:"), |
| 93 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"), | 97 cl::values(clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"), |
| 94 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"), | 98 clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"), |
| 95 clEnumValEnd), | 99 clEnumValEnd), |
| 96 cl::init(LLVMFormat)); | 100 cl::init(LLVMFormat)); |
| 97 | 101 |
| 98 static cl::opt<bool> | 102 static cl::opt<bool> |
| 99 BuildOnRead("build-on-read", | 103 BuildOnRead("build-on-read", |
| 100 cl::desc("Build ICE instructions when reading bitcode"), | 104 cl::desc("Build ICE instructions when reading bitcode"), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 121 } | 125 } |
| 122 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); | 126 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); |
| 123 Ls->SetUnbuffered(); | 127 Ls->SetUnbuffered(); |
| 124 | 128 |
| 125 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix); | 129 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix); |
| 126 | 130 |
| 127 Ice::ClFlags Flags; | 131 Ice::ClFlags Flags; |
| 128 Flags.DisableInternal = DisableInternal; | 132 Flags.DisableInternal = DisableInternal; |
| 129 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 133 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
| 130 Flags.DisableTranslation = DisableTranslation; | 134 Flags.DisableTranslation = DisableTranslation; |
| 135 Flags.DisableGlobals = DisableGlobals; |
| 131 | 136 |
| 132 if (BuildOnRead) { | 137 if (BuildOnRead) { |
| 133 Ice::PNaClTranslator Translator(&Ctx, Flags); | 138 Ice::PNaClTranslator Translator(&Ctx, Flags); |
| 134 Translator.translate(IRFilename); | 139 Translator.translate(IRFilename); |
| 135 return Translator.getErrorStatus(); | 140 return Translator.getErrorStatus(); |
| 136 } else { | 141 } else { |
| 137 // Parse the input LLVM IR file into a module. | 142 // Parse the input LLVM IR file into a module. |
| 138 SMDiagnostic Err; | 143 SMDiagnostic Err; |
| 139 Ice::Timer T; | 144 Ice::Timer T; |
| 140 Module *Mod = | 145 Module *Mod = |
| 141 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 146 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); |
| 142 | 147 |
| 143 if (SubzeroTimingEnabled) { | 148 if (SubzeroTimingEnabled) { |
| 144 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() | 149 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() |
| 145 << " sec\n"; | 150 << " sec\n"; |
| 146 } | 151 } |
| 147 | 152 |
| 148 if (!Mod) { | 153 if (!Mod) { |
| 149 Err.print(argv[0], errs()); | 154 Err.print(argv[0], errs()); |
| 150 return 1; | 155 return 1; |
| 151 } | 156 } |
| 152 | 157 |
| 153 Ice::Converter Converter(&Ctx, Flags); | 158 Ice::Converter Converter(&Ctx, Flags); |
| 154 Converter.convertToIce(Mod); | 159 Converter.convertToIce(Mod); |
| 155 return Converter.getErrorStatus(); | 160 return Converter.getErrorStatus(); |
| 156 } | 161 } |
| 157 } | 162 } |
| OLD | NEW |