blob: 1a971a55ed5d4a9c99076bda31add39107a4972c [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
11namespace v8 {
12namespace internal {
13
Emily Bernierd0a1eb72015-03-24 16:35:39 -040014class CompilationInfo;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000015
16namespace compiler {
17
18class Graph;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040019class InstructionSequence;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000020class RegisterAllocationData;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040021class Schedule;
22class SourcePositionTable;
23
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000024FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
25 const char* suffix, const char* mode);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040026
27struct AsJSON {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000028 AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040029 const Graph& graph;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000030 const SourcePositionTable* positions;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040031};
32
33std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
34
35struct AsRPO {
36 explicit AsRPO(const Graph& g) : graph(g) {}
37 const Graph& graph;
38};
39
40std::ostream& operator<<(std::ostream& os, const AsRPO& ad);
41
42
43struct AsC1VCompilation {
44 explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
45 const CompilationInfo* info_;
46};
47
48
49struct AsC1V {
50 AsC1V(const char* phase, const Schedule* schedule,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000051 const SourcePositionTable* positions = nullptr,
52 const InstructionSequence* instructions = nullptr)
Emily Bernierd0a1eb72015-03-24 16:35:39 -040053 : 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 Murdoch4a90d5f2016-03-22 12:00:34 +000063struct AsC1VRegisterAllocationData {
64 explicit AsC1VRegisterAllocationData(
65 const char* phase, const RegisterAllocationData* data = nullptr)
66 : phase_(phase), data_(data) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040067 const char* phase_;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000068 const RegisterAllocationData* data_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040069};
70
Emily Bernierd0a1eb72015-03-24 16:35:39 -040071std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
72std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000073std::ostream& operator<<(std::ostream& os,
74 const AsC1VRegisterAllocationData& ac);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040075
76} // namespace compiler
77} // namespace internal
78} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000079
80#endif // V8_COMPILER_GRAPH_VISUALIZER_H_