Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_COMPILER_GRAPH_VISUALIZER_H_ |
| 6 | #define V8_COMPILER_GRAPH_VISUALIZER_H_ |
| 7 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 8 | #include <stdio.h> |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 9 | #include <iosfwd> |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 10 | |
| 11 | namespace v8 { |
| 12 | namespace internal { |
| 13 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 14 | class CompilationInfo; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 15 | |
| 16 | namespace compiler { |
| 17 | |
| 18 | class Graph; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 19 | class InstructionSequence; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 20 | class RegisterAllocationData; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 21 | class Schedule; |
| 22 | class SourcePositionTable; |
| 23 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 24 | FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase, |
| 25 | const char* suffix, const char* mode); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 26 | |
| 27 | struct AsJSON { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 28 | AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {} |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 29 | const Graph& graph; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 30 | const SourcePositionTable* positions; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | std::ostream& operator<<(std::ostream& os, const AsJSON& ad); |
| 34 | |
| 35 | struct AsRPO { |
| 36 | explicit AsRPO(const Graph& g) : graph(g) {} |
| 37 | const Graph& graph; |
| 38 | }; |
| 39 | |
| 40 | std::ostream& operator<<(std::ostream& os, const AsRPO& ad); |
| 41 | |
| 42 | |
| 43 | struct AsC1VCompilation { |
| 44 | explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {} |
| 45 | const CompilationInfo* info_; |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | struct AsC1V { |
| 50 | AsC1V(const char* phase, const Schedule* schedule, |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 51 | const SourcePositionTable* positions = nullptr, |
| 52 | const InstructionSequence* instructions = nullptr) |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 53 | : schedule_(schedule), |
| 54 | instructions_(instructions), |
| 55 | positions_(positions), |
| 56 | phase_(phase) {} |
| 57 | const Schedule* schedule_; |
| 58 | const InstructionSequence* instructions_; |
| 59 | const SourcePositionTable* positions_; |
| 60 | const char* phase_; |
| 61 | }; |
| 62 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 63 | struct AsC1VRegisterAllocationData { |
| 64 | explicit AsC1VRegisterAllocationData( |
| 65 | const char* phase, const RegisterAllocationData* data = nullptr) |
| 66 | : phase_(phase), data_(data) {} |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 67 | const char* phase_; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 68 | const RegisterAllocationData* data_; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 69 | }; |
| 70 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 71 | std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac); |
| 72 | std::ostream& operator<<(std::ostream& os, const AsC1V& ac); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 73 | std::ostream& operator<<(std::ostream& os, |
| 74 | const AsC1VRegisterAllocationData& ac); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 75 | |
| 76 | } // namespace compiler |
| 77 | } // namespace internal |
| 78 | } // namespace v8 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 79 | |
| 80 | #endif // V8_COMPILER_GRAPH_VISUALIZER_H_ |