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/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 5d081e0..006d781 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -131,7 +131,7 @@
void TargetX8632Traits::X86OperandMem::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
- const bool UseNonsfi = Func->getContext()->getFlags().getUseNonsfi();
+ const bool UseNonsfi = getFlags().getUseNonsfi();
validateMemOperandPIC(this, UseNonsfi);
const auto *Target =
static_cast<const ::Ice::X8632::TargetX8632 *>(Func->getTarget());
@@ -263,7 +263,7 @@
const Ice::TargetLowering *TargetLowering, bool /*IsLeaAddr*/) const {
const auto *Target =
static_cast<const ::Ice::X8632::TargetX8632 *>(TargetLowering);
- const bool UseNonsfi = Target->getGlobalContext()->getFlags().getUseNonsfi();
+ const bool UseNonsfi = getFlags().getUseNonsfi();
validateMemOperandPIC(this, UseNonsfi);
int32_t Disp = 0;
if (getBase() && getBase()->isRematerializable()) {