| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 342 } |
| 343 | 343 |
| 344 Inst *getDefinition() const { return DefInst; } | 344 Inst *getDefinition() const { return DefInst; } |
| 345 void setDefinition(Inst *Inst, const CfgNode *Node); | 345 void setDefinition(Inst *Inst, const CfgNode *Node); |
| 346 void replaceDefinition(Inst *Inst, const CfgNode *Node); | 346 void replaceDefinition(Inst *Inst, const CfgNode *Node); |
| 347 | 347 |
| 348 const CfgNode *getLocalUseNode() const { return DefNode; } | 348 const CfgNode *getLocalUseNode() const { return DefNode; } |
| 349 bool isMultiblockLife() const { return (DefNode == NULL); } | 349 bool isMultiblockLife() const { return (DefNode == NULL); } |
| 350 void setUse(const Inst *Inst, const CfgNode *Node); | 350 void setUse(const Inst *Inst, const CfgNode *Node); |
| 351 | 351 |
| 352 // Multidef means a variable is non-SSA and has multiple defining |
| 353 // instructions. Currently this classification is limited to SSA |
| 354 // lowering temporaries where the definitions are in different basic |
| 355 // blocks, and it is not maintained during target lowering when the |
| 356 // same temporary may be updated in consecutive instructions. |
| 357 bool getIsMultidef() const { return IsMultidef; } |
| 358 void setIsMultidef() { IsMultidef = true; } |
| 359 |
| 352 bool getIsArg() const { return IsArgument; } | 360 bool getIsArg() const { return IsArgument; } |
| 353 void setIsArg(Cfg *Func, bool IsArg = true); | 361 void setIsArg(Cfg *Func, bool IsArg = true); |
| 354 | 362 |
| 355 int32_t getStackOffset() const { return StackOffset; } | 363 int32_t getStackOffset() const { return StackOffset; } |
| 356 void setStackOffset(int32_t Offset) { StackOffset = Offset; } | 364 void setStackOffset(int32_t Offset) { StackOffset = Offset; } |
| 357 | 365 |
| 358 static const int32_t NoRegister = -1; | 366 static const int32_t NoRegister = -1; |
| 359 bool hasReg() const { return getRegNum() != NoRegister; } | 367 bool hasReg() const { return getRegNum() != NoRegister; } |
| 360 int32_t getRegNum() const { return RegNum; } | 368 int32_t getRegNum() const { return RegNum; } |
| 361 void setRegNum(int32_t NewRegNum) { | 369 void setRegNum(int32_t NewRegNum) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 static bool classof(const Operand *Operand) { | 420 static bool classof(const Operand *Operand) { |
| 413 return Operand->getKind() == kVariable; | 421 return Operand->getKind() == kVariable; |
| 414 } | 422 } |
| 415 | 423 |
| 416 // The destructor is public because of the asType() method. | 424 // The destructor is public because of the asType() method. |
| 417 virtual ~Variable() {} | 425 virtual ~Variable() {} |
| 418 | 426 |
| 419 private: | 427 private: |
| 420 Variable(Type Ty, const CfgNode *Node, SizeT Index, const IceString &Name) | 428 Variable(Type Ty, const CfgNode *Node, SizeT Index, const IceString &Name) |
| 421 : Operand(kVariable, Ty), Number(Index), Name(Name), DefInst(NULL), | 429 : Operand(kVariable, Ty), Number(Index), Name(Name), DefInst(NULL), |
| 422 DefNode(Node), IsArgument(false), StackOffset(0), RegNum(NoRegister), | 430 DefNode(Node), IsMultidef(false), IsArgument(false), StackOffset(0), |
| 423 RegNumTmp(NoRegister), Weight(1), RegisterPreference(NULL), | 431 RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), |
| 424 AllowRegisterOverlap(false), LoVar(NULL), HiVar(NULL) { | 432 RegisterPreference(NULL), AllowRegisterOverlap(false), LoVar(NULL), |
| 433 HiVar(NULL) { |
| 425 Vars = VarsReal; | 434 Vars = VarsReal; |
| 426 Vars[0] = this; | 435 Vars[0] = this; |
| 427 NumVars = 1; | 436 NumVars = 1; |
| 428 } | 437 } |
| 429 Variable(const Variable &) LLVM_DELETED_FUNCTION; | 438 Variable(const Variable &) LLVM_DELETED_FUNCTION; |
| 430 Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; | 439 Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; |
| 431 // Number is unique across all variables, and is used as a | 440 // Number is unique across all variables, and is used as a |
| 432 // (bit)vector index for liveness analysis. | 441 // (bit)vector index for liveness analysis. |
| 433 const SizeT Number; | 442 const SizeT Number; |
| 434 // Name is optional. | 443 // Name is optional. |
| 435 IceString Name; | 444 IceString Name; |
| 436 // DefInst is the instruction that produces this variable as its | 445 // DefInst is the instruction that produces this variable as its |
| 437 // dest. | 446 // dest. |
| 438 Inst *DefInst; | 447 Inst *DefInst; |
| 439 // DefNode is the node where this variable was produced, and is | 448 // DefNode is the node where this variable was produced, and is |
| 440 // reset to NULL if it is used outside that node. This is used for | 449 // reset to NULL if it is used outside that node. This is used for |
| 441 // detecting isMultiblockLife(). TODO: Collapse this to a single | 450 // detecting isMultiblockLife(). TODO: Collapse this to a single |
| 442 // bit and use a separate pass to calculate the values across the | 451 // bit and use a separate pass to calculate the values across the |
| 443 // Cfg. This saves space in the Variable, and removes the fragility | 452 // Cfg. This saves space in the Variable, and removes the fragility |
| 444 // of incrementally computing and maintaining the information. | 453 // of incrementally computing and maintaining the information. |
| 445 const CfgNode *DefNode; | 454 const CfgNode *DefNode; |
| 455 bool IsMultidef; |
| 446 bool IsArgument; | 456 bool IsArgument; |
| 447 // StackOffset is the canonical location on stack (only if | 457 // StackOffset is the canonical location on stack (only if |
| 448 // RegNum<0 || IsArgument). | 458 // RegNum<0 || IsArgument). |
| 449 int32_t StackOffset; | 459 int32_t StackOffset; |
| 450 // RegNum is the allocated register, or NoRegister if it isn't | 460 // RegNum is the allocated register, or NoRegister if it isn't |
| 451 // register-allocated. | 461 // register-allocated. |
| 452 int32_t RegNum; | 462 int32_t RegNum; |
| 453 // RegNumTmp is the tentative assignment during register allocation. | 463 // RegNumTmp is the tentative assignment during register allocation. |
| 454 int32_t RegNumTmp; | 464 int32_t RegNumTmp; |
| 455 RegWeight Weight; // Register allocation priority | 465 RegWeight Weight; // Register allocation priority |
| (...skipping 18 matching lines...) Expand all Loading... |
| 474 Variable *LoVar; | 484 Variable *LoVar; |
| 475 Variable *HiVar; | 485 Variable *HiVar; |
| 476 // VarsReal (and Operand::Vars) are set up such that Vars[0] == | 486 // VarsReal (and Operand::Vars) are set up such that Vars[0] == |
| 477 // this. | 487 // this. |
| 478 Variable *VarsReal[1]; | 488 Variable *VarsReal[1]; |
| 479 }; | 489 }; |
| 480 | 490 |
| 481 } // end of namespace Ice | 491 } // end of namespace Ice |
| 482 | 492 |
| 483 #endif // SUBZERO_SRC_ICEOPERAND_H | 493 #endif // SUBZERO_SRC_ICEOPERAND_H |
| OLD | NEW |