OLD | NEW |
1 /* Copyright 2013 The Native Client Authors. All rights reserved. | 1 /* Copyright 2013 The Native Client Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can | 2 * Use of this source code is governed by a BSD-style license that can |
3 * be found in the LICENSE file. | 3 * be found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 //===-- pnacl-freeze.cpp - The low-level NaCl bitcode freezer --------===// | 6 //===-- pnacl-freeze.cpp - The low-level NaCl bitcode freezer --------===// |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Generates NaCl pexe wire format. | 10 // Generates NaCl pexe wire format. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "llvm/IR/LLVMContext.h" | 14 #include "llvm/IR/LLVMContext.h" |
15 #include "llvm/Assembly/AssemblyAnnotationWriter.h" | |
16 // Note: We need the following to provide the API for calling the NaCl | 15 // Note: We need the following to provide the API for calling the NaCl |
17 // Bitcode Writer to generate the frozen file. | 16 // Bitcode Writer to generate the frozen file. |
18 #include "llvm/Bitcode/NaCl/NaClReaderWriter.h" | 17 #include "llvm/Bitcode/NaCl/NaClReaderWriter.h" |
19 // Note: We need the following to provide the API for calling the (LLVM) | 18 // Note: We need the following to provide the API for calling the (LLVM) |
20 // Bitcode Reader to read in the corresonding pexe file to freeze. | 19 // Bitcode Reader to read in the corresonding pexe file to freeze. |
21 #include "llvm/Bitcode/ReaderWriter.h" | 20 #include "llvm/Bitcode/ReaderWriter.h" |
22 #include "llvm/DebugInfo.h" | |
23 #include "llvm/IR/IntrinsicInst.h" | |
24 #include "llvm/IR/Module.h" | 21 #include "llvm/IR/Module.h" |
25 #include "llvm/IR/Type.h" | |
26 #include "llvm/Support/CommandLine.h" | 22 #include "llvm/Support/CommandLine.h" |
27 #include "llvm/Support/DataStream.h" | 23 #include "llvm/Support/DataStream.h" |
28 #include "llvm/Support/FormattedStream.h" | |
29 #include "llvm/Support/ManagedStatic.h" | 24 #include "llvm/Support/ManagedStatic.h" |
30 #include "llvm/Support/MemoryBuffer.h" | |
31 #include "llvm/Support/PrettyStackTrace.h" | 25 #include "llvm/Support/PrettyStackTrace.h" |
32 #include "llvm/Support/Signals.h" | 26 #include "llvm/Support/Signals.h" |
33 #include "llvm/Support/ToolOutputFile.h" | 27 #include "llvm/Support/ToolOutputFile.h" |
34 #include "llvm/Support/system_error.h" | |
35 | |
36 // llvm/Bitcode/BitstreamWriter.h | |
37 | 28 |
38 using namespace llvm; | 29 using namespace llvm; |
39 | 30 |
40 | 31 |
41 static cl::opt<std::string> | 32 static cl::opt<std::string> |
42 OutputFilename("o", cl::desc("Specify output filename"), | 33 OutputFilename("o", cl::desc("Specify output filename"), |
43 cl::value_desc("filename")); | 34 cl::value_desc("filename")); |
44 | 35 |
45 static cl::opt<std::string> | 36 static cl::opt<std::string> |
46 InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::Required); | 37 InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::Required); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (ErrorMessage.size()) | 85 if (ErrorMessage.size()) |
95 errs() << ErrorMessage << "\n"; | 86 errs() << ErrorMessage << "\n"; |
96 else | 87 else |
97 errs() << "bitcode didn't read correctly.\n"; | 88 errs() << "bitcode didn't read correctly.\n"; |
98 return 1; | 89 return 1; |
99 } | 90 } |
100 | 91 |
101 WriteOutputFile(M.get()); | 92 WriteOutputFile(M.get()); |
102 return 0; | 93 return 0; |
103 } | 94 } |
OLD | NEW |