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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Variable Variable::asType(Type Ty) { | 191 Variable Variable::asType(Type Ty) { |
192 Variable V(Ty, DefNode, Number, Name); | 192 // Note: This returns a Variable, even if the "this" object is a |
| 193 // subclass of Variable. |
| 194 Variable V(kVariable, Ty, DefNode, Number, Name); |
193 V.RegNum = RegNum; | 195 V.RegNum = RegNum; |
194 V.StackOffset = StackOffset; | 196 V.StackOffset = StackOffset; |
195 return V; | 197 return V; |
196 } | 198 } |
197 | 199 |
198 // ======================== dump routines ======================== // | 200 // ======================== dump routines ======================== // |
199 | 201 |
200 void Variable::emit(const Cfg *Func) const { | 202 void Variable::emit(const Cfg *Func) const { |
201 Func->getTarget()->emitVariable(this, Func); | 203 Func->getTarget()->emitVariable(this, Func); |
202 } | 204 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 269 |
268 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 270 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
269 if (W.getWeight() == RegWeight::Inf) | 271 if (W.getWeight() == RegWeight::Inf) |
270 Str << "Inf"; | 272 Str << "Inf"; |
271 else | 273 else |
272 Str << W.getWeight(); | 274 Str << W.getWeight(); |
273 return Str; | 275 return Str; |
274 } | 276 } |
275 | 277 |
276 } // end of namespace Ice | 278 } // end of namespace Ice |
OLD | NEW |