From 164cb69e045f91900410781605cff7e5594460f2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Oct 2001 23:23:33 +0000 Subject: [PATCH] Add a new -d argument to dump the internal rep as assembly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@804 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/link/link.cpp | 5 +++++ tools/llvm-link/llvm-link.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/link/link.cpp b/tools/link/link.cpp index 8dbcf4895ce..e9e9ac17263 100644 --- a/tools/link/link.cpp +++ b/tools/link/link.cpp @@ -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 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(), diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 8dbcf4895ce..e9e9ac17263 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -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 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(), -- 2.34.1