Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: vm/intermediate_language.h

Issue 10700034: Add a goto instruction to the IL use it to terminate basic blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: vm/intermediate_language.h
===================================================================
--- vm/intermediate_language.h (revision 9101)
+++ vm/intermediate_language.h (working copy)
@@ -1707,6 +1707,7 @@
M(Throw) \
M(ReThrow) \
M(Branch) \
+ M(Goto) \
M(ParallelMove)
@@ -1818,12 +1819,7 @@
// Returns structure describing location constraints required
// to emit native code for this instruction.
- virtual LocationSummary* locs() {
- // TODO(vegorov): This should be pure virtual method.
- // However we are temporary using NULL for instructions that
- // were not converted to the location based code generation yet.
- return NULL;
- }
+ virtual LocationSummary* locs() = 0;
virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
UNIMPLEMENTED();
@@ -1890,7 +1886,7 @@
dominated_blocks_.Add(block);
}
- Instruction* last_instruction() const { return last_instruction_; }
+ inline Instruction* last_instruction() const;
void set_last_instruction(Instruction* instr) { last_instruction_ = instr; }
virtual void DiscoverBlocks(
@@ -1901,6 +1897,8 @@
GrowableArray<BitVector*>* assigned_vars,
intptr_t variable_count);
+ virtual LocationSummary* locs() { return NULL; }
+
protected:
BlockEntryInstr()
: preorder_number_(-1),
@@ -1993,6 +1991,7 @@
return successor_;
}
virtual void SetSuccessor(Instruction* instr) {
+ ASSERT(instr == NULL || !instr->IsBlockEntry());
successor_ = instr;
}
@@ -2047,6 +2046,7 @@
return successor_;
}
virtual void SetSuccessor(Instruction* instr) {
+ ASSERT(instr == NULL || !instr->IsBlockEntry());
successor_ = instr;
}
@@ -2088,6 +2088,7 @@
}
virtual void SetSuccessor(Instruction* instr) {
+ ASSERT(instr == NULL || !instr->IsBlockEntry());
successor_ = instr;
}
@@ -2149,6 +2150,7 @@
}
virtual void SetSuccessor(Instruction* instr) {
+ ASSERT(instr == NULL || !instr->IsBlockEntry());
successor_ = instr;
}
@@ -2186,6 +2188,8 @@
virtual Instruction* StraightLineSuccessor() const { return NULL; }
virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
+ virtual LocationSummary* locs() { return NULL; }
+
private:
GrowableArray<Value*> inputs_;
@@ -2366,6 +2370,27 @@
};
+class GotoInstr : public Instruction {
+ public:
+ explicit GotoInstr(BlockEntryInstr* successor)
+ : successor_(successor) {
+ ASSERT(successor != NULL);
+ }
+
+ DECLARE_INSTRUCTION(Goto)
+
+ virtual Instruction* StraightLineSuccessor() const { return successor_; }
+ virtual void SetSuccessor(Instruction* instr) {
+ successor_ = instr->AsBlockEntry();
+ }
+
+ virtual LocationSummary* locs() { return NULL; }
Vyacheslav Egorov (Google) 2012/06/29 16:06:03 () { single space
Florian Schneider 2012/06/29 16:13:12 Done.
+
+ private:
+ BlockEntryInstr* successor_;
+};
+
+
class MoveOperands : public ValueObject {
public:
MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { }
@@ -2400,6 +2425,17 @@
#undef DECLARE_INSTRUCTION
+// Definition of inline functions.
+Instruction* BlockEntryInstr::last_instruction() const {
+ ASSERT(last_instruction_->IsGraphEntry() ||
+ last_instruction_->IsGoto() ||
+ last_instruction_->IsReturn() ||
+ last_instruction_->IsBranch() ||
+ last_instruction_->IsThrow() ||
+ last_instruction_->IsReThrow());
+ return last_instruction_;
+}
+
// Visitor base class to visit each instruction and computation in a flow
// graph as defined by a reversed list of basic blocks.
class FlowGraphVisitor : public ValueObject {
« vm/flow_graph_builder.cc ('K') | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698