diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-05-24 12:04:22 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-05-24 12:04:22 -0700 |
commit | fde18fe06ae70f60e0f184a9d384055c4f08cbbb (patch) | |
tree | 96a77030079d2d53a706131a39e606db31bd19dc /tools/llvm-as/llvm-as.cpp | |
parent | 80b7ba7480724c773b96da24999d817b6b46ef29 (diff) |
Allow generation of pnacl bitcode files in several llvm commnads.
Adds command line option '-pnacl-freeze' to generate a pnacl bit code file
instead of an llvm bitcode file.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405
R=dschuff@chromium.org
Review URL: https://codereview.chromium.org/15178005
Diffstat (limited to 'tools/llvm-as/llvm-as.cpp')
-rw-r--r-- | tools/llvm-as/llvm-as.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 273c4274b5..57820a59bd 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -19,6 +19,9 @@ #include "llvm/Analysis/Verifier.h" #include "llvm/Assembly/Parser.h" #include "llvm/Bitcode/ReaderWriter.h" +// @LOCALMOD-BEGIN +#include "llvm/Bitcode/NaCl/NaClReaderWriter.h" +// @LOCALMOD-END #include "llvm/IR/Module.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" @@ -50,6 +53,13 @@ static cl::opt<bool> DisableVerify("disable-verify", cl::Hidden, cl::desc("Do not run verifier on input LLVM (dangerous!)")); +// @LOCALMOD-BEGIN +static cl::opt<bool> +GeneratePNaClBitcode("pnacl-freeze", + cl::desc("Generate a pnacl-frozen bitcode file"), + cl::init(false)); +// @LOCALMOD-END + static void WriteOutputFile(const Module *M) { // Infer the output filename if needed. if (OutputFilename.empty()) { @@ -77,8 +87,14 @@ static void WriteOutputFile(const Module *M) { exit(1); } - if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) - WriteBitcodeToFile(M, Out->os()); + // @LOCALMOD-BEGIN + if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) { + if (GeneratePNaClBitcode) + NaClWriteBitcodeToFile(M, Out->os()); + else + WriteBitcodeToFile(M, Out->os()); + } + // @LOCALMOD-END // Declare success. Out->keep(); |