[opt] Remove obsolete --quiet option

git blame shows these were last touched in 2004?
 Obsoleted in r13844.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D83409
This commit is contained in:
Arthur Eubanks 2020-07-08 13:20:34 -07:00
parent 6e089e98a9
commit 930eaadacf
8 changed files with 50 additions and 81 deletions

View File

@ -15,17 +15,16 @@
#define LLVM_SUPPORT_SYSTEMUTILS_H #define LLVM_SUPPORT_SYSTEMUTILS_H
namespace llvm { namespace llvm {
class raw_ostream; class raw_ostream;
/// Determine if the raw_ostream provided is connected to a terminal. If so, /// Determine if the raw_ostream provided is connected to a terminal. If so,
/// generate a warning message to errs() advising against display of bitcode /// generate a warning message to errs() advising against display of bitcode
/// and return true. Otherwise just return false. /// and return true. Otherwise just return false.
/// Check for output written to a console /// Check for output written to a console
bool CheckBitcodeOutputToConsole( bool CheckBitcodeOutputToConsole(
raw_ostream &stream_to_check, ///< The stream to be checked raw_ostream &stream_to_check ///< The stream to be checked
bool print_warning = true ///< Control whether warnings are printed
); );
} // End llvm namespace } // namespace llvm
#endif #endif

View File

@ -15,15 +15,12 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check, bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check) {
bool print_warning) {
if (stream_to_check.is_displayed()) { if (stream_to_check.is_displayed()) {
if (print_warning) { errs() << "WARNING: You're attempting to print out a bitcode file.\n"
errs() << "WARNING: You're attempting to print out a bitcode file.\n" "This is inadvisable as it may cause display problems. If\n"
"This is inadvisable as it may cause display problems. If\n" "you REALLY want to taste LLVM bitcode first-hand, you\n"
"you REALLY want to taste LLVM bitcode first-hand, you\n" "can force output with the `-f' option.\n\n";
"can force output with the `-f' option.\n\n";
}
return true; return true;
} }
return false; return false;

View File

@ -88,7 +88,7 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
exit(1); exit(1);
} }
if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) { if (Force || !CheckBitcodeOutputToConsole(Out->os())) {
const ModuleSummaryIndex *IndexToWrite = nullptr; const ModuleSummaryIndex *IndexToWrite = nullptr;
// Don't attempt to write a summary index unless it contains any entries or // Don't attempt to write a summary index unless it contains any entries or
// has non-zero flags. The latter is used to assemble dummy index files for // has non-zero flags. The latter is used to assemble dummy index files for

View File

@ -381,7 +381,7 @@ int main(int argc, char **argv) {
if (OutputAssembly) if (OutputAssembly)
Passes.add( Passes.add(
createPrintModulePass(Out.os(), "", PreserveAssemblyUseListOrder)); createPrintModulePass(Out.os(), "", PreserveAssemblyUseListOrder));
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true)) else if (Force || !CheckBitcodeOutputToConsole(Out.os()))
Passes.add(createBitcodeWriterPass(Out.os(), PreserveBitcodeUseListOrder)); Passes.add(createBitcodeWriterPass(Out.os(), PreserveBitcodeUseListOrder));
Passes.run(*M.get()); Passes.run(*M.get());

View File

@ -399,7 +399,7 @@ int main(int argc, char **argv) {
errs() << "Writing bitcode...\n"; errs() << "Writing bitcode...\n";
if (OutputAssembly) { if (OutputAssembly) {
Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder); Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
} else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true)) } else if (Force || !CheckBitcodeOutputToConsole(Out.os()))
WriteBitcodeToFile(*Composite, Out.os(), PreserveBitcodeUseListOrder); WriteBitcodeToFile(*Composite, Out.os(), PreserveBitcodeUseListOrder);
// Declare success. // Declare success.

View File

@ -33,18 +33,16 @@ struct FunctionPassPrinter : public FunctionPass {
raw_ostream &Out; raw_ostream &Out;
static char ID; static char ID;
std::string PassName; std::string PassName;
bool QuietPass;
FunctionPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet) FunctionPassPrinter(const PassInfo *PI, raw_ostream &out)
: FunctionPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) { : FunctionPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName()); std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "FunctionPass Printer: " + PassToPrintName; PassName = "FunctionPass Printer: " + PassToPrintName;
} }
bool runOnFunction(Function &F) override { bool runOnFunction(Function &F) override {
if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName()
Out << "Printing analysis '" << PassToPrint->getPassName() << "' for function '" << F.getName() << "':\n";
<< "' for function '" << F.getName() << "':\n";
// Get and print pass... // Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, F.getParent()); getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, F.getParent());
@ -66,17 +64,15 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
const PassInfo *PassToPrint; const PassInfo *PassToPrint;
raw_ostream &Out; raw_ostream &Out;
std::string PassName; std::string PassName;
bool QuietPass;
CallGraphSCCPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet) CallGraphSCCPassPrinter(const PassInfo *PI, raw_ostream &out)
: CallGraphSCCPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) { : CallGraphSCCPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName()); std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "CallGraphSCCPass Printer: " + PassToPrintName; PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
} }
bool runOnSCC(CallGraphSCC &SCC) override { bool runOnSCC(CallGraphSCC &SCC) override {
if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass... // Get and print pass...
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
@ -103,17 +99,15 @@ struct ModulePassPrinter : public ModulePass {
const PassInfo *PassToPrint; const PassInfo *PassToPrint;
raw_ostream &Out; raw_ostream &Out;
std::string PassName; std::string PassName;
bool QuietPass;
ModulePassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet) ModulePassPrinter(const PassInfo *PI, raw_ostream &out)
: ModulePass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) { : ModulePass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName()); std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "ModulePass Printer: " + PassToPrintName; PassName = "ModulePass Printer: " + PassToPrintName;
} }
bool runOnModule(Module &M) override { bool runOnModule(Module &M) override {
if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass... // Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, &M); getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, &M);
@ -135,17 +129,15 @@ struct LoopPassPrinter : public LoopPass {
const PassInfo *PassToPrint; const PassInfo *PassToPrint;
raw_ostream &Out; raw_ostream &Out;
std::string PassName; std::string PassName;
bool QuietPass;
LoopPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet) LoopPassPrinter(const PassInfo *PI, raw_ostream &out)
: LoopPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) { : LoopPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName()); std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "LoopPass Printer: " + PassToPrintName; PassName = "LoopPass Printer: " + PassToPrintName;
} }
bool runOnLoop(Loop *L, LPPassManager &LPM) override { bool runOnLoop(Loop *L, LPPassManager &LPM) override {
if (!QuietPass) Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass... // Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()) getAnalysisID<Pass>(PassToPrint->getTypeInfo())
@ -168,20 +160,17 @@ struct RegionPassPrinter : public RegionPass {
const PassInfo *PassToPrint; const PassInfo *PassToPrint;
raw_ostream &Out; raw_ostream &Out;
std::string PassName; std::string PassName;
bool QuietPass;
RegionPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet) RegionPassPrinter(const PassInfo *PI, raw_ostream &out)
: RegionPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) { : RegionPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName()); std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "RegionPass Printer: " + PassToPrintName; PassName = "RegionPass Printer: " + PassToPrintName;
} }
bool runOnRegion(Region *R, RGPassManager &RGM) override { bool runOnRegion(Region *R, RGPassManager &RGM) override {
if (!QuietPass) { Out << "Printing analysis '" << PassToPrint->getPassName() << "' for "
Out << "Printing analysis '" << PassToPrint->getPassName() << "' for " << "region: '" << R->getNameStr() << "' in function '"
<< "region: '" << R->getNameStr() << "' in function '" << R->getEntry()->getParent()->getName() << "':\n";
<< R->getEntry()->getParent()->getName() << "':\n";
}
// Get and print pass... // Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()) getAnalysisID<Pass>(PassToPrint->getTypeInfo())
.print(Out, R->getEntry()->getParent()->getParent()); .print(Out, R->getEntry()->getParent()->getParent());
@ -201,28 +190,23 @@ char RegionPassPrinter::ID = 0;
} // end anonymous namespace } // end anonymous namespace
FunctionPass *llvm::createFunctionPassPrinter(const PassInfo *PI, FunctionPass *llvm::createFunctionPassPrinter(const PassInfo *PI,
raw_ostream &OS, bool Quiet) { raw_ostream &OS) {
return new FunctionPassPrinter(PI, OS, Quiet); return new FunctionPassPrinter(PI, OS);
} }
CallGraphSCCPass *llvm::createCallGraphPassPrinter(const PassInfo *PI, CallGraphSCCPass *llvm::createCallGraphPassPrinter(const PassInfo *PI,
raw_ostream &OS, raw_ostream &OS) {
bool Quiet) { return new CallGraphSCCPassPrinter(PI, OS);
return new CallGraphSCCPassPrinter(PI, OS, Quiet);
} }
ModulePass *llvm::createModulePassPrinter(const PassInfo *PI, raw_ostream &OS, ModulePass *llvm::createModulePassPrinter(const PassInfo *PI, raw_ostream &OS) {
bool Quiet) { return new ModulePassPrinter(PI, OS);
return new ModulePassPrinter(PI, OS, Quiet);
} }
LoopPass *llvm::createLoopPassPrinter(const PassInfo *PI, raw_ostream &OS, LoopPass *llvm::createLoopPassPrinter(const PassInfo *PI, raw_ostream &OS) {
bool Quiet) { return new LoopPassPrinter(PI, OS);
return new LoopPassPrinter(PI, OS, Quiet);
} }
RegionPass *llvm::createRegionPassPrinter(const PassInfo *PI, raw_ostream &OS, RegionPass *llvm::createRegionPassPrinter(const PassInfo *PI, raw_ostream &OS) {
bool Quiet) { return new RegionPassPrinter(PI, OS);
return new RegionPassPrinter(PI, OS, Quiet);
} }

View File

@ -24,20 +24,16 @@ class PassInfo;
class raw_ostream; class raw_ostream;
class RegionPass; class RegionPass;
FunctionPass *createFunctionPassPrinter(const PassInfo *PI, raw_ostream &out, FunctionPass *createFunctionPassPrinter(const PassInfo *PI, raw_ostream &out);
bool Quiet);
CallGraphSCCPass *createCallGraphPassPrinter(const PassInfo *PI, CallGraphSCCPass *createCallGraphPassPrinter(const PassInfo *PI,
raw_ostream &out, bool Quiet); raw_ostream &out);
ModulePass *createModulePassPrinter(const PassInfo *PI, raw_ostream &out, ModulePass *createModulePassPrinter(const PassInfo *PI, raw_ostream &out);
bool Quiet);
LoopPass *createLoopPassPrinter(const PassInfo *PI, raw_ostream &out, LoopPass *createLoopPassPrinter(const PassInfo *PI, raw_ostream &out);
bool Quiet);
RegionPass *createRegionPassPrinter(const PassInfo *PI, raw_ostream &out, RegionPass *createRegionPassPrinter(const PassInfo *PI, raw_ostream &out);
bool Quiet);
} // end namespace llvm } // end namespace llvm

View File

@ -203,13 +203,6 @@ DisableBuiltins("disable-builtin",
cl::desc("Disable specific target library builtin function"), cl::desc("Disable specific target library builtin function"),
cl::ZeroOrMore); cl::ZeroOrMore);
static cl::opt<bool>
Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
static cl::alias
QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
static cl::opt<bool> static cl::opt<bool>
AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization")); AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization"));
@ -730,7 +723,7 @@ int main(int argc, char **argv) {
// console, print out a warning message and refuse to do it. We don't // console, print out a warning message and refuse to do it. We don't
// impress anyone by spewing tons of binary goo to a terminal. // impress anyone by spewing tons of binary goo to a terminal.
if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly) if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
if (CheckBitcodeOutputToConsole(Out->os(), !Quiet)) if (CheckBitcodeOutputToConsole(Out->os()))
NoOutput = true; NoOutput = true;
if (OutputThinLTOBC) if (OutputThinLTOBC)
@ -900,19 +893,19 @@ int main(int argc, char **argv) {
if (AnalyzeOnly) { if (AnalyzeOnly) {
switch (Kind) { switch (Kind) {
case PT_Region: case PT_Region:
Passes.add(createRegionPassPrinter(PassInf, Out->os(), Quiet)); Passes.add(createRegionPassPrinter(PassInf, Out->os()));
break; break;
case PT_Loop: case PT_Loop:
Passes.add(createLoopPassPrinter(PassInf, Out->os(), Quiet)); Passes.add(createLoopPassPrinter(PassInf, Out->os()));
break; break;
case PT_Function: case PT_Function:
Passes.add(createFunctionPassPrinter(PassInf, Out->os(), Quiet)); Passes.add(createFunctionPassPrinter(PassInf, Out->os()));
break; break;
case PT_CallGraphSCC: case PT_CallGraphSCC:
Passes.add(createCallGraphPassPrinter(PassInf, Out->os(), Quiet)); Passes.add(createCallGraphPassPrinter(PassInf, Out->os()));
break; break;
default: default:
Passes.add(createModulePassPrinter(PassInf, Out->os(), Quiet)); Passes.add(createModulePassPrinter(PassInf, Out->os()));
break; break;
} }
} }