Line data Source code
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 :
8 : #include <stdio.h>
9 : #include <iosfwd>
10 : #include <memory>
11 :
12 : #include "src/globals.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 :
17 : class CompilationInfo;
18 :
19 : namespace compiler {
20 :
21 : class Graph;
22 : class InstructionSequence;
23 : class RegisterAllocationData;
24 : class Schedule;
25 : class SourcePositionTable;
26 :
27 : std::unique_ptr<char[]> GetVisualizerLogFileName(CompilationInfo* info,
28 : const char* phase,
29 : const char* suffix);
30 :
31 : struct AsJSON {
32 30 : AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
33 : const Graph& graph;
34 : const SourcePositionTable* positions;
35 : };
36 :
37 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
38 :
39 : struct AsRPO {
40 0 : explicit AsRPO(const Graph& g) : graph(g) {}
41 : const Graph& graph;
42 : };
43 :
44 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const AsRPO& ad);
45 :
46 : struct AsC1VCompilation {
47 0 : explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
48 : const CompilationInfo* info_;
49 : };
50 :
51 : struct AsScheduledGraph {
52 0 : explicit AsScheduledGraph(const Schedule* schedule) : schedule(schedule) {}
53 : const Schedule* schedule;
54 : };
55 :
56 : std::ostream& operator<<(std::ostream& os, const AsScheduledGraph& scheduled);
57 : struct AsC1V {
58 : AsC1V(const char* phase, const Schedule* schedule,
59 : const SourcePositionTable* positions = nullptr,
60 : const InstructionSequence* instructions = nullptr)
61 : : schedule_(schedule),
62 : instructions_(instructions),
63 : positions_(positions),
64 0 : phase_(phase) {}
65 : const Schedule* schedule_;
66 : const InstructionSequence* instructions_;
67 : const SourcePositionTable* positions_;
68 : const char* phase_;
69 : };
70 :
71 : struct AsC1VRegisterAllocationData {
72 : explicit AsC1VRegisterAllocationData(
73 : const char* phase, const RegisterAllocationData* data = nullptr)
74 0 : : phase_(phase), data_(data) {}
75 : const char* phase_;
76 : const RegisterAllocationData* data_;
77 : };
78 :
79 : std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
80 : std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
81 : std::ostream& operator<<(std::ostream& os,
82 : const AsC1VRegisterAllocationData& ac);
83 :
84 : } // namespace compiler
85 : } // namespace internal
86 : } // namespace v8
87 :
88 : #endif // V8_COMPILER_GRAPH_VISUALIZER_H_
|