From 27bb3af61c44f92bb3939e7020ee61fb0779e46a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 22 Apr 2007 06:28:58 +0000 Subject: [PATCH] add a temporary -bitcode option, which instructs llvm-as to produce a bitcode file instead of a bytecode file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36333 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-as/llvm-as.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index e3dbfb46be9..a7463b532eb 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -19,6 +19,7 @@ #include "llvm/Assembly/Parser.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Analysis/Verifier.h" +#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Streams.h" @@ -50,6 +51,10 @@ static cl::opt DisableVerify("disable-verify", cl::Hidden, cl::desc("Do not run verifier on input LLVM (dangerous!)")); +static cl::opt +EnableBitcode("bitcode", cl::desc("Emit bitcode")); + + int main(int argc, char **argv) { llvm_shutdown_obj X; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n"); @@ -130,8 +135,12 @@ int main(int argc, char **argv) { } if (Force || !CheckBytecodeOutputToConsole(Out,true)) { - OStream L(*Out); - WriteBytecodeToFile(M.get(), L, !NoCompress); + if (EnableBitcode) { + WriteBitcodeToFile(M.get(), *Out); + } else { + OStream L(*Out); + WriteBytecodeToFile(M.get(), L, !NoCompress); + } } } catch (const std::string& msg) { cerr << argv[0] << ": " << msg << "\n"; -- 2.34.1