OLD | NEW |
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// | 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// |
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 declares the Operand class and its target-independent | 10 // This file declares the Operand class and its target-independent |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // have a non-negative RegNum field. | 328 // have a non-negative RegNum field. |
329 class Variable : public Operand { | 329 class Variable : public Operand { |
330 public: | 330 public: |
331 static Variable *create(Cfg *Func, Type Ty, const CfgNode *Node, SizeT Index, | 331 static Variable *create(Cfg *Func, Type Ty, const CfgNode *Node, SizeT Index, |
332 const IceString &Name) { | 332 const IceString &Name) { |
333 return new (Func->allocate<Variable>()) Variable(Ty, Node, Index, Name); | 333 return new (Func->allocate<Variable>()) Variable(Ty, Node, Index, Name); |
334 } | 334 } |
335 | 335 |
336 SizeT getIndex() const { return Number; } | 336 SizeT getIndex() const { return Number; } |
337 IceString getName() const; | 337 IceString getName() const; |
| 338 void setName(IceString &NewName) { |
| 339 // Make sure that the name can only be set once. |
| 340 assert(Name.empty()); |
| 341 Name = NewName; |
| 342 } |
338 | 343 |
339 Inst *getDefinition() const { return DefInst; } | 344 Inst *getDefinition() const { return DefInst; } |
340 void setDefinition(Inst *Inst, const CfgNode *Node); | 345 void setDefinition(Inst *Inst, const CfgNode *Node); |
341 void replaceDefinition(Inst *Inst, const CfgNode *Node); | 346 void replaceDefinition(Inst *Inst, const CfgNode *Node); |
342 | 347 |
343 const CfgNode *getLocalUseNode() const { return DefNode; } | 348 const CfgNode *getLocalUseNode() const { return DefNode; } |
344 bool isMultiblockLife() const { return (DefNode == NULL); } | 349 bool isMultiblockLife() const { return (DefNode == NULL); } |
345 void setUse(const Inst *Inst, const CfgNode *Node); | 350 void setUse(const Inst *Inst, const CfgNode *Node); |
346 | 351 |
347 bool getIsArg() const { return IsArgument; } | 352 bool getIsArg() const { return IsArgument; } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 Vars = VarsReal; | 425 Vars = VarsReal; |
421 Vars[0] = this; | 426 Vars[0] = this; |
422 NumVars = 1; | 427 NumVars = 1; |
423 } | 428 } |
424 Variable(const Variable &) LLVM_DELETED_FUNCTION; | 429 Variable(const Variable &) LLVM_DELETED_FUNCTION; |
425 Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; | 430 Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; |
426 // Number is unique across all variables, and is used as a | 431 // Number is unique across all variables, and is used as a |
427 // (bit)vector index for liveness analysis. | 432 // (bit)vector index for liveness analysis. |
428 const SizeT Number; | 433 const SizeT Number; |
429 // Name is optional. | 434 // Name is optional. |
430 const IceString Name; | 435 IceString Name; |
431 // DefInst is the instruction that produces this variable as its | 436 // DefInst is the instruction that produces this variable as its |
432 // dest. | 437 // dest. |
433 Inst *DefInst; | 438 Inst *DefInst; |
434 // DefNode is the node where this variable was produced, and is | 439 // DefNode is the node where this variable was produced, and is |
435 // reset to NULL if it is used outside that node. This is used for | 440 // reset to NULL if it is used outside that node. This is used for |
436 // detecting isMultiblockLife(). TODO: Collapse this to a single | 441 // detecting isMultiblockLife(). TODO: Collapse this to a single |
437 // bit and use a separate pass to calculate the values across the | 442 // bit and use a separate pass to calculate the values across the |
438 // Cfg. This saves space in the Variable, and removes the fragility | 443 // Cfg. This saves space in the Variable, and removes the fragility |
439 // of incrementally computing and maintaining the information. | 444 // of incrementally computing and maintaining the information. |
440 const CfgNode *DefNode; | 445 const CfgNode *DefNode; |
(...skipping 28 matching lines...) Expand all Loading... |
469 Variable *LoVar; | 474 Variable *LoVar; |
470 Variable *HiVar; | 475 Variable *HiVar; |
471 // VarsReal (and Operand::Vars) are set up such that Vars[0] == | 476 // VarsReal (and Operand::Vars) are set up such that Vars[0] == |
472 // this. | 477 // this. |
473 Variable *VarsReal[1]; | 478 Variable *VarsReal[1]; |
474 }; | 479 }; |
475 | 480 |
476 } // end of namespace Ice | 481 } // end of namespace Ice |
477 | 482 |
478 #endif // SUBZERO_SRC_ICEOPERAND_H | 483 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |