github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ssa/config.go (about)

     1  // Copyright 2015 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 ssa
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/compile/internal/abi"
     9  	"github.com/shogo82148/std/cmd/compile/internal/ir"
    10  	"github.com/shogo82148/std/cmd/compile/internal/types"
    11  	"github.com/shogo82148/std/cmd/internal/obj"
    12  	"github.com/shogo82148/std/cmd/internal/src"
    13  )
    14  
    15  // A Config holds readonly compilation information.
    16  // It is created once, early during compilation,
    17  // and shared across all compilations.
    18  type Config struct {
    19  	arch           string
    20  	PtrSize        int64
    21  	RegSize        int64
    22  	Types          Types
    23  	lowerBlock     blockRewriter
    24  	lowerValue     valueRewriter
    25  	lateLowerBlock blockRewriter
    26  	lateLowerValue valueRewriter
    27  	splitLoad      valueRewriter
    28  	registers      []Register
    29  	gpRegMask      regMask
    30  	fpRegMask      regMask
    31  	fp32RegMask    regMask
    32  	fp64RegMask    regMask
    33  	specialRegMask regMask
    34  	intParamRegs   []int8
    35  	floatParamRegs []int8
    36  	ABI1           *abi.ABIConfig
    37  	ABI0           *abi.ABIConfig
    38  	GCRegMap       []*Register
    39  	FPReg          int8
    40  	LinkReg        int8
    41  	hasGReg        bool
    42  	ctxt           *obj.Link
    43  	optimize       bool
    44  	noDuffDevice   bool
    45  	useSSE         bool
    46  	useAvg         bool
    47  	useHmul        bool
    48  	SoftFloat      bool
    49  	Race           bool
    50  	BigEndian      bool
    51  	UseFMA         bool
    52  	unalignedOK    bool
    53  	haveBswap64    bool
    54  	haveBswap32    bool
    55  	haveBswap16    bool
    56  }
    57  
    58  type Types struct {
    59  	Bool       *types.Type
    60  	Int8       *types.Type
    61  	Int16      *types.Type
    62  	Int32      *types.Type
    63  	Int64      *types.Type
    64  	UInt8      *types.Type
    65  	UInt16     *types.Type
    66  	UInt32     *types.Type
    67  	UInt64     *types.Type
    68  	Int        *types.Type
    69  	Float32    *types.Type
    70  	Float64    *types.Type
    71  	UInt       *types.Type
    72  	Uintptr    *types.Type
    73  	String     *types.Type
    74  	BytePtr    *types.Type
    75  	Int32Ptr   *types.Type
    76  	UInt32Ptr  *types.Type
    77  	IntPtr     *types.Type
    78  	UintptrPtr *types.Type
    79  	Float32Ptr *types.Type
    80  	Float64Ptr *types.Type
    81  	BytePtrPtr *types.Type
    82  }
    83  
    84  // NewTypes creates and populates a Types.
    85  func NewTypes() *Types
    86  
    87  // SetTypPtrs populates t.
    88  func (t *Types) SetTypPtrs()
    89  
    90  type Logger interface {
    91  	Logf(string, ...interface{})
    92  
    93  	Log() bool
    94  
    95  	Fatalf(pos src.XPos, msg string, args ...interface{})
    96  
    97  	Warnl(pos src.XPos, fmt_ string, args ...interface{})
    98  
    99  	Debug_checknil() bool
   100  }
   101  
   102  type Frontend interface {
   103  	Logger
   104  
   105  	StringData(string) *obj.LSym
   106  
   107  	SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot
   108  
   109  	Syslook(string) *obj.LSym
   110  
   111  	UseWriteBarrier() bool
   112  
   113  	Func() *ir.Func
   114  }
   115  
   116  // NewConfig returns a new configuration object for the given architecture.
   117  func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat bool) *Config
   118  
   119  func (c *Config) Ctxt() *obj.Link