Home | History | Annotate | Download | only in compiler
      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 
     11 namespace v8 {
     12 namespace internal {
     13 
     14 class CompilationInfo;
     15 
     16 namespace compiler {
     17 
     18 class Graph;
     19 class InstructionSequence;
     20 class RegisterAllocationData;
     21 class Schedule;
     22 class SourcePositionTable;
     23 
     24 FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
     25                             const char* suffix, const char* mode);
     26 
     27 struct AsJSON {
     28   AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
     29   const Graph& graph;
     30   const SourcePositionTable* positions;
     31 };
     32 
     33 std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
     34 
     35 struct AsRPO {
     36   explicit AsRPO(const Graph& g) : graph(g) {}
     37   const Graph& graph;
     38 };
     39 
     40 std::ostream& operator<<(std::ostream& os, const AsRPO& ad);
     41 
     42 
     43 struct AsC1VCompilation {
     44   explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
     45   const CompilationInfo* info_;
     46 };
     47 
     48 
     49 struct AsC1V {
     50   AsC1V(const char* phase, const Schedule* schedule,
     51         const SourcePositionTable* positions = nullptr,
     52         const InstructionSequence* instructions = nullptr)
     53       : 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 
     63 struct AsC1VRegisterAllocationData {
     64   explicit AsC1VRegisterAllocationData(
     65       const char* phase, const RegisterAllocationData* data = nullptr)
     66       : phase_(phase), data_(data) {}
     67   const char* phase_;
     68   const RegisterAllocationData* data_;
     69 };
     70 
     71 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
     72 std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
     73 std::ostream& operator<<(std::ostream& os,
     74                          const AsC1VRegisterAllocationData& ac);
     75 
     76 }  // namespace compiler
     77 }  // namespace internal
     78 }  // namespace v8
     79 
     80 #endif  // V8_COMPILER_GRAPH_VISUALIZER_H_
     81