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

Side by Side Diff: src/compiler/scheduler.h

Issue 696363002: Make special RPO computation iterative during scheduling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/schedule.cc ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_SCHEDULER_H_ 5 #ifndef V8_COMPILER_SCHEDULER_H_
6 #define V8_COMPILER_SCHEDULER_H_ 6 #define V8_COMPILER_SCHEDULER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
11 #include "src/compiler/schedule.h" 11 #include "src/compiler/schedule.h"
12 #include "src/compiler/zone-pool.h" 12 #include "src/compiler/zone-pool.h"
13 #include "src/zone-containers.h" 13 #include "src/zone-containers.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace compiler { 17 namespace compiler {
18 18
19 class SpecialRPONumberer;
20
19 // Computes a schedule from a graph, placing nodes into basic blocks and 21 // Computes a schedule from a graph, placing nodes into basic blocks and
20 // ordering the basic blocks in the special RPO order. 22 // ordering the basic blocks in the special RPO order.
21 class Scheduler { 23 class Scheduler {
22 public: 24 public:
23 // The complete scheduling algorithm. Creates a new schedule and places all 25 // The complete scheduling algorithm. Creates a new schedule and places all
24 // nodes from the graph into it. 26 // nodes from the graph into it.
25 static Schedule* ComputeSchedule(ZonePool* zone_pool, Graph* graph); 27 static Schedule* ComputeSchedule(ZonePool* zone_pool, Graph* graph);
26 28
27 // Compute the RPO of blocks in an existing schedule. 29 // Compute the RPO of blocks in an existing schedule.
28 static BasicBlockVector* ComputeSpecialRPO(ZonePool* zone_pool, 30 static BasicBlockVector* ComputeSpecialRPO(ZonePool* zone_pool,
(...skipping 24 matching lines...) Expand all
53 // coupled to another node, or not yet known. 55 // coupled to another node, or not yet known.
54 }; 56 };
55 57
56 Zone* zone_; 58 Zone* zone_;
57 Graph* graph_; 59 Graph* graph_;
58 Schedule* schedule_; 60 Schedule* schedule_;
59 NodeVectorVector scheduled_nodes_; // Per-block list of nodes in reverse. 61 NodeVectorVector scheduled_nodes_; // Per-block list of nodes in reverse.
60 NodeVector schedule_root_nodes_; // Fixed root nodes seed the worklist. 62 NodeVector schedule_root_nodes_; // Fixed root nodes seed the worklist.
61 ZoneQueue<Node*> schedule_queue_; // Worklist of schedulable nodes. 63 ZoneQueue<Node*> schedule_queue_; // Worklist of schedulable nodes.
62 ZoneVector<SchedulerData> node_data_; // Per-node data for all nodes. 64 ZoneVector<SchedulerData> node_data_; // Per-node data for all nodes.
65 SpecialRPONumberer* special_rpo_; // Special RPO numbering of blocks.
63 66
64 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); 67 Scheduler(Zone* zone, Graph* graph, Schedule* schedule);
65 68
66 inline SchedulerData DefaultSchedulerData(); 69 inline SchedulerData DefaultSchedulerData();
67 inline SchedulerData* GetData(Node* node); 70 inline SchedulerData* GetData(Node* node);
68 71
69 Placement GetPlacement(Node* node); 72 Placement GetPlacement(Node* node);
70 void UpdatePlacement(Node* node, Placement placement); 73 void UpdatePlacement(Node* node, Placement placement);
71 74
72 inline bool IsCoupledControlEdge(Node* node, int index); 75 inline bool IsCoupledControlEdge(Node* node, int index);
73 void IncrementUnscheduledUseCount(Node* node, int index, Node* from); 76 void IncrementUnscheduledUseCount(Node* node, int index, Node* from);
74 void DecrementUnscheduledUseCount(Node* node, int index, Node* from); 77 void DecrementUnscheduledUseCount(Node* node, int index, Node* from);
75 78
76 inline int GetRPONumber(BasicBlock* block);
77 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); 79 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2);
78 80
79 // Phase 1: Build control-flow graph. 81 // Phase 1: Build control-flow graph.
80 friend class CFGBuilder; 82 friend class CFGBuilder;
81 void BuildCFG(); 83 void BuildCFG();
82 84
83 // Phase 2: Compute special RPO and dominator tree. 85 // Phase 2: Compute special RPO and dominator tree.
84 friend class SpecialRPONumberer; 86 friend class SpecialRPONumberer;
85 void ComputeSpecialRPONumbering(); 87 void ComputeSpecialRPONumbering();
86 void GenerateImmediateDominatorTree(); 88 void GenerateImmediateDominatorTree();
87 89
88 // Phase 3: Prepare use counts for nodes. 90 // Phase 3: Prepare use counts for nodes.
89 friend class PrepareUsesVisitor; 91 friend class PrepareUsesVisitor;
90 void PrepareUses(); 92 void PrepareUses();
91 93
92 // Phase 4: Schedule nodes early. 94 // Phase 4: Schedule nodes early.
93 friend class ScheduleEarlyNodeVisitor; 95 friend class ScheduleEarlyNodeVisitor;
94 void ScheduleEarly(); 96 void ScheduleEarly();
95 97
96 // Phase 5: Schedule nodes late. 98 // Phase 5: Schedule nodes late.
97 friend class ScheduleLateNodeVisitor; 99 friend class ScheduleLateNodeVisitor;
98 void ScheduleLate(); 100 void ScheduleLate();
99 101
102 // Phase 6: Seal the final schedule.
103 void SealFinalSchedule();
104
100 void FuseFloatingControl(BasicBlock* block, Node* node); 105 void FuseFloatingControl(BasicBlock* block, Node* node);
101 void MovePlannedNodes(BasicBlock* from, BasicBlock* to); 106 void MovePlannedNodes(BasicBlock* from, BasicBlock* to);
102 }; 107 };
103 108
104 } // namespace compiler 109 } // namespace compiler
105 } // namespace internal 110 } // namespace internal
106 } // namespace v8 111 } // namespace v8
107 112
108 #endif // V8_COMPILER_SCHEDULER_H_ 113 #endif // V8_COMPILER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « src/compiler/schedule.cc ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698