add a temporary -bitcode option, which instructs llvm-as to produce a bitcode file instead of a bytecode file

llvm-svn: 36333
This commit is contained in:
Chris Lattner 2007-04-22 06:28:58 +00:00
parent 20571d9c35
commit 52e1f0f297
1 changed files with 11 additions and 2 deletions

View File

@ -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<bool>
DisableVerify("disable-verify", cl::Hidden,
cl::desc("Do not run verifier on input LLVM (dangerous!)"));
static cl::opt<bool>
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";