Commit 5281cbeb authored by titzer@chromium.org's avatar titzer@chromium.org

Finish TODO in Schedule. s/entry/start/g and s/exit/end/g to be more regular.

R=jarin@chromium.org
BUG=

Review URL: https://codereview.chromium.org/484653002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23161 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 849a226d
...@@ -19,8 +19,8 @@ RawMachineAssembler::RawMachineAssembler( ...@@ -19,8 +19,8 @@ RawMachineAssembler::RawMachineAssembler(
common_(zone()), common_(zone()),
call_descriptor_builder_(call_descriptor_builder), call_descriptor_builder_(call_descriptor_builder),
parameters_(NULL), parameters_(NULL),
exit_label_(schedule()->exit()), exit_label_(schedule()->end()),
current_block_(schedule()->entry()) { current_block_(schedule()->start()) {
Node* s = graph->NewNode(common_.Start(parameter_count())); Node* s = graph->NewNode(common_.Start(parameter_count()));
graph->SetStart(s); graph->SetStart(s);
if (parameter_count() == 0) return; if (parameter_count() == 0) return;
...@@ -55,7 +55,7 @@ RawMachineAssembler::Label* RawMachineAssembler::Exit() { ...@@ -55,7 +55,7 @@ RawMachineAssembler::Label* RawMachineAssembler::Exit() {
void RawMachineAssembler::Goto(Label* label) { void RawMachineAssembler::Goto(Label* label) {
DCHECK(current_block_ != schedule()->exit()); DCHECK(current_block_ != schedule()->end());
schedule()->AddGoto(CurrentBlock(), Use(label)); schedule()->AddGoto(CurrentBlock(), Use(label));
current_block_ = NULL; current_block_ = NULL;
} }
...@@ -63,7 +63,7 @@ void RawMachineAssembler::Goto(Label* label) { ...@@ -63,7 +63,7 @@ void RawMachineAssembler::Goto(Label* label) {
void RawMachineAssembler::Branch(Node* condition, Label* true_val, void RawMachineAssembler::Branch(Node* condition, Label* true_val,
Label* false_val) { Label* false_val) {
DCHECK(current_block_ != schedule()->exit()); DCHECK(current_block_ != schedule()->end());
Node* branch = NewNode(common()->Branch(), condition); Node* branch = NewNode(common()->Branch(), condition);
schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val));
current_block_ = NULL; current_block_ = NULL;
......
...@@ -163,16 +163,10 @@ class Schedule : public GenericGraph<BasicBlock> { ...@@ -163,16 +163,10 @@ class Schedule : public GenericGraph<BasicBlock> {
nodeid_to_block_(BasicBlockVector::allocator_type(zone)), nodeid_to_block_(BasicBlockVector::allocator_type(zone)),
rpo_order_(BasicBlockVector::allocator_type(zone)), rpo_order_(BasicBlockVector::allocator_type(zone)),
immediate_dominator_(BasicBlockVector::allocator_type(zone)) { immediate_dominator_(BasicBlockVector::allocator_type(zone)) {
NewBasicBlock(); // entry. SetStart(NewBasicBlock()); // entry.
NewBasicBlock(); // exit. SetEnd(NewBasicBlock()); // exit.
SetStart(entry());
SetEnd(exit());
} }
// TODO(titzer): rewrite users of these methods to use start() and end().
BasicBlock* entry() const { return all_blocks_[0]; } // Return entry block.
BasicBlock* exit() const { return all_blocks_[1]; } // Return exit block.
// Return the block which contains {node}, if any. // Return the block which contains {node}, if any.
BasicBlock* block(Node* node) const { BasicBlock* block(Node* node) const {
if (node->id() < static_cast<NodeId>(nodeid_to_block_.size())) { if (node->id() < static_cast<NodeId>(nodeid_to_block_.size())) {
...@@ -273,7 +267,7 @@ class Schedule : public GenericGraph<BasicBlock> { ...@@ -273,7 +267,7 @@ class Schedule : public GenericGraph<BasicBlock> {
DCHECK(block->control_ == BasicBlock::kNone); DCHECK(block->control_ == BasicBlock::kNone);
block->control_ = BasicBlock::kReturn; block->control_ = BasicBlock::kReturn;
SetControlInput(block, input); SetControlInput(block, input);
if (block != exit()) AddSuccessor(block, exit()); if (block != end()) AddSuccessor(block, end());
} }
// BasicBlock building: add a throw at the end of {block}. // BasicBlock building: add a throw at the end of {block}.
...@@ -281,7 +275,7 @@ class Schedule : public GenericGraph<BasicBlock> { ...@@ -281,7 +275,7 @@ class Schedule : public GenericGraph<BasicBlock> {
DCHECK(block->control_ == BasicBlock::kNone); DCHECK(block->control_ == BasicBlock::kNone);
block->control_ = BasicBlock::kThrow; block->control_ = BasicBlock::kThrow;
SetControlInput(block, input); SetControlInput(block, input);
if (block != exit()) AddSuccessor(block, exit()); if (block != end()) AddSuccessor(block, end());
} }
// BasicBlock building: add a deopt at the end of {block}. // BasicBlock building: add a deopt at the end of {block}.
...@@ -290,7 +284,7 @@ class Schedule : public GenericGraph<BasicBlock> { ...@@ -290,7 +284,7 @@ class Schedule : public GenericGraph<BasicBlock> {
block->control_ = BasicBlock::kDeoptimize; block->control_ = BasicBlock::kDeoptimize;
SetControlInput(block, state); SetControlInput(block, state);
block->deferred_ = true; // By default, consider deopts the slow path. block->deferred_ = true; // By default, consider deopts the slow path.
if (block != exit()) AddSuccessor(block, exit()); if (block != end()) AddSuccessor(block, end());
} }
friend class Scheduler; friend class Scheduler;
......
...@@ -132,7 +132,7 @@ void Scheduler::CreateBlocks() { ...@@ -132,7 +132,7 @@ void Scheduler::CreateBlocks() {
if (FLAG_trace_turbo_scheduler) { if (FLAG_trace_turbo_scheduler) {
PrintF("---------------- CREATING BLOCKS ------------------\n"); PrintF("---------------- CREATING BLOCKS ------------------\n");
} }
schedule_->AddNode(schedule_->entry(), graph_->start()); schedule_->AddNode(schedule_->start(), graph_->start());
graph_->VisitNodeInputsFromEnd(&create_blocks); graph_->VisitNodeInputsFromEnd(&create_blocks);
} }
...@@ -332,7 +332,7 @@ void Scheduler::GenerateImmediateDominatorTree() { ...@@ -332,7 +332,7 @@ void Scheduler::GenerateImmediateDominatorTree() {
} }
for (size_t i = 0; i < schedule_->rpo_order_.size(); i++) { for (size_t i = 0; i < schedule_->rpo_order_.size(); i++) {
BasicBlock* current_rpo = schedule_->rpo_order_[i]; BasicBlock* current_rpo = schedule_->rpo_order_[i];
if (current_rpo != schedule_->entry()) { if (current_rpo != schedule_->start()) {
BasicBlock::Predecessors::iterator current_pred = BasicBlock::Predecessors::iterator current_pred =
current_rpo->predecessors().begin(); current_rpo->predecessors().begin();
BasicBlock::Predecessors::iterator end = BasicBlock::Predecessors::iterator end =
...@@ -462,7 +462,7 @@ class PrepareUsesVisitor : public NullNodeVisitor { ...@@ -462,7 +462,7 @@ class PrepareUsesVisitor : public NullNodeVisitor {
IrOpcode::Value opcode = node->opcode(); IrOpcode::Value opcode = node->opcode();
BasicBlock* block = BasicBlock* block =
opcode == IrOpcode::kParameter opcode == IrOpcode::kParameter
? schedule_->entry() ? schedule_->start()
: schedule_->block(NodeProperties::GetControlInput(node)); : schedule_->block(NodeProperties::GetControlInput(node));
DCHECK(block != NULL); DCHECK(block != NULL);
schedule_->AddNode(block, node); schedule_->AddNode(block, node);
...@@ -869,7 +869,7 @@ BasicBlockVector* Scheduler::ComputeSpecialRPO(Schedule* schedule) { ...@@ -869,7 +869,7 @@ BasicBlockVector* Scheduler::ComputeSpecialRPO(Schedule* schedule) {
PrintF("------------- COMPUTING SPECIAL RPO ---------------\n"); PrintF("------------- COMPUTING SPECIAL RPO ---------------\n");
} }
// RPO should not have been computed for this schedule yet. // RPO should not have been computed for this schedule yet.
CHECK_EQ(kBlockUnvisited1, schedule->entry()->rpo_number_); CHECK_EQ(kBlockUnvisited1, schedule->start()->rpo_number_);
CHECK_EQ(0, static_cast<int>(schedule->rpo_order_.size())); CHECK_EQ(0, static_cast<int>(schedule->rpo_order_.size()));
// Perform an iterative RPO traversal using an explicit stack, // Perform an iterative RPO traversal using an explicit stack,
...@@ -877,7 +877,7 @@ BasicBlockVector* Scheduler::ComputeSpecialRPO(Schedule* schedule) { ...@@ -877,7 +877,7 @@ BasicBlockVector* Scheduler::ComputeSpecialRPO(Schedule* schedule) {
ZoneList<std::pair<BasicBlock*, int> > backedges(1, zone); ZoneList<std::pair<BasicBlock*, int> > backedges(1, zone);
SpecialRPOStackFrame* stack = SpecialRPOStackFrame* stack =
zone->NewArray<SpecialRPOStackFrame>(schedule->BasicBlockCount()); zone->NewArray<SpecialRPOStackFrame>(schedule->BasicBlockCount());
BasicBlock* entry = schedule->entry(); BasicBlock* entry = schedule->start();
BlockList* order = NULL; BlockList* order = NULL;
int stack_depth = Push(stack, 0, entry, kBlockUnvisited1); int stack_depth = Push(stack, 0, entry, kBlockUnvisited1);
int num_loops = 0; int num_loops = 0;
......
...@@ -26,7 +26,7 @@ StructuredMachineAssembler::StructuredMachineAssembler( ...@@ -26,7 +26,7 @@ StructuredMachineAssembler::StructuredMachineAssembler(
call_descriptor_builder_(call_descriptor_builder), call_descriptor_builder_(call_descriptor_builder),
parameters_(NULL), parameters_(NULL),
current_environment_(new (zone()) current_environment_(new (zone())
Environment(zone(), schedule()->entry(), false)), Environment(zone(), schedule()->start(), false)),
number_of_variables_(0) { number_of_variables_(0) {
Node* s = graph->NewNode(common_.Start(parameter_count())); Node* s = graph->NewNode(common_.Start(parameter_count()));
graph->SetStart(s); graph->SetStart(s);
......
...@@ -59,19 +59,19 @@ class InstructionTester : public HandleAndZoneScope { ...@@ -59,19 +59,19 @@ class InstructionTester : public HandleAndZoneScope {
Node* Int32Constant(int32_t val) { Node* Int32Constant(int32_t val) {
Node* node = graph.NewNode(common.Int32Constant(val)); Node* node = graph.NewNode(common.Int32Constant(val));
schedule.AddNode(schedule.entry(), node); schedule.AddNode(schedule.start(), node);
return node; return node;
} }
Node* Float64Constant(double val) { Node* Float64Constant(double val) {
Node* node = graph.NewNode(common.Float64Constant(val)); Node* node = graph.NewNode(common.Float64Constant(val));
schedule.AddNode(schedule.entry(), node); schedule.AddNode(schedule.start(), node);
return node; return node;
} }
Node* Parameter(int32_t which) { Node* Parameter(int32_t which) {
Node* node = graph.NewNode(common.Parameter(which)); Node* node = graph.NewNode(common.Parameter(which));
schedule.AddNode(schedule.entry(), node); schedule.AddNode(schedule.start(), node);
return node; return node;
} }
...@@ -103,7 +103,7 @@ TEST(InstructionBasic) { ...@@ -103,7 +103,7 @@ TEST(InstructionBasic) {
R.Int32Constant(i); // Add some nodes to the graph. R.Int32Constant(i); // Add some nodes to the graph.
} }
BasicBlock* last = R.schedule.entry(); BasicBlock* last = R.schedule.start();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
BasicBlock* block = R.schedule.NewBasicBlock(); BasicBlock* block = R.schedule.NewBasicBlock();
R.schedule.AddGoto(last, block); R.schedule.AddGoto(last, block);
...@@ -130,10 +130,10 @@ TEST(InstructionBasic) { ...@@ -130,10 +130,10 @@ TEST(InstructionBasic) {
TEST(InstructionGetBasicBlock) { TEST(InstructionGetBasicBlock) {
InstructionTester R; InstructionTester R;
BasicBlock* b0 = R.schedule.entry(); BasicBlock* b0 = R.schedule.start();
BasicBlock* b1 = R.schedule.NewBasicBlock(); BasicBlock* b1 = R.schedule.NewBasicBlock();
BasicBlock* b2 = R.schedule.NewBasicBlock(); BasicBlock* b2 = R.schedule.NewBasicBlock();
BasicBlock* b3 = R.schedule.exit(); BasicBlock* b3 = R.schedule.end();
R.schedule.AddGoto(b0, b1); R.schedule.AddGoto(b0, b1);
R.schedule.AddGoto(b1, b2); R.schedule.AddGoto(b1, b2);
...@@ -188,7 +188,7 @@ TEST(InstructionGetBasicBlock) { ...@@ -188,7 +188,7 @@ TEST(InstructionGetBasicBlock) {
TEST(InstructionIsGapAt) { TEST(InstructionIsGapAt) {
InstructionTester R; InstructionTester R;
BasicBlock* b0 = R.schedule.entry(); BasicBlock* b0 = R.schedule.start();
R.schedule.AddReturn(b0, R.Int32Constant(1)); R.schedule.AddReturn(b0, R.Int32Constant(1));
R.allocCode(); R.allocCode();
...@@ -213,8 +213,8 @@ TEST(InstructionIsGapAt) { ...@@ -213,8 +213,8 @@ TEST(InstructionIsGapAt) {
TEST(InstructionIsGapAt2) { TEST(InstructionIsGapAt2) {
InstructionTester R; InstructionTester R;
BasicBlock* b0 = R.schedule.entry(); BasicBlock* b0 = R.schedule.start();
BasicBlock* b1 = R.schedule.exit(); BasicBlock* b1 = R.schedule.end();
R.schedule.AddGoto(b0, b1); R.schedule.AddGoto(b0, b1);
R.schedule.AddReturn(b1, R.Int32Constant(1)); R.schedule.AddReturn(b1, R.Int32Constant(1));
...@@ -256,7 +256,7 @@ TEST(InstructionIsGapAt2) { ...@@ -256,7 +256,7 @@ TEST(InstructionIsGapAt2) {
TEST(InstructionAddGapMove) { TEST(InstructionAddGapMove) {
InstructionTester R; InstructionTester R;
BasicBlock* b0 = R.schedule.entry(); BasicBlock* b0 = R.schedule.start();
R.schedule.AddReturn(b0, R.Int32Constant(1)); R.schedule.AddReturn(b0, R.Int32Constant(1));
R.allocCode(); R.allocCode();
......
...@@ -23,8 +23,8 @@ TEST(TestScheduleAllocation) { ...@@ -23,8 +23,8 @@ TEST(TestScheduleAllocation) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
CHECK_NE(NULL, schedule.entry()); CHECK_NE(NULL, schedule.start());
CHECK_EQ(schedule.entry(), *(schedule.all_blocks().begin())); CHECK_EQ(schedule.start(), *(schedule.all_blocks().begin()));
} }
...@@ -36,7 +36,7 @@ TEST(TestScheduleAddNode) { ...@@ -36,7 +36,7 @@ TEST(TestScheduleAddNode) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
schedule.AddNode(entry, n0); schedule.AddNode(entry, n0);
schedule.AddNode(entry, n1); schedule.AddNode(entry, n1);
...@@ -53,7 +53,7 @@ TEST(TestScheduleAddGoto) { ...@@ -53,7 +53,7 @@ TEST(TestScheduleAddGoto) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
BasicBlock* next = schedule.NewBasicBlock(); BasicBlock* next = schedule.NewBasicBlock();
schedule.AddGoto(entry, next); schedule.AddGoto(entry, next);
...@@ -72,7 +72,7 @@ TEST(TestScheduleAddBranch) { ...@@ -72,7 +72,7 @@ TEST(TestScheduleAddBranch) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
BasicBlock* tblock = schedule.NewBasicBlock(); BasicBlock* tblock = schedule.NewBasicBlock();
BasicBlock* fblock = schedule.NewBasicBlock(); BasicBlock* fblock = schedule.NewBasicBlock();
...@@ -103,12 +103,12 @@ TEST(TestScheduleAddReturn) { ...@@ -103,12 +103,12 @@ TEST(TestScheduleAddReturn) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
Graph graph(scope.main_zone()); Graph graph(scope.main_zone());
Node* n0 = graph.NewNode(&dummy_operator); Node* n0 = graph.NewNode(&dummy_operator);
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
schedule.AddReturn(entry, n0); schedule.AddReturn(entry, n0);
CHECK_EQ(0, entry->PredecessorCount()); CHECK_EQ(0, entry->PredecessorCount());
CHECK_EQ(1, entry->SuccessorCount()); CHECK_EQ(1, entry->SuccessorCount());
CHECK_EQ(schedule.exit(), entry->SuccessorAt(0)); CHECK_EQ(schedule.end(), entry->SuccessorAt(0));
} }
...@@ -117,12 +117,12 @@ TEST(TestScheduleAddThrow) { ...@@ -117,12 +117,12 @@ TEST(TestScheduleAddThrow) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
Graph graph(scope.main_zone()); Graph graph(scope.main_zone());
Node* n0 = graph.NewNode(&dummy_operator); Node* n0 = graph.NewNode(&dummy_operator);
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
schedule.AddThrow(entry, n0); schedule.AddThrow(entry, n0);
CHECK_EQ(0, entry->PredecessorCount()); CHECK_EQ(0, entry->PredecessorCount());
CHECK_EQ(1, entry->SuccessorCount()); CHECK_EQ(1, entry->SuccessorCount());
CHECK_EQ(schedule.exit(), entry->SuccessorAt(0)); CHECK_EQ(schedule.end(), entry->SuccessorAt(0));
} }
...@@ -131,12 +131,12 @@ TEST(TestScheduleAddDeopt) { ...@@ -131,12 +131,12 @@ TEST(TestScheduleAddDeopt) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
Graph graph(scope.main_zone()); Graph graph(scope.main_zone());
Node* n0 = graph.NewNode(&dummy_operator); Node* n0 = graph.NewNode(&dummy_operator);
BasicBlock* entry = schedule.entry(); BasicBlock* entry = schedule.start();
schedule.AddDeoptimize(entry, n0); schedule.AddDeoptimize(entry, n0);
CHECK_EQ(0, entry->PredecessorCount()); CHECK_EQ(0, entry->PredecessorCount());
CHECK_EQ(1, entry->SuccessorCount()); CHECK_EQ(1, entry->SuccessorCount());
CHECK_EQ(schedule.exit(), entry->SuccessorAt(0)); CHECK_EQ(schedule.end(), entry->SuccessorAt(0));
} }
......
...@@ -71,7 +71,7 @@ TEST(RPODegenerate1) { ...@@ -71,7 +71,7 @@ TEST(RPODegenerate1) {
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 1, false); CheckRPONumbers(order, 1, false);
CHECK_EQ(schedule.entry(), order->at(0)); CHECK_EQ(schedule.start(), order->at(0));
} }
...@@ -79,11 +79,11 @@ TEST(RPODegenerate2) { ...@@ -79,11 +79,11 @@ TEST(RPODegenerate2) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
schedule.AddGoto(schedule.entry(), schedule.exit()); schedule.AddGoto(schedule.start(), schedule.end());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 2, false); CheckRPONumbers(order, 2, false);
CHECK_EQ(schedule.entry(), order->at(0)); CHECK_EQ(schedule.start(), order->at(0));
CHECK_EQ(schedule.exit(), order->at(1)); CHECK_EQ(schedule.end(), order->at(1));
} }
...@@ -93,7 +93,7 @@ TEST(RPOLine) { ...@@ -93,7 +93,7 @@ TEST(RPOLine) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* last = schedule.entry(); BasicBlock* last = schedule.start();
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
BasicBlock* block = schedule.NewBasicBlock(); BasicBlock* block = schedule.NewBasicBlock();
schedule.AddGoto(last, block); schedule.AddGoto(last, block);
...@@ -117,10 +117,10 @@ TEST(RPOLine) { ...@@ -117,10 +117,10 @@ TEST(RPOLine) {
TEST(RPOSelfLoop) { TEST(RPOSelfLoop) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
schedule.AddSuccessor(schedule.entry(), schedule.entry()); schedule.AddSuccessor(schedule.start(), schedule.start());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 1, true); CheckRPONumbers(order, 1, true);
BasicBlock* loop[] = {schedule.entry()}; BasicBlock* loop[] = {schedule.start()};
CheckLoopContains(loop, 1); CheckLoopContains(loop, 1);
} }
...@@ -128,11 +128,11 @@ TEST(RPOSelfLoop) { ...@@ -128,11 +128,11 @@ TEST(RPOSelfLoop) {
TEST(RPOEntryLoop) { TEST(RPOEntryLoop) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
schedule.AddSuccessor(schedule.entry(), schedule.exit()); schedule.AddSuccessor(schedule.start(), schedule.end());
schedule.AddSuccessor(schedule.exit(), schedule.entry()); schedule.AddSuccessor(schedule.end(), schedule.start());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 2, true); CheckRPONumbers(order, 2, true);
BasicBlock* loop[] = {schedule.entry(), schedule.exit()}; BasicBlock* loop[] = {schedule.start(), schedule.end()};
CheckLoopContains(loop, 2); CheckLoopContains(loop, 2);
} }
...@@ -141,7 +141,7 @@ TEST(RPOEndLoop) { ...@@ -141,7 +141,7 @@ TEST(RPOEndLoop) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
schedule.AddSuccessor(schedule.entry(), loop1->header()); schedule.AddSuccessor(schedule.start(), loop1->header());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 3, true); CheckRPONumbers(order, 3, true);
CheckLoopContains(loop1->nodes, loop1->count); CheckLoopContains(loop1->nodes, loop1->count);
...@@ -152,8 +152,8 @@ TEST(RPOEndLoopNested) { ...@@ -152,8 +152,8 @@ TEST(RPOEndLoopNested) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
schedule.AddSuccessor(schedule.entry(), loop1->header()); schedule.AddSuccessor(schedule.start(), loop1->header());
schedule.AddSuccessor(loop1->last(), schedule.entry()); schedule.AddSuccessor(loop1->last(), schedule.start());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule); BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&schedule);
CheckRPONumbers(order, 3, true); CheckRPONumbers(order, 3, true);
CheckLoopContains(loop1->nodes, loop1->count); CheckLoopContains(loop1->nodes, loop1->count);
...@@ -164,10 +164,10 @@ TEST(RPODiamond) { ...@@ -164,10 +164,10 @@ TEST(RPODiamond) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.exit(); BasicBlock* D = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(A, C); schedule.AddSuccessor(A, C);
...@@ -188,10 +188,10 @@ TEST(RPOLoop1) { ...@@ -188,10 +188,10 @@ TEST(RPOLoop1) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.exit(); BasicBlock* D = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, C); schedule.AddSuccessor(B, C);
...@@ -209,10 +209,10 @@ TEST(RPOLoop2) { ...@@ -209,10 +209,10 @@ TEST(RPOLoop2) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.exit(); BasicBlock* D = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, C); schedule.AddSuccessor(B, C);
...@@ -231,13 +231,13 @@ TEST(RPOLoopN) { ...@@ -231,13 +231,13 @@ TEST(RPOLoopN) {
for (int i = 0; i < 11; i++) { for (int i = 0; i < 11; i++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.NewBasicBlock(); BasicBlock* D = schedule.NewBasicBlock();
BasicBlock* E = schedule.NewBasicBlock(); BasicBlock* E = schedule.NewBasicBlock();
BasicBlock* F = schedule.NewBasicBlock(); BasicBlock* F = schedule.NewBasicBlock();
BasicBlock* G = schedule.exit(); BasicBlock* G = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, C); schedule.AddSuccessor(B, C);
...@@ -273,12 +273,12 @@ TEST(RPOLoopNest1) { ...@@ -273,12 +273,12 @@ TEST(RPOLoopNest1) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.NewBasicBlock(); BasicBlock* D = schedule.NewBasicBlock();
BasicBlock* E = schedule.NewBasicBlock(); BasicBlock* E = schedule.NewBasicBlock();
BasicBlock* F = schedule.exit(); BasicBlock* F = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, C); schedule.AddSuccessor(B, C);
...@@ -302,14 +302,14 @@ TEST(RPOLoopNest2) { ...@@ -302,14 +302,14 @@ TEST(RPOLoopNest2) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.NewBasicBlock(); BasicBlock* D = schedule.NewBasicBlock();
BasicBlock* E = schedule.NewBasicBlock(); BasicBlock* E = schedule.NewBasicBlock();
BasicBlock* F = schedule.NewBasicBlock(); BasicBlock* F = schedule.NewBasicBlock();
BasicBlock* G = schedule.NewBasicBlock(); BasicBlock* G = schedule.NewBasicBlock();
BasicBlock* H = schedule.exit(); BasicBlock* H = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, C); schedule.AddSuccessor(B, C);
...@@ -343,8 +343,8 @@ TEST(RPOLoopFollow1) { ...@@ -343,8 +343,8 @@ TEST(RPOLoopFollow1) {
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
schedule.AddSuccessor(loop1->header(), loop2->header()); schedule.AddSuccessor(loop1->header(), loop2->header());
...@@ -367,9 +367,9 @@ TEST(RPOLoopFollow2) { ...@@ -367,9 +367,9 @@ TEST(RPOLoopFollow2) {
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* S = schedule.NewBasicBlock(); BasicBlock* S = schedule.NewBasicBlock();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
schedule.AddSuccessor(loop1->header(), S); schedule.AddSuccessor(loop1->header(), S);
...@@ -394,8 +394,8 @@ TEST(RPOLoopFollowN) { ...@@ -394,8 +394,8 @@ TEST(RPOLoopFollowN) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size));
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
schedule.AddSuccessor(loop1->nodes[exit], loop2->header()); schedule.AddSuccessor(loop1->nodes[exit], loop2->header());
...@@ -418,10 +418,10 @@ TEST(RPONestedLoopFollow1) { ...@@ -418,10 +418,10 @@ TEST(RPONestedLoopFollow1) {
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1)); SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
schedule.AddSuccessor(B, loop1->header()); schedule.AddSuccessor(B, loop1->header());
...@@ -450,8 +450,8 @@ TEST(RPOLoopBackedges1) { ...@@ -450,8 +450,8 @@ TEST(RPOLoopBackedges1) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
...@@ -475,9 +475,9 @@ TEST(RPOLoopOutedges1) { ...@@ -475,9 +475,9 @@ TEST(RPOLoopOutedges1) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* D = schedule.NewBasicBlock(); BasicBlock* D = schedule.NewBasicBlock();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
...@@ -501,8 +501,8 @@ TEST(RPOLoopOutedges2) { ...@@ -501,8 +501,8 @@ TEST(RPOLoopOutedges2) {
int size = 8; int size = 8;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
...@@ -527,8 +527,8 @@ TEST(RPOLoopOutloops1) { ...@@ -527,8 +527,8 @@ TEST(RPOLoopOutloops1) {
int size = 8; int size = 8;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* E = schedule.exit(); BasicBlock* E = schedule.end();
SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size)); SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessor(A, loop1->header()); schedule.AddSuccessor(A, loop1->header());
schedule.AddSuccessor(loop1->last(), E); schedule.AddSuccessor(loop1->last(), E);
...@@ -557,10 +557,10 @@ TEST(RPOLoopMultibackedge) { ...@@ -557,10 +557,10 @@ TEST(RPOLoopMultibackedge) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Schedule schedule(scope.main_zone()); Schedule schedule(scope.main_zone());
BasicBlock* A = schedule.entry(); BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock(); BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* C = schedule.NewBasicBlock(); BasicBlock* C = schedule.NewBasicBlock();
BasicBlock* D = schedule.exit(); BasicBlock* D = schedule.end();
BasicBlock* E = schedule.NewBasicBlock(); BasicBlock* E = schedule.NewBasicBlock();
schedule.AddSuccessor(A, B); schedule.AddSuccessor(A, B);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment