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

Unified Diff: src/IceOperand.h

Issue 1691193002: Subzero: Prototype to make use of RegNumT::No Register more concise (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: get rid of unneccessary initialization. Created 4 years, 10 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/IceInstX86BaseImpl.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index a20308660ced41885cc20c2d8cdf756a5ee4ffe3..bb390f95fe3f36bd22134a9ff51dc9636e2ddc7c 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -441,7 +441,9 @@ public:
// Define NoRegisterValue as an enum value so that it can be used as an
// argument for the public ctor if desired.
enum { NoRegisterValue = std::numeric_limits<BaseType>::max() };
- const static RegNumT NoRegister /* = NoRegisterValue */;
+
+ bool hasValue() const { return Value != NoRegisterValue; }
+ bool hasNoValue() const { return !hasValue(); }
private:
BaseType Value = NoRegisterValue;
@@ -646,14 +648,14 @@ public:
return "lv$" + getName(Func);
}
- bool hasReg() const { return getRegNum() != RegNumT::NoRegister; }
+ bool hasReg() const { return getRegNum().hasValue(); }
RegNumT getRegNum() const { return RegNum; }
void setRegNum(RegNumT NewRegNum) {
// Regnum shouldn't be set more than once.
assert(!hasReg() || RegNum == NewRegNum);
RegNum = NewRegNum;
}
- bool hasRegTmp() const { return getRegNumTmp() != RegNumT::NoRegister; }
+ bool hasRegTmp() const { return getRegNumTmp().hasValue(); }
RegNumT getRegNumTmp() const { return RegNumTmp; }
void setRegNumTmp(RegNumT NewRegNum) { RegNumTmp = NewRegNum; }
@@ -711,7 +713,7 @@ public:
void dump(const Cfg *Func, Ostream &Str) const override;
/// Return reg num of base register, if different from stack/frame register.
- virtual RegNumT getBaseRegNum() const { return RegNumT::NoRegister; }
+ virtual RegNumT getBaseRegNum() const { return RegNumT(); }
static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind();
@@ -743,9 +745,9 @@ protected:
RegClass RegisterClass;
/// RegNum is the allocated register, or NoRegister if it isn't
Jim Stichnoth 2016/02/13 18:58:10 /// RegNum is the allocated register (as long as R
rkotlerimgtec 2016/02/14 00:04:05 Done.
/// register-allocated.
- RegNumT RegNum = RegNumT::NoRegister;
+ RegNumT RegNum;
/// RegNumTmp is the tentative assignment during register allocation.
- RegNumT RegNumTmp = RegNumT::NoRegister;
+ RegNumT RegNumTmp;
/// StackOffset is the canonical location on stack (only if
/// RegNum==NoRegister || IsArgument).
Jim Stichnoth 2016/02/13 18:58:10 RegNum.hasNoValue()
rkotlerimgtec 2016/02/14 00:04:05 Done.
int32_t StackOffset = 0;
« no previous file with comments | « src/IceInstX86BaseImpl.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698