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/IceCfgNode.cpp b/src/IceCfgNode.cpp
index a87642d..9fc6634 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -53,7 +53,7 @@
namespace {
template <typename List> void removeDeletedAndRenumber(List *L, Cfg *Func) {
const bool DoDelete =
- BuildDefs::minimal() || !GlobalContext::getFlags().getKeepDeletedInsts();
+ BuildDefs::minimal() || !getFlags().getKeepDeletedInsts();
auto I = L->begin(), E = L->end(), Next = I;
for (++Next; I != E; I = Next++) {
if (DoDelete && I->isDeleted()) {
@@ -1053,8 +1053,7 @@
Func->setCurrentNode(this);
Ostream &Str = Func->getContext()->getStrEmit();
Liveness *Liveness = Func->getLiveness();
- const bool DecorateAsm =
- Liveness && Func->getContext()->getFlags().getDecorateAsm();
+ const bool DecorateAsm = Liveness && getFlags().getDecorateAsm();
Str << getAsmName() << ":\n";
// LiveRegCount keeps track of the number of currently live variables that
// each register is assigned to. Normally that would be only 0 or 1, but the
@@ -1259,7 +1258,7 @@
}
// Do the simple emission if not sandboxed.
- if (!Func->getContext()->getFlags().getUseSandboxing()) {
+ if (!getFlags().getUseSandboxing()) {
for (const Inst &I : Insts) {
if (!I.isDeleted() && !I.isRedundantAssign()) {
I.emitIAS(Func);