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 /// \file | 10 /// \file |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 // Make sure it's only called once. | 436 // Make sure it's only called once. |
437 assert(Limit == 0); | 437 assert(Limit == 0); |
438 assert(Value != 0); | 438 assert(Value != 0); |
439 Limit = Value; | 439 Limit = Value; |
440 } | 440 } |
441 // Define NoRegisterValue as an enum value so that it can be used as an | 441 // Define NoRegisterValue as an enum value so that it can be used as an |
442 // argument for the public ctor if desired. | 442 // argument for the public ctor if desired. |
443 enum { NoRegisterValue = std::numeric_limits<BaseType>::max() }; | 443 enum { NoRegisterValue = std::numeric_limits<BaseType>::max() }; |
444 const static RegNumT NoRegister /* = NoRegisterValue */; | 444 const static RegNumT NoRegister /* = NoRegisterValue */; |
445 | 445 |
446 bool hasNoValue() const { return !hasValue(); } | |
Jim Stichnoth
2016/02/12 18:29:54
Nit: I would reverse the order of these two defini
rkotlerimgtec
2016/02/12 22:02:01
Done.
| |
447 bool hasValue() const { return Value != NoRegisterValue; } | |
448 | |
446 private: | 449 private: |
447 BaseType Value = NoRegisterValue; | 450 BaseType Value = NoRegisterValue; |
448 static BaseType Limit; | 451 static BaseType Limit; |
449 /// Private ctor called only by fromInt() and fixme(). | 452 /// Private ctor called only by fromInt() and fixme(). |
450 RegNumT(BaseType Value) : Value(Value) { validate(Value); } | 453 RegNumT(BaseType Value) : Value(Value) { validate(Value); } |
451 /// The ctor calls this to validate against the target-supplied limit. | 454 /// The ctor calls this to validate against the target-supplied limit. |
452 static void validate(BaseType Value) { | 455 static void validate(BaseType Value) { |
453 (void)Value; | 456 (void)Value; |
454 assert(Value == NoRegisterValue || Value < Limit); | 457 assert(Value == NoRegisterValue || Value < Limit); |
455 } | 458 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
639 bool getIgnoreLiveness() const { return IgnoreLiveness; } | 642 bool getIgnoreLiveness() const { return IgnoreLiveness; } |
640 | 643 |
641 int32_t getStackOffset() const { return StackOffset; } | 644 int32_t getStackOffset() const { return StackOffset; } |
642 void setStackOffset(int32_t Offset) { StackOffset = Offset; } | 645 void setStackOffset(int32_t Offset) { StackOffset = Offset; } |
643 /// Returns the variable's stack offset in symbolic form, to improve | 646 /// Returns the variable's stack offset in symbolic form, to improve |
644 /// readability in DecorateAsm mode. | 647 /// readability in DecorateAsm mode. |
645 IceString getSymbolicStackOffset(const Cfg *Func) const { | 648 IceString getSymbolicStackOffset(const Cfg *Func) const { |
646 return "lv$" + getName(Func); | 649 return "lv$" + getName(Func); |
647 } | 650 } |
648 | 651 |
649 bool hasReg() const { return getRegNum() != RegNumT::NoRegister; } | 652 bool hasReg() const { return getRegNum().hasValue(); } |
650 RegNumT getRegNum() const { return RegNum; } | 653 RegNumT getRegNum() const { return RegNum; } |
651 void setRegNum(RegNumT NewRegNum) { | 654 void setRegNum(RegNumT NewRegNum) { |
652 // Regnum shouldn't be set more than once. | 655 // Regnum shouldn't be set more than once. |
653 assert(!hasReg() || RegNum == NewRegNum); | 656 assert(!hasReg() || RegNum == NewRegNum); |
654 RegNum = NewRegNum; | 657 RegNum = NewRegNum; |
655 } | 658 } |
656 bool hasRegTmp() const { return getRegNumTmp() != RegNumT::NoRegister; } | 659 bool hasRegTmp() const { return getRegNumTmp().hasValue(); } |
657 RegNumT getRegNumTmp() const { return RegNumTmp; } | 660 RegNumT getRegNumTmp() const { return RegNumTmp; } |
658 void setRegNumTmp(RegNumT NewRegNum) { RegNumTmp = NewRegNum; } | 661 void setRegNumTmp(RegNumT NewRegNum) { RegNumTmp = NewRegNum; } |
659 | 662 |
660 RegWeight getWeight(const Cfg *Func) const; | 663 RegWeight getWeight(const Cfg *Func) const; |
661 | 664 |
662 void setMustHaveReg() { RegRequirement = RR_MustHaveRegister; } | 665 void setMustHaveReg() { RegRequirement = RR_MustHaveRegister; } |
663 bool mustHaveReg() const { return RegRequirement == RR_MustHaveRegister; } | 666 bool mustHaveReg() const { return RegRequirement == RR_MustHaveRegister; } |
664 void setMustNotHaveReg() { RegRequirement = RR_MustNotHaveRegister; } | 667 void setMustNotHaveReg() { RegRequirement = RR_MustNotHaveRegister; } |
665 bool mustNotHaveReg() const { | 668 bool mustNotHaveReg() const { |
666 return RegRequirement == RR_MustNotHaveRegister; | 669 return RegRequirement == RR_MustNotHaveRegister; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 private: | 926 private: |
924 const Cfg *Func; | 927 const Cfg *Func; |
925 MetadataKind Kind; | 928 MetadataKind Kind; |
926 CfgVector<VariableTracking> Metadata; | 929 CfgVector<VariableTracking> Metadata; |
927 const static InstDefList NoDefinitions; | 930 const static InstDefList NoDefinitions; |
928 }; | 931 }; |
929 | 932 |
930 } // end of namespace Ice | 933 } // end of namespace Ice |
931 | 934 |
932 #endif // SUBZERO_SRC_ICEOPERAND_H | 935 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |