| 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 // This file implements the Operand class and its target-independent | 10 // This file implements the Operand class and its target-independent |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 119 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
| 120 ++TrimmedBegin; | 120 ++TrimmedBegin; |
| 121 } | 121 } |
| 122 | 122 |
| 123 IceString Variable::getName(const Cfg *Func) const { | 123 IceString Variable::getName(const Cfg *Func) const { |
| 124 if (Func && NameIndex >= 0) | 124 if (Func && NameIndex >= 0) |
| 125 return Func->getIdentifierName(NameIndex); | 125 return Func->getIdentifierName(NameIndex); |
| 126 return "__" + std::to_string(getIndex()); | 126 return "__" + std::to_string(getIndex()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 Variable Variable::asType(Type Ty) { | 129 Variable *Variable::asType(Type Ty) { |
| 130 // Note: This returns a Variable, even if the "this" object is a | 130 // Note: This returns a Variable, even if the "this" object is a |
| 131 // subclass of Variable. | 131 // subclass of Variable. |
| 132 Variable V(kVariable, Ty, Number); | 132 if (!ALLOW_DUMP || getType() == Ty) |
| 133 V.NameIndex = NameIndex; | 133 return this; |
| 134 V.RegNum = RegNum; | 134 Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>()) |
| 135 V.StackOffset = StackOffset; | 135 Variable(kVariable, Ty, Number); |
| 136 V->NameIndex = NameIndex; |
| 137 V->RegNum = RegNum; |
| 138 V->StackOffset = StackOffset; |
| 136 return V; | 139 return V; |
| 137 } | 140 } |
| 138 | 141 |
| 139 void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr, | 142 void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr, |
| 140 const CfgNode *Node, bool IsFromDef, | 143 const CfgNode *Node, bool IsFromDef, |
| 141 bool IsImplicit) { | 144 bool IsImplicit) { |
| 142 (void)TrackingKind; | 145 (void)TrackingKind; |
| 143 if (MultiBlock == MBS_MultiBlock) | 146 if (MultiBlock == MBS_MultiBlock) |
| 144 return; | 147 return; |
| 145 // TODO(stichnot): If the use occurs as a source operand in the | 148 // TODO(stichnot): If the use occurs as a source operand in the |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 if (!ALLOW_DUMP) | 483 if (!ALLOW_DUMP) |
| 481 return Str; | 484 return Str; |
| 482 if (W.getWeight() == RegWeight::Inf) | 485 if (W.getWeight() == RegWeight::Inf) |
| 483 Str << "Inf"; | 486 Str << "Inf"; |
| 484 else | 487 else |
| 485 Str << W.getWeight(); | 488 Str << W.getWeight(); |
| 486 return Str; | 489 return Str; |
| 487 } | 490 } |
| 488 | 491 |
| 489 } // end of namespace Ice | 492 } // end of namespace Ice |
| OLD | NEW |