void LLabel::PrintDataTo(StringStream* stream) {
- LGap::PrintDataTo(stream);
LLabel* rep = replacement();
if (rep != NULL) {
stream->Add(" Dead block replaced with B%d", rep->block_id());
return false;
}
}
-
return true;
}
if (last_instr->IsGoto()) {
LGoto* goto_instr = LGoto::cast(last_instr);
if (!goto_instr->include_stack_check() &&
- label->IsRedundant() &&
!label->is_loop_header()) {
bool can_eliminate = true;
for (int i = first + 1; i < last && can_eliminate; ++i) {
};
-class LLabel: public LGap {
+class LLabel: public LTemplateInstruction<0, 0, 0> {
public:
explicit LLabel(HBasicBlock* block)
- : LGap(block), replacement_(NULL) { }
+ : block_(block), replacement_(NULL) { }
DECLARE_CONCRETE_INSTRUCTION(Label, "label")
virtual void PrintDataTo(StringStream* stream);
- int block_id() const { return block()->block_id(); }
- bool is_loop_header() const { return block()->IsLoopHeader(); }
+ int block_id() const { return block_->block_id(); }
+ bool is_loop_header() const { return block_->IsLoopHeader(); }
Label* label() { return &label_; }
LLabel* replacement() const { return replacement_; }
void set_replacement(LLabel* label) { replacement_ = label; }
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
int first_instruction = block->first_instruction_index();
return LLabel::cast(instructions_[first_instruction]);
}
+ LGap* GetFirstGap(HBasicBlock* block) const {
+ int first_instruction = block->first_instruction_index();
+ return LGap::cast(instructions_[first_instruction + 1]);
+ }
int LookupDestination(int block_id) const {
LLabel* cur = GetLabel(block_id);
while (cur->replacement() != NULL) {
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
void LLabel::PrintDataTo(StringStream* stream) {
- LGap::PrintDataTo(stream);
LLabel* rep = replacement();
if (rep != NULL) {
stream->Add(" Dead block replaced with B%d", rep->block_id());
return false;
}
}
-
return true;
}
if (last_instr->IsGoto()) {
LGoto* goto_instr = LGoto::cast(last_instr);
if (!goto_instr->include_stack_check() &&
- label->IsRedundant() &&
!label->is_loop_header()) {
bool can_eliminate = true;
for (int i = first + 1; i < last && can_eliminate; ++i) {
};
-class LLabel: public LGap {
+class LLabel: public LTemplateInstruction<0, 0, 0> {
public:
explicit LLabel(HBasicBlock* block)
- : LGap(block), replacement_(NULL) { }
+ : block_(block), replacement_(NULL) { }
DECLARE_CONCRETE_INSTRUCTION(Label, "label")
virtual void PrintDataTo(StringStream* stream);
- int block_id() const { return block()->block_id(); }
- bool is_loop_header() const { return block()->IsLoopHeader(); }
+ int block_id() const { return block_->block_id(); }
+ bool is_loop_header() const { return block_->IsLoopHeader(); }
Label* label() { return &label_; }
LLabel* replacement() const { return replacement_; }
void set_replacement(LLabel* label) { replacement_ = label; }
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
int first_instruction = block->first_instruction_index();
return LLabel::cast(instructions_[first_instruction]);
}
+ LGap* GetFirstGap(HBasicBlock* block) const {
+ int first_instruction = block->first_instruction_index();
+ return LGap::cast(instructions_[first_instruction + 1]);
+ }
int LookupDestination(int block_id) const {
LLabel* cur = GetLabel(block_id);
while (cur->replacement() != NULL) {
}
}
+ // Insert spill-move in the first section of the first gap.
LiveRange* live_range = LiveRangeFor(phi->id());
- LLabel* label = chunk_->GetLabel(phi->block()->block_id());
- label->GetOrCreateParallelMove(LGap::START)->
+ LGap* gap = chunk_->GetFirstGap(phi->block());
+ gap->GetOrCreateParallelMove(LGap::BEFORE)->
AddMove(phi_operand, live_range->GetSpillOperand());
live_range->SetSpillStartIndex(phi->block()->first_instruction_index());
}
LOperand* pred_op = pred_cover->CreateAssignedOperand();
LOperand* cur_op = cur_cover->CreateAssignedOperand();
if (!pred_op->Equals(cur_op)) {
- LGap* gap = NULL;
if (block->predecessors()->length() == 1) {
- gap = GapAt(block->first_instruction_index());
+ LGap* gap = chunk_->GetFirstGap(block);
+ gap->GetOrCreateParallelMove(LGap::BEFORE)->AddMove(pred_op, cur_op);
} else {
ASSERT(pred->end()->SecondSuccessor() == NULL);
- gap = GetLastGap(pred);
+ LGap* gap = GetLastGap(pred);
// We are going to insert a move before the branch instruction.
// Some branch instructions (e.g. loops' back edges)
branch->pointer_map()->RecordPointer(cur_op);
}
}
+ gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op);
}
- gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op);
}
}
}
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
void LLabel::PrintDataTo(StringStream* stream) {
- LGap::PrintDataTo(stream);
LLabel* rep = replacement();
if (rep != NULL) {
stream->Add(" Dead block replaced with B%d", rep->block_id());
return false;
}
}
-
return true;
}
if (last_instr->IsGoto()) {
LGoto* goto_instr = LGoto::cast(last_instr);
if (!goto_instr->include_stack_check() &&
- label->IsRedundant() &&
!label->is_loop_header()) {
bool can_eliminate = true;
for (int i = first + 1; i < last && can_eliminate; ++i) {
};
-class LLabel: public LGap {
+class LLabel: public LTemplateInstruction<0, 0, 0> {
public:
explicit LLabel(HBasicBlock* block)
- : LGap(block), replacement_(NULL) { }
+ : block_(block), replacement_(NULL) { }
DECLARE_CONCRETE_INSTRUCTION(Label, "label")
virtual void PrintDataTo(StringStream* stream);
- int block_id() const { return block()->block_id(); }
- bool is_loop_header() const { return block()->IsLoopHeader(); }
+ int block_id() const { return block_->block_id(); }
+ bool is_loop_header() const { return block_->IsLoopHeader(); }
Label* label() { return &label_; }
LLabel* replacement() const { return replacement_; }
void set_replacement(LLabel* label) { replacement_ = label; }
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
int first_instruction = block->first_instruction_index();
return LLabel::cast(instructions_[first_instruction]);
}
+ LGap* GetFirstGap(HBasicBlock* block) const {
+ int first_instruction = block->first_instruction_index();
+ return LGap::cast(instructions_[first_instruction + 1]);
+ }
int LookupDestination(int block_id) const {
LLabel* cur = GetLabel(block_id);
while (cur->replacement() != NULL) {