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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 DefInst = Inst; | 152 DefInst = Inst; |
153 if (Node != DefNode) | 153 if (Node != DefNode) |
154 DefNode = NULL; | 154 DefNode = NULL; |
155 } | 155 } |
156 | 156 |
157 void Variable::replaceDefinition(Inst *Inst, const CfgNode *Node) { | 157 void Variable::replaceDefinition(Inst *Inst, const CfgNode *Node) { |
158 DefInst = NULL; | 158 DefInst = NULL; |
159 setDefinition(Inst, Node); | 159 setDefinition(Inst, Node); |
160 } | 160 } |
161 | 161 |
162 void Variable::setIsArg(Cfg *Func) { | 162 void Variable::setIsArg(Cfg *Func, bool IsArg) { |
163 IsArgument = true; | 163 if (IsArg) { |
164 if (DefNode == NULL) | 164 IsArgument = true; |
165 return; | 165 if (DefNode == NULL) |
166 CfgNode *Entry = Func->getEntryNode(); | 166 return; |
167 if (DefNode == Entry) | 167 CfgNode *Entry = Func->getEntryNode(); |
168 return; | 168 if (DefNode == Entry) |
169 DefNode = NULL; | 169 return; |
| 170 DefNode = NULL; |
| 171 } else { |
| 172 IsArgument = false; |
| 173 } |
170 } | 174 } |
171 | 175 |
172 IceString Variable::getName() const { | 176 IceString Variable::getName() const { |
173 if (!Name.empty()) | 177 if (!Name.empty()) |
174 return Name; | 178 return Name; |
175 char buf[30]; | 179 char buf[30]; |
176 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); | 180 snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); |
177 return buf; | 181 return buf; |
178 } | 182 } |
179 | 183 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 258 |
255 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 259 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
256 if (W.getWeight() == RegWeight::Inf) | 260 if (W.getWeight() == RegWeight::Inf) |
257 Str << "Inf"; | 261 Str << "Inf"; |
258 else | 262 else |
259 Str << W.getWeight(); | 263 Str << W.getWeight(); |
260 return Str; | 264 return Str; |
261 } | 265 } |
262 | 266 |
263 } // end of namespace Ice | 267 } // end of namespace Ice |
OLD | NEW |