summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-link
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-15 03:14:06 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-15 03:14:06 +0000
commit8a7b84b4d042ea68342cf6cec87c35aeff7bf106 (patch)
tree955f1a28b9cfd361335f2abb80687920e692f91d /llvm/tools/llvm-link
parentfda02091e615ef5bfd24b96894aef72d674cfaaf (diff)
downloadbcm5719-llvm-8a7b84b4d042ea68342cf6cec87c35aeff7bf106.tar.gz
bcm5719-llvm-8a7b84b4d042ea68342cf6cec87c35aeff7bf106.zip
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
Diffstat (limited to 'llvm/tools/llvm-link')
-rw-r--r--llvm/tools/llvm-link/llvm-link.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 9d5369df66d..bcefc0b507a 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -20,7 +20,6 @@
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/UseListOrder.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/CommandLine.h"
@@ -60,6 +59,16 @@ static cl::opt<bool>
SuppressWarnings("suppress-warnings", cl::desc("Suppress all linking warnings"),
cl::init(false));
+static cl::opt<bool> PreserveBitcodeUseListOrder(
+ "preserve-bc-uselistorder",
+ cl::desc("Preserve use-list order when writing LLVM bitcode."),
+ cl::init(true), cl::Hidden);
+
+static cl::opt<bool> PreserveAssemblyUseListOrder(
+ "preserve-ll-uselistorder",
+ cl::desc("Preserve use-list order when writing LLVM assembly."),
+ cl::init(false), cl::Hidden);
+
// Read the specified bitcode file in and return it. This routine searches the
// link path for the specified file to try to find it...
//
@@ -105,11 +114,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 linker\n");
auto Composite = make_unique<Module>("llvm-link", Context);
@@ -150,10 +154,9 @@ int main(int argc, char **argv) {
if (Verbose) errs() << "Writing bitcode...\n";
if (OutputAssembly) {
- Composite->print(Out.os(), nullptr, shouldPreserveAssemblyUseListOrder());
+ Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
} else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
- WriteBitcodeToFile(Composite.get(), Out.os(),
- shouldPreserveBitcodeUseListOrder());
+ WriteBitcodeToFile(Composite.get(), Out.os(), PreserveBitcodeUseListOrder);
// Declare success.
Out.keep();
OpenPOWER on IntegriCloud