github.com/mh-cbon/go@v0.0.0-20160603070303-9e112a3fe4c0/src/cmd/compile/internal/amd64/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 amd64
     6  
     7  import (
     8  	"cmd/compile/internal/gc"
     9  	"cmd/internal/obj"
    10  	"cmd/internal/obj/x86"
    11  )
    12  
    13  var (
    14  	addptr = x86.AADDQ
    15  	movptr = x86.AMOVQ
    16  	leaptr = x86.ALEAQ
    17  	cmpptr = x86.ACMPQ
    18  )
    19  
    20  func betypeinit() {
    21  	if obj.Getgoarch() == "amd64p32" {
    22  		addptr = x86.AADDL
    23  		movptr = x86.AMOVL
    24  		leaptr = x86.ALEAL
    25  		cmpptr = x86.ACMPL
    26  	}
    27  
    28  	if gc.Ctxt.Flag_dynlink || obj.Getgoos() == "nacl" {
    29  		resvd = append(resvd, x86.REG_R15)
    30  	}
    31  	if gc.Ctxt.Framepointer_enabled || obj.Getgoos() == "nacl" {
    32  		resvd = append(resvd, x86.REG_BP)
    33  	}
    34  	gc.Thearch.ReservedRegs = resvd
    35  }
    36  
    37  func Main() {
    38  	gc.Thearch.LinkArch = &x86.Linkamd64
    39  	if obj.Getgoarch() == "amd64p32" {
    40  		gc.Thearch.LinkArch = &x86.Linkamd64p32
    41  	}
    42  	gc.Thearch.REGSP = x86.REGSP
    43  	gc.Thearch.REGCTXT = x86.REGCTXT
    44  	gc.Thearch.REGCALLX = x86.REG_BX
    45  	gc.Thearch.REGCALLX2 = x86.REG_AX
    46  	gc.Thearch.REGRETURN = x86.REG_AX
    47  	gc.Thearch.REGMIN = x86.REG_AX
    48  	gc.Thearch.REGMAX = x86.REG_R15
    49  	gc.Thearch.FREGMIN = x86.REG_X0
    50  	gc.Thearch.FREGMAX = x86.REG_X15
    51  	gc.Thearch.MAXWIDTH = 1 << 50
    52  
    53  	gc.Thearch.AddIndex = addindex
    54  	gc.Thearch.Betypeinit = betypeinit
    55  	gc.Thearch.Cgen_bmul = cgen_bmul
    56  	gc.Thearch.Cgen_hmul = cgen_hmul
    57  	gc.Thearch.Cgen_shift = cgen_shift
    58  	gc.Thearch.Clearfat = clearfat
    59  	gc.Thearch.Defframe = defframe
    60  	gc.Thearch.Dodiv = dodiv
    61  	gc.Thearch.Excise = excise
    62  	gc.Thearch.Expandchecks = expandchecks
    63  	gc.Thearch.Getg = getg
    64  	gc.Thearch.Gins = gins
    65  	gc.Thearch.Ginsboolval = ginsboolval
    66  	gc.Thearch.Ginscmp = ginscmp
    67  	gc.Thearch.Ginscon = ginscon
    68  	gc.Thearch.Ginsnop = ginsnop
    69  	gc.Thearch.Gmove = gmove
    70  	gc.Thearch.Peep = peep
    71  	gc.Thearch.Proginfo = proginfo
    72  	gc.Thearch.Regtyp = regtyp
    73  	gc.Thearch.Sameaddr = sameaddr
    74  	gc.Thearch.Smallindir = smallindir
    75  	gc.Thearch.Stackaddr = stackaddr
    76  	gc.Thearch.Blockcopy = blockcopy
    77  	gc.Thearch.Sudoaddable = sudoaddable
    78  	gc.Thearch.Sudoclean = sudoclean
    79  	gc.Thearch.Excludedregs = excludedregs
    80  	gc.Thearch.RtoB = RtoB
    81  	gc.Thearch.FtoB = FtoB
    82  	gc.Thearch.BtoR = BtoR
    83  	gc.Thearch.BtoF = BtoF
    84  	gc.Thearch.Optoas = optoas
    85  	gc.Thearch.Doregbits = doregbits
    86  	gc.Thearch.Regnames = regnames
    87  
    88  	gc.Thearch.SSARegToReg = ssaRegToReg
    89  	gc.Thearch.SSAMarkMoves = ssaMarkMoves
    90  	gc.Thearch.SSAGenValue = ssaGenValue
    91  	gc.Thearch.SSAGenBlock = ssaGenBlock
    92  
    93  	gc.Main()
    94  	gc.Exit(0)
    95  }