Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/IceOperand.h

Issue 2177033002: Subzero: Local variable splitting. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 void setRegNumTmp(RegNumT NewRegNum) { RegNumTmp = NewRegNum; } 722 void setRegNumTmp(RegNumT NewRegNum) { RegNumTmp = NewRegNum; }
723 723
724 RegWeight getWeight(const Cfg *Func) const; 724 RegWeight getWeight(const Cfg *Func) const;
725 725
726 void setMustHaveReg() { RegRequirement = RR_MustHaveRegister; } 726 void setMustHaveReg() { RegRequirement = RR_MustHaveRegister; }
727 bool mustHaveReg() const { return RegRequirement == RR_MustHaveRegister; } 727 bool mustHaveReg() const { return RegRequirement == RR_MustHaveRegister; }
728 void setMustNotHaveReg() { RegRequirement = RR_MustNotHaveRegister; } 728 void setMustNotHaveReg() { RegRequirement = RR_MustNotHaveRegister; }
729 bool mustNotHaveReg() const { 729 bool mustNotHaveReg() const {
730 return RegRequirement == RR_MustNotHaveRegister; 730 return RegRequirement == RR_MustNotHaveRegister;
731 } 731 }
732 bool mayHaveReg() const { return RegRequirement == RR_MayHaveRegister; }
732 void setRematerializable(RegNumT NewRegNum, int32_t NewOffset) { 733 void setRematerializable(RegNumT NewRegNum, int32_t NewOffset) {
733 IsRematerializable = true; 734 IsRematerializable = true;
734 setRegNum(NewRegNum); 735 setRegNum(NewRegNum);
735 setStackOffset(NewOffset); 736 setStackOffset(NewOffset);
736 setMustHaveReg(); 737 setMustHaveReg();
737 } 738 }
738 bool isRematerializable() const { return IsRematerializable; } 739 bool isRematerializable() const { return IsRematerializable; }
739 740
740 void setRegClass(uint8_t RC) { RegisterClass = static_cast<RegClass>(RC); } 741 void setRegClass(uint8_t RC) { RegisterClass = static_cast<RegClass>(RC); }
741 RegClass getRegClass() const { return RegisterClass; } 742 RegClass getRegClass() const { return RegisterClass; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 Variable *getLinkedTo() const { return LinkedTo; } 783 Variable *getLinkedTo() const { return LinkedTo; }
783 /// Follow the LinkedTo chain up to the furthest ancestor. 784 /// Follow the LinkedTo chain up to the furthest ancestor.
784 Variable *getLinkedToRoot() const { 785 Variable *getLinkedToRoot() const {
785 Variable *Root = LinkedTo; 786 Variable *Root = LinkedTo;
786 if (Root == nullptr) 787 if (Root == nullptr)
787 return nullptr; 788 return nullptr;
788 while (Root->LinkedTo != nullptr) 789 while (Root->LinkedTo != nullptr)
789 Root = Root->LinkedTo; 790 Root = Root->LinkedTo;
790 return Root; 791 return Root;
791 } 792 }
793 /// Follow the LinkedTo chain up to the furthest stack-allocated ancestor.
794 /// This only makes sense after register allocation is complete.
Eric Holk 2016/07/25 19:59:22 Is there an assertion you could add to make sure r
Jim Stichnoth 2016/07/26 05:59:09 I don't really think it could be done cleanly and
795 Variable *getLinkedToStackRoot() const {
796 Variable *FurthestStackVar = nullptr;
797 for (Variable *Root = LinkedTo; Root != nullptr; Root = Root->LinkedTo) {
798 if (!Root->hasReg()) {
799 FurthestStackVar = Root;
800 }
801 }
802 return FurthestStackVar;
803 }
792 804
793 static bool classof(const Operand *Operand) { 805 static bool classof(const Operand *Operand) {
794 OperandKind Kind = Operand->getKind(); 806 OperandKind Kind = Operand->getKind();
795 return Kind >= kVariable && Kind <= kVariable_Max; 807 return Kind >= kVariable && Kind <= kVariable_Max;
796 } 808 }
797 809
798 SizeT hashValue() const override { return std::hash<SizeT>()(getIndex()); } 810 SizeT hashValue() const override { return std::hash<SizeT>()(getIndex()); }
799 811
800 protected: 812 protected:
801 Variable(const Cfg *Func, OperandKind K, Type Ty, SizeT Index) 813 Variable(const Cfg *Func, OperandKind K, Type Ty, SizeT Index)
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 return Operand->getKind() == kVariableBoolean; 1056 return Operand->getKind() == kVariableBoolean;
1045 } 1057 }
1046 1058
1047 private: 1059 private:
1048 Variable *BoolSource = nullptr; 1060 Variable *BoolSource = nullptr;
1049 }; 1061 };
1050 1062
1051 } // end of namespace Ice 1063 } // end of namespace Ice
1052 1064
1053 #endif // SUBZERO_SRC_ICEOPERAND_H 1065 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« src/IceInst.h ('K') | « src/IceInstX86Base.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698