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

Unified Diff: vm/il_printer.h

Issue 10398015: Move FlowGraphPrinter to a new file. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « vm/flow_graph_builder.cc ('k') | vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/il_printer.h
===================================================================
--- vm/il_printer.h (revision 0)
+++ vm/il_printer.h (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef VM_IL_PRINTER_H_
+#define VM_IL_PRINTER_H_
+
+#include "vm/flow_graph_builder.h"
srdjan 2012/05/14 18:21:16 Do you need to import flow_graph_builder.h or woul
Florian Schneider 2012/05/14 18:38:49 Good point. Actually, I don't need anything from
+#include "vm/intermediate_language.h"
+
+namespace dart {
+
+// Graph printing.
+class FlowGraphPrinter : public FlowGraphVisitor {
+ public:
+ FlowGraphPrinter(const Function& function,
+ const GrowableArray<BlockEntryInstr*>& block_order)
+ : FlowGraphVisitor(block_order), function_(function) { }
+
+ virtual ~FlowGraphPrinter() {}
+
+ // Print the instructions in a block terminated by newlines. Add "goto N"
+ // to the end of the block if it ends with an unconditional jump to
+ // another block and that block is not next in reverse postorder.
+ void VisitBlocks();
+
+ // Visiting a computation prints it with no indentation or newline.
+#define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \
+ virtual void Visit##ShortName(ClassName* comp);
+
+ // Visiting an instruction prints it with a four space indent and no
+ // trailing newline. Basic block entries are labeled with their block
+ // number.
+#define DECLARE_VISIT_INSTRUCTION(ShortName) \
+ virtual void Visit##ShortName(ShortName##Instr* instr);
+
+ FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION)
+ FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
+
+#undef DECLARE_VISIT_COMPUTATION
+#undef DECLARE_VISIT_INSTRUCTION
+
+ private:
+ const Function& function_;
+
+ DISALLOW_COPY_AND_ASSIGN(FlowGraphPrinter);
+};
+
+} // namespace dart
+
+#endif // VM_IL_PRINTER_H_
« no previous file with comments | « vm/flow_graph_builder.cc ('k') | vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698