Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: tools/pnacl-thaw/pnacl-thaw.cpp

Issue 14314016: Copy LLVM bitcode reader to generate a PNaCl wire format reader. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/pnacl-thaw/Makefile ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pnacl-thaw/pnacl-thaw.cpp
diff --git a/tools/pnacl-freeze/pnacl-freeze.cpp b/tools/pnacl-thaw/pnacl-thaw.cpp
similarity index 72%
copy from tools/pnacl-freeze/pnacl-freeze.cpp
copy to tools/pnacl-thaw/pnacl-thaw.cpp
index 963000a714a5063d224e00bc328348bcd343eba1..b28c357165779af6ec11dd6e5e19cb225e8b7f31 100644
--- a/tools/pnacl-freeze/pnacl-freeze.cpp
+++ b/tools/pnacl-thaw/pnacl-thaw.cpp
@@ -3,20 +3,20 @@
* be found in the LICENSE file.
*/
-//===-- pnacl-freeze.cpp - The low-level NaCl bitcode freezer --------===//
+//===-- pnacl-thaw.cpp - The low-level NaCl bitcode thawer ----------------===//
//
//===----------------------------------------------------------------------===//
//
-// Generates NaCl pexe wire format.
+// Converts NaCl wire format back to LLVM bitcode.
//
//===----------------------------------------------------------------------===//
#include "llvm/IR/LLVMContext.h"
// Note: We need the following to provide the API for calling the NaCl
-// Bitcode Writer to generate the frozen file.
+// Bitcode Reader to read the frozen file.
#include "llvm/Bitcode/NaCl/NaClReaderWriter.h"
// Note: We need the following to provide the API for calling the (LLVM)
-// Bitcode Reader to read in the corresonding pexe file to freeze.
+// Bitcode Writer to generate the corresponding LLVM bitcode file.
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
@@ -28,29 +28,28 @@
using namespace llvm;
-
static cl::opt<std::string>
-OutputFilename("o", cl::desc("Specify output filename"),
+OutputFilename("o", cl::desc("Specify thawed pexe filename"),
cl::value_desc("filename"));
static cl::opt<std::string>
-InputFilename(cl::Positional, cl::desc("<pexe file>"), cl::Required);
+InputFilename(cl::Positional, cl::desc("<frozen file>"), cl::Required);
static void WriteOutputFile(const Module *M) {
- std::string FrozenFilename =
- (OutputFilename.size() == 0 ? (InputFilename + ".frozen") : OutputFilename);
+ std::string ThawedFilename =
+ (OutputFilename.size() == 0 ? (InputFilename + ".thawed") : OutputFilename);
std::string ErrorInfo;
OwningPtr<tool_output_file> Out
- (new tool_output_file(FrozenFilename.c_str(), ErrorInfo,
+ (new tool_output_file(ThawedFilename.c_str(), ErrorInfo,
raw_fd_ostream::F_Binary));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
exit(1);
}
- NaClWriteBitcodeToFile(M, Out->os());
+ WriteBitcodeToFile(M, Out->os());
// Declare success.
Out->keep();
@@ -64,7 +63,8 @@ int main(int argc, char **argv) {
LLVMContext &Context = getGlobalContext();
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "Generates NaCl pexe wire format\n");
+ cl::ParseCommandLineOptions(
+ argc, argv, "Converts NaCl pexe wire format into LLVM bitcode format\n");
std::string ErrorMessage;
std::auto_ptr<Module> M;
@@ -73,8 +73,8 @@ int main(int argc, char **argv) {
DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
if (streamer) {
std::string DisplayFilename = InputFilename;
- M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context,
- &ErrorMessage));
+ M.reset(getNaClStreamedBitcodeModule(DisplayFilename, streamer, Context,
+ &ErrorMessage));
if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) {
M.reset();
}
« no previous file with comments | « tools/pnacl-thaw/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698