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 #include <memory>
     11 
     12 #include "src/globals.h"
     13 
     14 namespace v8 {
     15 namespace internal {
     16 
     17 class CompilationInfo;
     18 
     19 namespace compiler {
     20 
     21 class Graph;
     22 class InstructionSequence;
     23 class RegisterAllocationData;
     24 class Schedule;
     25 class SourcePositionTable;
     26 
     27 std::unique_ptr<char[]> GetVisualizerLogFileName(CompilationInfo* info,
     28                                                  const char* phase,
     29                                                  const char* suffix);
     30 
     31 struct AsJSON {
     32   AsJSON(const Graph& g, SourcePositionTable* p) : graph(g), positions(p) {}
     33   const Graph& graph;
     34   const SourcePositionTable* positions;
     35 };
     36 
     37 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
     38 
     39 struct AsRPO {
     40   explicit AsRPO(const Graph& g) : graph(g) {}
     41   const Graph& graph;
     42 };
     43 
     44 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const AsRPO& ad);
     45 
     46 struct AsC1VCompilation {
     47   explicit AsC1VCompilation(const CompilationInfo* info) : info_(info) {}
     48   const CompilationInfo* info_;
     49 };
     50 
     51 
     52 struct AsC1V {
     53   AsC1V(const char* phase, const Schedule* schedule,
     54         const SourcePositionTable* positions = nullptr,
     55         const InstructionSequence* instructions = nullptr)
     56       : schedule_(schedule),
     57         instructions_(instructions),
     58         positions_(positions),
     59         phase_(phase) {}
     60   const Schedule* schedule_;
     61   const InstructionSequence* instructions_;
     62   const SourcePositionTable* positions_;
     63   const char* phase_;
     64 };
     65 
     66 struct AsC1VRegisterAllocationData {
     67   explicit AsC1VRegisterAllocationData(
     68       const char* phase, const RegisterAllocationData* data = nullptr)
     69       : phase_(phase), data_(data) {}
     70   const char* phase_;
     71   const RegisterAllocationData* data_;
     72 };
     73 
     74 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac);
     75 std::ostream& operator<<(std::ostream& os, const AsC1V& ac);
     76 std::ostream& operator<<(std::ostream& os,
     77                          const AsC1VRegisterAllocationData& ac);
     78 
     79 }  // namespace compiler
     80 }  // namespace internal
     81 }  // namespace v8
     82 
     83 #endif  // V8_COMPILER_GRAPH_VISUALIZER_H_
     84