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

Side by Side Diff: src/IceTargetLowering.h

Issue 1385433002: Subzero: Use register availability during lowering to improve the code. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add comments Created 5 years, 2 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
« no previous file with comments | « src/IceRegAlloc.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 InstList::iterator getNext() const { return Next; } 58 InstList::iterator getNext() const { return Next; }
59 InstList::iterator getEnd() const { return End; } 59 InstList::iterator getEnd() const { return End; }
60 void insert(Inst *Inst); 60 void insert(Inst *Inst);
61 Inst *getLastInserted() const; 61 Inst *getLastInserted() const;
62 void advanceCur() { Cur = Next; } 62 void advanceCur() { Cur = Next; }
63 void advanceNext() { advanceForward(Next); } 63 void advanceNext() { advanceForward(Next); }
64 void setCur(InstList::iterator C) { Cur = C; } 64 void setCur(InstList::iterator C) { Cur = C; }
65 void setNext(InstList::iterator N) { Next = N; } 65 void setNext(InstList::iterator N) { Next = N; }
66 void rewind(); 66 void rewind();
67 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } 67 void setInsertPoint(const InstList::iterator &Position) { Next = Position; }
68 void availabilityReset();
69 void availabilityUpdate();
70 Variable *availabilityGet(Operand *Src) const;
68 71
69 private: 72 private:
70 /// Node is the argument to Inst::updateVars(). 73 /// Node is the argument to Inst::updateVars().
71 CfgNode *Node = nullptr; 74 CfgNode *Node = nullptr;
72 Inst *LastInserted = nullptr; 75 Inst *LastInserted = nullptr;
73 /// Cur points to the current instruction being considered. It is guaranteed 76 /// Cur points to the current instruction being considered. It is guaranteed
74 /// to point to a non-deleted instruction, or to be End. 77 /// to point to a non-deleted instruction, or to be End.
75 InstList::iterator Cur; 78 InstList::iterator Cur;
76 /// Next doubles as a pointer to the next valid instruction (if any), and the 79 /// Next doubles as a pointer to the next valid instruction (if any), and the
77 /// new-instruction insertion point. It is also updated for the caller in case 80 /// new-instruction insertion point. It is also updated for the caller in case
78 /// the lowering consumes more than one high-level instruction. It is 81 /// the lowering consumes more than one high-level instruction. It is
79 /// guaranteed to point to a non-deleted instruction after Cur, or to be End. 82 /// guaranteed to point to a non-deleted instruction after Cur, or to be End.
80 // TODO: Consider separating the notion of "next valid instruction" and "new 83 // TODO: Consider separating the notion of "next valid instruction" and "new
81 // instruction insertion point", to avoid confusion when previously-deleted 84 // instruction insertion point", to avoid confusion when previously-deleted
82 // instructions come between the two points. 85 // instructions come between the two points.
83 InstList::iterator Next; 86 InstList::iterator Next;
84 /// Begin is a copy of Insts.begin(), used if iterators are moved backward. 87 /// Begin is a copy of Insts.begin(), used if iterators are moved backward.
85 InstList::iterator Begin; 88 InstList::iterator Begin;
86 /// End is a copy of Insts.end(), used if Next needs to be advanced. 89 /// End is a copy of Insts.end(), used if Next needs to be advanced.
87 InstList::iterator End; 90 InstList::iterator End;
91 /// LastDest and LastSrc capture the parameters of the last "Dest=Src" simple
92 /// assignment inserted (provided Src is a variable). This is used for simple
93 /// availability analysis.
94 Variable *LastDest = nullptr;
95 Variable *LastSrc = nullptr;
88 96
89 void skipDeleted(InstList::iterator &I) const; 97 void skipDeleted(InstList::iterator &I) const;
90 void advanceForward(InstList::iterator &I) const; 98 void advanceForward(InstList::iterator &I) const;
91 }; 99 };
92 100
93 /// A helper class to advance the LoweringContext at each loop iteration. 101 /// A helper class to advance the LoweringContext at each loop iteration.
94 class PostIncrLoweringContext { 102 class PostIncrLoweringContext {
95 PostIncrLoweringContext() = delete; 103 PostIncrLoweringContext() = delete;
96 PostIncrLoweringContext(const PostIncrLoweringContext &) = delete; 104 PostIncrLoweringContext(const PostIncrLoweringContext &) = delete;
97 PostIncrLoweringContext &operator=(const PostIncrLoweringContext &) = delete; 105 PostIncrLoweringContext &operator=(const PostIncrLoweringContext &) = delete;
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 virtual void lower() {} 461 virtual void lower() {}
454 462
455 protected: 463 protected:
456 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} 464 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {}
457 GlobalContext *Ctx; 465 GlobalContext *Ctx;
458 }; 466 };
459 467
460 } // end of namespace Ice 468 } // end of namespace Ice
461 469
462 #endif // SUBZERO_SRC_ICETARGETLOWERING_H 470 #endif // SUBZERO_SRC_ICETARGETLOWERING_H
OLDNEW
« no previous file with comments | « src/IceRegAlloc.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698