Add a new -d argument to dump the internal rep as assembly.
authorChris Lattner <sabre@nondot.org>
Sun, 14 Oct 2001 23:23:33 +0000 (23:23 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 14 Oct 2001 23:23:33 +0000 (23:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@804 91177308-0d34-0410-b5e6-96231b3b80d8

tools/link/link.cpp
tools/llvm-link/llvm-link.cpp

index 8dbcf4895cec414eba810b841e4465cb90bb4398..e9e9ac17263e695081aa01530de669af1282d186 100644 (file)
@@ -9,6 +9,7 @@
 #include "llvm/Transforms/Linker.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Writer.h"
+#include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
@@ -20,6 +21,7 @@ cl::StringList InputFilenames("", "Load <arg> files, linking them together",
                              cl::OneOrMore);
 cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
 cl::Flag   Force         ("f", "Overwrite output files", cl::NoFlags, false);
+cl::Flag   DumpAsm       ("d", "Print assembly as linked", cl::Hidden, false);
 
 
 int main(int argc, char **argv) {
@@ -47,6 +49,9 @@ int main(int argc, char **argv) {
     }
   }
 
+  if (DumpAsm)
+    cerr << "Here's the assembly:\n" << Composite.get();
+
   ostream *Out = &cout;  // Default to printing to stdout...
   if (OutputFilename != "-") {
     Out = new ofstream(OutputFilename.c_str(), 
index 8dbcf4895cec414eba810b841e4465cb90bb4398..e9e9ac17263e695081aa01530de669af1282d186 100644 (file)
@@ -9,6 +9,7 @@
 #include "llvm/Transforms/Linker.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Bytecode/Writer.h"
+#include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
@@ -20,6 +21,7 @@ cl::StringList InputFilenames("", "Load <arg> files, linking them together",
                              cl::OneOrMore);
 cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
 cl::Flag   Force         ("f", "Overwrite output files", cl::NoFlags, false);
+cl::Flag   DumpAsm       ("d", "Print assembly as linked", cl::Hidden, false);
 
 
 int main(int argc, char **argv) {
@@ -47,6 +49,9 @@ int main(int argc, char **argv) {
     }
   }
 
+  if (DumpAsm)
+    cerr << "Here's the assembly:\n" << Composite.get();
+
   ostream *Out = &cout;  // Default to printing to stdout...
   if (OutputFilename != "-") {
     Out = new ofstream(OutputFilename.c_str(),