Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: src/IceOperand.cpp

Issue 1197863003: Subzero: Reduce the amount of #ifdef'd code. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.cpp
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index 459d0a07c19101f9ee537b2f63a8473858ce4de9..db530db5d9d71bf9bd72f97308eb02133600fcfc 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -91,13 +91,17 @@ bool LiveRange::overlapsInst(InstNumberT OtherBegin, bool UseTrimmed) const {
break;
}
}
-#if 0
- // An equivalent but less inefficient implementation:
- LiveRange Temp;
- Temp.addSegment(OtherBegin, OtherBegin + 1);
- bool Validation = overlaps(Temp);
- assert(Result == Validation);
-#endif
+ // This is an equivalent but less inefficient implementation. It's
+ // expensive enough that we wouldn't want to run it under any build,
+ // but it could be enabled if e.g. the LiveRange implementation
+ // changes and extra testing is needed.
+ if (BuildDefs::extraValidation()) {
+ LiveRange Temp;
+ Temp.addSegment(OtherBegin, OtherBegin + 1);
+ bool Validation = overlaps(Temp);
+ (void)Validation;
+ assert(Result == Validation);
+ }
return Result;
}
@@ -129,7 +133,7 @@ IceString Variable::getName(const Cfg *Func) const {
Variable *Variable::asType(Type Ty) {
// Note: This returns a Variable, even if the "this" object is a
// subclass of Variable.
- if (!ALLOW_DUMP || getType() == Ty)
+ if (!BuildDefs::dump() || getType() == Ty)
return this;
Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>())
Variable(kVariable, Ty, Number);
@@ -388,12 +392,12 @@ const InstDefList VariablesMetadata::NoDefinitions;
// ======================== dump routines ======================== //
void Variable::emit(const Cfg *Func) const {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Func->getTarget()->emitVariable(this);
}
void Variable::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (Func == nullptr) {
Str << "%" << getName(Func);
@@ -447,7 +451,7 @@ void ConstantRelocatable::emitWithoutPrefix(TargetLowering *Target) const {
}
void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Str << "@";
if (Func && !SuppressMangling) {
@@ -462,7 +466,7 @@ void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const {
void ConstantUndef::emit(TargetLowering *Target) const { Target->emit(this); }
void LiveRange::dump(Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Str << "(weight=" << Weight << ") ";
bool First = true;
@@ -475,14 +479,14 @@ void LiveRange::dump(Ostream &Str) const {
}
Ostream &operator<<(Ostream &Str, const LiveRange &L) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return Str;
L.dump(Str);
return Str;
}
Ostream &operator<<(Ostream &Str, const RegWeight &W) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return Str;
if (W.getWeight() == RegWeight::Inf)
Str << "Inf";
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698