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/IceTargetLowering.h b/src/IceTargetLowering.h
index 03a8cb2..37bf127 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -51,7 +51,7 @@
// FakeDef and FakeUse instructions to try maintain liveness consistency.
#define UnimplementedLoweringError(Target, Instr) \
do { \
- if ((Target)->Ctx->getFlags().getSkipUnimplemented()) { \
+ if (getFlags().getSkipUnimplemented()) { \
(Target)->addFakeDefUses(Instr); \
} else { \
/* Use llvm_unreachable instead of report_fatal_error, which gives \
@@ -181,7 +181,7 @@
virtual std::unique_ptr<Assembler> createAssembler() const = 0;
void translate() {
- switch (Ctx->getFlags().getOptLevel()) {
+ switch (getFlags().getOptLevel()) {
case Opt_m1:
translateOm1();
break;