Revision: 7665
Author: [email protected]
Date: Tue Apr 19 09:14:42 2011
Log: Lithium LLabel instruction are no longer used as gap instructions.
Instead we use the first part of the first gap after
the label to insert gap-moves for resolving control-flow
and phis.
Review URL: http://codereview.chromium.org/6873075
http://code.google.com/p/v8/source/detail?r=7665
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/lithium-allocator.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Fri Apr 15 00:58:22 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Apr 19 09:14:42 2011
@@ -131,7 +131,6 @@
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());
@@ -145,7 +144,6 @@
return false;
}
}
-
return true;
}
@@ -430,7 +428,6 @@
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) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Tue Apr 19 06:43:36 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Tue Apr 19 09:14:42 2011
@@ -407,17 +407,17 @@
};
-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; }
@@ -425,6 +425,7 @@
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
@@ -2022,6 +2023,10 @@
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) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Apr 18
06:53:11 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Apr 19
09:14:42 2011
@@ -739,7 +739,6 @@
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Apr 15
00:58:22 2011
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Apr 19
09:14:42 2011
@@ -689,7 +689,6 @@
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri Apr 15 00:58:22
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Apr 19 09:14:42
2011
@@ -133,7 +133,6 @@
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());
@@ -147,7 +146,6 @@
return false;
}
}
-
return true;
}
@@ -388,7 +386,6 @@
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) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Tue Apr 19 06:43:36 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Tue Apr 19 09:14:42 2011
@@ -409,17 +409,17 @@
};
-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; }
@@ -427,6 +427,7 @@
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
@@ -2081,6 +2082,10 @@
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) {
=======================================
--- /branches/bleeding_edge/src/lithium-allocator.cc Mon Apr 18 13:26:24
2011
+++ /branches/bleeding_edge/src/lithium-allocator.cc Tue Apr 19 09:14:42
2011
@@ -1047,9 +1047,10 @@
}
}
+ // 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());
}
@@ -1122,12 +1123,12 @@
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)
@@ -1143,8 +1144,8 @@
branch->pointer_map()->RecordPointer(cur_op);
}
}
- }
- gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op);
+ gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op,
cur_op);
+ }
}
}
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri Apr 15
06:06:41 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Apr 19
09:14:42 2011
@@ -690,7 +690,6 @@
}
__ bind(label->label());
current_block_ = label->block_id();
- LCodeGen::DoGap(label);
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Fri Apr 15 00:58:22 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Apr 19 09:14:42 2011
@@ -133,7 +133,6 @@
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());
@@ -147,7 +146,6 @@
return false;
}
}
-
return true;
}
@@ -387,7 +385,6 @@
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) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Tue Apr 19 06:43:36 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Tue Apr 19 09:14:42 2011
@@ -408,17 +408,17 @@
};
-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; }
@@ -426,6 +426,7 @@
private:
Label label_;
+ HBasicBlock* block_;
LLabel* replacement_;
};
@@ -2004,6 +2005,10 @@
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) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev