graph-visualizer.h 2.13 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_

ben's avatar
ben committed
8
#include <stdio.h>
9
#include <iosfwd>
10 11 12

namespace v8 {
namespace internal {
13 14 15

class CompilationInfo;

16 17 18
namespace compiler {

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

24 25
FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
                            const char* suffix, const char* mode);
26

27
struct AsJSON {
danno's avatar
danno committed
28
  AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
29
  const Graph& graph;
danno's avatar
danno committed
30
  const SourcePositionTable* positions;
31 32
};

33 34
std::ostream& operator<<(std::ostream& os, const AsJSON& ad);

35 36 37 38 39 40 41 42
struct AsRPO {
  explicit AsRPO(const Graph& g) : graph(g) {}
  const Graph& graph;
};

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


43 44 45 46 47 48 49 50
struct AsC1VCompilation {
  explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
  const CompilationInfo* info_;
};


struct AsC1V {
  AsC1V(const char* phase, const Schedule* schedule,
51 52
        const SourcePositionTable* positions = nullptr,
        const InstructionSequence* instructions = nullptr)
53 54 55 56 57 58 59 60 61 62
      : schedule_(schedule),
        instructions_(instructions),
        positions_(positions),
        phase_(phase) {}
  const Schedule* schedule_;
  const InstructionSequence* instructions_;
  const SourcePositionTable* positions_;
  const char* phase_;
};

63 64 65 66
struct AsC1VRegisterAllocationData {
  explicit AsC1VRegisterAllocationData(
      const char* phase, const RegisterAllocationData* data = nullptr)
      : phase_(phase), data_(data) {}
67
  const char* phase_;
68
  const RegisterAllocationData* data_;
69 70 71 72
};

std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
73 74
std::ostream& operator<<(std::ostream& os,
                         const AsC1VRegisterAllocationData& ac);
75

76 77 78
}  // namespace compiler
}  // namespace internal
}  // namespace v8
79 80

#endif  // V8_COMPILER_GRAPH_VISUALIZER_H_