Home | History | Annotate | Download | only in amd64
      1 // Do not edit. Bootstrap copy of /Volumes/Android/buildbot/src/android/build-tools/out/obj/go/src/cmd/compile/internal/amd64/galign.go
      2 
      3 //line /Volumes/Android/buildbot/src/android/build-tools/out/obj/go/src/cmd/compile/internal/amd64/galign.go:1
      4 // Copyright 2009 The Go Authors. All rights reserved.
      5 // Use of this source code is governed by a BSD-style
      6 // license that can be found in the LICENSE file.
      7 
      8 package amd64
      9 
     10 import (
     11 	"bootstrap/compile/internal/gc"
     12 	"bootstrap/internal/obj"
     13 	"bootstrap/internal/obj/x86"
     14 )
     15 
     16 var (
     17 	thechar     int           = '6'
     18 	thestring   string        = "amd64"
     19 	thelinkarch *obj.LinkArch = &x86.Linkamd64
     20 )
     21 
     22 func linkarchinit() {
     23 	if obj.Getgoarch() == "amd64p32" {
     24 		thelinkarch = &x86.Linkamd64p32
     25 		gc.Thearch.Thelinkarch = thelinkarch
     26 		thestring = "amd64p32"
     27 		gc.Thearch.Thestring = "amd64p32"
     28 	}
     29 }
     30 
     31 var MAXWIDTH int64 = 1 << 50
     32 
     33 var (
     34 	addptr int = x86.AADDQ
     35 	movptr int = x86.AMOVQ
     36 	leaptr int = x86.ALEAQ
     37 	cmpptr int = x86.ACMPQ
     38 )
     39 
     40 /*
     41  * go declares several platform-specific type aliases:
     42  * int, uint, and uintptr
     43  */
     44 var typedefs = []gc.Typedef{
     45 	gc.Typedef{"int", gc.TINT, gc.TINT64},
     46 	gc.Typedef{"uint", gc.TUINT, gc.TUINT64},
     47 	gc.Typedef{"uintptr", gc.TUINTPTR, gc.TUINT64},
     48 }
     49 
     50 func betypeinit() {
     51 	gc.Widthptr = 8
     52 	gc.Widthint = 8
     53 	gc.Widthreg = 8
     54 	if obj.Getgoarch() == "amd64p32" {
     55 		gc.Widthptr = 4
     56 		gc.Widthint = 4
     57 		addptr = x86.AADDL
     58 		movptr = x86.AMOVL
     59 		leaptr = x86.ALEAL
     60 		cmpptr = x86.ACMPL
     61 		typedefs[0].Sameas = gc.TINT32
     62 		typedefs[1].Sameas = gc.TUINT32
     63 		typedefs[2].Sameas = gc.TUINT32
     64 	}
     65 
     66 	if gc.Ctxt.Flag_dynlink {
     67 		gc.Thearch.ReservedRegs = append(gc.Thearch.ReservedRegs, x86.REG_R15)
     68 	}
     69 }
     70 
     71 func Main() {
     72 	if obj.Getgoos() == "nacl" {
     73 		resvd = append(resvd, x86.REG_BP, x86.REG_R15)
     74 	} else if obj.Framepointer_enabled != 0 {
     75 		resvd = append(resvd, x86.REG_BP)
     76 	}
     77 
     78 	gc.Thearch.Thechar = thechar
     79 	gc.Thearch.Thestring = thestring
     80 	gc.Thearch.Thelinkarch = thelinkarch
     81 	gc.Thearch.Typedefs = typedefs
     82 	gc.Thearch.REGSP = x86.REGSP
     83 	gc.Thearch.REGCTXT = x86.REGCTXT
     84 	gc.Thearch.REGCALLX = x86.REG_BX
     85 	gc.Thearch.REGCALLX2 = x86.REG_AX
     86 	gc.Thearch.REGRETURN = x86.REG_AX
     87 	gc.Thearch.REGMIN = x86.REG_AX
     88 	gc.Thearch.REGMAX = x86.REG_R15
     89 	gc.Thearch.FREGMIN = x86.REG_X0
     90 	gc.Thearch.FREGMAX = x86.REG_X15
     91 	gc.Thearch.MAXWIDTH = MAXWIDTH
     92 	gc.Thearch.ReservedRegs = resvd
     93 
     94 	gc.Thearch.AddIndex = addindex
     95 	gc.Thearch.Betypeinit = betypeinit
     96 	gc.Thearch.Cgen_bmul = cgen_bmul
     97 	gc.Thearch.Cgen_hmul = cgen_hmul
     98 	gc.Thearch.Cgen_shift = cgen_shift
     99 	gc.Thearch.Clearfat = clearfat
    100 	gc.Thearch.Defframe = defframe
    101 	gc.Thearch.Dodiv = dodiv
    102 	gc.Thearch.Excise = excise
    103 	gc.Thearch.Expandchecks = expandchecks
    104 	gc.Thearch.Getg = getg
    105 	gc.Thearch.Gins = gins
    106 	gc.Thearch.Ginsboolval = ginsboolval
    107 	gc.Thearch.Ginscmp = ginscmp
    108 	gc.Thearch.Ginscon = ginscon
    109 	gc.Thearch.Ginsnop = ginsnop
    110 	gc.Thearch.Gmove = gmove
    111 	gc.Thearch.Linkarchinit = linkarchinit
    112 	gc.Thearch.Peep = peep
    113 	gc.Thearch.Proginfo = proginfo
    114 	gc.Thearch.Regtyp = regtyp
    115 	gc.Thearch.Sameaddr = sameaddr
    116 	gc.Thearch.Smallindir = smallindir
    117 	gc.Thearch.Stackaddr = stackaddr
    118 	gc.Thearch.Blockcopy = blockcopy
    119 	gc.Thearch.Sudoaddable = sudoaddable
    120 	gc.Thearch.Sudoclean = sudoclean
    121 	gc.Thearch.Excludedregs = excludedregs
    122 	gc.Thearch.RtoB = RtoB
    123 	gc.Thearch.FtoB = FtoB
    124 	gc.Thearch.BtoR = BtoR
    125 	gc.Thearch.BtoF = BtoF
    126 	gc.Thearch.Optoas = optoas
    127 	gc.Thearch.Doregbits = doregbits
    128 	gc.Thearch.Regnames = regnames
    129 
    130 	gc.Main()
    131 	gc.Exit(0)
    132 }
    133