SubRegIndex'ize Mips
[oota-llvm.git] / tools / llvm-link / llvm-link.cpp
index cb741991bc49654f6da05de24a7eef37cfc8f8bd..c60e56ae9b6e78765631b5bc5609cef3deb087c3 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/SystemUtils.h"
@@ -40,6 +39,10 @@ OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
 static cl::opt<bool>
 Force("f", cl::desc("Enable binary output on terminals"));
 
+static cl::opt<bool>
+OutputAssembly("S",
+         cl::desc("Write output as LLVM assembly"), cl::Hidden);
+
 static cl::opt<bool>
 Verbose("v", cl::desc("Print information about actions taken"));
 
@@ -116,7 +119,7 @@ int main(int argc, char **argv) {
   // TODO: Iterate over the -l list and link in any modules containing
   // global symbols that have not been resolved so far.
 
-  if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite.get();
+  if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
 
   std::string ErrorInfo;
   std::auto_ptr<raw_ostream> 
@@ -132,13 +135,15 @@ int main(int argc, char **argv) {
   if (OutputFilename != "-")
     sys::RemoveFileOnSignal(sys::Path(OutputFilename));
 
-  if (verifyModule(*Composite.get())) {
+  if (verifyModule(*Composite)) {
     errs() << argv[0] << ": linked module is broken!\n";
     return 1;
   }
 
   if (Verbose) errs() << "Writing bitcode...\n";
-  if (Force || !CheckBitcodeOutputToConsole(*Out, true))
+  if (OutputAssembly) {
+    *Out << *Composite;
+  } else if (Force || !CheckBitcodeOutputToConsole(*Out, true))
     WriteBitcodeToFile(Composite.get(), *Out);
 
   return 0;