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