github.com/q45/go@v0.0.0-20151101211701-a4fb8c13db3f/src/cmd/compile/internal/x86/galign.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 x86
     6  
     7  import (
     8  	"cmd/compile/internal/gc"
     9  	"cmd/internal/obj"
    10  	"cmd/internal/obj/x86"
    11  	"fmt"
    12  	"os"
    13  )
    14  
    15  var thechar int = '8'
    16  
    17  var thestring string = "386"
    18  
    19  var thelinkarch *obj.LinkArch = &x86.Link386
    20  
    21  func linkarchinit() {
    22  }
    23  
    24  var MAXWIDTH int64 = (1 << 32) - 1
    25  
    26  /*
    27   * go declares several platform-specific type aliases:
    28   * int, uint, and uintptr
    29   */
    30  var typedefs = []gc.Typedef{
    31  	{"int", gc.TINT, gc.TINT32},
    32  	{"uint", gc.TUINT, gc.TUINT32},
    33  	{"uintptr", gc.TUINTPTR, gc.TUINT32},
    34  }
    35  
    36  func betypeinit() {
    37  	gc.Widthptr = 4
    38  	gc.Widthint = 4
    39  	gc.Widthreg = 4
    40  }
    41  
    42  func Main() {
    43  	gc.Thearch.Thechar = thechar
    44  	gc.Thearch.Thestring = thestring
    45  	gc.Thearch.Thelinkarch = thelinkarch
    46  	gc.Thearch.Typedefs = typedefs
    47  	gc.Thearch.REGSP = x86.REGSP
    48  	gc.Thearch.REGCTXT = x86.REGCTXT
    49  	gc.Thearch.REGCALLX = x86.REG_BX
    50  	gc.Thearch.REGCALLX2 = x86.REG_AX
    51  	gc.Thearch.REGRETURN = x86.REG_AX
    52  	gc.Thearch.REGMIN = x86.REG_AX
    53  	gc.Thearch.REGMAX = x86.REG_DI
    54  	switch v := obj.Getgo386(); v {
    55  	case "387":
    56  		gc.Thearch.FREGMIN = x86.REG_F0
    57  		gc.Thearch.FREGMAX = x86.REG_F7
    58  		gc.Thearch.Use387 = true
    59  	case "sse2":
    60  		gc.Thearch.FREGMIN = x86.REG_X0
    61  		gc.Thearch.FREGMAX = x86.REG_X7
    62  	default:
    63  		fmt.Fprintf(os.Stderr, "unsupported setting GO386=%s\n", v)
    64  		gc.Exit(1)
    65  	}
    66  	gc.Thearch.MAXWIDTH = MAXWIDTH
    67  	gc.Thearch.ReservedRegs = resvd
    68  
    69  	gc.Thearch.Betypeinit = betypeinit
    70  	gc.Thearch.Bgen_float = bgen_float
    71  	gc.Thearch.Cgen64 = cgen64
    72  	gc.Thearch.Cgen_bmul = cgen_bmul
    73  	gc.Thearch.Cgen_float = cgen_float
    74  	gc.Thearch.Cgen_hmul = cgen_hmul
    75  	gc.Thearch.Cgen_shift = cgen_shift
    76  	gc.Thearch.Clearfat = clearfat
    77  	gc.Thearch.Cmp64 = cmp64
    78  	gc.Thearch.Defframe = defframe
    79  	gc.Thearch.Dodiv = cgen_div
    80  	gc.Thearch.Excise = excise
    81  	gc.Thearch.Expandchecks = expandchecks
    82  	gc.Thearch.Getg = getg
    83  	gc.Thearch.Gins = gins
    84  	gc.Thearch.Ginscmp = ginscmp
    85  	gc.Thearch.Ginscon = ginscon
    86  	gc.Thearch.Ginsnop = ginsnop
    87  	gc.Thearch.Gmove = gmove
    88  	gc.Thearch.Igenindex = igenindex
    89  	gc.Thearch.Linkarchinit = linkarchinit
    90  	gc.Thearch.Peep = peep
    91  	gc.Thearch.Proginfo = proginfo
    92  	gc.Thearch.Regtyp = regtyp
    93  	gc.Thearch.Sameaddr = sameaddr
    94  	gc.Thearch.Smallindir = smallindir
    95  	gc.Thearch.Stackaddr = stackaddr
    96  	gc.Thearch.Blockcopy = blockcopy
    97  	gc.Thearch.Sudoaddable = sudoaddable
    98  	gc.Thearch.Sudoclean = sudoclean
    99  	gc.Thearch.Excludedregs = excludedregs
   100  	gc.Thearch.RtoB = RtoB
   101  	gc.Thearch.FtoB = FtoB
   102  	gc.Thearch.BtoR = BtoR
   103  	gc.Thearch.BtoF = BtoF
   104  	gc.Thearch.Optoas = optoas
   105  	gc.Thearch.Doregbits = doregbits
   106  	gc.Thearch.Regnames = regnames
   107  
   108  	gc.Main()
   109  	gc.Exit(0)
   110  }