github.com/q45/go@v0.0.0-20151101211701-a4fb8c13db3f/src/cmd/compile/internal/x86/prog.go (about)

     1  // Copyright 2013 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  )
    12  
    13  var (
    14  	AX               = RtoB(x86.REG_AX)
    15  	BX               = RtoB(x86.REG_BX)
    16  	CX               = RtoB(x86.REG_CX)
    17  	DX               = RtoB(x86.REG_DX)
    18  	DI               = RtoB(x86.REG_DI)
    19  	SI               = RtoB(x86.REG_SI)
    20  	LeftRdwr  uint32 = gc.LeftRead | gc.LeftWrite
    21  	RightRdwr uint32 = gc.RightRead | gc.RightWrite
    22  )
    23  
    24  // This table gives the basic information about instruction
    25  // generated by the compiler and processed in the optimizer.
    26  // See opt.h for bit definitions.
    27  //
    28  // Instructions not generated need not be listed.
    29  // As an exception to that rule, we typically write down all the
    30  // size variants of an operation even if we just use a subset.
    31  //
    32  // The table is formatted for 8-space tabs.
    33  var progtable = [x86.ALAST]obj.ProgInfo{
    34  	obj.ATYPE:     {Flags: gc.Pseudo | gc.Skip},
    35  	obj.ATEXT:     {Flags: gc.Pseudo},
    36  	obj.AFUNCDATA: {Flags: gc.Pseudo},
    37  	obj.APCDATA:   {Flags: gc.Pseudo},
    38  	obj.AUNDEF:    {Flags: gc.Break},
    39  	obj.AUSEFIELD: {Flags: gc.OK},
    40  	obj.ACHECKNIL: {Flags: gc.LeftRead},
    41  	obj.AVARDEF:   {Flags: gc.Pseudo | gc.RightWrite},
    42  	obj.AVARKILL:  {Flags: gc.Pseudo | gc.RightWrite},
    43  
    44  	// NOP is an internal no-op that also stands
    45  	// for USED and SET annotations, not the Intel opcode.
    46  	obj.ANOP:       {Flags: gc.LeftRead | gc.RightWrite},
    47  	x86.AADCL:      {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry},
    48  	x86.AADCW:      {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry},
    49  	x86.AADDB:      {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry},
    50  	x86.AADDL:      {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry},
    51  	x86.AADDW:      {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry},
    52  	x86.AADDSD:     {Flags: gc.SizeD | gc.LeftRead | RightRdwr},
    53  	x86.AADDSS:     {Flags: gc.SizeF | gc.LeftRead | RightRdwr},
    54  	x86.AANDB:      {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry},
    55  	x86.AANDL:      {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry},
    56  	x86.AANDW:      {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry},
    57  	obj.ACALL:      {Flags: gc.RightAddr | gc.Call | gc.KillCarry},
    58  	x86.ACDQ:       {Flags: gc.OK, Reguse: AX, Regset: AX | DX},
    59  	x86.ACWD:       {Flags: gc.OK, Reguse: AX, Regset: AX | DX},
    60  	x86.ACLD:       {Flags: gc.OK},
    61  	x86.ASTD:       {Flags: gc.OK},
    62  	x86.ACMPB:      {Flags: gc.SizeB | gc.LeftRead | gc.RightRead | gc.SetCarry},
    63  	x86.ACMPL:      {Flags: gc.SizeL | gc.LeftRead | gc.RightRead | gc.SetCarry},
    64  	x86.ACMPW:      {Flags: gc.SizeW | gc.LeftRead | gc.RightRead | gc.SetCarry},
    65  	x86.ACOMISD:    {Flags: gc.SizeD | gc.LeftRead | gc.RightRead | gc.SetCarry},
    66  	x86.ACOMISS:    {Flags: gc.SizeF | gc.LeftRead | gc.RightRead | gc.SetCarry},
    67  	x86.ACVTSD2SL:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
    68  	x86.ACVTSD2SS:  {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Conv},
    69  	x86.ACVTSL2SD:  {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Conv},
    70  	x86.ACVTSL2SS:  {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Conv},
    71  	x86.ACVTSS2SD:  {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Conv},
    72  	x86.ACVTSS2SL:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
    73  	x86.ACVTTSD2SL: {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
    74  	x86.ACVTTSS2SL: {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
    75  	x86.ADECB:      {Flags: gc.SizeB | RightRdwr},
    76  	x86.ADECL:      {Flags: gc.SizeL | RightRdwr},
    77  	x86.ADECW:      {Flags: gc.SizeW | RightRdwr},
    78  	x86.ADIVB:      {Flags: gc.SizeB | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX},
    79  	x86.ADIVL:      {Flags: gc.SizeL | gc.LeftRead | gc.SetCarry, Reguse: AX | DX, Regset: AX | DX},
    80  	x86.ADIVW:      {Flags: gc.SizeW | gc.LeftRead | gc.SetCarry, Reguse: AX | DX, Regset: AX | DX},
    81  	x86.ADIVSD:     {Flags: gc.SizeD | gc.LeftRead | RightRdwr},
    82  	x86.ADIVSS:     {Flags: gc.SizeF | gc.LeftRead | RightRdwr},
    83  	x86.AFLDCW:     {Flags: gc.SizeW | gc.LeftAddr},
    84  	x86.AFSTCW:     {Flags: gc.SizeW | gc.RightAddr},
    85  	x86.AFSTSW:     {Flags: gc.SizeW | gc.RightAddr | gc.RightWrite},
    86  	x86.AFADDD:     {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
    87  	x86.AFADDDP:    {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
    88  	x86.AFADDF:     {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
    89  	x86.AFCOMD:     {Flags: gc.SizeD | gc.LeftAddr | gc.RightRead},
    90  	x86.AFCOMDP:    {Flags: gc.SizeD | gc.LeftAddr | gc.RightRead},
    91  	x86.AFCOMDPP:   {Flags: gc.SizeD | gc.LeftAddr | gc.RightRead},
    92  	x86.AFCOMF:     {Flags: gc.SizeF | gc.LeftAddr | gc.RightRead},
    93  	x86.AFCOMFP:    {Flags: gc.SizeF | gc.LeftAddr | gc.RightRead},
    94  	x86.AFUCOMIP:   {Flags: gc.SizeF | gc.LeftAddr | gc.RightRead},
    95  	x86.AFCHS:      {Flags: gc.SizeD | RightRdwr}, // also SizeF
    96  
    97  	x86.AFDIVDP:  {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
    98  	x86.AFDIVF:   {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
    99  	x86.AFDIVD:   {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   100  	x86.AFDIVRDP: {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   101  	x86.AFDIVRF:  {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
   102  	x86.AFDIVRD:  {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   103  	x86.AFXCHD:   {Flags: gc.SizeD | LeftRdwr | RightRdwr},
   104  	x86.AFSUBD:   {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   105  	x86.AFSUBDP:  {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   106  	x86.AFSUBF:   {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
   107  	x86.AFSUBRD:  {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   108  	x86.AFSUBRDP: {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   109  	x86.AFSUBRF:  {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
   110  	x86.AFMOVD:   {Flags: gc.SizeD | gc.LeftAddr | gc.RightWrite},
   111  	x86.AFMOVF:   {Flags: gc.SizeF | gc.LeftAddr | gc.RightWrite},
   112  	x86.AFMOVL:   {Flags: gc.SizeL | gc.LeftAddr | gc.RightWrite},
   113  	x86.AFMOVW:   {Flags: gc.SizeW | gc.LeftAddr | gc.RightWrite},
   114  	x86.AFMOVV:   {Flags: gc.SizeQ | gc.LeftAddr | gc.RightWrite},
   115  
   116  	// These instructions are marked as RightAddr
   117  	// so that the register optimizer does not try to replace the
   118  	// memory references with integer register references.
   119  	// But they do not use the previous value at the address, so
   120  	// we also mark them RightWrite.
   121  	x86.AFMOVDP:   {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.RightAddr},
   122  	x86.AFMOVFP:   {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.RightAddr},
   123  	x86.AFMOVLP:   {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.RightAddr},
   124  	x86.AFMOVWP:   {Flags: gc.SizeW | gc.LeftRead | gc.RightWrite | gc.RightAddr},
   125  	x86.AFMOVVP:   {Flags: gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.RightAddr},
   126  	x86.AFMULD:    {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   127  	x86.AFMULDP:   {Flags: gc.SizeD | gc.LeftAddr | RightRdwr},
   128  	x86.AFMULF:    {Flags: gc.SizeF | gc.LeftAddr | RightRdwr},
   129  	x86.AIDIVB:    {Flags: gc.SizeB | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX},
   130  	x86.AIDIVL:    {Flags: gc.SizeL | gc.LeftRead | gc.SetCarry, Reguse: AX | DX, Regset: AX | DX},
   131  	x86.AIDIVW:    {Flags: gc.SizeW | gc.LeftRead | gc.SetCarry, Reguse: AX | DX, Regset: AX | DX},
   132  	x86.AIMULB:    {Flags: gc.SizeB | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX},
   133  	x86.AIMULL:    {Flags: gc.SizeL | gc.LeftRead | gc.ImulAXDX | gc.SetCarry},
   134  	x86.AIMULW:    {Flags: gc.SizeW | gc.LeftRead | gc.ImulAXDX | gc.SetCarry},
   135  	x86.AINCB:     {Flags: gc.SizeB | RightRdwr},
   136  	x86.AINCL:     {Flags: gc.SizeL | RightRdwr},
   137  	x86.AINCW:     {Flags: gc.SizeW | RightRdwr},
   138  	x86.AJCC:      {Flags: gc.Cjmp | gc.UseCarry},
   139  	x86.AJCS:      {Flags: gc.Cjmp | gc.UseCarry},
   140  	x86.AJEQ:      {Flags: gc.Cjmp | gc.UseCarry},
   141  	x86.AJGE:      {Flags: gc.Cjmp | gc.UseCarry},
   142  	x86.AJGT:      {Flags: gc.Cjmp | gc.UseCarry},
   143  	x86.AJHI:      {Flags: gc.Cjmp | gc.UseCarry},
   144  	x86.AJLE:      {Flags: gc.Cjmp | gc.UseCarry},
   145  	x86.AJLS:      {Flags: gc.Cjmp | gc.UseCarry},
   146  	x86.AJLT:      {Flags: gc.Cjmp | gc.UseCarry},
   147  	x86.AJMI:      {Flags: gc.Cjmp | gc.UseCarry},
   148  	x86.AJNE:      {Flags: gc.Cjmp | gc.UseCarry},
   149  	x86.AJOC:      {Flags: gc.Cjmp | gc.UseCarry},
   150  	x86.AJOS:      {Flags: gc.Cjmp | gc.UseCarry},
   151  	x86.AJPC:      {Flags: gc.Cjmp | gc.UseCarry},
   152  	x86.AJPL:      {Flags: gc.Cjmp | gc.UseCarry},
   153  	x86.AJPS:      {Flags: gc.Cjmp | gc.UseCarry},
   154  	obj.AJMP:      {Flags: gc.Jump | gc.Break | gc.KillCarry},
   155  	x86.ALEAL:     {Flags: gc.LeftAddr | gc.RightWrite},
   156  	x86.AMOVBLSX:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
   157  	x86.AMOVBLZX:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
   158  	x86.AMOVBWSX:  {Flags: gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Conv},
   159  	x86.AMOVBWZX:  {Flags: gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Conv},
   160  	x86.AMOVWLSX:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
   161  	x86.AMOVWLZX:  {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv},
   162  	x86.AMOVB:     {Flags: gc.SizeB | gc.LeftRead | gc.RightWrite | gc.Move},
   163  	x86.AMOVL:     {Flags: gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Move},
   164  	x86.AMOVW:     {Flags: gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Move},
   165  	x86.AMOVSB:    {Flags: gc.OK, Reguse: DI | SI, Regset: DI | SI},
   166  	x86.AMOVSL:    {Flags: gc.OK, Reguse: DI | SI, Regset: DI | SI},
   167  	x86.AMOVSW:    {Flags: gc.OK, Reguse: DI | SI, Regset: DI | SI},
   168  	obj.ADUFFCOPY: {Flags: gc.OK, Reguse: DI | SI, Regset: DI | SI | CX},
   169  	x86.AMOVSD:    {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move},
   170  	x86.AMOVSS:    {Flags: gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Move},
   171  
   172  	// We use MOVAPD as a faster synonym for MOVSD.
   173  	x86.AMOVAPD:   {Flags: gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move},
   174  	x86.AMULB:     {Flags: gc.SizeB | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX},
   175  	x86.AMULL:     {Flags: gc.SizeL | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX | DX},
   176  	x86.AMULW:     {Flags: gc.SizeW | gc.LeftRead | gc.SetCarry, Reguse: AX, Regset: AX | DX},
   177  	x86.AMULSD:    {Flags: gc.SizeD | gc.LeftRead | RightRdwr},
   178  	x86.AMULSS:    {Flags: gc.SizeF | gc.LeftRead | RightRdwr},
   179  	x86.ANEGB:     {Flags: gc.SizeB | RightRdwr | gc.SetCarry},
   180  	x86.ANEGL:     {Flags: gc.SizeL | RightRdwr | gc.SetCarry},
   181  	x86.ANEGW:     {Flags: gc.SizeW | RightRdwr | gc.SetCarry},
   182  	x86.ANOTB:     {Flags: gc.SizeB | RightRdwr},
   183  	x86.ANOTL:     {Flags: gc.SizeL | RightRdwr},
   184  	x86.ANOTW:     {Flags: gc.SizeW | RightRdwr},
   185  	x86.AORB:      {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry},
   186  	x86.AORL:      {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry},
   187  	x86.AORW:      {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry},
   188  	x86.APOPL:     {Flags: gc.SizeL | gc.RightWrite},
   189  	x86.APUSHL:    {Flags: gc.SizeL | gc.LeftRead},
   190  	x86.ARCLB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   191  	x86.ARCLL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   192  	x86.ARCLW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   193  	x86.ARCRB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   194  	x86.ARCRL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   195  	x86.ARCRW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry},
   196  	x86.AREP:      {Flags: gc.OK, Reguse: CX, Regset: CX},
   197  	x86.AREPN:     {Flags: gc.OK, Reguse: CX, Regset: CX},
   198  	obj.ARET:      {Flags: gc.Break | gc.KillCarry},
   199  	x86.AROLB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   200  	x86.AROLL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   201  	x86.AROLW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   202  	x86.ARORB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   203  	x86.ARORL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   204  	x86.ARORW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   205  	x86.ASAHF:     {Flags: gc.OK, Reguse: AX, Regset: AX},
   206  	x86.ASALB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   207  	x86.ASALL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   208  	x86.ASALW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   209  	x86.ASARB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   210  	x86.ASARL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   211  	x86.ASARW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   212  	x86.ASBBB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry},
   213  	x86.ASBBL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry},
   214  	x86.ASBBW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry},
   215  	x86.ASETCC:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   216  	x86.ASETCS:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   217  	x86.ASETEQ:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   218  	x86.ASETGE:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   219  	x86.ASETGT:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   220  	x86.ASETHI:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   221  	x86.ASETLE:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   222  	x86.ASETLS:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   223  	x86.ASETLT:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   224  	x86.ASETMI:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   225  	x86.ASETNE:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   226  	x86.ASETOC:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   227  	x86.ASETOS:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   228  	x86.ASETPC:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   229  	x86.ASETPL:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   230  	x86.ASETPS:    {Flags: gc.SizeB | RightRdwr | gc.UseCarry},
   231  	x86.ASHLB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   232  	x86.ASHLL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   233  	x86.ASHLW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   234  	x86.ASHRB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   235  	x86.ASHRL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   236  	x86.ASHRW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry},
   237  	x86.ASTOSB:    {Flags: gc.OK, Reguse: AX | DI, Regset: DI},
   238  	x86.ASTOSL:    {Flags: gc.OK, Reguse: AX | DI, Regset: DI},
   239  	x86.ASTOSW:    {Flags: gc.OK, Reguse: AX | DI, Regset: DI},
   240  	obj.ADUFFZERO: {Flags: gc.OK, Reguse: AX | DI, Regset: DI},
   241  	x86.ASUBB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry},
   242  	x86.ASUBL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry},
   243  	x86.ASUBW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry},
   244  	x86.ASUBSD:    {Flags: gc.SizeD | gc.LeftRead | RightRdwr},
   245  	x86.ASUBSS:    {Flags: gc.SizeF | gc.LeftRead | RightRdwr},
   246  	x86.ATESTB:    {Flags: gc.SizeB | gc.LeftRead | gc.RightRead | gc.SetCarry},
   247  	x86.ATESTL:    {Flags: gc.SizeL | gc.LeftRead | gc.RightRead | gc.SetCarry},
   248  	x86.ATESTW:    {Flags: gc.SizeW | gc.LeftRead | gc.RightRead | gc.SetCarry},
   249  	x86.AUCOMISD:  {Flags: gc.SizeD | gc.LeftRead | gc.RightRead},
   250  	x86.AUCOMISS:  {Flags: gc.SizeF | gc.LeftRead | gc.RightRead},
   251  	x86.AXCHGB:    {Flags: gc.SizeB | LeftRdwr | RightRdwr},
   252  	x86.AXCHGL:    {Flags: gc.SizeL | LeftRdwr | RightRdwr},
   253  	x86.AXCHGW:    {Flags: gc.SizeW | LeftRdwr | RightRdwr},
   254  	x86.AXORB:     {Flags: gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry},
   255  	x86.AXORL:     {Flags: gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry},
   256  	x86.AXORW:     {Flags: gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry},
   257  }
   258  
   259  func proginfo(p *obj.Prog) {
   260  	info := &p.Info
   261  	*info = progtable[p.As]
   262  	if info.Flags == 0 {
   263  		gc.Fatalf("unknown instruction %v", p)
   264  	}
   265  
   266  	if (info.Flags&gc.ShiftCX != 0) && p.From.Type != obj.TYPE_CONST {
   267  		info.Reguse |= CX
   268  	}
   269  
   270  	if info.Flags&gc.ImulAXDX != 0 {
   271  		if p.To.Type == obj.TYPE_NONE {
   272  			info.Reguse |= AX
   273  			info.Regset |= AX | DX
   274  		} else {
   275  			info.Flags |= RightRdwr
   276  		}
   277  	}
   278  
   279  	// Addressing makes some registers used.
   280  	if p.From.Type == obj.TYPE_MEM && p.From.Name == obj.NAME_NONE {
   281  		info.Regindex |= RtoB(int(p.From.Reg))
   282  	}
   283  	if p.From.Index != x86.REG_NONE {
   284  		info.Regindex |= RtoB(int(p.From.Index))
   285  	}
   286  	if p.To.Type == obj.TYPE_MEM && p.To.Name == obj.NAME_NONE {
   287  		info.Regindex |= RtoB(int(p.To.Reg))
   288  	}
   289  	if p.To.Index != x86.REG_NONE {
   290  		info.Regindex |= RtoB(int(p.To.Index))
   291  	}
   292  }