visitBottomUp(xtop, func(list []*Node, recursive bool) {
// Functions with write barriers have depth 0.
for _, n := range list {
+ if n.Func.WBPos.IsKnown() && n.Func.Pragma&Nowritebarrier != 0 {
+ yyerrorl(n.Func.WBPos, "write barrier prohibited")
+ }
if n.Func.WBPos.IsKnown() && n.Func.Pragma&Yeswritebarrierrec == 0 {
c.best[n] = nowritebarrierrecCall{target: nil, depth: 0, lineno: n.Func.WBPos}
}
if instrumenting {
instrument(fn)
}
- if nerrors != 0 {
- return
- }
// From this point, there should be no uses of Curfn. Enforce that.
Curfn = nil
// Build an SSA backend function.
ssafn := buildssa(fn)
- if nerrors != 0 {
- return
- }
-
pp := newProgs(fn)
genssa(ssafn, pp)
fieldtrack(pp.Text.From.Sym, fn.Func.FieldTrack)
if fn.Func.Pragma&Nosplit != 0 {
s.f.NoSplit = true
}
- if fn.Func.Pragma&Nowritebarrier != 0 {
- s.f.NoWB = true
- }
defer func() {
if s.f.WBPos.IsKnown() {
fn.Func.WBPos = s.f.WBPos
s.popLine()
}
- if nerrors > 0 {
- return nil
- }
-
s.insertPhis()
// Don't carry reference this around longer than necessary
// Main call to ssa package to compile function
ssa.Compile(s.f)
- if nerrors > 0 {
- return nil
- }
-
return s.f
}
Fatalf(msg, args...)
}
-// Error reports a compiler error but keep going.
-func (e *ssafn) Error(pos src.XPos, msg string, args ...interface{}) {
- yyerrorl(pos, msg, args...)
-}
-
// Warnl reports a "warning", which is usually flag-triggered
// logging output for the benefit of tests.
func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...interface{}) {
// Fatal reports a compiler error and exits.
Fatalf(pos src.XPos, msg string, args ...interface{})
- // Error reports a compiler error but keep going.
- Error(pos src.XPos, msg string, args ...interface{})
-
// Warnl writes compiler messages in the form expected by "errorcheck" tests
Warnl(pos src.XPos, fmt_ string, args ...interface{})
func (d DummyFrontend) Log() bool { return true }
func (d DummyFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) }
-func (d DummyFrontend) Error(_ src.XPos, msg string, args ...interface{}) { d.t.Errorf(msg, args...) }
func (d DummyFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
func (d DummyFrontend) Debug_checknil() bool { return false }
func (d DummyFrontend) Debug_wb() bool { return false }
scheduled bool // Values in Blocks are in final order
NoSplit bool // true if function is marked as nosplit. Used by schedule check pass.
- NoWB bool // write barrier is not allowed
WBPos src.XPos // line number of first write barrier
// when register allocation is done, maps value ids to locations
memElse.Aux = w.Aux
}
- if f.NoWB {
- f.fe.Error(pos, "write barrier prohibited")
- }
if !f.WBPos.IsKnown() {
f.WBPos = pos
}