| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void LiveRange::trim(InstNumberT Lower) { | 129 void LiveRange::trim(InstNumberT Lower) { |
| 130 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 130 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
| 131 ++TrimmedBegin; | 131 ++TrimmedBegin; |
| 132 } | 132 } |
| 133 | 133 |
| 134 IceString Variable::getName() const { | 134 IceString Variable::getName(const Cfg *Func) const { |
| 135 if (!Name.empty()) | 135 if (Func && NameIndex >= 0) |
| 136 return Name; | 136 return Func->getIdentifierName(NameIndex); |
| 137 return "__" + std::to_string(getIndex()); | 137 return "__" + std::to_string(getIndex()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 Variable Variable::asType(Type Ty) { | 140 Variable Variable::asType(Type Ty) { |
| 141 // Note: This returns a Variable, even if the "this" object is a | 141 // Note: This returns a Variable, even if the "this" object is a |
| 142 // subclass of Variable. | 142 // subclass of Variable. |
| 143 Variable V(kVariable, Ty, Number, Name); | 143 Variable V(kVariable, Ty, Number); |
| 144 V.NameIndex = NameIndex; |
| 144 V.RegNum = RegNum; | 145 V.RegNum = RegNum; |
| 145 V.StackOffset = StackOffset; | 146 V.StackOffset = StackOffset; |
| 146 return V; | 147 return V; |
| 147 } | 148 } |
| 148 | 149 |
| 149 void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr, | 150 void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr, |
| 150 const CfgNode *Node, bool IsFromDef, | 151 const CfgNode *Node, bool IsFromDef, |
| 151 bool IsImplicit) { | 152 bool IsImplicit) { |
| 152 (void)TrackingKind; | 153 (void)TrackingKind; |
| 153 if (MultiBlock == MBS_MultiBlock) | 154 if (MultiBlock == MBS_MultiBlock) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 399 |
| 399 void Variable::emit(const Cfg *Func) const { | 400 void Variable::emit(const Cfg *Func) const { |
| 400 if (ALLOW_DUMP) | 401 if (ALLOW_DUMP) |
| 401 Func->getTarget()->emitVariable(this); | 402 Func->getTarget()->emitVariable(this); |
| 402 } | 403 } |
| 403 | 404 |
| 404 void Variable::dump(const Cfg *Func, Ostream &Str) const { | 405 void Variable::dump(const Cfg *Func, Ostream &Str) const { |
| 405 if (!ALLOW_DUMP) | 406 if (!ALLOW_DUMP) |
| 406 return; | 407 return; |
| 407 if (Func == NULL) { | 408 if (Func == NULL) { |
| 408 Str << "%" << getName(); | 409 Str << "%" << getName(Func); |
| 409 return; | 410 return; |
| 410 } | 411 } |
| 411 if (Func->getContext()->isVerbose(IceV_RegOrigins) || | 412 if (Func->getContext()->isVerbose(IceV_RegOrigins) || |
| 412 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 413 (!hasReg() && !Func->getTarget()->hasComputedFrame())) |
| 413 Str << "%" << getName(); | 414 Str << "%" << getName(Func); |
| 414 if (hasReg()) { | 415 if (hasReg()) { |
| 415 if (Func->getContext()->isVerbose(IceV_RegOrigins)) | 416 if (Func->getContext()->isVerbose(IceV_RegOrigins)) |
| 416 Str << ":"; | 417 Str << ":"; |
| 417 Str << Func->getTarget()->getRegName(RegNum, getType()); | 418 Str << Func->getTarget()->getRegName(RegNum, getType()); |
| 418 } else if (Func->getTarget()->hasComputedFrame()) { | 419 } else if (Func->getTarget()->hasComputedFrame()) { |
| 419 if (Func->getContext()->isVerbose(IceV_RegOrigins)) | 420 if (Func->getContext()->isVerbose(IceV_RegOrigins)) |
| 420 Str << ":"; | 421 Str << ":"; |
| 421 Str << "[" << Func->getTarget()->getRegName( | 422 Str << "[" << Func->getTarget()->getRegName( |
| 422 Func->getTarget()->getFrameOrStackReg(), IceType_i32); | 423 Func->getTarget()->getFrameOrStackReg(), IceType_i32); |
| 423 int32_t Offset = getStackOffset(); | 424 int32_t Offset = getStackOffset(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 if (!ALLOW_DUMP) | 491 if (!ALLOW_DUMP) |
| 491 return Str; | 492 return Str; |
| 492 if (W.getWeight() == RegWeight::Inf) | 493 if (W.getWeight() == RegWeight::Inf) |
| 493 Str << "Inf"; | 494 Str << "Inf"; |
| 494 else | 495 else |
| 495 Str << W.getWeight(); | 496 Str << W.getWeight(); |
| 496 return Str; | 497 return Str; |
| 497 } | 498 } |
| 498 | 499 |
| 499 } // end of namespace Ice | 500 } // end of namespace Ice |
| OLD | NEW |