| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool getIsArg() const { return IsArgument; } | 400 bool getIsArg() const { return IsArgument; } |
| 401 void setIsArg(bool Val = true) { IsArgument = Val; } | 401 void setIsArg(bool Val = true) { IsArgument = Val; } |
| 402 bool getIsImplicitArg() const { return IsImplicitArgument; } | 402 bool getIsImplicitArg() const { return IsImplicitArgument; } |
| 403 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } | 403 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } |
| 404 | 404 |
| 405 void setIgnoreLiveness() { IgnoreLiveness = true; } | 405 void setIgnoreLiveness() { IgnoreLiveness = true; } |
| 406 bool getIgnoreLiveness() const { return IgnoreLiveness; } | 406 bool getIgnoreLiveness() const { return IgnoreLiveness; } |
| 407 | 407 |
| 408 bool needsStackSlot() const { return NeedsStackSlot; } | |
| 409 void setNeedsStackSlot() { NeedsStackSlot = true; } | |
| 410 int32_t getStackOffset() const { return StackOffset; } | 408 int32_t getStackOffset() const { return StackOffset; } |
| 411 void setStackOffset(int32_t Offset) { StackOffset = Offset; } | 409 void setStackOffset(int32_t Offset) { StackOffset = Offset; } |
| 412 | 410 |
| 413 static const int32_t NoRegister = -1; | 411 static const int32_t NoRegister = -1; |
| 414 bool hasReg() const { return getRegNum() != NoRegister; } | 412 bool hasReg() const { return getRegNum() != NoRegister; } |
| 415 int32_t getRegNum() const { return RegNum; } | 413 int32_t getRegNum() const { return RegNum; } |
| 416 void setRegNum(int32_t NewRegNum) { | 414 void setRegNum(int32_t NewRegNum) { |
| 417 // Regnum shouldn't be set more than once. | 415 // Regnum shouldn't be set more than once. |
| 418 assert(!hasReg() || RegNum == NewRegNum); | 416 assert(!hasReg() || RegNum == NewRegNum); |
| 419 RegNum = NewRegNum; | 417 RegNum = NewRegNum; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 OperandKind Kind = Operand->getKind(); | 474 OperandKind Kind = Operand->getKind(); |
| 477 return Kind >= kVariable && Kind <= kVariable_Num; | 475 return Kind >= kVariable && Kind <= kVariable_Num; |
| 478 } | 476 } |
| 479 | 477 |
| 480 // The destructor is public because of the asType() method. | 478 // The destructor is public because of the asType() method. |
| 481 ~Variable() override {} | 479 ~Variable() override {} |
| 482 | 480 |
| 483 protected: | 481 protected: |
| 484 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) | 482 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) |
| 485 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), | 483 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), |
| 486 IsImplicitArgument(false), IgnoreLiveness(false), NeedsStackSlot(false), | 484 IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0), |
| 487 StackOffset(0), RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), | 485 RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL), |
| 488 LoVar(NULL), HiVar(NULL) { | 486 HiVar(NULL) { |
| 489 Vars = VarsReal; | 487 Vars = VarsReal; |
| 490 Vars[0] = this; | 488 Vars[0] = this; |
| 491 NumVars = 1; | 489 NumVars = 1; |
| 492 } | 490 } |
| 493 // Number is unique across all variables, and is used as a | 491 // Number is unique across all variables, and is used as a |
| 494 // (bit)vector index for liveness analysis. | 492 // (bit)vector index for liveness analysis. |
| 495 const SizeT Number; | 493 const SizeT Number; |
| 496 // Name is optional. | 494 // Name is optional. |
| 497 IceString Name; | 495 IceString Name; |
| 498 bool IsArgument; | 496 bool IsArgument; |
| 499 bool IsImplicitArgument; | 497 bool IsImplicitArgument; |
| 500 // IgnoreLiveness means that the variable should be ignored when | 498 // IgnoreLiveness means that the variable should be ignored when |
| 501 // constructing and validating live ranges. This is usually | 499 // constructing and validating live ranges. This is usually |
| 502 // reserved for the stack pointer. | 500 // reserved for the stack pointer. |
| 503 bool IgnoreLiveness; | 501 bool IgnoreLiveness; |
| 504 // NeedsStackSlot starts out false, and is set to true once we know | |
| 505 // for sure that the variable needs a stack slot. | |
| 506 bool NeedsStackSlot; | |
| 507 // StackOffset is the canonical location on stack (only if | 502 // StackOffset is the canonical location on stack (only if |
| 508 // RegNum==NoRegister || IsArgument). | 503 // RegNum==NoRegister || IsArgument). |
| 509 int32_t StackOffset; | 504 int32_t StackOffset; |
| 510 // RegNum is the allocated register, or NoRegister if it isn't | 505 // RegNum is the allocated register, or NoRegister if it isn't |
| 511 // register-allocated. | 506 // register-allocated. |
| 512 int32_t RegNum; | 507 int32_t RegNum; |
| 513 // RegNumTmp is the tentative assignment during register allocation. | 508 // RegNumTmp is the tentative assignment during register allocation. |
| 514 int32_t RegNumTmp; | 509 int32_t RegNumTmp; |
| 515 RegWeight Weight; // Register allocation priority | 510 RegWeight Weight; // Register allocation priority |
| 516 LiveRange Live; | 511 LiveRange Live; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 private: | 628 private: |
| 634 const Cfg *Func; | 629 const Cfg *Func; |
| 635 MetadataKind Kind; | 630 MetadataKind Kind; |
| 636 std::vector<VariableTracking> Metadata; | 631 std::vector<VariableTracking> Metadata; |
| 637 const static InstDefList NoDefinitions; | 632 const static InstDefList NoDefinitions; |
| 638 }; | 633 }; |
| 639 | 634 |
| 640 } // end of namespace Ice | 635 } // end of namespace Ice |
| 641 | 636 |
| 642 #endif // SUBZERO_SRC_ICEOPERAND_H | 637 #endif // SUBZERO_SRC_ICEOPERAND_H |
| OLD | NEW |