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 1676123002: Subzero: Use a proper RegNumT type instead of int32_t/SizeT. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make it possible to do "auto NewReg = RegNumT::NoRegister;" 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/IceOperand.h ('k') | src/IceRegAlloc.h » ('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 ff1de640e9a69c47d70085bd216a3a64443c9e55..cc4e9642f6808aa6af38982e58b280b93b2ff650 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -86,6 +86,9 @@ bool operator==(const RelocatableTuple &A, const RelocatableTuple &B) {
return true;
}
+const RegNumT RegNumT::NoRegister(RegNumT::NoRegisterValue);
+RegNumT::BaseType RegNumT::Limit = 0;
+
bool operator<(const RegWeight &A, const RegWeight &B) {
return A.getWeight() < B.getWeight();
}
@@ -190,7 +193,7 @@ IceString Variable::getName(const Cfg *Func) const {
return "__" + std::to_string(getIndex());
}
-const Variable *Variable::asType(Type Ty, int32_t NewRegNum) const {
+const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const {
// Note: This returns a Variable, even if the "this" object is a subclass of
// Variable.
if (!BuildDefs::dump() || getType() == Ty)
@@ -198,7 +201,7 @@ const Variable *Variable::asType(Type Ty, int32_t NewRegNum) const {
Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>())
Variable(kVariable, Ty, Number);
V->NameIndex = NameIndex;
- V->RegNum = NewRegNum == NoRegister ? RegNum : NewRegNum;
+ V->RegNum = NewRegNum == RegNumT::NoRegister ? RegNum : NewRegNum;
V->StackOffset = StackOffset;
return V;
}
@@ -511,9 +514,8 @@ void Variable::dump(const Cfg *Func, Ostream &Str) const {
} else if (Func->getTarget()->hasComputedFrame()) {
if (Func->isVerbose(IceV_RegOrigins))
Str << ":";
- int32_t BaseRegisterNumber = getBaseRegNum();
- if (BaseRegisterNumber == NoRegister)
- BaseRegisterNumber = Func->getTarget()->getFrameOrStackReg();
+ const auto BaseRegisterNumber =
+ hasReg() ? getBaseRegNum() : Func->getTarget()->getFrameOrStackReg();
Str << "["
<< Func->getTarget()->getRegName(BaseRegisterNumber, IceType_i32);
int32_t Offset = getStackOffset();
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698