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

Side by Side Diff: src/IceTargetLowering.h

Issue 1253833002: Subzero: Cleanly implement register allocation after phi lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 5 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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 CfgNode *getNode() const { return Node; } 57 CfgNode *getNode() const { return Node; }
58 bool atEnd() const { return Cur == End; } 58 bool atEnd() const { return Cur == End; }
59 InstList::iterator getCur() const { return Cur; } 59 InstList::iterator getCur() const { return Cur; }
60 InstList::iterator getNext() const { return Next; } 60 InstList::iterator getNext() const { return Next; }
61 InstList::iterator getEnd() const { return End; } 61 InstList::iterator getEnd() const { return End; }
62 void insert(Inst *Inst); 62 void insert(Inst *Inst);
63 Inst *getLastInserted() const; 63 Inst *getLastInserted() const;
64 void advanceCur() { Cur = Next; } 64 void advanceCur() { Cur = Next; }
65 void advanceNext() { advanceForward(Next); } 65 void advanceNext() { advanceForward(Next); }
66 void setCur(InstList::iterator C) { Cur = C; }
67 void setNext(InstList::iterator N) { Next = N; }
66 void rewind(); 68 void rewind();
67 void setInsertPoint(const InstList::iterator &Position) { Next = Position; } 69 void setInsertPoint(const InstList::iterator &Position) { Next = Position; }
68 70
69 private: 71 private:
70 /// Node is the argument to Inst::updateVars(). 72 /// Node is the argument to Inst::updateVars().
71 CfgNode *Node = nullptr; 73 CfgNode *Node = nullptr;
72 Inst *LastInserted = nullptr; 74 Inst *LastInserted = nullptr;
73 /// Cur points to the current instruction being considered. It is 75 /// Cur points to the current instruction being considered. It is
74 /// guaranteed to point to a non-deleted instruction, or to be End. 76 /// guaranteed to point to a non-deleted instruction, or to be End.
75 InstList::iterator Cur; 77 InstList::iterator Cur;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 virtual void translateO2() { 131 virtual void translateO2() {
130 Func->setError("Target doesn't specify O2 lowering steps."); 132 Func->setError("Target doesn't specify O2 lowering steps.");
131 } 133 }
132 134
133 /// Tries to do address mode optimization on a single instruction. 135 /// Tries to do address mode optimization on a single instruction.
134 void doAddressOpt(); 136 void doAddressOpt();
135 /// Randomly insert NOPs. 137 /// Randomly insert NOPs.
136 void doNopInsertion(); 138 void doNopInsertion();
137 /// Lowers a single non-Phi instruction. 139 /// Lowers a single non-Phi instruction.
138 void lower(); 140 void lower();
141 /// Inserts and lowers a single high-level instruction at a specific insertion
142 /// point.
143 void lowerInst(CfgNode *Node, InstList::iterator Next, InstHighLevel *Instr);
139 /// Does preliminary lowering of the set of Phi instructions in the 144 /// Does preliminary lowering of the set of Phi instructions in the
140 /// current node. The main intention is to do what's needed to keep 145 /// current node. The main intention is to do what's needed to keep
141 /// the unlowered Phi instructions consistent with the lowered 146 /// the unlowered Phi instructions consistent with the lowered
142 /// non-Phi instructions, e.g. to lower 64-bit operands on a 32-bit 147 /// non-Phi instructions, e.g. to lower 64-bit operands on a 32-bit
143 /// target. 148 /// target.
144 virtual void prelowerPhis() {} 149 virtual void prelowerPhis() {}
145 /// Lowers a list of "parallel" assignment instructions representing
146 /// a topological sort of the Phi instructions.
147 virtual void lowerPhiAssignments(CfgNode *Node,
148 const AssignList &Assignments) = 0;
149 /// Tries to do branch optimization on a single instruction. Returns 150 /// Tries to do branch optimization on a single instruction. Returns
150 /// true if some optimization was done. 151 /// true if some optimization was done.
151 virtual bool doBranchOpt(Inst * /*I*/, const CfgNode * /*NextNode*/) { 152 virtual bool doBranchOpt(Inst * /*I*/, const CfgNode * /*NextNode*/) {
152 return false; 153 return false;
153 } 154 }
154 155
155 virtual SizeT getNumRegisters() const = 0; 156 virtual SizeT getNumRegisters() const = 0;
156 /// Returns a variable pre-colored to the specified physical 157 /// Returns a variable pre-colored to the specified physical
157 /// register. This is generally used to get very direct access to 158 /// register. This is generally used to get very direct access to
158 /// the register such as in the prolog or epilog or for marking 159 /// the register such as in the prolog or epilog or for marking
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 virtual void lower() {} 427 virtual void lower() {}
427 428
428 protected: 429 protected:
429 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} 430 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {}
430 GlobalContext *Ctx; 431 GlobalContext *Ctx;
431 }; 432 };
432 433
433 } // end of namespace Ice 434 } // end of namespace Ice
434 435
435 #endif // SUBZERO_SRC_ICETARGETLOWERING_H 436 #endif // SUBZERO_SRC_ICETARGETLOWERING_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698