aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Schimpf <kschimpf@google.com>2013-06-05 09:34:46 -0700
committerKarl Schimpf <kschimpf@google.com>2013-06-05 09:34:46 -0700
commit69a8e32d4f4451e11cda6d48b318ba4f7e01c683 (patch)
tree4bfc77a36fa3e648b7d0d9b7a463c6b1180add47
parent70fa5e76093e7566e92786d5cc25ef1792b7cea1 (diff)
Change CL flag -pnacl-freeze to -bitcode-format={llvm,pnacl}.
Also removes flag from llvm-as.cpp and LTOCodeGenerator.cpp since one should call pnacl-finalize to transform pexe's to PNaCl bitcode form. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=dschuff@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/16295014
-rw-r--r--tools/llvm-as/CMakeLists.txt2
-rw-r--r--tools/llvm-as/LLVMBuild.txt2
-rw-r--r--tools/llvm-as/Makefile2
-rw-r--r--tools/llvm-as/llvm-as.cpp15
-rw-r--r--tools/lto/CMakeLists.txt2
-rw-r--r--tools/lto/LTOCodeGenerator.cpp17
-rw-r--r--tools/lto/Makefile2
-rw-r--r--tools/opt/opt.cpp33
8 files changed, 32 insertions, 43 deletions
diff --git a/tools/llvm-as/CMakeLists.txt b/tools/llvm-as/CMakeLists.txt
index c7a017afc3..d5620e7297 100644
--- a/tools/llvm-as/CMakeLists.txt
+++ b/tools/llvm-as/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_LINK_COMPONENTS asmparser bitwriter naclbitwriter)
+set(LLVM_LINK_COMPONENTS asmparser bitwriter)
add_llvm_tool(llvm-as
llvm-as.cpp
diff --git a/tools/llvm-as/LLVMBuild.txt b/tools/llvm-as/LLVMBuild.txt
index 166bcc5120..542470bbdd 100644
--- a/tools/llvm-as/LLVMBuild.txt
+++ b/tools/llvm-as/LLVMBuild.txt
@@ -19,4 +19,4 @@
type = Tool
name = llvm-as
parent = Tools
-required_libraries = AsmParser BitWriter NaClBitWriter
+required_libraries = AsmParser BitWriter
diff --git a/tools/llvm-as/Makefile b/tools/llvm-as/Makefile
index d7c3d35f40..dfd71b295a 100644
--- a/tools/llvm-as/Makefile
+++ b/tools/llvm-as/Makefile
@@ -9,7 +9,7 @@
LEVEL := ../..
TOOLNAME := llvm-as
-LINK_COMPONENTS := asmparser bitwriter naclbitwriter
+LINK_COMPONENTS := asmparser bitwriter
# This tool has no plugins, optimize startup time.
TOOL_NO_EXPORTS := 1
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index 57820a59bd..c9dda85c79 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -19,9 +19,6 @@
#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"
@@ -53,13 +50,6 @@ 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()) {
@@ -89,10 +79,7 @@ static void WriteOutputFile(const Module *M) {
// @LOCALMOD-BEGIN
if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) {
- if (GeneratePNaClBitcode)
- NaClWriteBitcodeToFile(M, Out->os());
- else
- WriteBitcodeToFile(M, Out->os());
+ WriteBitcodeToFile(M, Out->os());
}
// @LOCALMOD-END
diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
index e984601ced..5820b1415b 100644
--- a/tools/lto/CMakeLists.txt
+++ b/tools/lto/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
- ipo scalaropts linker bitreader bitwriter naclbitwriter mcdisassembler vectorize)
+ ipo scalaropts linker bitreader bitwriter mcdisassembler vectorize)
add_definitions( -DLLVM_VERSION_INFO=\"${PACKAGE_VERSION}\" )
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index a8959aeae4..cb0e41fff5 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -18,7 +18,6 @@
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Bitcode/NaCl/NaClReaderWriter.h" // @LOCALMOD
#include "llvm/CodeGen/IntrinsicLowering.h" // @LOCALMOD
#include "llvm/Config/config.h"
#include "llvm/IR/Constants.h"
@@ -56,14 +55,6 @@ static cl::opt<bool>
DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false),
cl::desc("Do not run the GVN load PRE pass"));
-// @LOCALMOD-BEGIN
-static llvm::cl::opt<bool>
-GeneratePNaClBitcode("pnacl-freeze",
- llvm::cl::desc("Generate a pnacl-frozen bitcode file"),
- llvm::cl::init(false));
-
-// @LOCALMOD-END
-
const char* LTOCodeGenerator::getVersionString() {
#ifdef LLVM_VERSION_INFO
return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
@@ -295,13 +286,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
return true;
}
- // @LOCALMOD-BEGIN
- // write bitcode to it
- if (GeneratePNaClBitcode)
- NaClWriteBitcodeToFile(_linker.getModule(), Out.os());
- else
- WriteBitcodeToFile(_linker.getModule(), Out.os());
- // @LOCALMOD-END
+ WriteBitcodeToFile(_linker.getModule(), Out.os());
Out.os().close();
if (Out.os().has_error()) {
diff --git a/tools/lto/Makefile b/tools/lto/Makefile
index 082082026c..c13a0ba7f6 100644
--- a/tools/lto/Makefile
+++ b/tools/lto/Makefile
@@ -10,7 +10,7 @@
LEVEL := ../..
LIBRARYNAME := LTO
LINK_COMPONENTS := all-targets ipo scalaropts linker bitreader bitwriter \
- naclbitwriter mcdisassembler vectorize
+ mcdisassembler vectorize
LINK_LIBS_IN_SHARED := 1
SHARED_LIBRARY := 1
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 135b36e3db..81006c3507 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -171,10 +171,20 @@ DefaultDataLayout("default-data-layout",
cl::value_desc("layout-string"), cl::init(""));
// @LOCALMOD-BEGIN
-static cl::opt<bool>
-GeneratePNaClBitcode("pnacl-freeze",
- cl::desc("Generate a pnacl-frozen bitcode file"),
- cl::init(false));
+enum BcFormat {
+ LLVMFormat,
+ PNaClFormat
+};
+
+static cl::opt<BcFormat>
+BitcodeFormat(
+ "bitcode-format",
+ cl::desc("Define format of generated bitcode file:"),
+ cl::values(
+ clEnumValN(LLVMFormat, "llvm", "LLVM bitcode (default)"),
+ clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode"),
+ clEnumValEnd),
+ cl::init(LLVMFormat));
// @LOCALMOD-END
// ---------- Define Printers for module and function passes ------------
@@ -891,10 +901,17 @@ int main(int argc, char **argv) {
// @LOCALMOD-BEGIN
// Write bitcode to the output.
if (!NoOutput && !AnalyzeOnly && !OutputAssembly) {
- if (GeneratePNaClBitcode)
- NaClWriteBitcodeToFile(M.get(), Out->os());
- else
- WriteBitcodeToFile(M.get(), Out->os());
+ switch (BitcodeFormat) {
+ case LLVMFormat:
+ WriteBitcodeToFile(M.get(), Out->os());
+ break;
+ case PNaClFormat:
+ NaClWriteBitcodeToFile(M.get(), Out->os());
+ break;
+ default:
+ errs() << "Don't understand bitcode format for generated bitcode.\n";
+ return 1;
+ }
}
// @LOCALMOD-END