[llvm] r224186 - Rename argument strings of codegen passes to avoid collisions with command line
Akira Hatanaka
ahatanaka at apple.com
Fri Dec 12 20:52:04 PST 2014
Author: ahatanak
Date: Fri Dec 12 22:52:04 2014
New Revision: 224186
URL: http://llvm.org/viewvc/llvm-project?rev=224186&view=rev
Log:
Rename argument strings of codegen passes to avoid collisions with command line
options.
This commit changes the command line arguments (PassInfo::PassArgument) of two
passes, MachineFunctionPrinter and MachineScheduler, to avoid collisions with
command line options that have the same argument strings.
This bug manifests when the PassList construct (defined in opt.cpp) is used
in a tool that links with codegen passes. To reproduce the bug, paste the
following lines into llc.cpp and run llc.
#include "llvm/IR/LegacyPassNameParser.h"
static llvm::cl::list<const llvm::PassInfo*, bool, llvm::PassNameParser>
PassList(llvm::cl::desc("Optimizations available:"));
rdar://problem/19212448
Modified:
llvm/trunk/lib/CodeGen/MachineFunctionPrinterPass.cpp
llvm/trunk/lib/CodeGen/MachineScheduler.cpp
llvm/trunk/lib/CodeGen/Passes.cpp
llvm/trunk/test/CodeGen/Generic/print-machineinstrs.ll
Modified: llvm/trunk/lib/CodeGen/MachineFunctionPrinterPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPrinterPass.cpp?rev=224186&r1=224185&r2=224186&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionPrinterPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionPrinterPass.cpp Fri Dec 12 22:52:04 2014
@@ -52,7 +52,7 @@ char MachineFunctionPrinterPass::ID = 0;
}
char &llvm::MachineFunctionPrinterPassID = MachineFunctionPrinterPass::ID;
-INITIALIZE_PASS(MachineFunctionPrinterPass, "print-machineinstrs",
+INITIALIZE_PASS(MachineFunctionPrinterPass, "machineinstr-printer",
"Machine Function Printer", false, false)
namespace llvm {
Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=224186&r1=224185&r2=224186&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Fri Dec 12 22:52:04 2014
@@ -144,12 +144,12 @@ char MachineScheduler::ID = 0;
char &llvm::MachineSchedulerID = MachineScheduler::ID;
-INITIALIZE_PASS_BEGIN(MachineScheduler, "misched",
+INITIALIZE_PASS_BEGIN(MachineScheduler, "machine-scheduler",
"Machine Instruction Scheduler", false, false)
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
-INITIALIZE_PASS_END(MachineScheduler, "misched",
+INITIALIZE_PASS_END(MachineScheduler, "machine-scheduler",
"Machine Instruction Scheduler", false, false)
MachineScheduler::MachineScheduler()
Modified: llvm/trunk/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Passes.cpp?rev=224186&r1=224185&r2=224186&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Passes.cpp (original)
+++ llvm/trunk/lib/CodeGen/Passes.cpp Fri Dec 12 22:52:04 2014
@@ -520,7 +520,7 @@ void TargetPassConfig::addMachinePasses(
.equals("option-unspecified")) {
const PassRegistry *PR = PassRegistry::getPassRegistry();
const PassInfo *TPI = PR->getPassInfo(PrintMachineInstrs.getValue());
- const PassInfo *IPI = PR->getPassInfo(StringRef("print-machineinstrs"));
+ const PassInfo *IPI = PR->getPassInfo(StringRef("machineinstr-printer"));
assert (TPI && IPI && "Pass ID not registered!");
const char *TID = (const char *)(TPI->getTypeInfo());
const char *IID = (const char *)(IPI->getTypeInfo());
Modified: llvm/trunk/test/CodeGen/Generic/print-machineinstrs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/print-machineinstrs.ll?rev=224186&r1=224185&r2=224186&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/print-machineinstrs.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/print-machineinstrs.ll Fri Dec 12 22:52:04 2014
@@ -3,7 +3,7 @@
; RUN: llc < %s -O3 -debug-pass=Structure -print-machineinstrs= -o /dev/null 2>&1 | FileCheck %s
define i64 @foo(i64 %a, i64 %b) nounwind {
-; CHECK: -branch-folder -print-machineinstrs
+; CHECK: -branch-folder -machineinstr-printer
; CHECK: Control Flow Optimizer
; CHECK-NEXT: MachineFunction Printer
; CHECK: Machine code for function foo:
More information about the llvm-commits
mailing list