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