Index: test/unittests/compiler/move-optimizer-unittest.cc |
diff --git a/test/unittests/compiler/move-optimizer-unittest.cc b/test/unittests/compiler/move-optimizer-unittest.cc |
index da887fe88a4a40f370cb4551f19ac120f35824d9..26afc7837bc4886a57ea09c25fea97691355e70e 100644 |
--- a/test/unittests/compiler/move-optimizer-unittest.cc |
+++ b/test/unittests/compiler/move-optimizer-unittest.cc |
@@ -11,13 +11,11 @@ namespace compiler { |
class MoveOptimizerTest : public InstructionSequenceTest { |
public: |
- GapInstruction* LastGap() { |
- return GapInstruction::cast(*(sequence()->instructions().rbegin() + 1)); |
- } |
+ Instruction* LastInstruction() { return sequence()->instructions().back(); } |
- void AddMove(GapInstruction* gap, TestOperand from, TestOperand to, |
- GapInstruction::InnerPosition pos = GapInstruction::START) { |
- auto parallel_move = gap->GetOrCreateParallelMove(pos, zone()); |
+ void AddMove(Instruction* instr, TestOperand from, TestOperand to, |
+ Instruction::GapPosition pos = Instruction::START) { |
+ auto parallel_move = instr->GetOrCreateParallelMove(pos, zone()); |
parallel_move->AddMove(ConvertMoveArg(from), ConvertMoveArg(to), zone()); |
} |
@@ -86,16 +84,16 @@ class MoveOptimizerTest : public InstructionSequenceTest { |
TEST_F(MoveOptimizerTest, RemovesRedundant) { |
StartBlock(); |
- EmitNop(); |
- AddMove(LastGap(), Reg(0), Reg(1)); |
- EmitNop(); |
- AddMove(LastGap(), Reg(1), Reg(0)); |
+ auto first_instr = EmitNop(); |
+ AddMove(first_instr, Reg(0), Reg(1)); |
+ auto last_instr = EmitNop(); |
+ AddMove(last_instr, Reg(1), Reg(0)); |
EndBlock(Last()); |
Optimize(); |
- auto gap = LastGap(); |
- auto move = gap->parallel_moves()[0]; |
+ CHECK_EQ(0, NonRedundantSize(first_instr->parallel_moves()[0])); |
+ auto move = last_instr->parallel_moves()[0]; |
CHECK_EQ(1, NonRedundantSize(move)); |
CHECK(Contains(move, Reg(0), Reg(1))); |
} |
@@ -105,7 +103,7 @@ TEST_F(MoveOptimizerTest, SplitsConstants) { |
StartBlock(); |
EndBlock(Last()); |
- auto gap = LastGap(); |
+ auto gap = LastInstruction(); |
AddMove(gap, Const(1), Slot(0)); |
AddMove(gap, Const(1), Slot(1)); |
AddMove(gap, Const(1), Reg(0)); |
@@ -131,18 +129,18 @@ TEST_F(MoveOptimizerTest, SimpleMerge) { |
StartBlock(); |
EndBlock(Jump(2)); |
- AddMove(LastGap(), Reg(0), Reg(1)); |
+ AddMove(LastInstruction(), Reg(0), Reg(1)); |
StartBlock(); |
EndBlock(Jump(1)); |
- AddMove(LastGap(), Reg(0), Reg(1)); |
+ AddMove(LastInstruction(), Reg(0), Reg(1)); |
StartBlock(); |
EndBlock(Last()); |
Optimize(); |
- auto move = LastGap()->parallel_moves()[0]; |
+ auto move = LastInstruction()->parallel_moves()[0]; |
CHECK_EQ(1, NonRedundantSize(move)); |
CHECK(Contains(move, Reg(0), Reg(1))); |
} |
@@ -154,13 +152,13 @@ TEST_F(MoveOptimizerTest, SimpleMergeCycle) { |
StartBlock(); |
EndBlock(Jump(2)); |
- auto gap_0 = LastGap(); |
+ auto gap_0 = LastInstruction(); |
AddMove(gap_0, Reg(0), Reg(1)); |
- AddMove(LastGap(), Reg(1), Reg(0)); |
+ AddMove(LastInstruction(), Reg(1), Reg(0)); |
StartBlock(); |
EndBlock(Jump(1)); |
- auto gap_1 = LastGap(); |
+ auto gap_1 = LastInstruction(); |
AddMove(gap_1, Reg(0), Reg(1)); |
AddMove(gap_1, Reg(1), Reg(0)); |
@@ -169,9 +167,9 @@ TEST_F(MoveOptimizerTest, SimpleMergeCycle) { |
Optimize(); |
- CHECK(gap_0->IsRedundant()); |
- CHECK(gap_1->IsRedundant()); |
- auto move = LastGap()->parallel_moves()[0]; |
+ CHECK(gap_0->AreMovesRedundant()); |
+ CHECK(gap_1->AreMovesRedundant()); |
+ auto move = LastInstruction()->parallel_moves()[0]; |
CHECK_EQ(2, NonRedundantSize(move)); |
CHECK(Contains(move, Reg(0), Reg(1))); |
CHECK(Contains(move, Reg(1), Reg(0))); |