From: Dan Gohman Date: Tue, 15 Sep 2009 15:35:07 +0000 (+0000) Subject: Give llvm-link a -S option. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a93f30ee65e2fa48c8caff7d5c3052559b0829fb;p=oota-llvm.git Give llvm-link a -S option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81859 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/CommandGuide/llvm-link.pod b/docs/CommandGuide/llvm-link.pod index 8a2a8c5d770..e1a1267c52e 100644 --- a/docs/CommandGuide/llvm-link.pod +++ b/docs/CommandGuide/llvm-link.pod @@ -42,6 +42,10 @@ B will write raw bitcode regardless of the output device. Specify the output file name. If F is C<->, then B 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 prints a human-readable version of the output diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index cb741991bc4..fae4d107b1a 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -40,6 +40,10 @@ OutputFilename("o", cl::desc("Override output filename"), cl::init("-"), static cl::opt Force("f", cl::desc("Enable binary output on terminals")); +static cl::opt +OutputAssembly("S", + cl::desc("Write output as LLVM assembly"), cl::Hidden); + static cl::opt Verbose("v", cl::desc("Print information about actions taken")); @@ -116,7 +120,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 @@ -132,13 +136,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;