From 8a7b84b4d042ea68342cf6cec87c35aeff7bf106 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 15 Apr 2015 03:14:06 +0000 Subject: uselistorder: Remove the global bits Remove all the global bits to do with preserving use-list order by moving the `cl::opt`s to the individual tools that want them. There's a minor functionality change to `libLTO`, in that you can't send in `-preserve-bc-uselistorder=false`, but making that bit settable (if it's worth doing) should be through explicit LTO API. As a drive-by fix, I removed some includes of `UseListOrder.h` that were made unnecessary by recent commits. llvm-svn: 234973 --- llvm/tools/llvm-extract/llvm-extract.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'llvm/tools/llvm-extract') diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index 1a477934357..936496cd7fe 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -19,7 +19,6 @@ #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" -#include "llvm/IR/UseListOrder.h" #include "llvm/IRReader/IRReader.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/Support/CommandLine.h" @@ -91,6 +90,16 @@ static cl::opt OutputAssembly("S", cl::desc("Write output as LLVM assembly"), cl::Hidden); +static cl::opt PreserveBitcodeUseListOrder( + "preserve-bc-uselistorder", + cl::desc("Preserve use-list order when writing LLVM bitcode."), + cl::init(true), cl::Hidden); + +static cl::opt PreserveAssemblyUseListOrder( + "preserve-ll-uselistorder", + cl::desc("Preserve use-list order when writing LLVM assembly."), + cl::init(false), cl::Hidden); + int main(int argc, char **argv) { // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); @@ -98,11 +107,6 @@ int main(int argc, char **argv) { LLVMContext &Context = getGlobalContext(); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. - - // Turn on -preserve-bc-uselistorder by default, but let the command-line - // override it. - setPreserveBitcodeUseListOrder(true); - cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n"); // Use lazy loading, since we only care about selected global values. @@ -270,11 +274,10 @@ int main(int argc, char **argv) { } if (OutputAssembly) - Passes.add(createPrintModulePass(Out.os(), "", - shouldPreserveAssemblyUseListOrder())); - else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true)) Passes.add( - createBitcodeWriterPass(Out.os(), shouldPreserveBitcodeUseListOrder())); + createPrintModulePass(Out.os(), "", PreserveAssemblyUseListOrder)); + else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true)) + Passes.add(createBitcodeWriterPass(Out.os(), PreserveBitcodeUseListOrder)); Passes.run(*M.get()); -- cgit v1.2.3