github.com/gocuntian/go@v0.0.0-20160610041250-fee02d270bf8/src/cmd/compile/internal/ssa/gen/ARMOps.go (about)

     1  // Copyright 2016 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  // +build ignore
     6  
     7  package main
     8  
     9  func init() {
    10  	var (
    11  		gp01       = regInfo{inputs: []regMask{}, outputs: []regMask{31}}
    12  		gp11       = regInfo{inputs: []regMask{31}, outputs: []regMask{31}}
    13  		gp21       = regInfo{inputs: []regMask{31, 31}, outputs: []regMask{31}}
    14  		gp2flags   = regInfo{inputs: []regMask{31, 31}, outputs: []regMask{32}}
    15  		gpload     = regInfo{inputs: []regMask{31}, outputs: []regMask{31}}
    16  		gpstore    = regInfo{inputs: []regMask{31, 31}, outputs: []regMask{}}
    17  		flagsgp    = regInfo{inputs: []regMask{32}, outputs: []regMask{31}}
    18  		callerSave = regMask(15)
    19  	)
    20  	ops := []opData{
    21  		{name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true},  // arg0 + arg1
    22  		{name: "ADDconst", argLength: 1, reg: gp11, asm: "ADD", aux: "SymOff"}, // arg0 + auxInt + aux.(*gc.Sym)
    23  
    24  		{name: "MOVWconst", argLength: 0, reg: gp01, aux: "Int32", asm: "MOVW", rematerializeable: true}, // 32 low bits of auxint
    25  
    26  		{name: "CMP", argLength: 2, reg: gp2flags, asm: "CMP", typ: "Flags"}, // arg0 compare to arg1
    27  
    28  		{name: "MOVWload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVW"},   // load from arg0 + auxInt + aux.  arg1=mem.
    29  		{name: "MOVWstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVW"}, // store 4 bytes of arg1 to arg0 + auxInt + aux.  arg2=mem.
    30  
    31  		{name: "CALLstatic", argLength: 1, reg: regInfo{clobbers: callerSave}, aux: "SymOff"}, // call static function aux.(*gc.Sym).  arg0=mem, auxint=argsize, returns mem
    32  
    33  		// pseudo-ops
    34  		{name: "LessThan", argLength: 1, reg: flagsgp}, // bool, 1 flags encode x<y 0 otherwise.
    35  	}
    36  
    37  	blocks := []blockData{
    38  		{name: "EQ"},
    39  		{name: "NE"},
    40  		{name: "LT"},
    41  		{name: "LE"},
    42  		{name: "GT"},
    43  		{name: "GE"},
    44  		{name: "ULT"},
    45  		{name: "ULE"},
    46  		{name: "UGT"},
    47  		{name: "UGE"},
    48  	}
    49  
    50  	regNames := []string{
    51  		"R0",
    52  		"R1",
    53  		"R2",
    54  		"R3",
    55  		"SP",
    56  		"FLAGS",
    57  		"SB",
    58  	}
    59  
    60  	archs = append(archs, arch{
    61  		name:     "ARM",
    62  		pkg:      "cmd/internal/obj/arm",
    63  		genfile:  "../../arm/ssa.go",
    64  		ops:      ops,
    65  		blocks:   blocks,
    66  		regnames: regNames,
    67  	})
    68  }