github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ssa/html.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ssa
     6  
     7  import (
     8  	"github.com/shogo82148/std/bytes"
     9  	"github.com/shogo82148/std/io"
    10  )
    11  
    12  type HTMLWriter struct {
    13  	w             io.WriteCloser
    14  	Func          *Func
    15  	path          string
    16  	dot           *dotWriter
    17  	prevHash      []byte
    18  	pendingPhases []string
    19  	pendingTitles []string
    20  }
    21  
    22  func NewHTMLWriter(path string, f *Func, cfgMask string) *HTMLWriter
    23  
    24  // Fatalf reports an error and exits.
    25  func (w *HTMLWriter) Fatalf(msg string, args ...interface{})
    26  
    27  // Logf calls the (w *HTMLWriter).Func's Logf method passing along a msg and args.
    28  func (w *HTMLWriter) Logf(msg string, args ...interface{})
    29  
    30  func (w *HTMLWriter) Close()
    31  
    32  // WritePhase writes f in a column headed by title.
    33  // phase is used for collapsing columns and should be unique across the table.
    34  func (w *HTMLWriter) WritePhase(phase, title string)
    35  
    36  // FuncLines contains source code for a function to be displayed
    37  // in sources column.
    38  type FuncLines struct {
    39  	Filename    string
    40  	StartLineno uint
    41  	Lines       []string
    42  }
    43  
    44  // ByTopo sorts topologically: target function is on top,
    45  // followed by inlined functions sorted by filename and line numbers.
    46  type ByTopo []*FuncLines
    47  
    48  func (x ByTopo) Len() int
    49  func (x ByTopo) Swap(i, j int)
    50  func (x ByTopo) Less(i, j int) bool
    51  
    52  // WriteSources writes lines as source code in a column headed by title.
    53  // phase is used for collapsing columns and should be unique across the table.
    54  func (w *HTMLWriter) WriteSources(phase string, all []*FuncLines)
    55  
    56  func (w *HTMLWriter) WriteAST(phase string, buf *bytes.Buffer)
    57  
    58  // WriteColumn writes raw HTML in a column headed by title.
    59  // It is intended for pre- and post-compilation log output.
    60  func (w *HTMLWriter) WriteColumn(phase, title, class, html string)
    61  
    62  func (w *HTMLWriter) WriteMultiTitleColumn(phase string, titles []string, class, html string)
    63  
    64  func (w *HTMLWriter) Printf(msg string, v ...interface{})
    65  
    66  func (w *HTMLWriter) WriteString(s string)
    67  
    68  func (v *Value) HTML() string
    69  
    70  func (v *Value) LongHTML() string
    71  
    72  func (b *Block) HTML() string
    73  
    74  func (b *Block) LongHTML() string
    75  
    76  func (f *Func) HTML(phase string, dot *dotWriter) string