github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ir/dump.go (about) 1 // Copyright 2018 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 // This file implements textual dumping of arbitrary data structures 6 // for debugging purposes. The code is customized for Node graphs 7 // and may be used for an alternative view of the node structure. 8 9 package ir 10 11 import ( 12 "github.com/shogo82148/std/io" 13 ) 14 15 // DumpAny is like FDumpAny but prints to stderr. 16 func DumpAny(root interface{}, filter string, depth int) 17 18 // FDumpAny prints the structure of a rooted data structure 19 // to w by depth-first traversal of the data structure. 20 // 21 // The filter parameter is a regular expression. If it is 22 // non-empty, only struct fields whose names match filter 23 // are printed. 24 // 25 // The depth parameter controls how deep traversal recurses 26 // before it returns (higher value means greater depth). 27 // If an empty field filter is given, a good depth default value 28 // is 4. A negative depth means no depth limit, which may be fine 29 // for small data structures or if there is a non-empty filter. 30 // 31 // In the output, Node structs are identified by their Op name 32 // rather than their type; struct fields with zero values or 33 // non-matching field names are omitted, and "…" means recursion 34 // depth has been reached or struct fields have been omitted. 35 func FDumpAny(w io.Writer, root interface{}, filter string, depth int)