s.f.Cache.Reset()
s.f.DebugTest = s.f.DebugHashMatch("GOSSAHASH", name)
s.f.Name = name
+ s.f.PrintOrHtmlSSA = printssa
if fn.Func.Pragma&Nosplit != 0 {
s.f.NoSplit = true
}
var progToValue map[*obj.Prog]*ssa.Value
var progToBlock map[*obj.Prog]*ssa.Block
var valueToProgAfter []*obj.Prog // The first Prog following computation of a value v; v is visible at this point.
- var logProgs = e.log
- if f.HTMLWriter != nil {
- // logProgs can be false, meaning that we do not dump to the Stdout.
+ if f.PrintOrHtmlSSA {
progToValue = make(map[*obj.Prog]*ssa.Value, f.NumValues())
progToBlock = make(map[*obj.Prog]*ssa.Block, f.NumBlocks())
f.Logf("genssa %s\n", f.Name)
valueToProgAfter[v.ID] = s.pp.next
}
- if logProgs {
+ if f.PrintOrHtmlSSA {
for ; x != s.pp.next; x = x.Link {
progToValue[x] = v
}
x := s.pp.next
s.SetPos(b.Pos)
thearch.SSAGenBlock(&s, b, next)
- if logProgs {
+ if f.PrintOrHtmlSSA {
for ; x != s.pp.next; x = x.Link {
progToBlock[x] = b
}
}
}
- if logProgs {
+ if e.log { // spew to stdout
filename := ""
for p := pp.Text; p != nil; p = p.Link {
if p.Pos.IsKnown() && p.InnermostFilename() != filename {
f.Logf(" %-6s\t%.5d (%s)\t%s\n", s, p.Pc, p.InnermostLineNumber(), p.InstructionString())
}
}
- if f.HTMLWriter != nil {
+ if f.HTMLWriter != nil { // spew to ssa.html
var buf bytes.Buffer
buf.WriteString("<code>")
buf.WriteString("<dl class=\"ssa-gen\">")
// RegisterSet is a bitmap of registers, indexed by Register.num.
type RegisterSet uint64
+// logf prints debug-specific logging to stdout (always stdout) if the current
+// function is tagged by GOSSAFUNC (for ssa output directed either to stdout or html).
func (s *debugState) logf(msg string, args ...interface{}) {
- s.f.Logf(msg, args...)
+ if s.f.PrintOrHtmlSSA {
+ fmt.Printf(msg, args...)
+ }
}
type debugState struct {
// Given an environment variable used for debug hash match,
// what file (if any) receives the yes/no logging?
- logfiles map[string]writeSyncer
- HTMLWriter *HTMLWriter // html writer, for debugging
- DebugTest bool // default true unless $GOSSAHASH != ""; as a debugging aid, make new code conditional on this and use GOSSAHASH to binary search for failing cases
+ logfiles map[string]writeSyncer
+ HTMLWriter *HTMLWriter // html writer, for debugging
+ DebugTest bool // default true unless $GOSSAHASH != ""; as a debugging aid, make new code conditional on this and use GOSSAHASH to binary search for failing cases
+ PrintOrHtmlSSA bool // true if GOSSAFUNC matches, true even if fe.Log() (spew phase results to stdout) is false.
scheduled bool // Values in Blocks are in final order
NoSplit bool // true if function is marked as nosplit. Used by schedule check pass.