[llvm-commits] [llvm] r81859 - in /llvm/trunk: docs/CommandGuide/llvm-link.pod tools/llvm-link/llvm-link.cpp

Dan Gohman gohman at apple.com
Tue Sep 15 08:35:08 PDT 2009


Author: djg
Date: Tue Sep 15 10:35:07 2009
New Revision: 81859

URL: http://llvm.org/viewvc/llvm-project?rev=81859&view=rev
Log:
Give llvm-link a -S option.

Modified:
    llvm/trunk/docs/CommandGuide/llvm-link.pod
    llvm/trunk/tools/llvm-link/llvm-link.cpp

Modified: llvm/trunk/docs/CommandGuide/llvm-link.pod
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-link.pod?rev=81859&r1=81858&r2=81859&view=diff

==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-link.pod (original)
+++ llvm/trunk/docs/CommandGuide/llvm-link.pod Tue Sep 15 10:35:07 2009
@@ -42,6 +42,10 @@
 Specify the output file name.  If F<filename> is C<->, then B<llvm-link> will
 write its output to standard output.
 
+=item B<-S>
+
+Write output in LLVM intermediate language (instead of bitcode).
+
 =item B<-d>
 
 If specified, B<llvm-link> prints a human-readable version of the output

Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=81859&r1=81858&r2=81859&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/trunk/tools/llvm-link/llvm-link.cpp Tue Sep 15 10:35:07 2009
@@ -41,6 +41,10 @@
 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"));
 
 static cl::opt<bool>
@@ -116,7 +120,7 @@
   // 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 +136,15 @@
   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;





More information about the llvm-commits mailing list