| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 void Variable::setUse(const Inst *Inst, const CfgNode *Node) { | 141 void Variable::setUse(const Inst *Inst, const CfgNode *Node) { |
| 142 if (DefNode == NULL) | 142 if (DefNode == NULL) |
| 143 return; | 143 return; |
| 144 if (llvm::isa<InstPhi>(Inst) || Node != DefNode) | 144 if (llvm::isa<InstPhi>(Inst) || Node != DefNode) |
| 145 DefNode = NULL; | 145 DefNode = NULL; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void Variable::setDefinition(Inst *Inst, const CfgNode *Node) { | 148 void Variable::setDefinition(Inst *Inst, const CfgNode *Node) { |
| 149 if (DefInst && !DefInst->isDeleted() && DefInst != Inst) { |
| 150 // Detect when a variable is being defined multiple times, |
| 151 // particularly for Phi instruction lowering. If this happens, we |
| 152 // need to lock DefInst to NULL. |
| 153 DefInst = NULL; |
| 154 DefNode = NULL; |
| 155 return; |
| 156 } |
| 149 if (DefNode == NULL) | 157 if (DefNode == NULL) |
| 150 return; | 158 return; |
| 151 // Can first check preexisting DefInst if we care about multi-def vars. | |
| 152 DefInst = Inst; | 159 DefInst = Inst; |
| 153 if (Node != DefNode) | 160 if (Node != DefNode) |
| 154 DefNode = NULL; | 161 DefNode = NULL; |
| 155 } | 162 } |
| 156 | 163 |
| 157 void Variable::replaceDefinition(Inst *Inst, const CfgNode *Node) { | 164 void Variable::replaceDefinition(Inst *Inst, const CfgNode *Node) { |
| 158 DefInst = NULL; | 165 DefInst = NULL; |
| 159 setDefinition(Inst, Node); | 166 setDefinition(Inst, Node); |
| 160 } | 167 } |
| 161 | 168 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 265 |
| 259 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 266 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
| 260 if (W.getWeight() == RegWeight::Inf) | 267 if (W.getWeight() == RegWeight::Inf) |
| 261 Str << "Inf"; | 268 Str << "Inf"; |
| 262 else | 269 else |
| 263 Str << W.getWeight(); | 270 Str << W.getWeight(); |
| 264 return Str; | 271 return Str; |
| 265 } | 272 } |
| 266 | 273 |
| 267 } // end of namespace Ice | 274 } // end of namespace Ice |
| OLD | NEW |