| OLD | NEW |
| 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 |
| 11 /// This file implements the Operand class and its target-independent | 11 /// This file implements the Operand class and its target-independent |
| 12 /// subclasses, primarily for the methods of the Variable class. | 12 /// subclasses, primarily for the methods of the Variable class. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceOperand.h" | 16 #include "IceOperand.h" |
| 17 | 17 |
| 18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceInst.h" | 20 #include "IceInst.h" |
| 21 #include "IceInstVarIter.h" |
| 21 #include "IceTargetLowering.h" // dumping stack/frame pointer register | 22 #include "IceTargetLowering.h" // dumping stack/frame pointer register |
| 22 | 23 |
| 23 namespace Ice { | 24 namespace Ice { |
| 24 | 25 |
| 25 bool operator==(const RelocatableTuple &A, const RelocatableTuple &B) { | 26 bool operator==(const RelocatableTuple &A, const RelocatableTuple &B) { |
| 26 return A.Offset == B.Offset && A.Name == B.Name; | 27 return A.Offset == B.Offset && A.Name == B.Name; |
| 27 } | 28 } |
| 28 | 29 |
| 29 bool operator<(const RegWeight &A, const RegWeight &B) { | 30 bool operator<(const RegWeight &A, const RegWeight &B) { |
| 30 return A.getWeight() < B.getWeight(); | 31 return A.getWeight() < B.getWeight(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 for (Inst &I : Node->getInsts()) { | 322 for (Inst &I : Node->getInsts()) { |
| 322 if (I.isDeleted()) | 323 if (I.isDeleted()) |
| 323 continue; | 324 continue; |
| 324 // Note: The implicit definitions (and uses) from InstFakeKill are | 325 // Note: The implicit definitions (and uses) from InstFakeKill are |
| 325 // deliberately ignored. | 326 // deliberately ignored. |
| 326 if (Variable *Dest = I.getDest()) { | 327 if (Variable *Dest = I.getDest()) { |
| 327 SizeT DestNum = Dest->getIndex(); | 328 SizeT DestNum = Dest->getIndex(); |
| 328 assert(DestNum < Metadata.size()); | 329 assert(DestNum < Metadata.size()); |
| 329 Metadata[DestNum].markDef(Kind, &I, Node); | 330 Metadata[DestNum].markDef(Kind, &I, Node); |
| 330 } | 331 } |
| 331 for (SizeT SrcNum = 0; SrcNum < I.getSrcSize(); ++SrcNum) { | 332 FOREACH_VAR_IN_INST(Var, I) { |
| 332 Operand *Src = I.getSrc(SrcNum); | 333 SizeT VarNum = Var->getIndex(); |
| 333 SizeT NumVars = Src->getNumVars(); | 334 assert(VarNum < Metadata.size()); |
| 334 for (SizeT J = 0; J < NumVars; ++J) { | 335 constexpr bool IsImplicit = false; |
| 335 const Variable *Var = Src->getVar(J); | 336 Metadata[VarNum].markUse(Kind, &I, Node, IsImplicit); |
| 336 SizeT VarNum = Var->getIndex(); | |
| 337 assert(VarNum < Metadata.size()); | |
| 338 constexpr bool IsImplicit = false; | |
| 339 Metadata[VarNum].markUse(Kind, &I, Node, IsImplicit); | |
| 340 } | |
| 341 } | 337 } |
| 342 } | 338 } |
| 343 } | 339 } |
| 344 | 340 |
| 345 bool VariablesMetadata::isMultiDef(const Variable *Var) const { | 341 bool VariablesMetadata::isMultiDef(const Variable *Var) const { |
| 346 assert(Kind != VMK_Uses); | 342 assert(Kind != VMK_Uses); |
| 347 if (Var->getIsArg()) | 343 if (Var->getIsArg()) |
| 348 return false; | 344 return false; |
| 349 if (!isTracked(Var)) | 345 if (!isTracked(Var)) |
| 350 return true; // conservative answer | 346 return true; // conservative answer |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (getType() != IceType_i32 && getType() != IceType_i16 && | 519 if (getType() != IceType_i32 && getType() != IceType_i16 && |
| 524 getType() != IceType_i8) | 520 getType() != IceType_i8) |
| 525 return false; | 521 return false; |
| 526 // The Following checks if the signed representation of Value is between | 522 // The Following checks if the signed representation of Value is between |
| 527 // -Threshold/2 and +Threshold/2 | 523 // -Threshold/2 and +Threshold/2 |
| 528 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; | 524 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; |
| 529 return largerThanThreshold; | 525 return largerThanThreshold; |
| 530 } | 526 } |
| 531 | 527 |
| 532 } // end of namespace Ice | 528 } // end of namespace Ice |
| OLD | NEW |