| Index: runtime/vm/il_printer.cc
|
| ===================================================================
|
| --- runtime/vm/il_printer.cc (revision 13460)
|
| +++ runtime/vm/il_printer.cc (working copy)
|
| @@ -169,11 +169,6 @@
|
| }
|
|
|
|
|
| -void Instruction::PrintToVisualizer(BufferFormatter* f) const {
|
| - PrintTo(f);
|
| -}
|
| -
|
| -
|
| void Definition::PrintTo(BufferFormatter* f) const {
|
| PrintUse(f, *this);
|
| if (is_used()) {
|
| @@ -198,11 +193,6 @@
|
| }
|
|
|
|
|
| -void Definition::PrintToVisualizer(BufferFormatter* f) const {
|
| - PrintTo(f);
|
| -}
|
| -
|
| -
|
| void Value::PrintTo(BufferFormatter* f) const {
|
| PrintUse(f, *definition());
|
| }
|
| @@ -649,214 +639,6 @@
|
| }
|
|
|
|
|
| -void FlowGraphVisualizer::Print(const char* format, ...) {
|
| - char str[1000];
|
| - BufferFormatter f(str, sizeof(str));
|
| - f.Print("%*s", static_cast<int>(2 * indent_), "");
|
| - va_list args;
|
| - va_start(args, format);
|
| - f.VPrint(format, args);
|
| - va_end(args);
|
| - (*Dart::flow_graph_writer())(str, strlen(str));
|
| -}
|
| -
|
| -
|
| -void FlowGraphVisualizer::PrintInstruction(Instruction* instr) {
|
| - char str[1000];
|
| - BufferFormatter f(str, sizeof(str));
|
| - instr->PrintToVisualizer(&f);
|
| - if (FLAG_print_environments && (instr->env() != NULL)) {
|
| - instr->env()->PrintTo(&f);
|
| - }
|
| - f.Print(" <|@\n");
|
| - (*Dart::flow_graph_writer())(str, strlen(str));
|
| -}
|
| -
|
| -
|
| -void FlowGraphVisualizer::PrintFunction() {
|
| -#define BEGIN(name) \
|
| - Print("begin_%s\n", name); \
|
| - indent_++;
|
| -#define END(name) \
|
| - Print("end_%s\n", name); \
|
| - indent_--;
|
| -
|
| - {
|
| - BEGIN("compilation");
|
| - const char* name = function_.ToFullyQualifiedCString();
|
| - Print("%s \"%s\"\n", "name", name);
|
| - Print("%s \"%s\"\n", "method", name);
|
| - Print("%s %d\n", "date", 0); // Required field. Unused.
|
| - END("compilation");
|
| - }
|
| -
|
| - {
|
| - BEGIN("cfg");
|
| - Print("%s \"%s\"\n", "name", "Flow graph builder");
|
| -
|
| - for (intptr_t i = 0; i < block_order_.length(); ++i) {
|
| - BEGIN("block");
|
| - BlockEntryInstr* entry = block_order_[i];
|
| - Print("%s \"B%"Pd"\"\n", "name", entry->block_id());
|
| - Print("%s %d\n", "from_bci", -1); // Required field. Unused.
|
| - Print("%s %d\n", "to_bci", -1); // Required field. Unused.
|
| -
|
| - Print("predecessors");
|
| - for (intptr_t j = 0; j < entry->PredecessorCount(); ++j) {
|
| - BlockEntryInstr* pred = entry->PredecessorAt(j);
|
| - Print(" \"B%"Pd"\"", pred->block_id());
|
| - }
|
| - Print("\n");
|
| -
|
| - Print("successors");
|
| - Instruction* last = entry->last_instruction();
|
| - for (intptr_t j = 0; j < last->SuccessorCount(); ++j) {
|
| - intptr_t next_id = last->SuccessorAt(j)->block_id();
|
| - Print(" \"B%"Pd"\"", next_id);
|
| - }
|
| - Print("\n");
|
| -
|
| - // TODO(fschneider): Use this for exception handlers.
|
| - Print("xhandlers\n");
|
| -
|
| - // Can be freely used to mark blocks
|
| - Print("flags\n");
|
| -
|
| - if (entry->dominator() != NULL) {
|
| - Print("%s \"B%"Pd"\"\n", "dominator", entry->dominator()->block_id());
|
| - }
|
| -
|
| - // TODO(fschneider): Mark blocks with loop nesting level.
|
| - Print("%s %d\n", "loop_depth", 0);
|
| -
|
| - {
|
| - BEGIN("states"); // Required section.
|
| - {
|
| - BEGIN("locals"); // Required section.
|
| - JoinEntryInstr* join = entry->AsJoinEntry();
|
| - intptr_t num_phis = (join != NULL && join->phi_count())
|
| - ? join->phis()->length()
|
| - : 0;
|
| - Print("%s %"Pd"\n", "size", num_phis);
|
| - for (intptr_t j = 0; j < num_phis; ++j) {
|
| - PhiInstr* phi = (*join->phis())[j];
|
| - if (phi != NULL) {
|
| - Print("%"Pd" ", j); // Print variable index.
|
| - char buffer[120];
|
| - BufferFormatter formatter(buffer, sizeof(buffer));
|
| - phi->PrintToVisualizer(&formatter);
|
| - Print("%s\n", buffer);
|
| - }
|
| - }
|
| - END("locals");
|
| - }
|
| - END("states");
|
| - }
|
| -
|
| - {
|
| - BEGIN("HIR");
|
| - // Print the block entry.
|
| - Print("0 0 "); // Required fields "bci" and "use". Unused.
|
| - PrintInstruction(block_order_[i]);
|
| - // And all the successors until an exit, branch, or a block entry.
|
| - BlockEntryInstr* entry = block_order_[i];
|
| - Instruction* current = entry;
|
| - for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
|
| - current = it.Current();
|
| - Print("0 0 ");
|
| - PrintInstruction(current);
|
| - }
|
| - if (current->next() != NULL) {
|
| - ASSERT(current->next()->IsBlockEntry());
|
| - Print("0 0 _ Goto B%"Pd" <|@\n",
|
| - current->next()->AsBlockEntry()->block_id());
|
| - }
|
| - END("HIR");
|
| - }
|
| - END("block");
|
| - }
|
| - END("cfg");
|
| - }
|
| -#undef BEGIN
|
| -#undef END
|
| -}
|
| -
|
| -
|
| -// === Printing instructions in a visualizer-understandable format:
|
| -// "result instruction(op1, op2)" where result is a temporary name
|
| -// or _ for instruction without result.
|
| -void GraphEntryInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - const GrowableArray<Definition*>& defns = initial_definitions_;
|
| - f->Print("_ [graph]");
|
| - if (defns.length() > 0) {
|
| - f->Print(" init={ ");
|
| - for (intptr_t i = 0; i < defns.length(); ++i) {
|
| - if (i > 0) f->Print(", ");
|
| - defns[i]->PrintTo(f);
|
| - }
|
| - f->Print(" }");
|
| - }
|
| -}
|
| -
|
| -
|
| -void JoinEntryInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("_ [join]");
|
| -}
|
| -
|
| -
|
| -void PhiInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("v%"Pd" [", ssa_temp_index());
|
| - for (intptr_t i = 0; i < InputCount(); ++i) {
|
| - if (i > 0) f->Print(" ");
|
| - InputAt(i)->PrintTo(f);
|
| - }
|
| - f->Print("]");
|
| -}
|
| -
|
| -
|
| -void ParameterInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - ASSERT(HasSSATemp());
|
| - ASSERT(temp_index() == -1);
|
| - f->Print("v%"Pd" Parameter(%"Pd")", ssa_temp_index(), index());
|
| -}
|
| -
|
| -
|
| -void TargetEntryInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("_ [target");
|
| - if (IsCatchEntry()) {
|
| - f->Print(" catch %"Pd"]", catch_try_index());
|
| - } else {
|
| - f->Print("]");
|
| - }
|
| -}
|
| -
|
| -
|
| -void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("_ %s ", DebugName());
|
| - value()->PrintTo(f);
|
| -}
|
| -
|
| -
|
| -void GotoInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("_ goto B%"Pd"", successor()->block_id());
|
| -}
|
| -
|
| -
|
| -void BranchInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - f->Print("_ %s ", DebugName());
|
| - f->Print("if ");
|
| - comparison()->PrintTo(f);
|
| - f->Print(" goto (B%"Pd", B%"Pd")",
|
| - true_successor()->block_id(),
|
| - false_successor()->block_id());
|
| -}
|
| -
|
| -
|
| -void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const {
|
| - UNIMPLEMENTED();
|
| -}
|
| -
|
| -
|
| void Environment::PrintTo(BufferFormatter* f) const {
|
| f->Print(" env={ ");
|
| int arg_count = 0;
|
|
|