1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Internalize some cl::opt global variables or move them under namespace llvm

This commit is contained in:
Fangrui Song 2021-05-07 11:15:43 -07:00
parent 363580b4e0
commit 9289990558
24 changed files with 70 additions and 33 deletions

View File

@ -48,9 +48,8 @@
#define DEBUG_TYPE "block-freq" #define DEBUG_TYPE "block-freq"
extern llvm::cl::opt<bool> CheckBFIUnknownBlockQueries;
namespace llvm { namespace llvm {
extern llvm::cl::opt<bool> CheckBFIUnknownBlockQueries;
class BranchProbabilityInfo; class BranchProbabilityInfo;
class Function; class Function;

View File

@ -17,17 +17,16 @@
#include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
extern llvm::cl::opt<bool> EnablePGSO;
extern llvm::cl::opt<bool> PGSOLargeWorkingSetSizeOnly;
extern llvm::cl::opt<bool> PGSOColdCodeOnly;
extern llvm::cl::opt<bool> PGSOColdCodeOnlyForInstrPGO;
extern llvm::cl::opt<bool> PGSOColdCodeOnlyForSamplePGO;
extern llvm::cl::opt<bool> PGSOColdCodeOnlyForPartialSamplePGO;
extern llvm::cl::opt<bool> ForcePGSO;
extern llvm::cl::opt<int> PgsoCutoffInstrProf;
extern llvm::cl::opt<int> PgsoCutoffSampleProf;
namespace llvm { namespace llvm {
extern cl::opt<bool> EnablePGSO;
extern cl::opt<bool> PGSOLargeWorkingSetSizeOnly;
extern cl::opt<bool> PGSOColdCodeOnly;
extern cl::opt<bool> PGSOColdCodeOnlyForInstrPGO;
extern cl::opt<bool> PGSOColdCodeOnlyForSamplePGO;
extern cl::opt<bool> PGSOColdCodeOnlyForPartialSamplePGO;
extern cl::opt<bool> ForcePGSO;
extern cl::opt<int> PgsoCutoffInstrProf;
extern cl::opt<int> PgsoCutoffSampleProf;
class BasicBlock; class BasicBlock;
class BlockFrequencyInfo; class BlockFrequencyInfo;

View File

@ -63,9 +63,11 @@ STATISTIC(NumNoAlias, "Number of NoAlias results");
STATISTIC(NumMayAlias, "Number of MayAlias results"); STATISTIC(NumMayAlias, "Number of MayAlias results");
STATISTIC(NumMustAlias, "Number of MustAlias results"); STATISTIC(NumMustAlias, "Number of MustAlias results");
namespace llvm {
/// Allow disabling BasicAA from the AA results. This is particularly useful /// Allow disabling BasicAA from the AA results. This is particularly useful
/// when testing to isolate a single AA implementation. /// when testing to isolate a single AA implementation.
cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false)); cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
} // namespace llvm
#ifndef NDEBUG #ifndef NDEBUG
/// Print a trace of alias analysis queries and their results. /// Print a trace of alias analysis queries and their results.

View File

@ -47,6 +47,7 @@ static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG(
clEnumValN(GVDT_Count, "count", "display a graph using the real " clEnumValN(GVDT_Count, "count", "display a graph using the real "
"profile count if available."))); "profile count if available.")));
namespace llvm {
cl::opt<std::string> cl::opt<std::string>
ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden, ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden,
cl::desc("The option to specify " cl::desc("The option to specify "
@ -86,6 +87,7 @@ cl::opt<std::string> PrintBlockFreqFuncName(
"print-bfi-func-name", cl::Hidden, "print-bfi-func-name", cl::Hidden,
cl::desc("The option to specify the name of the function " cl::desc("The option to specify the name of the function "
"whose block frequency info is printed.")); "whose block frequency info is printed."));
} // namespace llvm
namespace llvm { namespace llvm {

View File

@ -40,11 +40,13 @@ using namespace llvm::bfi_detail;
#define DEBUG_TYPE "block-freq" #define DEBUG_TYPE "block-freq"
namespace llvm {
cl::opt<bool> CheckBFIUnknownBlockQueries( cl::opt<bool> CheckBFIUnknownBlockQueries(
"check-bfi-unknown-block-queries", "check-bfi-unknown-block-queries",
cl::init(false), cl::Hidden, cl::init(false), cl::Hidden,
cl::desc("Check if block frequency is queried for an unknown block " cl::desc("Check if block frequency is queried for an unknown block "
"for debugging missed BFI updates")); "for debugging missed BFI updates"));
}
ScaledNumber<uint64_t> BlockMass::toScaled() const { ScaledNumber<uint64_t> BlockMass::toScaled() const {
if (isFull()) if (isFull())

View File

@ -43,8 +43,10 @@ using namespace llvm;
#define DEBUG_TYPE "cgscc-passmgr" #define DEBUG_TYPE "cgscc-passmgr"
namespace llvm {
cl::opt<unsigned> MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden, cl::opt<unsigned> MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden,
cl::init(4)); cl::init(4));
}
STATISTIC(MaxSCCIterations, "Maximum CGSCCPassMgr iterations on one SCC"); STATISTIC(MaxSCCIterations, "Maximum CGSCCPassMgr iterations on one SCC");

View File

@ -29,6 +29,7 @@ using namespace llvm;
#define DEBUG_TYPE "machine-block-freq" #define DEBUG_TYPE "machine-block-freq"
namespace llvm {
static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG( static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG(
"view-machine-block-freq-propagation-dags", cl::Hidden, "view-machine-block-freq-propagation-dags", cl::Hidden,
cl::desc("Pop up a window to show a dag displaying how machine block " cl::desc("Pop up a window to show a dag displaying how machine block "
@ -75,6 +76,7 @@ static cl::opt<bool> PrintMachineBlockFreq(
// Command line option to specify the name of the function for block frequency // Command line option to specify the name of the function for block frequency
// dump. Defined in Analysis/BlockFrequencyInfo.cpp. // dump. Defined in Analysis/BlockFrequencyInfo.cpp.
extern cl::opt<std::string> PrintBlockFreqFuncName; extern cl::opt<std::string> PrintBlockFreqFuncName;
} // namespace llvm
static GVDAGType getGVDT() { static GVDAGType getGVDT() {
if (ViewBlockLayoutWithBFI != GVDT_None) if (ViewBlockLayoutWithBFI != GVDT_None)

View File

@ -193,6 +193,7 @@ static cl::opt<unsigned> TriangleChainCount(
cl::init(2), cl::init(2),
cl::Hidden); cl::Hidden);
namespace llvm {
extern cl::opt<unsigned> StaticLikelyProb; extern cl::opt<unsigned> StaticLikelyProb;
extern cl::opt<unsigned> ProfileLikelyProb; extern cl::opt<unsigned> ProfileLikelyProb;
@ -204,6 +205,7 @@ extern cl::opt<GVDAGType> ViewBlockLayoutWithBFI;
// Command line option to specify the name of the function for CFG dump // Command line option to specify the name of the function for CFG dump
// Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name= // Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name=
extern cl::opt<std::string> ViewBlockFreqFuncName; extern cl::opt<std::string> ViewBlockFreqFuncName;
} // namespace llvm
namespace { namespace {

View File

@ -25,6 +25,7 @@ INITIALIZE_PASS_BEGIN(MachineBranchProbabilityInfo, "machine-branch-prob",
INITIALIZE_PASS_END(MachineBranchProbabilityInfo, "machine-branch-prob", INITIALIZE_PASS_END(MachineBranchProbabilityInfo, "machine-branch-prob",
"Machine Branch Probability Analysis", false, true) "Machine Branch Probability Analysis", false, true)
namespace llvm {
cl::opt<unsigned> cl::opt<unsigned>
StaticLikelyProb("static-likely-prob", StaticLikelyProb("static-likely-prob",
cl::desc("branch probability threshold in percentage" cl::desc("branch probability threshold in percentage"
@ -36,6 +37,7 @@ cl::opt<unsigned> ProfileLikelyProb(
cl::desc("branch probability threshold in percentage to be considered" cl::desc("branch probability threshold in percentage to be considered"
" very likely when profile is available"), " very likely when profile is available"),
cl::init(51), cl::Hidden); cl::init(51), cl::Hidden);
} // namespace llvm
char MachineBranchProbabilityInfo::ID = 0; char MachineBranchProbabilityInfo::ID = 0;

View File

@ -23,7 +23,9 @@ static cl::opt<bool> ThinLTOSynthesizeEntryCounts(
"thinlto-synthesize-entry-counts", cl::init(false), cl::Hidden, "thinlto-synthesize-entry-counts", cl::init(false), cl::Hidden,
cl::desc("Synthesize entry counts based on the summary")); cl::desc("Synthesize entry counts based on the summary"));
namespace llvm {
extern cl::opt<int> InitialSyntheticCount; extern cl::opt<int> InitialSyntheticCount;
}
static void initializeCounts(ModuleSummaryIndex &Index) { static void initializeCounts(ModuleSummaryIndex &Index) {
auto Root = Index.calculateCallGraphRoot(); auto Root = Index.calculateCallGraphRoot();

View File

@ -20,7 +20,9 @@
using namespace llvm; using namespace llvm;
namespace {
enum DefaultOnOff { Default, Enable, Disable }; enum DefaultOnOff { Default, Enable, Disable };
}
static cl::opt<DefaultOnOff> DwarfExtendedLoc( static cl::opt<DefaultOnOff> DwarfExtendedLoc(
"dwarf-extended-loc", cl::Hidden, "dwarf-extended-loc", cl::Hidden,
cl::desc("Disable emission of the extended flags in .loc directives."), cl::desc("Disable emission of the extended flags in .loc directives."),
@ -28,11 +30,13 @@ static cl::opt<DefaultOnOff> DwarfExtendedLoc(
clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")),
cl::init(Default)); cl::init(Default));
namespace llvm {
cl::opt<cl::boolOrDefault> UseLEB128Directives( cl::opt<cl::boolOrDefault> UseLEB128Directives(
"use-leb128-directives", cl::Hidden, "use-leb128-directives", cl::Hidden,
cl::desc( cl::desc(
"Disable the usage of LEB128 directives, and generate .byte instead."), "Disable the usage of LEB128 directives, and generate .byte instead."),
cl::init(cl::BOU_UNSET)); cl::init(cl::BOU_UNSET));
}
MCAsmInfo::MCAsmInfo() { MCAsmInfo::MCAsmInfo() {
SeparatorString = ";"; SeparatorString = ";";

View File

@ -12,7 +12,9 @@
using namespace llvm; using namespace llvm;
namespace llvm {
extern cl::opt<cl::boolOrDefault> UseLEB128Directives; extern cl::opt<cl::boolOrDefault> UseLEB128Directives;
}
void MCAsmInfoXCOFF::anchor() {} void MCAsmInfoXCOFF::anchor() {}

View File

@ -240,8 +240,6 @@
using namespace llvm; using namespace llvm;
extern cl::opt<unsigned> MaxDevirtIterations;
static cl::opt<InliningAdvisorMode> UseInlineAdvisor( static cl::opt<InliningAdvisorMode> UseInlineAdvisor(
"enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden, "enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden,
cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"), cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"),
@ -296,8 +294,9 @@ PipelineTuningOptions::PipelineTuningOptions() {
CallGraphProfile = true; CallGraphProfile = true;
MergeFunctions = false; MergeFunctions = false;
} }
extern cl::opt<bool> ExtraVectorizerPasses;
namespace llvm {
extern cl::opt<unsigned> MaxDevirtIterations;
extern cl::opt<bool> EnableConstraintElimination; extern cl::opt<bool> EnableConstraintElimination;
extern cl::opt<bool> EnableGVNHoist; extern cl::opt<bool> EnableGVNHoist;
extern cl::opt<bool> EnableGVNSink; extern cl::opt<bool> EnableGVNSink;
@ -310,6 +309,7 @@ extern cl::opt<bool> EnableUnrollAndJam;
extern cl::opt<bool> EnableLoopFlatten; extern cl::opt<bool> EnableLoopFlatten;
extern cl::opt<bool> RunNewGVN; extern cl::opt<bool> RunNewGVN;
extern cl::opt<bool> RunPartialInlining; extern cl::opt<bool> RunPartialInlining;
extern cl::opt<bool> ExtraVectorizerPasses;
extern cl::opt<bool> FlattenedProfileUsed; extern cl::opt<bool> FlattenedProfileUsed;
@ -320,6 +320,7 @@ extern cl::opt<bool> EnableMatrix;
extern cl::opt<bool> DisablePreInliner; extern cl::opt<bool> DisablePreInliner;
extern cl::opt<int> PreInlineThreshold; extern cl::opt<int> PreInlineThreshold;
} // namespace llvm
const PassBuilder::OptimizationLevel PassBuilder::OptimizationLevel::O0 = { const PassBuilder::OptimizationLevel PassBuilder::OptimizationLevel::O0 = {
/*SpeedLevel*/ 0, /*SpeedLevel*/ 0,

View File

@ -36,9 +36,10 @@ static cl::opt<std::string> BlockExtractorFile(
"extract-blocks-file", cl::value_desc("filename"), "extract-blocks-file", cl::value_desc("filename"),
cl::desc("A file containing list of basic blocks to extract"), cl::Hidden); cl::desc("A file containing list of basic blocks to extract"), cl::Hidden);
cl::opt<bool> BlockExtractorEraseFuncs("extract-blocks-erase-funcs", static cl::opt<bool>
cl::desc("Erase the existing functions"), BlockExtractorEraseFuncs("extract-blocks-erase-funcs",
cl::Hidden); cl::desc("Erase the existing functions"),
cl::Hidden);
namespace { namespace {
class BlockExtractor { class BlockExtractor {
public: public:

View File

@ -51,6 +51,7 @@
using namespace llvm; using namespace llvm;
namespace llvm {
cl::opt<bool> RunPartialInlining("enable-partial-inlining", cl::init(false), cl::opt<bool> RunPartialInlining("enable-partial-inlining", cl::init(false),
cl::Hidden, cl::ZeroOrMore, cl::Hidden, cl::ZeroOrMore,
cl::desc("Run Partial inlinining pass")); cl::desc("Run Partial inlinining pass"));
@ -178,6 +179,7 @@ cl::opt<AttributorRunOption> AttributorRun(
"disable attributor runs"))); "disable attributor runs")));
extern cl::opt<bool> EnableKnowledgeRetention; extern cl::opt<bool> EnableKnowledgeRetention;
} // namespace llvm
PassManagerBuilder::PassManagerBuilder() { PassManagerBuilder::PassManagerBuilder() {
OptLevel = 2; OptLevel = 2;

View File

@ -44,11 +44,12 @@ using ProfileCount = Function::ProfileCount;
#define DEBUG_TYPE "synthetic-counts-propagation" #define DEBUG_TYPE "synthetic-counts-propagation"
/// Initial synthetic count assigned to functions. namespace llvm {
cl::opt<int> cl::opt<int>
InitialSyntheticCount("initial-synthetic-count", cl::Hidden, cl::init(10), InitialSyntheticCount("initial-synthetic-count", cl::Hidden, cl::init(10),
cl::ZeroOrMore, cl::ZeroOrMore,
cl::desc("Initial value of synthetic entry count.")); cl::desc("Initial value of synthetic entry count"));
} // namespace llvm
/// Initial synthetic count assigned to inline functions. /// Initial synthetic count assigned to inline functions.
static cl::opt<int> InlineSyntheticCount( static cl::opt<int> InlineSyntheticCount(

View File

@ -145,20 +145,20 @@ static cl::opt<bool>
/// This is needed to support legacy tests that don't contain /// This is needed to support legacy tests that don't contain
/// !vcall_visibility metadata (the mere presense of type tests /// !vcall_visibility metadata (the mere presense of type tests
/// previously implied hidden visibility). /// previously implied hidden visibility).
cl::opt<bool> static cl::opt<bool>
WholeProgramVisibility("whole-program-visibility", cl::init(false), WholeProgramVisibility("whole-program-visibility", cl::init(false),
cl::Hidden, cl::ZeroOrMore, cl::Hidden, cl::ZeroOrMore,
cl::desc("Enable whole program visibility")); cl::desc("Enable whole program visibility"));
/// Provide a way to force disable whole program for debugging or workarounds, /// Provide a way to force disable whole program for debugging or workarounds,
/// when enabled via the linker. /// when enabled via the linker.
cl::opt<bool> DisableWholeProgramVisibility( static cl::opt<bool> DisableWholeProgramVisibility(
"disable-whole-program-visibility", cl::init(false), cl::Hidden, "disable-whole-program-visibility", cl::init(false), cl::Hidden,
cl::ZeroOrMore, cl::ZeroOrMore,
cl::desc("Disable whole program visibility (overrides enabling options)")); cl::desc("Disable whole program visibility (overrides enabling options)"));
/// Provide way to prevent certain function from being devirtualized /// Provide way to prevent certain function from being devirtualized
cl::list<std::string> static cl::list<std::string>
SkipFunctionNames("wholeprogramdevirt-skip", SkipFunctionNames("wholeprogramdevirt-skip",
cl::desc("Prevent function(s) from being devirtualized"), cl::desc("Prevent function(s) from being devirtualized"),
cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated); cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated);
@ -166,7 +166,7 @@ cl::list<std::string>
/// Mechanism to add runtime checking of devirtualization decisions, trapping on /// Mechanism to add runtime checking of devirtualization decisions, trapping on
/// any that are not correct. Useful for debugging undefined behavior leading to /// any that are not correct. Useful for debugging undefined behavior leading to
/// failures with WPD. /// failures with WPD.
cl::opt<bool> static cl::opt<bool>
CheckDevirt("wholeprogramdevirt-check", cl::init(false), cl::Hidden, CheckDevirt("wholeprogramdevirt-check", cl::init(false), cl::Hidden,
cl::ZeroOrMore, cl::ZeroOrMore,
cl::desc("Add code to trap on incorrect devirtualizations")); cl::desc("Add code to trap on incorrect devirtualizations"));

View File

@ -90,9 +90,11 @@ static cl::opt<unsigned> GuardWideningWindow(
cl::desc("How wide an instruction window to bypass looking for " cl::desc("How wide an instruction window to bypass looking for "
"another guard")); "another guard"));
namespace llvm {
/// enable preservation of attributes in assume like: /// enable preservation of attributes in assume like:
/// call void @llvm.assume(i1 true) [ "nonnull"(i32* %PTR) ] /// call void @llvm.assume(i1 true) [ "nonnull"(i32* %PTR) ]
extern cl::opt<bool> EnableKnowledgeRetention; extern cl::opt<bool> EnableKnowledgeRetention;
} // namespace llvm
/// Return the specified type promoted as it would be to pass though a va_arg /// Return the specified type promoted as it would be to pass though a va_arg
/// area. /// area.

View File

@ -280,6 +280,7 @@ static cl::opt<unsigned> PGOVerifyBFICutoff(
cl::desc("Set the threshold for pgo-verify-bfi -- skip the counts whose " cl::desc("Set the threshold for pgo-verify-bfi -- skip the counts whose "
"profile count value is below.")); "profile count value is below."));
namespace llvm {
// Command line option to turn on CFG dot dump after profile annotation. // Command line option to turn on CFG dot dump after profile annotation.
// Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts // Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts
extern cl::opt<PGOViewCountsType> PGOViewCounts; extern cl::opt<PGOViewCountsType> PGOViewCounts;
@ -287,6 +288,7 @@ extern cl::opt<PGOViewCountsType> PGOViewCounts;
// Command line option to specify the name of the function for CFG dump // Command line option to specify the name of the function for CFG dump
// Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name= // Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name=
extern cl::opt<std::string> ViewBlockFreqFuncName; extern cl::opt<std::string> ViewBlockFreqFuncName;
} // namespace llvm
static cl::opt<bool> static cl::opt<bool>
PGOOldCFGHashing("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden, PGOOldCFGHashing("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden,

View File

@ -25,6 +25,7 @@
using namespace llvm; using namespace llvm;
namespace llvm {
cl::opt<bool> ShouldPreserveAllAttributes( cl::opt<bool> ShouldPreserveAllAttributes(
"assume-preserve-all", cl::init(false), cl::Hidden, "assume-preserve-all", cl::init(false), cl::Hidden,
cl::desc("enable preservation of all attrbitues. even those that are " cl::desc("enable preservation of all attrbitues. even those that are "
@ -34,6 +35,7 @@ cl::opt<bool> EnableKnowledgeRetention(
"enable-knowledge-retention", cl::init(false), cl::Hidden, "enable-knowledge-retention", cl::init(false), cl::Hidden,
cl::desc( cl::desc(
"enable preservation of attributes throughout code transformation")); "enable preservation of attributes throughout code transformation"));
} // namespace llvm
#define DEBUG_TYPE "assume-builder" #define DEBUG_TYPE "assume-builder"

View File

@ -14,45 +14,45 @@
using namespace llvm; using namespace llvm;
cl::opt<bool> EnablePGSO( cl::opt<bool> llvm::EnablePGSO(
"pgso", cl::Hidden, cl::init(true), "pgso", cl::Hidden, cl::init(true),
cl::desc("Enable the profile guided size optimizations. ")); cl::desc("Enable the profile guided size optimizations. "));
cl::opt<bool> PGSOLargeWorkingSetSizeOnly( cl::opt<bool> llvm::PGSOLargeWorkingSetSizeOnly(
"pgso-lwss-only", cl::Hidden, cl::init(true), "pgso-lwss-only", cl::Hidden, cl::init(true),
cl::desc("Apply the profile guided size optimizations only " cl::desc("Apply the profile guided size optimizations only "
"if the working set size is large (except for cold code.)")); "if the working set size is large (except for cold code.)"));
cl::opt<bool> PGSOColdCodeOnly( cl::opt<bool> llvm::PGSOColdCodeOnly(
"pgso-cold-code-only", cl::Hidden, cl::init(false), "pgso-cold-code-only", cl::Hidden, cl::init(false),
cl::desc("Apply the profile guided size optimizations only " cl::desc("Apply the profile guided size optimizations only "
"to cold code.")); "to cold code."));
cl::opt<bool> PGSOColdCodeOnlyForInstrPGO( cl::opt<bool> llvm::PGSOColdCodeOnlyForInstrPGO(
"pgso-cold-code-only-for-instr-pgo", cl::Hidden, cl::init(false), "pgso-cold-code-only-for-instr-pgo", cl::Hidden, cl::init(false),
cl::desc("Apply the profile guided size optimizations only " cl::desc("Apply the profile guided size optimizations only "
"to cold code under instrumentation PGO.")); "to cold code under instrumentation PGO."));
cl::opt<bool> PGSOColdCodeOnlyForSamplePGO( cl::opt<bool> llvm::PGSOColdCodeOnlyForSamplePGO(
"pgso-cold-code-only-for-sample-pgo", cl::Hidden, cl::init(false), "pgso-cold-code-only-for-sample-pgo", cl::Hidden, cl::init(false),
cl::desc("Apply the profile guided size optimizations only " cl::desc("Apply the profile guided size optimizations only "
"to cold code under sample PGO.")); "to cold code under sample PGO."));
cl::opt<bool> PGSOColdCodeOnlyForPartialSamplePGO( cl::opt<bool> llvm::PGSOColdCodeOnlyForPartialSamplePGO(
"pgso-cold-code-only-for-partial-sample-pgo", cl::Hidden, cl::init(false), "pgso-cold-code-only-for-partial-sample-pgo", cl::Hidden, cl::init(false),
cl::desc("Apply the profile guided size optimizations only " cl::desc("Apply the profile guided size optimizations only "
"to cold code under partial-profile sample PGO.")); "to cold code under partial-profile sample PGO."));
cl::opt<bool> ForcePGSO( cl::opt<bool> llvm::ForcePGSO(
"force-pgso", cl::Hidden, cl::init(false), "force-pgso", cl::Hidden, cl::init(false),
cl::desc("Force the (profiled-guided) size optimizations. ")); cl::desc("Force the (profiled-guided) size optimizations. "));
cl::opt<int> PgsoCutoffInstrProf( cl::opt<int> llvm::PgsoCutoffInstrProf(
"pgso-cutoff-instr-prof", cl::Hidden, cl::init(950000), cl::ZeroOrMore, "pgso-cutoff-instr-prof", cl::Hidden, cl::init(950000), cl::ZeroOrMore,
cl::desc("The profile guided size optimization profile summary cutoff " cl::desc("The profile guided size optimization profile summary cutoff "
"for instrumentation profile.")); "for instrumentation profile."));
cl::opt<int> PgsoCutoffSampleProf( cl::opt<int> llvm::PgsoCutoffSampleProf(
"pgso-cutoff-sample-prof", cl::Hidden, cl::init(990000), cl::ZeroOrMore, "pgso-cutoff-sample-prof", cl::Hidden, cl::init(990000), cl::ZeroOrMore,
cl::desc("The profile guided size optimization profile summary cutoff " cl::desc("The profile guided size optimization profile summary cutoff "
"for sample profile.")); "for sample profile."));

View File

@ -121,11 +121,13 @@ static cl::opt<std::string> OptimizerLastEPPipeline(
// Individual pipeline tuning options. // Individual pipeline tuning options.
extern cl::opt<bool> DisableLoopUnrolling; extern cl::opt<bool> DisableLoopUnrolling;
namespace llvm {
extern cl::opt<PGOKind> PGOKindFlag; extern cl::opt<PGOKind> PGOKindFlag;
extern cl::opt<std::string> ProfileFile; extern cl::opt<std::string> ProfileFile;
extern cl::opt<CSPGOKind> CSPGOKindFlag; extern cl::opt<CSPGOKind> CSPGOKindFlag;
extern cl::opt<std::string> CSProfileGenFile; extern cl::opt<std::string> CSProfileGenFile;
extern cl::opt<bool> DisableBasicAA; extern cl::opt<bool> DisableBasicAA;
} // namespace llvm
static cl::opt<std::string> static cl::opt<std::string>
ProfileRemappingFile("profile-remapping-file", ProfileRemappingFile("profile-remapping-file",

View File

@ -313,6 +313,7 @@ static cl::opt<std::string> RemarksFormat(
cl::desc("The format used for serializing remarks (default: YAML)"), cl::desc("The format used for serializing remarks (default: YAML)"),
cl::value_desc("format"), cl::init("yaml")); cl::value_desc("format"), cl::init("yaml"));
namespace llvm {
cl::opt<PGOKind> cl::opt<PGOKind>
PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden, PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden,
cl::desc("The kind of profile guided optimization"), cl::desc("The kind of profile guided optimization"),
@ -341,6 +342,7 @@ cl::opt<std::string> CSProfileGenFile(
"cs-profilegen-file", "cs-profilegen-file",
cl::desc("Path to the instrumented context sensitive profile."), cl::desc("Path to the instrumented context sensitive profile."),
cl::Hidden); cl::Hidden);
} // namespace llvm
static inline void addPass(legacy::PassManagerBase &PM, Pass *P) { static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
// Add the pass to the pass manager... // Add the pass to the pass manager...

View File

@ -20,8 +20,10 @@
using namespace llvm; using namespace llvm;
namespace llvm {
extern cl::opt<bool> ShouldPreserveAllAttributes; extern cl::opt<bool> ShouldPreserveAllAttributes;
extern cl::opt<bool> EnableKnowledgeRetention; extern cl::opt<bool> EnableKnowledgeRetention;
} // namespace llvm
static void RunTest( static void RunTest(
StringRef Head, StringRef Tail, StringRef Head, StringRef Tail,