github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/ssagen/arch.go (about)

     1  // Copyright 2009 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 ssagen
     6  
     7  import (
     8  	"github.com/go-asm/go/cmd/compile/ir"
     9  	"github.com/go-asm/go/cmd/compile/objw"
    10  	"github.com/go-asm/go/cmd/compile/ssa"
    11  	"github.com/go-asm/go/cmd/compile/types"
    12  	"github.com/go-asm/go/cmd/obj"
    13  )
    14  
    15  var Arch ArchInfo
    16  
    17  // interface to back end
    18  
    19  type ArchInfo struct {
    20  	LinkArch *obj.LinkArch
    21  
    22  	REGSP     int
    23  	MAXWIDTH  int64
    24  	SoftFloat bool
    25  
    26  	PadFrame func(int64) int64
    27  
    28  	// ZeroRange zeroes a range of memory on stack. It is only inserted
    29  	// at function entry, and it is ok to clobber registers.
    30  	ZeroRange func(*objw.Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog
    31  
    32  	Ginsnop func(*objw.Progs) *obj.Prog
    33  
    34  	// SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
    35  	SSAMarkMoves func(*State, *ssa.Block)
    36  
    37  	// SSAGenValue emits Prog(s) for the Value.
    38  	SSAGenValue func(*State, *ssa.Value)
    39  
    40  	// SSAGenBlock emits end-of-block Progs. SSAGenValue should be called
    41  	// for all values in the block before SSAGenBlock.
    42  	SSAGenBlock func(s *State, b, next *ssa.Block)
    43  
    44  	// LoadRegResult emits instructions that loads register-assigned result
    45  	// at n+off (n is PPARAMOUT) to register reg. The result is already in
    46  	// memory. Used in open-coded defer return path.
    47  	LoadRegResult func(s *State, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog
    48  
    49  	// SpillArgReg emits instructions that spill reg to n+off.
    50  	SpillArgReg func(pp *objw.Progs, p *obj.Prog, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog
    51  }