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

Side by Side Diff: src/IceOperand.cpp

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: changes suggested by stichnot 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// 1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const { 196 const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const {
197 // Note: This returns a Variable, even if the "this" object is a subclass of 197 // Note: This returns a Variable, even if the "this" object is a subclass of
198 // Variable. 198 // Variable.
199 if (!BuildDefs::dump() || getType() == Ty) 199 if (!BuildDefs::dump() || getType() == Ty)
200 return this; 200 return this;
201 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) 201 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>())
202 Variable(kVariable, Ty, Number); 202 Variable(kVariable, Ty, Number);
203 V->NameIndex = NameIndex; 203 V->NameIndex = NameIndex;
204 V->RegNum = NewRegNum == RegNumT::NoRegister ? RegNum : NewRegNum; 204 V->RegNum = NewRegNum.hasNoValue() ? RegNum : NewRegNum;
Jim Stichnoth 2016/02/12 18:29:54 NewRegNum.hasValue() ? NewRegNum : RegNum similar
rkotlerimgtec 2016/02/12 22:02:01 Done.
205 V->StackOffset = StackOffset; 205 V->StackOffset = StackOffset;
206 return V; 206 return V;
207 } 207 }
208 208
209 RegWeight Variable::getWeight(const Cfg *Func) const { 209 RegWeight Variable::getWeight(const Cfg *Func) const {
210 VariablesMetadata *VMetadata = Func->getVMetadata(); 210 VariablesMetadata *VMetadata = Func->getVMetadata();
211 return mustHaveReg() ? RegWeight(RegWeight::Inf) 211 return mustHaveReg() ? RegWeight(RegWeight::Inf)
212 : mustNotHaveReg() ? RegWeight(RegWeight::Zero) 212 : mustNotHaveReg() ? RegWeight(RegWeight::Zero)
213 : VMetadata->getUseWeight(this); 213 : VMetadata->getUseWeight(this);
214 } 214 }
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (getType() != IceType_i32 && getType() != IceType_i16 && 617 if (getType() != IceType_i32 && getType() != IceType_i16 &&
618 getType() != IceType_i8) 618 getType() != IceType_i8)
619 return false; 619 return false;
620 // The Following checks if the signed representation of Value is between 620 // The Following checks if the signed representation of Value is between
621 // -Threshold/2 and +Threshold/2 621 // -Threshold/2 and +Threshold/2
622 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; 622 bool largerThanThreshold = Threshold / 2 + Value >= Threshold;
623 return largerThanThreshold; 623 return largerThanThreshold;
624 } 624 }
625 625
626 } // end of namespace Ice 626 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698