| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr, | 186 void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr, |
| 187 const CfgNode *Node) { | 187 const CfgNode *Node) { |
| 188 // TODO(stichnot): If the definition occurs in the last instruction | 188 // TODO(stichnot): If the definition occurs in the last instruction |
| 189 // of the block, consider not marking this as a separate use. But | 189 // of the block, consider not marking this as a separate use. But |
| 190 // be careful not to omit all uses of the variable if markDef() and | 190 // be careful not to omit all uses of the variable if markDef() and |
| 191 // markUse() both use this optimization. | 191 // markUse() both use this optimization. |
| 192 assert(Node); | 192 assert(Node); |
| 193 // Verify that instructions are added in increasing order. | 193 // Verify that instructions are added in increasing order. |
| 194 #ifndef NDEBUG | 194 #ifndef NDEBUG |
| 195 if (TrackingKind == VMK_All) { | 195 if (TrackingKind == VMK_All) { |
| 196 const Inst *LastInstruction = | 196 const Inst *LastInstruction = |
| 197 Definitions.empty() ? FirstOrSingleDefinition : Definitions.back(); | 197 Definitions.empty() ? FirstOrSingleDefinition : Definitions.back(); |
| 198 assert(LastInstruction == nullptr || | 198 assert(LastInstruction == nullptr || |
| 199 Instr->getNumber() >= LastInstruction->getNumber()); | 199 Instr->getNumber() >= LastInstruction->getNumber()); |
| 200 } | 200 } |
| 201 #endif | 201 #endif |
| 202 const bool IsFromDef = true; | 202 const bool IsFromDef = true; |
| 203 const bool IsImplicit = false; | 203 const bool IsImplicit = false; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 Kind = TrackingKind; | 267 Kind = TrackingKind; |
| 268 Metadata.clear(); | 268 Metadata.clear(); |
| 269 Metadata.resize(Func->getNumVariables()); | 269 Metadata.resize(Func->getNumVariables()); |
| 270 | 270 |
| 271 // Mark implicit args as being used in the entry node. | 271 // Mark implicit args as being used in the entry node. |
| 272 for (Variable *Var : Func->getImplicitArgs()) { | 272 for (Variable *Var : Func->getImplicitArgs()) { |
| 273 const Inst *NoInst = nullptr; | 273 const Inst *NoInst = nullptr; |
| 274 const CfgNode *EntryNode = Func->getEntryNode(); | 274 const CfgNode *EntryNode = Func->getEntryNode(); |
| 275 const bool IsFromDef = false; | 275 const bool IsFromDef = false; |
| 276 const bool IsImplicit = true; | 276 const bool IsImplicit = true; |
| 277 Metadata[Var->getIndex()] | 277 Metadata[Var->getIndex()].markUse(Kind, NoInst, EntryNode, IsFromDef, |
| 278 .markUse(Kind, NoInst, EntryNode, IsFromDef, IsImplicit); | 278 IsImplicit); |
| 279 } | 279 } |
| 280 | 280 |
| 281 for (CfgNode *Node : Func->getNodes()) | 281 for (CfgNode *Node : Func->getNodes()) |
| 282 addNode(Node); | 282 addNode(Node); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void VariablesMetadata::addNode(CfgNode *Node) { | 285 void VariablesMetadata::addNode(CfgNode *Node) { |
| 286 if (Func->getNumVariables() >= Metadata.size()) | 286 if (Func->getNumVariables() >= Metadata.size()) |
| 287 Metadata.resize(Func->getNumVariables()); | 287 Metadata.resize(Func->getNumVariables()); |
| 288 | 288 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 if (Func->isVerbose(IceV_RegOrigins) || | 402 if (Func->isVerbose(IceV_RegOrigins) || |
| 403 (!hasReg() && !Func->getTarget()->hasComputedFrame())) | 403 (!hasReg() && !Func->getTarget()->hasComputedFrame())) |
| 404 Str << "%" << getName(Func); | 404 Str << "%" << getName(Func); |
| 405 if (hasReg()) { | 405 if (hasReg()) { |
| 406 if (Func->isVerbose(IceV_RegOrigins)) | 406 if (Func->isVerbose(IceV_RegOrigins)) |
| 407 Str << ":"; | 407 Str << ":"; |
| 408 Str << Func->getTarget()->getRegName(RegNum, getType()); | 408 Str << Func->getTarget()->getRegName(RegNum, getType()); |
| 409 } else if (Func->getTarget()->hasComputedFrame()) { | 409 } else if (Func->getTarget()->hasComputedFrame()) { |
| 410 if (Func->isVerbose(IceV_RegOrigins)) | 410 if (Func->isVerbose(IceV_RegOrigins)) |
| 411 Str << ":"; | 411 Str << ":"; |
| 412 Str << "[" << Func->getTarget()->getRegName( | 412 Str << "[" |
| 413 Func->getTarget()->getFrameOrStackReg(), IceType_i32); | 413 << Func->getTarget()->getRegName( |
| 414 Func->getTarget()->getFrameOrStackReg(), IceType_i32); |
| 414 int32_t Offset = getStackOffset(); | 415 int32_t Offset = getStackOffset(); |
| 415 if (Offset) { | 416 if (Offset) { |
| 416 if (Offset > 0) | 417 if (Offset > 0) |
| 417 Str << "+"; | 418 Str << "+"; |
| 418 Str << Offset; | 419 Str << Offset; |
| 419 } | 420 } |
| 420 Str << "]"; | 421 Str << "]"; |
| 421 } | 422 } |
| 422 } | 423 } |
| 423 | 424 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (!ALLOW_DUMP) | 482 if (!ALLOW_DUMP) |
| 482 return Str; | 483 return Str; |
| 483 if (W.getWeight() == RegWeight::Inf) | 484 if (W.getWeight() == RegWeight::Inf) |
| 484 Str << "Inf"; | 485 Str << "Inf"; |
| 485 else | 486 else |
| 486 Str << W.getWeight(); | 487 Str << W.getWeight(); |
| 487 return Str; | 488 return Str; |
| 488 } | 489 } |
| 489 | 490 |
| 490 } // end of namespace Ice | 491 } // end of namespace Ice |
| OLD | NEW |