blob: 85b0cf7e0981aa97ae40ca78ef976cb15274f0b1 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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 Murdoch4a90d5f2016-03-22 12:00:34 +00008#include <stdio.h>
Emily Bernierd0a1eb72015-03-24 16:35:39 -04009#include <iosfwd>
Ben Murdochb8a8cc12014-11-26 15:28:44 +000010
Ben Murdochc5610432016-08-08 18:44:38 +010011#include "src/base/smart-pointers.h"
12
Ben Murdochb8a8cc12014-11-26 15:28:44 +000013namespace v8 {
14namespace internal {
15
Emily Bernierd0a1eb72015-03-24 16:35:39 -040016class CompilationInfo;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000017
18namespace compiler {
19
20class Graph;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040021class InstructionSequence;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000022class RegisterAllocationData;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040023class Schedule;
24class SourcePositionTable;
25
Ben Murdochc5610432016-08-08 18:44:38 +010026base::SmartArrayPointer<const char> GetVisualizerLogFileName(
27 CompilationInfo* info, const char* phase, const char* suffix);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040028
29struct AsJSON {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000030 AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040031 const Graph& graph;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000032 const SourcePositionTable* positions;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040033};
34
35std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
36
37struct AsRPO {
38 explicit AsRPO(const Graph& g) : graph(g) {}
39 const Graph& graph;
40};
41
42std::ostream& operator<<(std::ostream& os, const AsRPO& ad);
43
44
45struct AsC1VCompilation {
46 explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
47 const CompilationInfo* info_;
48};
49
50
51struct AsC1V {
52 AsC1V(const char* phase, const Schedule* schedule,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000053 const SourcePositionTable* positions = nullptr,
54 const InstructionSequence* instructions = nullptr)
Emily Bernierd0a1eb72015-03-24 16:35:39 -040055 : 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 Murdoch4a90d5f2016-03-22 12:00:34 +000065struct AsC1VRegisterAllocationData {
66 explicit AsC1VRegisterAllocationData(
67 const char* phase, const RegisterAllocationData* data = nullptr)
68 : phase_(phase), data_(data) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040069 const char* phase_;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000070 const RegisterAllocationData* data_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040071};
72
Emily Bernierd0a1eb72015-03-24 16:35:39 -040073std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
74std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000075std::ostream& operator<<(std::ostream& os,
76 const AsC1VRegisterAllocationData& ac);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040077
78} // namespace compiler
79} // namespace internal
80} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000081
82#endif // V8_COMPILER_GRAPH_VISUALIZER_H_