OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_IL_PRINTER_H_ | 5 #ifndef VM_IL_PRINTER_H_ |
6 #define VM_IL_PRINTER_H_ | 6 #define VM_IL_PRINTER_H_ |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 14 matching lines...) Expand all Loading... |
25 const intptr_t size_; | 25 const intptr_t size_; |
26 | 26 |
27 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); | 27 DISALLOW_COPY_AND_ASSIGN(BufferFormatter); |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 // Graph printing. | 31 // Graph printing. |
32 class FlowGraphPrinter : public ValueObject { | 32 class FlowGraphPrinter : public ValueObject { |
33 public: | 33 public: |
34 FlowGraphPrinter(const Function& function, | 34 FlowGraphPrinter(const Function& function, |
35 const GrowableArray<BlockEntryInstr*>& block_order) | 35 const GrowableArray<BlockEntryInstr*>& block_order, |
36 : function_(function), block_order_(block_order) { } | 36 bool print_locations = false) |
| 37 : function_(function), |
| 38 block_order_(block_order), |
| 39 print_locations_(print_locations) { } |
37 | 40 |
38 // Print the instructions in a block terminated by newlines. Add "goto N" | 41 // Print the instructions in a block terminated by newlines. Add "goto N" |
39 // to the end of the block if it ends with an unconditional jump to | 42 // to the end of the block if it ends with an unconditional jump to |
40 // another block and that block is not next in reverse postorder. | 43 // another block and that block is not next in reverse postorder. |
41 void PrintBlocks(); | 44 void PrintBlocks(); |
42 static void PrintInstruction(Instruction* instr); | 45 void PrintInstruction(Instruction* instr); |
43 static void PrintComputation(Computation* comp); | 46 static void PrintComputation(Computation* comp); |
44 | 47 |
45 private: | 48 private: |
46 const Function& function_; | 49 const Function& function_; |
47 const GrowableArray<BlockEntryInstr*>& block_order_; | 50 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 51 const bool print_locations_; |
48 }; | 52 }; |
49 | 53 |
50 | 54 |
51 class FlowGraphVisualizer : public ValueObject { | 55 class FlowGraphVisualizer : public ValueObject { |
52 public: | 56 public: |
53 FlowGraphVisualizer(const Function& function, | 57 FlowGraphVisualizer(const Function& function, |
54 const GrowableArray<BlockEntryInstr*>& block_order) | 58 const GrowableArray<BlockEntryInstr*>& block_order) |
55 : function_(function), block_order_(block_order), indent_(0) { } | 59 : function_(function), block_order_(block_order), indent_(0) { } |
56 | 60 |
57 void PrintFunction(); | 61 void PrintFunction(); |
58 | 62 |
59 private: | 63 private: |
60 // Helpers for printing. | 64 // Helpers for printing. |
61 void PrintInstruction(Instruction* instr); | 65 void PrintInstruction(Instruction* instr); |
62 void Print(const char* format, ...); | 66 void Print(const char* format, ...); |
63 | 67 |
64 const Function& function_; | 68 const Function& function_; |
65 const GrowableArray<BlockEntryInstr*>& block_order_; | 69 const GrowableArray<BlockEntryInstr*>& block_order_; |
66 intptr_t indent_; | 70 intptr_t indent_; |
67 | 71 |
68 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisualizer); | 72 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisualizer); |
69 }; | 73 }; |
70 | 74 |
71 } // namespace dart | 75 } // namespace dart |
72 | 76 |
73 #endif // VM_IL_PRINTER_H_ | 77 #endif // VM_IL_PRINTER_H_ |
OLD | NEW |