OLD | NEW |
---|---|
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 static Schedule* ComputeSchedule(Graph* graph); | 27 static Schedule* ComputeSchedule(Graph* graph); |
28 | 28 |
29 // Compute the RPO of blocks in an existing schedule. | 29 // Compute the RPO of blocks in an existing schedule. |
30 static BasicBlockVector* ComputeSpecialRPO(Schedule* schedule); | 30 static BasicBlockVector* ComputeSpecialRPO(Schedule* schedule); |
31 | 31 |
32 // (Exposed for testing only) | 32 // (Exposed for testing only) |
33 // Build and connect the CFG for a node graph, but don't schedule nodes. | 33 // Build and connect the CFG for a node graph, but don't schedule nodes. |
34 static void ComputeCFG(Graph* graph, Schedule* schedule); | 34 static void ComputeCFG(Graph* graph, Schedule* schedule); |
35 | 35 |
36 private: | 36 private: |
37 enum Placement { kUnknown, kSchedulable, kFixed }; | |
38 | |
39 struct SchedulerData { | |
Michael Starzinger
2014/08/26 14:49:23
nit: Can we get a short comment of how this data s
| |
40 int unscheduled_count_; | |
41 int minimum_rpo_; | |
42 bool is_connected_control_; | |
43 bool is_floating_control_; | |
44 Placement placement_ : 3; | |
45 }; | |
46 | |
37 Zone* zone_; | 47 Zone* zone_; |
38 Graph* graph_; | 48 Graph* graph_; |
39 Schedule* schedule_; | 49 Schedule* schedule_; |
40 IntVector unscheduled_uses_; | |
41 NodeVectorVector scheduled_nodes_; | 50 NodeVectorVector scheduled_nodes_; |
42 NodeVector schedule_root_nodes_; | 51 NodeVector schedule_root_nodes_; |
43 IntVector schedule_early_rpo_index_; | 52 std::vector<SchedulerData, zone_allocator<SchedulerData>> node_data_; |
53 bool has_floating_control_; | |
44 | 54 |
45 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); | 55 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); |
46 | 56 |
47 bool IsBasicBlockBegin(Node* node); | 57 SchedulerData* GetData(Node* node) { |
48 bool HasFixedSchedulePosition(Node* node); | 58 DCHECK(node->id() < static_cast<int>(node_data_.size())); |
49 bool IsScheduleRoot(Node* node); | 59 return &node_data_[node->id()]; |
60 } | |
61 | |
62 void BuildCFG(); | |
63 | |
64 Placement GetPlacement(Node* node); | |
50 | 65 |
51 int GetRPONumber(BasicBlock* block) { | 66 int GetRPONumber(BasicBlock* block) { |
52 DCHECK(block->rpo_number_ >= 0 && | 67 DCHECK(block->rpo_number_ >= 0 && |
53 block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size())); | 68 block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size())); |
54 DCHECK(schedule_->rpo_order_[block->rpo_number_] == block); | 69 DCHECK(schedule_->rpo_order_[block->rpo_number_] == block); |
55 return block->rpo_number_; | 70 return block->rpo_number_; |
56 } | 71 } |
57 | 72 |
58 void PrepareAuxiliaryNodeData(); | |
59 void PrepareAuxiliaryBlockData(); | |
60 | |
61 void GenerateImmediateDominatorTree(); | 73 void GenerateImmediateDominatorTree(); |
62 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); | 74 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); |
63 | 75 |
76 friend class CFGBuilder; | |
77 | |
64 friend class ScheduleEarlyNodeVisitor; | 78 friend class ScheduleEarlyNodeVisitor; |
65 void ScheduleEarly(); | 79 void ScheduleEarly(); |
66 | 80 |
67 friend class PrepareUsesVisitor; | 81 friend class PrepareUsesVisitor; |
68 void PrepareUses(); | 82 void PrepareUses(); |
69 | 83 |
70 friend class ScheduleLateNodeVisitor; | 84 friend class ScheduleLateNodeVisitor; |
71 void ScheduleLate(); | 85 void ScheduleLate(); |
86 | |
87 bool ConnectFloatingControl(); | |
88 | |
89 void ConnectFloatingControlSubgraph(BasicBlock* block, Node* node); | |
72 }; | 90 }; |
73 } | 91 } |
74 } | 92 } |
75 } // namespace v8::internal::compiler | 93 } // namespace v8::internal::compiler |
76 | 94 |
77 #endif // V8_COMPILER_SCHEDULER_H_ | 95 #endif // V8_COMPILER_SCHEDULER_H_ |
OLD | NEW |