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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 void LiveRange::trim(InstNumberT Lower) { | 166 void LiveRange::trim(InstNumberT Lower) { |
167 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) | 167 while (TrimmedBegin != Range.end() && TrimmedBegin->second <= Lower) |
168 ++TrimmedBegin; | 168 ++TrimmedBegin; |
169 } | 169 } |
170 | 170 |
171 IceString Variable::getName() const { | 171 IceString Variable::getName() const { |
172 if (!Name.empty()) | 172 if (!Name.empty()) |
173 return Name; | 173 return Name; |
174 char buf[30]; | 174 return "__" + std::to_string(getIndex()); |
175 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); | |
176 return buf; | |
177 } | 175 } |
178 | 176 |
179 Variable Variable::asType(Type Ty) { | 177 Variable Variable::asType(Type Ty) { |
180 // Note: This returns a Variable, even if the "this" object is a | 178 // Note: This returns a Variable, even if the "this" object is a |
181 // subclass of Variable. | 179 // subclass of Variable. |
182 Variable V(kVariable, Ty, Number, Name); | 180 Variable V(kVariable, Ty, Number, Name); |
183 V.RegNum = RegNum; | 181 V.RegNum = RegNum; |
184 V.StackOffset = StackOffset; | 182 V.StackOffset = StackOffset; |
185 return V; | 183 return V; |
186 } | 184 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 487 |
490 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 488 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
491 if (W.getWeight() == RegWeight::Inf) | 489 if (W.getWeight() == RegWeight::Inf) |
492 Str << "Inf"; | 490 Str << "Inf"; |
493 else | 491 else |
494 Str << W.getWeight(); | 492 Str << W.getWeight(); |
495 return Str; | 493 return Str; |
496 } | 494 } |
497 | 495 |
498 } // end of namespace Ice | 496 } // end of namespace Ice |
OLD | NEW |