Move global namespace cl::opt inside llvm::

This commit is contained in:
Fangrui Song 2023-02-14 00:09:44 -08:00
parent 4f0eb57222
commit 1e6921131a
13 changed files with 31 additions and 12 deletions

View File

@ -91,7 +91,7 @@ cl::opt<std::string> llvm::BBSectionsColdTextPrefix(
cl::desc("The text prefix to use for cold basic block clusters"),
cl::init(".text.split."), cl::Hidden);
cl::opt<bool> BBSectionsDetectSourceDrift(
static cl::opt<bool> BBSectionsDetectSourceDrift(
"bbsections-detect-source-drift",
cl::desc("This checks if there is a fdo instr. profile hash "
"mismatch for this function"),

View File

@ -83,12 +83,12 @@ static cl::opt<bool> EnableDevelopmentFeatures(
static const bool EnableDevelopmentFeatures = false;
#endif // #ifdef LLVM_HAVE_TFLITE
extern cl::opt<unsigned> EvictInterferenceCutoff;
/// The score injection pass.
/// This pass calculates the score for a function and inserts it in the log, but
/// this happens only in development mode. It's a no-op otherwise.
namespace llvm {
extern cl::opt<unsigned> EvictInterferenceCutoff;
class RegAllocScoring : public MachineFunctionPass {
public:
static char ID;

View File

@ -213,10 +213,9 @@ static cl::opt<bool> RenumberBlocksBeforeView(
"into a dot graph. Only used when a function is being printed."),
cl::init(false), cl::Hidden);
namespace llvm {
extern cl::opt<bool> EnableExtTspBlockPlacement;
extern cl::opt<bool> ApplyExtTspWithoutProfile;
namespace llvm {
extern cl::opt<unsigned> StaticLikelyProb;
extern cl::opt<unsigned> ProfileLikelyProb;

View File

@ -43,6 +43,7 @@ static cl::opt<bool> EnableLocalReassignment(
"may be compile time intensive"),
cl::init(false));
namespace llvm {
cl::opt<unsigned> EvictInterferenceCutoff(
"regalloc-eviction-max-interference-cutoff", cl::Hidden,
cl::desc("Number of interferences after which we declare "
@ -50,6 +51,7 @@ cl::opt<unsigned> EvictInterferenceCutoff(
"is a compilation cost-saving consideration. To "
"disable, pass a very large number."),
cl::init(10));
}
#define DEBUG_TYPE "regalloc"
#ifdef LLVM_HAVE_TF_AOT_REGALLOCEVICTMODEL

View File

@ -41,8 +41,8 @@
using namespace llvm;
using namespace irsymtab;
cl::opt<bool> DisableBitcodeVersionUpgrade(
"disable-bitcode-version-upgrade", cl::init(false), cl::Hidden,
static cl::opt<bool> DisableBitcodeVersionUpgrade(
"disable-bitcode-version-upgrade", cl::Hidden,
cl::desc("Disable automatic bitcode upgrade for version mismatch"));
static const char *PreservedSymbols[] = {

View File

@ -32,7 +32,7 @@ static cl::opt<uint64_t> ProfileSymbolListCutOff(
cl::desc("Cutoff value about how many symbols in profile symbol list "
"will be used. This is very useful for performance debugging"));
cl::opt<bool> GenerateMergedBaseProfiles(
static cl::opt<bool> GenerateMergedBaseProfiles(
"generate-merged-base-profiles",
cl::desc("When generating nested context-sensitive profiles, always "
"generate extra base profile for function with all its context "

View File

@ -174,9 +174,6 @@ static cl::opt<bool>
cl::desc("Process functions in a top-down order "
"defined by the profiled call graph when "
"-sample-profile-top-down-load is on."));
cl::opt<bool>
SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden,
cl::desc("Sort profiled recursion by edge weights."));
static cl::opt<bool> ProfileSizeInline(
"sample-profile-inline-size", cl::Hidden, cl::init(false),
@ -192,6 +189,11 @@ static cl::opt<bool> DisableSampleLoaderInlining(
"pass, and merge (or scale) profiles (as configured by "
"--sample-profile-merge-inlinee)."));
namespace llvm {
cl::opt<bool>
SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden,
cl::desc("Sort profiled recursion by edge weights."));
cl::opt<int> ProfileInlineGrowthLimit(
"sample-profile-inline-growth-limit", cl::Hidden, cl::init(12),
cl::desc("The size growth ratio limit for proirity-based sample profile "
@ -215,6 +217,7 @@ cl::opt<int> SampleHotCallSiteThreshold(
cl::opt<int> SampleColdCallSiteThreshold(
"sample-profile-cold-inline-threshold", cl::Hidden, cl::init(45),
cl::desc("Threshold for inlining cold callsites"));
} // namespace llvm
static cl::opt<unsigned> ProfileICPRelativeHotness(
"sample-profile-icp-relative-hotness", cl::Hidden, cl::init(25),
@ -308,7 +311,9 @@ static cl::opt<bool> AnnotateSampleProfileInlinePhase(
cl::desc("Annotate LTO phase (prelink / postlink), or main (no LTO) for "
"sample-profile inline pass name."));
namespace llvm {
extern cl::opt<bool> EnableExtTspBlockPlacement;
}
namespace {

View File

@ -47,6 +47,7 @@
using namespace llvm;
#define DEBUG_TYPE "code-layout"
namespace llvm {
cl::opt<bool> EnableExtTspBlockPlacement(
"enable-ext-tsp-block-placement", cl::Hidden, cl::init(false),
cl::desc("Enable machine block placement based on the ext-tsp model, "
@ -56,6 +57,7 @@ cl::opt<bool> ApplyExtTspWithoutProfile(
"ext-tsp-apply-without-profile",
cl::desc("Whether to apply ext-tsp placement for instances w/o profile"),
cl::init(true), cl::Hidden);
} // namespace llvm
// Algorithm-specific params. The values are tuned for the best performance
// of large-scale front-end bound binaries.

View File

@ -338,10 +338,12 @@ static cl::opt<bool> PreferPredicatedReductionSelect(
cl::desc(
"Prefer predicating a reduction operation over an after loop select."));
namespace llvm {
cl::opt<bool> EnableVPlanNativePath(
"enable-vplan-native-path", cl::init(false), cl::Hidden,
"enable-vplan-native-path", cl::Hidden,
cl::desc("Enable VPlan-native vectorization path with "
"support for outer loop vectorization."));
}
// This flag enables the stress testing of the VPlan H-CFG construction in the
// VPlan-native vectorization path. It must be used in conjuction with

View File

@ -46,7 +46,10 @@
#include <vector>
using namespace llvm;
namespace llvm {
extern cl::opt<bool> EnableVPlanNativePath;
}
#define DEBUG_TYPE "vplan"

View File

@ -34,7 +34,9 @@ using namespace llvm;
using VectorParts = SmallVector<Value *, 2>;
namespace llvm {
extern cl::opt<bool> EnableVPlanNativePath;
}
#define LV_NAME "loop-vectorize"
#define DEBUG_TYPE LV_NAME

View File

@ -34,6 +34,7 @@ STATISTIC(
// The switches specify inline thresholds used in SampleProfileLoader inlining.
// TODO: the actual threshold to be tuned here because the size here is based
// on machine code not LLVM IR.
namespace llvm {
extern cl::opt<int> SampleHotCallSiteThreshold;
extern cl::opt<int> SampleColdCallSiteThreshold;
extern cl::opt<int> ProfileInlineGrowthLimit;
@ -49,6 +50,7 @@ cl::opt<bool> EnableCSPreInliner(
cl::opt<bool> UseContextCostForPreInliner(
"use-context-cost-for-preinliner", cl::Hidden, cl::init(true),
cl::desc("Use context-sensitive byte size cost for preinliner decisions"));
} // namespace llvm
static cl::opt<bool> SamplePreInlineReplay(
"csspgo-replay-preinline", cl::Hidden, cl::init(false),

View File

@ -42,8 +42,10 @@
#include <unordered_set>
#include <vector>
namespace llvm {
extern cl::opt<bool> EnableCSPreInliner;
extern cl::opt<bool> UseContextCostForPreInliner;
} // namespace llvm
using namespace llvm;
using namespace sampleprof;