Source file src/cmd/compile/internal/ssagen/arch.go

     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  	"cmd/compile/internal/ir"
     9  	"cmd/compile/internal/objw"
    10  	"cmd/compile/internal/ssa"
    11  	"cmd/compile/internal/types"
    12  	"cmd/internal/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 the on stack.
    29  	//  - it is only called at function entry
    30  	//  - it is ok to clobber (non-arg) registers.
    31  	//  - currently used only for small things, so it can be simple.
    32  	//    - pointers to heap-allocated return values
    33  	//    - open-coded deferred functions
    34  	// (Max size in make.bash is 40 bytes.)
    35  	ZeroRange func(*objw.Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog
    36  
    37  	Ginsnop func(*objw.Progs) *obj.Prog
    38  
    39  	// SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
    40  	SSAMarkMoves func(*State, *ssa.Block)
    41  
    42  	// SSAGenValue emits Prog(s) for the Value.
    43  	SSAGenValue func(*State, *ssa.Value)
    44  
    45  	// SSAGenBlock emits end-of-block Progs. SSAGenValue should be called
    46  	// for all values in the block before SSAGenBlock.
    47  	SSAGenBlock func(s *State, b, next *ssa.Block)
    48  
    49  	// LoadRegResult emits instructions that loads register-assigned result
    50  	// at n+off (n is PPARAMOUT) to register reg. The result is already in
    51  	// memory. Used in open-coded defer return path.
    52  	LoadRegResult func(s *State, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog
    53  
    54  	// SpillArgReg emits instructions that spill reg to n+off.
    55  	SpillArgReg func(pp *objw.Progs, p *obj.Prog, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog
    56  }
    57  

View as plain text