OLD | NEW |
1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 1 //===- subzero/src/IceInst.cpp - High-level instruction 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void Inst::deleteIfDead() { | 87 void Inst::deleteIfDead() { |
88 if (Dead) | 88 if (Dead) |
89 setDeleted(); | 89 setDeleted(); |
90 } | 90 } |
91 | 91 |
92 // If Src is a Variable, it returns true if this instruction ends Src's live | 92 // If Src is a Variable, it returns true if this instruction ends Src's live |
93 // range. Otherwise, returns false. | 93 // range. Otherwise, returns false. |
94 bool Inst::isLastUse(const Operand *TestSrc) const { | 94 bool Inst::isLastUse(const Operand *TestSrc) const { |
95 if (LiveRangesEnded == 0) | 95 if (LiveRangesEnded == 0) |
96 return false; // early-exit optimization | 96 return false; // early-exit optimization |
97 if (const Variable *TestVar = llvm::dyn_cast<const Variable>(TestSrc)) { | 97 if (auto *TestVar = llvm::dyn_cast<const Variable>(TestSrc)) { |
98 LREndedBits Mask = LiveRangesEnded; | 98 LREndedBits Mask = LiveRangesEnded; |
99 FOREACH_VAR_IN_INST(Var, *this) { | 99 FOREACH_VAR_IN_INST(Var, *this) { |
100 if (Var == TestVar) { | 100 if (Var == TestVar) { |
101 // We've found where the variable is used in the instruction. | 101 // We've found where the variable is used in the instruction. |
102 return Mask & 1; | 102 return Mask & 1; |
103 } | 103 } |
104 Mask >>= 1; | 104 Mask >>= 1; |
105 if (Mask == 0) | 105 if (Mask == 0) |
106 return false; // another early-exit optimization | 106 return false; // another early-exit optimization |
107 } | 107 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 // Updates liveness for a particular operand based on the given predecessor | 360 // Updates liveness for a particular operand based on the given predecessor |
361 // edge. Doesn't mark the operand as live if the Phi instruction is dead or | 361 // edge. Doesn't mark the operand as live if the Phi instruction is dead or |
362 // deleted. | 362 // deleted. |
363 void InstPhi::livenessPhiOperand(LivenessBV &Live, CfgNode *Target, | 363 void InstPhi::livenessPhiOperand(LivenessBV &Live, CfgNode *Target, |
364 Liveness *Liveness) { | 364 Liveness *Liveness) { |
365 if (isDeleted() || Dead) | 365 if (isDeleted() || Dead) |
366 return; | 366 return; |
367 for (SizeT I = 0; I < getSrcSize(); ++I) { | 367 for (SizeT I = 0; I < getSrcSize(); ++I) { |
368 if (Labels[I] == Target) { | 368 if (Labels[I] == Target) { |
369 if (Variable *Var = llvm::dyn_cast<Variable>(getSrc(I))) { | 369 if (auto *Var = llvm::dyn_cast<Variable>(getSrc(I))) { |
370 SizeT SrcIndex = Liveness->getLiveIndex(Var->getIndex()); | 370 SizeT SrcIndex = Liveness->getLiveIndex(Var->getIndex()); |
371 if (!Live[SrcIndex]) { | 371 if (!Live[SrcIndex]) { |
372 setLastUse(I); | 372 setLastUse(I); |
373 Live[SrcIndex] = true; | 373 Live[SrcIndex] = true; |
374 } | 374 } |
375 } | 375 } |
376 return; | 376 return; |
377 } | 377 } |
378 } | 378 } |
379 llvm_unreachable("Phi operand not found for specified target node"); | 379 llvm_unreachable("Phi operand not found for specified target node"); |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 // upper 32 bits of rax. We need to recognize and preserve these. | 958 // upper 32 bits of rax. We need to recognize and preserve these. |
959 return true; | 959 return true; |
960 } | 960 } |
961 if (!Dest->hasReg() && !SrcVar->hasReg() && | 961 if (!Dest->hasReg() && !SrcVar->hasReg() && |
962 Dest->getStackOffset() == SrcVar->getStackOffset()) | 962 Dest->getStackOffset() == SrcVar->getStackOffset()) |
963 return true; | 963 return true; |
964 return false; | 964 return false; |
965 } | 965 } |
966 | 966 |
967 } // end of namespace Ice | 967 } // end of namespace Ice |
OLD | NEW |