OSDN Git Service

add a temporary -bitcode option, which instructs llvm-as to produce a bitcode file...
authorChris Lattner <sabre@nondot.org>
Sun, 22 Apr 2007 06:28:58 +0000 (06:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Apr 2007 06:28:58 +0000 (06:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36333 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-as/llvm-as.cpp

index e3dbfb4..a7463b5 100644 (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";