Commit 7b9cb2eb authored by dcarney's avatar dcarney Committed by Commit bot

[turbofan] remove control field from instruction

R=titzer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#25866}
parent 70b5eb47
...@@ -238,9 +238,8 @@ void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -238,9 +238,8 @@ void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -578,9 +577,8 @@ static inline void VisitShift(InstructionSelector* selector, Node* node, ...@@ -578,9 +577,8 @@ static inline void VisitShift(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -1077,7 +1075,7 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node, ...@@ -1077,7 +1075,7 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node,
selector->Emit(cont->Encode(kArmVcmpF64), nullptr, selector->Emit(cont->Encode(kArmVcmpF64), nullptr,
g.UseRegister(m.left().node()), g.UseRegister(m.left().node()),
g.UseRegister(m.right().node()), g.Label(cont->true_block()), g.UseRegister(m.right().node()), g.Label(cont->true_block()),
g.Label(cont->false_block()))->MarkAsControl(); g.Label(cont->false_block()));
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
selector->Emit( selector->Emit(
...@@ -1124,9 +1122,8 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, ...@@ -1124,9 +1122,8 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -1231,8 +1228,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, ...@@ -1231,8 +1228,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
InstructionOperand* const value_operand = g.UseRegister(value); InstructionOperand* const value_operand = g.UseRegister(value);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, nullptr, value_operand, value_operand, selector->Emit(opcode, nullptr, value_operand, value_operand,
g.Label(cont->true_block()), g.Label(cont->true_block()), g.Label(cont->false_block()));
g.Label(cont->false_block()))->MarkAsControl();
} else { } else {
selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand,
value_operand); value_operand);
......
...@@ -219,9 +219,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -219,9 +219,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -1163,7 +1162,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, ...@@ -1163,7 +1162,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
opcode = cont->Encode(opcode); opcode = cont->Encode(opcode);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
g.Label(cont->false_block()))->MarkAsControl(); g.Label(cont->false_block()));
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
...@@ -1351,8 +1350,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, ...@@ -1351,8 +1350,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
g.UseRegister(m.left().node()), g.UseRegister(m.left().node()),
g.TempImmediate( g.TempImmediate(
base::bits::CountTrailingZeros32(m.right().Value())), base::bits::CountTrailingZeros32(m.right().Value())),
g.Label(cont.true_block()), g.Label(cont.true_block()), g.Label(cont.false_block()));
g.Label(cont.false_block()))->MarkAsControl();
return; return;
} }
return VisitWordCompare(this, value, kArm64Tst32, &cont, true, return VisitWordCompare(this, value, kArm64Tst32, &cont, true,
...@@ -1369,8 +1367,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, ...@@ -1369,8 +1367,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
g.UseRegister(m.left().node()), g.UseRegister(m.left().node()),
g.TempImmediate( g.TempImmediate(
base::bits::CountTrailingZeros64(m.right().Value())), base::bits::CountTrailingZeros64(m.right().Value())),
g.Label(cont.true_block()), g.Label(cont.true_block()), g.Label(cont.false_block()));
g.Label(cont.false_block()))->MarkAsControl();
return; return;
} }
return VisitWordCompare(this, value, kArm64Tst, &cont, true, return VisitWordCompare(this, value, kArm64Tst, &cont, true,
...@@ -1383,8 +1380,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, ...@@ -1383,8 +1380,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
// Branch could not be combined with a compare, compare against 0 and branch. // Branch could not be combined with a compare, compare against 0 and branch.
Emit(cont.Encode(kArm64CompareAndBranch32), NULL, g.UseRegister(value), Emit(cont.Encode(kArm64CompareAndBranch32), NULL, g.UseRegister(value),
g.Label(cont.true_block()), g.Label(cont.true_block()), g.Label(cont.false_block()));
g.Label(cont.false_block()))->MarkAsControl();
} }
......
...@@ -374,9 +374,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -374,9 +374,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -776,8 +775,7 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode, ...@@ -776,8 +775,7 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
IA32OperandGenerator g(selector); IA32OperandGenerator g(selector);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(cont->Encode(opcode), NULL, left, right, selector->Emit(cont->Encode(opcode), NULL, left, right,
g.Label(cont->true_block()), g.Label(cont->true_block()), g.Label(cont->false_block()));
g.Label(cont->false_block()))->MarkAsControl();
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
// TODO(titzer): Needs byte register. // TODO(titzer): Needs byte register.
......
...@@ -1002,7 +1002,7 @@ void InstructionSelector::VisitConstant(Node* node) { ...@@ -1002,7 +1002,7 @@ void InstructionSelector::VisitConstant(Node* node) {
void InstructionSelector::VisitGoto(BasicBlock* target) { void InstructionSelector::VisitGoto(BasicBlock* target) {
// jump to the next block. // jump to the next block.
OperandGenerator g(this); OperandGenerator g(this);
Emit(kArchJmp, NULL, g.Label(target))->MarkAsControl(); Emit(kArchJmp, NULL, g.Label(target));
} }
......
...@@ -454,7 +454,7 @@ class Instruction : public ZoneObject { ...@@ -454,7 +454,7 @@ class Instruction : public ZoneObject {
return FlagsConditionField::decode(opcode()); return FlagsConditionField::decode(opcode());
} }
// TODO(titzer): make control and call into flags. // TODO(titzer): make call into a flag.
static Instruction* New(Zone* zone, InstructionCode opcode) { static Instruction* New(Zone* zone, InstructionCode opcode) {
return New(zone, opcode, 0, NULL, 0, NULL, 0, NULL); return New(zone, opcode, 0, NULL, 0, NULL, 0, NULL);
} }
...@@ -476,17 +476,10 @@ class Instruction : public ZoneObject { ...@@ -476,17 +476,10 @@ class Instruction : public ZoneObject {
opcode, output_count, outputs, input_count, inputs, temp_count, temps); opcode, output_count, outputs, input_count, inputs, temp_count, temps);
} }
// TODO(titzer): another holdover from lithium days; register allocator
// should not need to know about control instructions.
Instruction* MarkAsControl() {
bit_field_ = IsControlField::update(bit_field_, true);
return this;
}
Instruction* MarkAsCall() { Instruction* MarkAsCall() {
bit_field_ = IsCallField::update(bit_field_, true); bit_field_ = IsCallField::update(bit_field_, true);
return this; return this;
} }
bool IsControl() const { return IsControlField::decode(bit_field_); }
bool IsCall() const { return IsCallField::decode(bit_field_); } bool IsCall() const { return IsCallField::decode(bit_field_); }
bool NeedsPointerMap() const { return IsCall(); } bool NeedsPointerMap() const { return IsCall(); }
bool HasPointerMap() const { return pointer_map_ != NULL; } bool HasPointerMap() const { return pointer_map_ != NULL; }
...@@ -528,8 +521,7 @@ class Instruction : public ZoneObject { ...@@ -528,8 +521,7 @@ class Instruction : public ZoneObject {
explicit Instruction(InstructionCode opcode) explicit Instruction(InstructionCode opcode)
: opcode_(opcode), : opcode_(opcode),
bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
TempCountField::encode(0) | IsCallField::encode(false) | TempCountField::encode(0) | IsCallField::encode(false)),
IsControlField::encode(false)),
pointer_map_(NULL) {} pointer_map_(NULL) {}
Instruction(InstructionCode opcode, size_t output_count, Instruction(InstructionCode opcode, size_t output_count,
...@@ -540,7 +532,7 @@ class Instruction : public ZoneObject { ...@@ -540,7 +532,7 @@ class Instruction : public ZoneObject {
bit_field_(OutputCountField::encode(output_count) | bit_field_(OutputCountField::encode(output_count) |
InputCountField::encode(input_count) | InputCountField::encode(input_count) |
TempCountField::encode(temp_count) | TempCountField::encode(temp_count) |
IsCallField::encode(false) | IsControlField::encode(false)), IsCallField::encode(false)),
pointer_map_(NULL) { pointer_map_(NULL) {
for (size_t i = 0; i < output_count; ++i) { for (size_t i = 0; i < output_count; ++i) {
operands_[i] = outputs[i]; operands_[i] = outputs[i];
...@@ -558,7 +550,6 @@ class Instruction : public ZoneObject { ...@@ -558,7 +550,6 @@ class Instruction : public ZoneObject {
typedef BitField<size_t, 8, 16> InputCountField; typedef BitField<size_t, 8, 16> InputCountField;
typedef BitField<size_t, 24, 6> TempCountField; typedef BitField<size_t, 24, 6> TempCountField;
typedef BitField<bool, 30, 1> IsCallField; typedef BitField<bool, 30, 1> IsCallField;
typedef BitField<bool, 31, 1> IsControlField;
InstructionCode opcode_; InstructionCode opcode_;
uint32_t bit_field_; uint32_t bit_field_;
......
...@@ -105,9 +105,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -105,9 +105,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -586,7 +585,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, ...@@ -586,7 +585,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
opcode = cont->Encode(opcode); opcode = cont->Encode(opcode);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
g.Label(cont->false_block()))->MarkAsControl(); g.Label(cont->false_block()));
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
// TODO(plind): Revisit and test this path. // TODO(plind): Revisit and test this path.
...@@ -715,8 +714,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, ...@@ -715,8 +714,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
InstructionOperand* const value_operand = g.UseRegister(value); InstructionOperand* const value_operand = g.UseRegister(value);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0), selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0),
g.Label(cont->true_block()), g.Label(cont->true_block()), g.Label(cont->false_block()));
g.Label(cont->false_block()))->MarkAsControl();
} else { } else {
selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand,
g.TempImmediate(0)); g.TempImmediate(0));
......
...@@ -146,9 +146,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -146,9 +146,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -777,7 +776,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, ...@@ -777,7 +776,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
opcode = cont->Encode(opcode); opcode = cont->Encode(opcode);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
g.Label(cont->false_block()))->MarkAsControl(); g.Label(cont->false_block()));
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
...@@ -840,8 +839,7 @@ void EmitWordCompareZero(InstructionSelector* selector, InstructionCode opcode, ...@@ -840,8 +839,7 @@ void EmitWordCompareZero(InstructionSelector* selector, InstructionCode opcode,
InstructionOperand* const value_operand = g.UseRegister(value); InstructionOperand* const value_operand = g.UseRegister(value);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0), selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0),
g.Label(cont->true_block()), g.Label(cont->true_block()), g.Label(cont->false_block()));
g.Label(cont->false_block()))->MarkAsControl();
} else { } else {
selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand,
g.TempImmediate(0)); g.TempImmediate(0));
......
...@@ -2389,9 +2389,11 @@ LiveRange* RegisterAllocator::SplitRangeAt(LiveRange* range, ...@@ -2389,9 +2389,11 @@ LiveRange* RegisterAllocator::SplitRangeAt(LiveRange* range,
if (pos.Value() <= range->Start().Value()) return range; if (pos.Value() <= range->Start().Value()) return range;
// We can't properly connect liveranges if split occured at the end // We can't properly connect liveranges if split occured at the end
// of control instruction. // a block.
DCHECK(pos.IsInstructionStart() || DCHECK(pos.IsInstructionStart() ||
!InstructionAt(pos.InstructionIndex())->IsControl()); code()
->GetInstructionBlock(pos.InstructionIndex())
->last_instruction_index() != pos.InstructionIndex());
int vreg = GetVirtualRegister(); int vreg = GetVirtualRegister();
if (!AllocationOk()) return nullptr; if (!AllocationOk()) return nullptr;
......
...@@ -351,9 +351,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node, ...@@ -351,9 +351,8 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
DCHECK_GE(arraysize(inputs), input_count); DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count); DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
outputs, input_count, inputs); inputs);
if (cont->IsBranch()) instr->MarkAsControl();
} }
...@@ -977,7 +976,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, ...@@ -977,7 +976,7 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
opcode = cont->Encode(opcode); opcode = cont->Encode(opcode);
if (cont->IsBranch()) { if (cont->IsBranch()) {
selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
g.Label(cont->false_block()))->MarkAsControl(); g.Label(cont->false_block()));
} else { } else {
DCHECK(cont->IsSet()); DCHECK(cont->IsSet());
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
......
...@@ -208,7 +208,7 @@ TEST(InstructionIsGapAt) { ...@@ -208,7 +208,7 @@ TEST(InstructionIsGapAt) {
R.allocCode(); R.allocCode();
TestInstr* i0 = TestInstr::New(R.zone(), 100); TestInstr* i0 = TestInstr::New(R.zone(), 100);
TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl(); TestInstr* g = TestInstr::New(R.zone(), 103);
R.code->StartBlock(b0->GetRpoNumber()); R.code->StartBlock(b0->GetRpoNumber());
R.code->AddInstruction(i0); R.code->AddInstruction(i0);
R.code->AddInstruction(g); R.code->AddInstruction(g);
...@@ -231,14 +231,14 @@ TEST(InstructionIsGapAt2) { ...@@ -231,14 +231,14 @@ TEST(InstructionIsGapAt2) {
R.allocCode(); R.allocCode();
TestInstr* i0 = TestInstr::New(R.zone(), 100); TestInstr* i0 = TestInstr::New(R.zone(), 100);
TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl(); TestInstr* g = TestInstr::New(R.zone(), 103);
R.code->StartBlock(b0->GetRpoNumber()); R.code->StartBlock(b0->GetRpoNumber());
R.code->AddInstruction(i0); R.code->AddInstruction(i0);
R.code->AddInstruction(g); R.code->AddInstruction(g);
R.code->EndBlock(b0->GetRpoNumber()); R.code->EndBlock(b0->GetRpoNumber());
TestInstr* i1 = TestInstr::New(R.zone(), 102); TestInstr* i1 = TestInstr::New(R.zone(), 102);
TestInstr* g1 = TestInstr::New(R.zone(), 104)->MarkAsControl(); TestInstr* g1 = TestInstr::New(R.zone(), 104);
R.code->StartBlock(b1->GetRpoNumber()); R.code->StartBlock(b1->GetRpoNumber());
R.code->AddInstruction(i1); R.code->AddInstruction(i1);
R.code->AddInstruction(g1); R.code->AddInstruction(g1);
...@@ -259,7 +259,7 @@ TEST(InstructionAddGapMove) { ...@@ -259,7 +259,7 @@ TEST(InstructionAddGapMove) {
R.allocCode(); R.allocCode();
TestInstr* i0 = TestInstr::New(R.zone(), 100); TestInstr* i0 = TestInstr::New(R.zone(), 100);
TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl(); TestInstr* g = TestInstr::New(R.zone(), 103);
R.code->StartBlock(b0->GetRpoNumber()); R.code->StartBlock(b0->GetRpoNumber());
R.code->AddInstruction(i0); R.code->AddInstruction(i0);
R.code->AddInstruction(g); R.code->AddInstruction(g);
......
...@@ -32,8 +32,8 @@ class TestCode : public HandleAndZoneScope { ...@@ -32,8 +32,8 @@ class TestCode : public HandleAndZoneScope {
int Jump(int target) { int Jump(int target) {
Start(); Start();
InstructionOperand* ops[] = {UseRpo(target)}; InstructionOperand* ops[] = {UseRpo(target)};
sequence_.AddInstruction(Instruction::New(main_zone(), kArchJmp, 0, NULL, 1, sequence_.AddInstruction(
ops, 0, NULL)->MarkAsControl()); Instruction::New(main_zone(), kArchJmp, 0, NULL, 1, ops, 0, NULL));
int pos = static_cast<int>(sequence_.instructions().size() - 1); int pos = static_cast<int>(sequence_.instructions().size() - 1);
End(); End();
return pos; return pos;
...@@ -47,8 +47,8 @@ class TestCode : public HandleAndZoneScope { ...@@ -47,8 +47,8 @@ class TestCode : public HandleAndZoneScope {
InstructionOperand* ops[] = {UseRpo(ttarget), UseRpo(ftarget)}; InstructionOperand* ops[] = {UseRpo(ttarget), UseRpo(ftarget)};
InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) | InstructionCode code = 119 | FlagsModeField::encode(kFlags_branch) |
FlagsConditionField::encode(kEqual); FlagsConditionField::encode(kEqual);
sequence_.AddInstruction(Instruction::New(main_zone(), code, 0, NULL, 2, sequence_.AddInstruction(
ops, 0, NULL)->MarkAsControl()); Instruction::New(main_zone(), code, 0, NULL, 2, ops, 0, NULL));
int pos = static_cast<int>(sequence_.instructions().size() - 1); int pos = static_cast<int>(sequence_.instructions().size() - 1);
End(); End();
return pos; return pos;
......
...@@ -260,22 +260,20 @@ int InstructionSequenceTest::EmitBranch(TestOperand input_op) { ...@@ -260,22 +260,20 @@ int InstructionSequenceTest::EmitBranch(TestOperand input_op) {
ConvertInputOp(Imm()), ConvertInputOp(Imm())}; ConvertInputOp(Imm()), ConvertInputOp(Imm())};
InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) | InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) |
FlagsConditionField::encode(kEqual); FlagsConditionField::encode(kEqual);
auto instruction = auto instruction = NewInstruction(opcode, 0, nullptr, 4, inputs);
NewInstruction(opcode, 0, nullptr, 4, inputs)->MarkAsControl();
return AddInstruction(NewIndex(), instruction); return AddInstruction(NewIndex(), instruction);
} }
int InstructionSequenceTest::EmitFallThrough() { int InstructionSequenceTest::EmitFallThrough() {
auto instruction = NewInstruction(kArchNop, 0, nullptr)->MarkAsControl(); auto instruction = NewInstruction(kArchNop, 0, nullptr);
return AddInstruction(NewIndex(), instruction); return AddInstruction(NewIndex(), instruction);
} }
int InstructionSequenceTest::EmitJump() { int InstructionSequenceTest::EmitJump() {
InstructionOperand* inputs[1]{ConvertInputOp(Imm())}; InstructionOperand* inputs[1]{ConvertInputOp(Imm())};
auto instruction = auto instruction = NewInstruction(kArchJmp, 0, nullptr, 1, inputs);
NewInstruction(kArchJmp, 0, nullptr, 1, inputs)->MarkAsControl();
return AddInstruction(NewIndex(), instruction); return AddInstruction(NewIndex(), instruction);
} }
......
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