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 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 11 | #include "src/base/smart-pointers.h" |
| 12 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 13 | namespace v8 { |
| 14 | namespace internal { |
| 15 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 16 | class CompilationInfo; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 17 | |
| 18 | namespace compiler { |
| 19 | |
| 20 | class Graph; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 21 | class InstructionSequence; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 22 | class RegisterAllocationData; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 23 | class Schedule; |
| 24 | class SourcePositionTable; |
| 25 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 26 | base::SmartArrayPointer<const char> GetVisualizerLogFileName( |
| 27 | CompilationInfo* info, const char* phase, const char* suffix); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 28 | |
| 29 | struct AsJSON { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 30 | AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {} |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 31 | const Graph& graph; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 32 | const SourcePositionTable* positions; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | std::ostream& operator<<(std::ostream& os, const AsJSON& ad); |
| 36 | |
| 37 | struct AsRPO { |
| 38 | explicit AsRPO(const Graph& g) : graph(g) {} |
| 39 | const Graph& graph; |
| 40 | }; |
| 41 | |
| 42 | std::ostream& operator<<(std::ostream& os, const AsRPO& ad); |
| 43 | |
| 44 | |
| 45 | struct AsC1VCompilation { |
| 46 | explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {} |
| 47 | const CompilationInfo* info_; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | struct AsC1V { |
| 52 | AsC1V(const char* phase, const Schedule* schedule, |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 53 | const SourcePositionTable* positions = nullptr, |
| 54 | const InstructionSequence* instructions = nullptr) |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 55 | : schedule_(schedule), |
| 56 | instructions_(instructions), |
| 57 | positions_(positions), |
| 58 | phase_(phase) {} |
| 59 | const Schedule* schedule_; |
| 60 | const InstructionSequence* instructions_; |
| 61 | const SourcePositionTable* positions_; |
| 62 | const char* phase_; |
| 63 | }; |
| 64 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 65 | struct AsC1VRegisterAllocationData { |
| 66 | explicit AsC1VRegisterAllocationData( |
| 67 | const char* phase, const RegisterAllocationData* data = nullptr) |
| 68 | : phase_(phase), data_(data) {} |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 69 | const char* phase_; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 70 | const RegisterAllocationData* data_; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 71 | }; |
| 72 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 73 | std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac); |
| 74 | std::ostream& operator<<(std::ostream& os, const AsC1V& ac); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 75 | std::ostream& operator<<(std::ostream& os, |
| 76 | const AsC1VRegisterAllocationData& ac); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 77 | |
| 78 | } // namespace compiler |
| 79 | } // namespace internal |
| 80 | } // namespace v8 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 81 | |
| 82 | #endif // V8_COMPILER_GRAPH_VISUALIZER_H_ |