graph-visualizer.h 2.31 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_GRAPH_VISUALIZER_H_
#define V8_COMPILER_GRAPH_VISUALIZER_H_

8
#include <iosfwd>
9 10 11

namespace v8 {
namespace internal {
12 13 14

class CompilationInfo;

15 16 17
namespace compiler {

class Graph;
18
class InstructionSequence;
19
class RegisterAllocationData;
20 21 22
class Schedule;
class SourcePositionTable;

23 24
FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
                            const char* suffix, const char* mode);
25 26 27 28 29 30

struct AsDOT {
  explicit AsDOT(const Graph& g) : graph(g) {}
  const Graph& graph;
};

31 32
std::ostream& operator<<(std::ostream& os, const AsDOT& ad);

33 34

struct AsJSON {
danno's avatar
danno committed
35
  AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
36
  const Graph& graph;
danno's avatar
danno committed
37
  const SourcePositionTable* positions;
38 39
};

40 41
std::ostream& operator<<(std::ostream& os, const AsJSON& ad);

42 43 44 45 46 47 48 49
struct AsRPO {
  explicit AsRPO(const Graph& g) : graph(g) {}
  const Graph& graph;
};

std::ostream& operator<<(std::ostream& os, const AsRPO& ad);


50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
struct AsC1VCompilation {
  explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
  const CompilationInfo* info_;
};


struct AsC1V {
  AsC1V(const char* phase, const Schedule* schedule,
        const SourcePositionTable* positions = NULL,
        const InstructionSequence* instructions = NULL)
      : schedule_(schedule),
        instructions_(instructions),
        positions_(positions),
        phase_(phase) {}
  const Schedule* schedule_;
  const InstructionSequence* instructions_;
  const SourcePositionTable* positions_;
  const char* phase_;
};

70 71 72 73
struct AsC1VRegisterAllocationData {
  explicit AsC1VRegisterAllocationData(
      const char* phase, const RegisterAllocationData* data = nullptr)
      : phase_(phase), data_(data) {}
74
  const char* phase_;
75
  const RegisterAllocationData* data_;
76 77 78 79 80
};

std::ostream& operator<<(std::ostream& os, const AsDOT& ad);
std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
81 82
std::ostream& operator<<(std::ostream& os,
                         const AsC1VRegisterAllocationData& ac);
83

84 85 86
}  // namespace compiler
}  // namespace internal
}  // namespace v8
87 88

#endif  // V8_COMPILER_GRAPH_VISUALIZER_H_