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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Make sure that the name can only be set once. | 380 // Make sure that the name can only be set once. |
381 assert(Name.empty()); | 381 assert(Name.empty()); |
382 Name = NewName; | 382 Name = NewName; |
383 } | 383 } |
384 | 384 |
385 bool getIsArg() const { return IsArgument; } | 385 bool getIsArg() const { return IsArgument; } |
386 void setIsArg(bool Val = true) { IsArgument = Val; } | 386 void setIsArg(bool Val = true) { IsArgument = Val; } |
387 bool getIsImplicitArg() const { return IsImplicitArgument; } | 387 bool getIsImplicitArg() const { return IsImplicitArgument; } |
388 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } | 388 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } |
389 | 389 |
| 390 void setIgnoreLiveness() { IgnoreLiveness = true; } |
| 391 bool getIgnoreLiveness() const { return IgnoreLiveness; } |
| 392 |
390 int32_t getStackOffset() const { return StackOffset; } | 393 int32_t getStackOffset() const { return StackOffset; } |
391 void setStackOffset(int32_t Offset) { StackOffset = Offset; } | 394 void setStackOffset(int32_t Offset) { StackOffset = Offset; } |
392 | 395 |
393 static const int32_t NoRegister = -1; | 396 static const int32_t NoRegister = -1; |
394 bool hasReg() const { return getRegNum() != NoRegister; } | 397 bool hasReg() const { return getRegNum() != NoRegister; } |
395 int32_t getRegNum() const { return RegNum; } | 398 int32_t getRegNum() const { return RegNum; } |
396 void setRegNum(int32_t NewRegNum) { | 399 void setRegNum(int32_t NewRegNum) { |
397 // Regnum shouldn't be set more than once. | 400 // Regnum shouldn't be set more than once. |
398 assert(!hasReg() || RegNum == NewRegNum); | 401 assert(!hasReg() || RegNum == NewRegNum); |
399 RegNum = NewRegNum; | 402 RegNum = NewRegNum; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 OperandKind Kind = Operand->getKind(); | 447 OperandKind Kind = Operand->getKind(); |
445 return Kind >= kVariable && Kind <= kVariable_Num; | 448 return Kind >= kVariable && Kind <= kVariable_Num; |
446 } | 449 } |
447 | 450 |
448 // The destructor is public because of the asType() method. | 451 // The destructor is public because of the asType() method. |
449 ~Variable() override {} | 452 ~Variable() override {} |
450 | 453 |
451 protected: | 454 protected: |
452 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) | 455 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) |
453 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), | 456 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), |
454 IsImplicitArgument(false), StackOffset(0), RegNum(NoRegister), | 457 IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0), |
455 RegNumTmp(NoRegister), Weight(1), LoVar(NULL), HiVar(NULL) { | 458 RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL), |
| 459 HiVar(NULL) { |
456 Vars = VarsReal; | 460 Vars = VarsReal; |
457 Vars[0] = this; | 461 Vars[0] = this; |
458 NumVars = 1; | 462 NumVars = 1; |
459 } | 463 } |
460 // Number is unique across all variables, and is used as a | 464 // Number is unique across all variables, and is used as a |
461 // (bit)vector index for liveness analysis. | 465 // (bit)vector index for liveness analysis. |
462 const SizeT Number; | 466 const SizeT Number; |
463 // Name is optional. | 467 // Name is optional. |
464 IceString Name; | 468 IceString Name; |
465 bool IsArgument; | 469 bool IsArgument; |
466 bool IsImplicitArgument; | 470 bool IsImplicitArgument; |
| 471 // IgnoreLiveness means that the variable should be ignored when |
| 472 // constructing and validating live ranges. This is usually |
| 473 // reserved for the stack pointer. |
| 474 bool IgnoreLiveness; |
467 // StackOffset is the canonical location on stack (only if | 475 // StackOffset is the canonical location on stack (only if |
468 // RegNum==NoRegister || IsArgument). | 476 // RegNum==NoRegister || IsArgument). |
469 int32_t StackOffset; | 477 int32_t StackOffset; |
470 // RegNum is the allocated register, or NoRegister if it isn't | 478 // RegNum is the allocated register, or NoRegister if it isn't |
471 // register-allocated. | 479 // register-allocated. |
472 int32_t RegNum; | 480 int32_t RegNum; |
473 // RegNumTmp is the tentative assignment during register allocation. | 481 // RegNumTmp is the tentative assignment during register allocation. |
474 int32_t RegNumTmp; | 482 int32_t RegNumTmp; |
475 RegWeight Weight; // Register allocation priority | 483 RegWeight Weight; // Register allocation priority |
476 LiveRange Live; | 484 LiveRange Live; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 const Cfg *Func; | 587 const Cfg *Func; |
580 std::vector<VariableTracking> Metadata; | 588 std::vector<VariableTracking> Metadata; |
581 const static InstDefList NoDefinitions; | 589 const static InstDefList NoDefinitions; |
582 VariablesMetadata(const VariablesMetadata &) = delete; | 590 VariablesMetadata(const VariablesMetadata &) = delete; |
583 VariablesMetadata &operator=(const VariablesMetadata &) = delete; | 591 VariablesMetadata &operator=(const VariablesMetadata &) = delete; |
584 }; | 592 }; |
585 | 593 |
586 } // end of namespace Ice | 594 } // end of namespace Ice |
587 | 595 |
588 #endif // SUBZERO_SRC_ICEOPERAND_H | 596 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |