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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 } | 181 } |
182 | 182 |
183 IceString Variable::getName() const { | 183 IceString Variable::getName() const { |
184 if (!Name.empty()) | 184 if (!Name.empty()) |
185 return Name; | 185 return Name; |
186 char buf[30]; | 186 char buf[30]; |
187 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); | 187 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); |
188 return buf; | 188 return buf; |
189 } | 189 } |
190 | 190 |
191 void Variable::setName(IceString &NewName) { | |
192 assert(Name.empty()); | |
Jim Stichnoth
2014/09/10 18:44:23
Document that the assert is to be sure true renami
Karl
2014/09/10 21:14:33
Done.
| |
193 Name = NewName; | |
194 } | |
195 | |
191 Variable Variable::asType(Type Ty) { | 196 Variable Variable::asType(Type Ty) { |
192 Variable V(Ty, DefNode, Number, Name); | 197 Variable V(Ty, DefNode, Number, Name); |
193 V.RegNum = RegNum; | 198 V.RegNum = RegNum; |
194 V.StackOffset = StackOffset; | 199 V.StackOffset = StackOffset; |
195 return V; | 200 return V; |
196 } | 201 } |
197 | 202 |
198 // ======================== dump routines ======================== // | 203 // ======================== dump routines ======================== // |
199 | 204 |
200 void Variable::emit(const Cfg *Func) const { | 205 void Variable::emit(const Cfg *Func) const { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 | 270 |
266 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 271 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
267 if (W.getWeight() == RegWeight::Inf) | 272 if (W.getWeight() == RegWeight::Inf) |
268 Str << "Inf"; | 273 Str << "Inf"; |
269 else | 274 else |
270 Str << W.getWeight(); | 275 Str << W.getWeight(); |
271 return Str; | 276 return Str; |
272 } | 277 } |
273 | 278 |
274 } // end of namespace Ice | 279 } // end of namespace Ice |
OLD | NEW |