Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VM_IL_PRINTER_H_ | |
| 6 #define VM_IL_PRINTER_H_ | |
| 7 | |
| 8 #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
| |
| 9 #include "vm/intermediate_language.h" | |
| 10 | |
| 11 namespace dart { | |
| 12 | |
| 13 // Graph printing. | |
| 14 class FlowGraphPrinter : public FlowGraphVisitor { | |
| 15 public: | |
| 16 FlowGraphPrinter(const Function& function, | |
| 17 const GrowableArray<BlockEntryInstr*>& block_order) | |
| 18 : FlowGraphVisitor(block_order), function_(function) { } | |
| 19 | |
| 20 virtual ~FlowGraphPrinter() {} | |
| 21 | |
| 22 // Print the instructions in a block terminated by newlines. Add "goto N" | |
| 23 // to the end of the block if it ends with an unconditional jump to | |
| 24 // another block and that block is not next in reverse postorder. | |
| 25 void VisitBlocks(); | |
| 26 | |
| 27 // Visiting a computation prints it with no indentation or newline. | |
| 28 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ | |
| 29 virtual void Visit##ShortName(ClassName* comp); | |
| 30 | |
| 31 // Visiting an instruction prints it with a four space indent and no | |
| 32 // trailing newline. Basic block entries are labeled with their block | |
| 33 // number. | |
| 34 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ | |
| 35 virtual void Visit##ShortName(ShortName##Instr* instr); | |
| 36 | |
| 37 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION) | |
| 38 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) | |
| 39 | |
| 40 #undef DECLARE_VISIT_COMPUTATION | |
| 41 #undef DECLARE_VISIT_INSTRUCTION | |
| 42 | |
| 43 private: | |
| 44 const Function& function_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(FlowGraphPrinter); | |
| 47 }; | |
| 48 | |
| 49 } // namespace dart | |
| 50 | |
| 51 #endif // VM_IL_PRINTER_H_ | |
| OLD | NEW |