Home | History | Annotate | Download | only in ppc64
      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 ppc64
      6 
      7 import (
      8 	"cmd/compile/internal/gc"
      9 	"cmd/internal/obj"
     10 	"cmd/internal/obj/ppc64"
     11 )
     12 
     13 var thechar int = '9'
     14 
     15 var thestring string = "ppc64"
     16 
     17 var thelinkarch *obj.LinkArch
     18 
     19 func linkarchinit() {
     20 	thestring = obj.Getgoarch()
     21 	gc.Thearch.Thestring = thestring
     22 	if thestring == "ppc64le" {
     23 		thelinkarch = &ppc64.Linkppc64le
     24 	} else {
     25 		thelinkarch = &ppc64.Linkppc64
     26 	}
     27 	gc.Thearch.Thelinkarch = thelinkarch
     28 }
     29 
     30 var MAXWIDTH int64 = 1 << 50
     31 
     32 /*
     33  * go declares several platform-specific type aliases:
     34  * int, uint, and uintptr
     35  */
     36 var typedefs = []gc.Typedef{
     37 	gc.Typedef{"int", gc.TINT, gc.TINT64},
     38 	gc.Typedef{"uint", gc.TUINT, gc.TUINT64},
     39 	gc.Typedef{"uintptr", gc.TUINTPTR, gc.TUINT64},
     40 }
     41 
     42 func betypeinit() {
     43 	gc.Widthptr = 8
     44 	gc.Widthint = 8
     45 	gc.Widthreg = 8
     46 }
     47 
     48 func Main() {
     49 	gc.Thearch.Thechar = thechar
     50 	gc.Thearch.Thestring = thestring
     51 	gc.Thearch.Thelinkarch = thelinkarch
     52 	gc.Thearch.Typedefs = typedefs
     53 	gc.Thearch.REGSP = ppc64.REGSP
     54 	gc.Thearch.REGCTXT = ppc64.REGCTXT
     55 	gc.Thearch.REGCALLX = ppc64.REG_R3
     56 	gc.Thearch.REGCALLX2 = ppc64.REG_R4
     57 	gc.Thearch.REGRETURN = ppc64.REG_R3
     58 	gc.Thearch.REGMIN = ppc64.REG_R0
     59 	gc.Thearch.REGMAX = ppc64.REG_R31
     60 	gc.Thearch.FREGMIN = ppc64.REG_F0
     61 	gc.Thearch.FREGMAX = ppc64.REG_F31
     62 	gc.Thearch.MAXWIDTH = MAXWIDTH
     63 	gc.Thearch.ReservedRegs = resvd
     64 
     65 	gc.Thearch.Betypeinit = betypeinit
     66 	gc.Thearch.Cgen_hmul = cgen_hmul
     67 	gc.Thearch.Cgen_shift = cgen_shift
     68 	gc.Thearch.Clearfat = clearfat
     69 	gc.Thearch.Defframe = defframe
     70 	gc.Thearch.Dodiv = dodiv
     71 	gc.Thearch.Excise = excise
     72 	gc.Thearch.Expandchecks = expandchecks
     73 	gc.Thearch.Getg = getg
     74 	gc.Thearch.Gins = gins
     75 	gc.Thearch.Ginscmp = ginscmp
     76 	gc.Thearch.Ginscon = ginscon
     77 	gc.Thearch.Ginsnop = ginsnop
     78 	gc.Thearch.Gmove = gmove
     79 	gc.Thearch.Linkarchinit = linkarchinit
     80 	gc.Thearch.Peep = peep
     81 	gc.Thearch.Proginfo = proginfo
     82 	gc.Thearch.Regtyp = regtyp
     83 	gc.Thearch.Sameaddr = sameaddr
     84 	gc.Thearch.Smallindir = smallindir
     85 	gc.Thearch.Stackaddr = stackaddr
     86 	gc.Thearch.Blockcopy = blockcopy
     87 	gc.Thearch.Sudoaddable = sudoaddable
     88 	gc.Thearch.Sudoclean = sudoclean
     89 	gc.Thearch.Excludedregs = excludedregs
     90 	gc.Thearch.RtoB = RtoB
     91 	gc.Thearch.FtoB = RtoB
     92 	gc.Thearch.BtoR = BtoR
     93 	gc.Thearch.BtoF = BtoF
     94 	gc.Thearch.Optoas = optoas
     95 	gc.Thearch.Doregbits = doregbits
     96 	gc.Thearch.Regnames = regnames
     97 
     98 	gc.Main()
     99 	gc.Exit(0)
    100 }
    101