Source file src/cmd/compile/internal/riscv64/ggen.go

     1  // Copyright 2016 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 riscv64
     6  
     7  import (
     8  	"cmd/compile/internal/base"
     9  	"cmd/compile/internal/objw"
    10  	"cmd/compile/internal/types"
    11  	"cmd/internal/obj"
    12  	"cmd/internal/obj/riscv"
    13  )
    14  
    15  func zeroRange(pp *objw.Progs, p *obj.Prog, off, cnt int64, _ *uint32) *obj.Prog {
    16  
    17  	if cnt%int64(types.PtrSize) != 0 {
    18  		panic("zeroed region not aligned")
    19  	}
    20  
    21  	// Adjust the frame to account for LR.
    22  	off += base.Ctxt.Arch.FixedFrameSize
    23  
    24  	for cnt != 0 {
    25  		p = pp.Append(p, riscv.AMOV, obj.TYPE_REG, riscv.REG_ZERO, 0, obj.TYPE_MEM, riscv.REG_SP, off)
    26  		cnt -= int64(types.PtrSize)
    27  		off += int64(types.PtrSize)
    28  	}
    29  
    30  	return p
    31  }
    32  

View as plain text