}
func funccompile(n *Node) {
- Stksize = BADWIDTH
-
if n.Type == nil {
if nerrors == 0 {
Fatalf("funccompile missing type")
Fatalf("funccompile %v inside %v", n.Func.Nname.Sym, Curfn.Func.Nname.Sym)
}
- Stksize = 0
dclcontext = PAUTO
funcdepth = n.Func.Depth + 1
compile(n)
var scratchFpMem *Node
func (s *ssafn) AllocFrame(f *ssa.Func) {
- Stksize = 0
+ s.stksize = 0
stkptrsize = 0
fn := s.curfn.Func
if w >= thearch.MAXWIDTH || w < 0 {
Fatalf("bad width")
}
- Stksize += w
- Stksize = Rnd(Stksize, int64(n.Type.Align))
+ s.stksize += w
+ s.stksize = Rnd(s.stksize, int64(n.Type.Align))
if haspointers(n.Type) {
- stkptrsize = Stksize
+ stkptrsize = s.stksize
}
if thearch.LinkArch.InFamily(sys.MIPS, sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
- Stksize = Rnd(Stksize, int64(Widthptr))
+ s.stksize = Rnd(s.stksize, int64(Widthptr))
}
- if Stksize >= 1<<31 {
+ if s.stksize >= 1<<31 {
yyerrorl(s.curfn.Pos, "stack frame too large (>2GB)")
}
- n.Xoffset = -Stksize
+ n.Xoffset = -s.stksize
}
- Stksize = Rnd(Stksize, int64(Widthreg))
+ s.stksize = Rnd(s.stksize, int64(Widthreg))
stkptrsize = Rnd(stkptrsize, int64(Widthreg))
}
liveness(e.curfn, ptxt, gcargs, gclocals)
// Add frame prologue. Zero ambiguously live variables.
- thearch.Defframe(ptxt, e.curfn, Stksize+s.maxarg)
+ thearch.Defframe(ptxt, e.curfn, e.stksize+s.maxarg)
if Debug['f'] != 0 {
frame(0)
}
// ssafn holds frontend information about a function that the backend is processing.
// It also exports a bunch of compiler services for the ssa backend.
type ssafn struct {
- curfn *Node
- log bool
+ curfn *Node
+ stksize int64 // stack size for current frame
+ log bool
}
func (s *ssafn) TypeBool() ssa.Type { return Types[TBOOL] }