Simplify references to command line flags.
This CL removes all indirect pointer chasing to get the values of
command line flags. Since we are only using 1 copy of ClFlags, this CL
introduces a static field Flags to hold the defined command line flags
(it was previously a static field of GlobalContext).
For those few contexts where one must change CL flags due to context
(such as testsing and running in the browser), use ClFlags::Flags.
In the remainder of the cases, the code uses getFlags() which returns
a constant reference to ClFlags::Flags, allowing access to the get
accessors.
BUG=None
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1848303003 .
diff --git a/src/IceTargetLoweringX8664Traits.h b/src/IceTargetLoweringX8664Traits.h
index 0feaa20..0fc4800 100644
--- a/src/IceTargetLoweringX8664Traits.h
+++ b/src/IceTargetLoweringX8664Traits.h
@@ -615,11 +615,9 @@
return Registers;
}
- static void
- makeRandomRegisterPermutation(GlobalContext *Ctx, Cfg *Func,
- llvm::SmallVectorImpl<RegNumT> &Permutation,
- const SmallBitVector &ExcludeRegisters,
- uint64_t Salt) {
+ static void makeRandomRegisterPermutation(
+ Cfg *Func, llvm::SmallVectorImpl<RegNumT> &Permutation,
+ const SmallBitVector &ExcludeRegisters, uint64_t Salt) {
// TODO(stichnot): Declaring Permutation this way loses type/size
// information. Fix this in conjunction with the caller-side TODO.
assert(Permutation.size() >= RegisterSet::Reg_NUM);
@@ -664,7 +662,7 @@
#undef X
// Create a random number generator for regalloc randomization.
- RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(),
+ RandomNumberGenerator RNG(getFlags().getRandomSeed(),
RPE_RegAllocRandomization, Salt);
RandomNumberGeneratorWrapper RNGW(RNG);