github.com/rsc/tmp@v0.0.0-20240517235954-6deaab19748b/bootstrap/bootstrap6g/prog.go (about)

     1  // Do not edit. Bootstrap copy of /Users/rsc/g/go/src/cmd/6g/prog.go
     2  
     3  // Copyright 2013 The Go Authors.  All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  import (
    10  	"rsc.io/tmp/bootstrap/internal/gc"
    11  	"rsc.io/tmp/bootstrap/internal/obj"
    12  	"rsc.io/tmp/bootstrap/internal/obj/x86"
    13  )
    14  
    15  const (
    16  	LeftRdwr  uint32 = gc.LeftRead | gc.LeftWrite
    17  	RightRdwr uint32 = gc.RightRead | gc.RightWrite
    18  )
    19  
    20  // This table gives the basic information about instruction
    21  // generated by the compiler and processed in the optimizer.
    22  // See opt.h for bit definitions.
    23  //
    24  // Instructions not generated need not be listed.
    25  // As an exception to that rule, we typically write down all the
    26  // size variants of an operation even if we just use a subset.
    27  //
    28  // The table is formatted for 8-space tabs.
    29  var progtable = [x86.ALAST]obj.ProgInfo{
    30  	obj.ATYPE:     {gc.Pseudo | gc.Skip, 0, 0, 0},
    31  	obj.ATEXT:     {gc.Pseudo, 0, 0, 0},
    32  	obj.AFUNCDATA: {gc.Pseudo, 0, 0, 0},
    33  	obj.APCDATA:   {gc.Pseudo, 0, 0, 0},
    34  	obj.AUNDEF:    {gc.Break, 0, 0, 0},
    35  	obj.AUSEFIELD: {gc.OK, 0, 0, 0},
    36  	obj.ACHECKNIL: {gc.LeftRead, 0, 0, 0},
    37  	obj.AVARDEF:   {gc.Pseudo | gc.RightWrite, 0, 0, 0},
    38  	obj.AVARKILL:  {gc.Pseudo | gc.RightWrite, 0, 0, 0},
    39  
    40  	// NOP is an internal no-op that also stands
    41  	// for USED and SET annotations, not the Intel opcode.
    42  	obj.ANOP:       {gc.LeftRead | gc.RightWrite, 0, 0, 0},
    43  	x86.AADCL:      {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
    44  	x86.AADCQ:      {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
    45  	x86.AADCW:      {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
    46  	x86.AADDB:      {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    47  	x86.AADDL:      {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    48  	x86.AADDW:      {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    49  	x86.AADDQ:      {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    50  	x86.AADDSD:     {gc.SizeD | gc.LeftRead | RightRdwr, 0, 0, 0},
    51  	x86.AADDSS:     {gc.SizeF | gc.LeftRead | RightRdwr, 0, 0, 0},
    52  	x86.AANDB:      {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    53  	x86.AANDL:      {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    54  	x86.AANDQ:      {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    55  	x86.AANDW:      {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
    56  	obj.ACALL:      {gc.RightAddr | gc.Call | gc.KillCarry, 0, 0, 0},
    57  	x86.ACDQ:       {gc.OK, AX, AX | DX, 0},
    58  	x86.ACQO:       {gc.OK, AX, AX | DX, 0},
    59  	x86.ACWD:       {gc.OK, AX, AX | DX, 0},
    60  	x86.ACLD:       {gc.OK, 0, 0, 0},
    61  	x86.ASTD:       {gc.OK, 0, 0, 0},
    62  	x86.ACMPB:      {gc.SizeB | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    63  	x86.ACMPL:      {gc.SizeL | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    64  	x86.ACMPQ:      {gc.SizeQ | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    65  	x86.ACMPW:      {gc.SizeW | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    66  	x86.ACOMISD:    {gc.SizeD | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    67  	x86.ACOMISS:    {gc.SizeF | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
    68  	x86.ACVTSD2SL:  {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    69  	x86.ACVTSD2SQ:  {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    70  	x86.ACVTSD2SS:  {gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    71  	x86.ACVTSL2SD:  {gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    72  	x86.ACVTSL2SS:  {gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    73  	x86.ACVTSQ2SD:  {gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    74  	x86.ACVTSQ2SS:  {gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    75  	x86.ACVTSS2SD:  {gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    76  	x86.ACVTSS2SL:  {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    77  	x86.ACVTSS2SQ:  {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    78  	x86.ACVTTSD2SL: {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    79  	x86.ACVTTSD2SQ: {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    80  	x86.ACVTTSS2SL: {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    81  	x86.ACVTTSS2SQ: {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
    82  	x86.ADECB:      {gc.SizeB | RightRdwr, 0, 0, 0},
    83  	x86.ADECL:      {gc.SizeL | RightRdwr, 0, 0, 0},
    84  	x86.ADECQ:      {gc.SizeQ | RightRdwr, 0, 0, 0},
    85  	x86.ADECW:      {gc.SizeW | RightRdwr, 0, 0, 0},
    86  	x86.ADIVB:      {gc.SizeB | gc.LeftRead | gc.SetCarry, AX, AX, 0},
    87  	x86.ADIVL:      {gc.SizeL | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    88  	x86.ADIVQ:      {gc.SizeQ | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    89  	x86.ADIVW:      {gc.SizeW | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    90  	x86.ADIVSD:     {gc.SizeD | gc.LeftRead | RightRdwr, 0, 0, 0},
    91  	x86.ADIVSS:     {gc.SizeF | gc.LeftRead | RightRdwr, 0, 0, 0},
    92  	x86.AIDIVB:     {gc.SizeB | gc.LeftRead | gc.SetCarry, AX, AX, 0},
    93  	x86.AIDIVL:     {gc.SizeL | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    94  	x86.AIDIVQ:     {gc.SizeQ | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    95  	x86.AIDIVW:     {gc.SizeW | gc.LeftRead | gc.SetCarry, AX | DX, AX | DX, 0},
    96  	x86.AIMULB:     {gc.SizeB | gc.LeftRead | gc.SetCarry, AX, AX, 0},
    97  	x86.AIMULL:     {gc.SizeL | gc.LeftRead | gc.ImulAXDX | gc.SetCarry, 0, 0, 0},
    98  	x86.AIMULQ:     {gc.SizeQ | gc.LeftRead | gc.ImulAXDX | gc.SetCarry, 0, 0, 0},
    99  	x86.AIMULW:     {gc.SizeW | gc.LeftRead | gc.ImulAXDX | gc.SetCarry, 0, 0, 0},
   100  	x86.AINCB:      {gc.SizeB | RightRdwr, 0, 0, 0},
   101  	x86.AINCL:      {gc.SizeL | RightRdwr, 0, 0, 0},
   102  	x86.AINCQ:      {gc.SizeQ | RightRdwr, 0, 0, 0},
   103  	x86.AINCW:      {gc.SizeW | RightRdwr, 0, 0, 0},
   104  	x86.AJCC:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   105  	x86.AJCS:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   106  	x86.AJEQ:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   107  	x86.AJGE:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   108  	x86.AJGT:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   109  	x86.AJHI:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   110  	x86.AJLE:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   111  	x86.AJLS:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   112  	x86.AJLT:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   113  	x86.AJMI:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   114  	x86.AJNE:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   115  	x86.AJOC:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   116  	x86.AJOS:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   117  	x86.AJPC:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   118  	x86.AJPL:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   119  	x86.AJPS:       {gc.Cjmp | gc.UseCarry, 0, 0, 0},
   120  	obj.AJMP:       {gc.Jump | gc.Break | gc.KillCarry, 0, 0, 0},
   121  	x86.ALEAL:      {gc.LeftAddr | gc.RightWrite, 0, 0, 0},
   122  	x86.ALEAQ:      {gc.LeftAddr | gc.RightWrite, 0, 0, 0},
   123  	x86.AMOVBLSX:   {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   124  	x86.AMOVBLZX:   {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   125  	x86.AMOVBQSX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   126  	x86.AMOVBQZX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   127  	x86.AMOVBWSX:   {gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   128  	x86.AMOVBWZX:   {gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   129  	x86.AMOVLQSX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   130  	x86.AMOVLQZX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   131  	x86.AMOVWLSX:   {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   132  	x86.AMOVWLZX:   {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   133  	x86.AMOVWQSX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   134  	x86.AMOVWQZX:   {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   135  	x86.AMOVQL:     {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Conv, 0, 0, 0},
   136  	x86.AMOVB:      {gc.SizeB | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   137  	x86.AMOVL:      {gc.SizeL | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   138  	x86.AMOVQ:      {gc.SizeQ | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   139  	x86.AMOVW:      {gc.SizeW | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   140  	x86.AMOVSB:     {gc.OK, DI | SI, DI | SI, 0},
   141  	x86.AMOVSL:     {gc.OK, DI | SI, DI | SI, 0},
   142  	x86.AMOVSQ:     {gc.OK, DI | SI, DI | SI, 0},
   143  	x86.AMOVSW:     {gc.OK, DI | SI, DI | SI, 0},
   144  	obj.ADUFFCOPY:  {gc.OK, DI | SI, DI | SI | CX, 0},
   145  	x86.AMOVSD:     {gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   146  	x86.AMOVSS:     {gc.SizeF | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   147  
   148  	// We use MOVAPD as a faster synonym for MOVSD.
   149  	x86.AMOVAPD:   {gc.SizeD | gc.LeftRead | gc.RightWrite | gc.Move, 0, 0, 0},
   150  	x86.AMULB:     {gc.SizeB | gc.LeftRead | gc.SetCarry, AX, AX, 0},
   151  	x86.AMULL:     {gc.SizeL | gc.LeftRead | gc.SetCarry, AX, AX | DX, 0},
   152  	x86.AMULQ:     {gc.SizeQ | gc.LeftRead | gc.SetCarry, AX, AX | DX, 0},
   153  	x86.AMULW:     {gc.SizeW | gc.LeftRead | gc.SetCarry, AX, AX | DX, 0},
   154  	x86.AMULSD:    {gc.SizeD | gc.LeftRead | RightRdwr, 0, 0, 0},
   155  	x86.AMULSS:    {gc.SizeF | gc.LeftRead | RightRdwr, 0, 0, 0},
   156  	x86.ANEGB:     {gc.SizeB | RightRdwr | gc.SetCarry, 0, 0, 0},
   157  	x86.ANEGL:     {gc.SizeL | RightRdwr | gc.SetCarry, 0, 0, 0},
   158  	x86.ANEGQ:     {gc.SizeQ | RightRdwr | gc.SetCarry, 0, 0, 0},
   159  	x86.ANEGW:     {gc.SizeW | RightRdwr | gc.SetCarry, 0, 0, 0},
   160  	x86.ANOTB:     {gc.SizeB | RightRdwr, 0, 0, 0},
   161  	x86.ANOTL:     {gc.SizeL | RightRdwr, 0, 0, 0},
   162  	x86.ANOTQ:     {gc.SizeQ | RightRdwr, 0, 0, 0},
   163  	x86.ANOTW:     {gc.SizeW | RightRdwr, 0, 0, 0},
   164  	x86.AORB:      {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   165  	x86.AORL:      {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   166  	x86.AORQ:      {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   167  	x86.AORW:      {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   168  	x86.APOPQ:     {gc.SizeQ | gc.RightWrite, 0, 0, 0},
   169  	x86.APUSHQ:    {gc.SizeQ | gc.LeftRead, 0, 0, 0},
   170  	x86.ARCLB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   171  	x86.ARCLL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   172  	x86.ARCLQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   173  	x86.ARCLW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   174  	x86.ARCRB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   175  	x86.ARCRL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   176  	x86.ARCRQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   177  	x86.ARCRW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   178  	x86.AREP:      {gc.OK, CX, CX, 0},
   179  	x86.AREPN:     {gc.OK, CX, CX, 0},
   180  	obj.ARET:      {gc.Break | gc.KillCarry, 0, 0, 0},
   181  	x86.AROLB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   182  	x86.AROLL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   183  	x86.AROLQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   184  	x86.AROLW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   185  	x86.ARORB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   186  	x86.ARORL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   187  	x86.ARORQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   188  	x86.ARORW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   189  	x86.ASALB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   190  	x86.ASALL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   191  	x86.ASALQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   192  	x86.ASALW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   193  	x86.ASARB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   194  	x86.ASARL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   195  	x86.ASARQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   196  	x86.ASARW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   197  	x86.ASBBB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   198  	x86.ASBBL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   199  	x86.ASBBQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   200  	x86.ASBBW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry | gc.UseCarry, 0, 0, 0},
   201  	x86.ASETCC:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   202  	x86.ASETCS:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   203  	x86.ASETEQ:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   204  	x86.ASETGE:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   205  	x86.ASETGT:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   206  	x86.ASETHI:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   207  	x86.ASETLE:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   208  	x86.ASETLS:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   209  	x86.ASETLT:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   210  	x86.ASETMI:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   211  	x86.ASETNE:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   212  	x86.ASETOC:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   213  	x86.ASETOS:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   214  	x86.ASETPC:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   215  	x86.ASETPL:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   216  	x86.ASETPS:    {gc.SizeB | gc.RightWrite | gc.UseCarry, 0, 0, 0},
   217  	x86.ASHLB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   218  	x86.ASHLL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   219  	x86.ASHLQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   220  	x86.ASHLW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   221  	x86.ASHRB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   222  	x86.ASHRL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   223  	x86.ASHRQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   224  	x86.ASHRW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.ShiftCX | gc.SetCarry, 0, 0, 0},
   225  	x86.ASQRTSD:   {gc.SizeD | gc.LeftRead | RightRdwr, 0, 0, 0},
   226  	x86.ASTOSB:    {gc.OK, AX | DI, DI, 0},
   227  	x86.ASTOSL:    {gc.OK, AX | DI, DI, 0},
   228  	x86.ASTOSQ:    {gc.OK, AX | DI, DI, 0},
   229  	x86.ASTOSW:    {gc.OK, AX | DI, DI, 0},
   230  	obj.ADUFFZERO: {gc.OK, AX | DI, DI, 0},
   231  	x86.ASUBB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   232  	x86.ASUBL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   233  	x86.ASUBQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   234  	x86.ASUBW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   235  	x86.ASUBSD:    {gc.SizeD | gc.LeftRead | RightRdwr, 0, 0, 0},
   236  	x86.ASUBSS:    {gc.SizeF | gc.LeftRead | RightRdwr, 0, 0, 0},
   237  	x86.ATESTB:    {gc.SizeB | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
   238  	x86.ATESTL:    {gc.SizeL | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
   239  	x86.ATESTQ:    {gc.SizeQ | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
   240  	x86.ATESTW:    {gc.SizeW | gc.LeftRead | gc.RightRead | gc.SetCarry, 0, 0, 0},
   241  	x86.AUCOMISD:  {gc.SizeD | gc.LeftRead | gc.RightRead, 0, 0, 0},
   242  	x86.AUCOMISS:  {gc.SizeF | gc.LeftRead | gc.RightRead, 0, 0, 0},
   243  	x86.AXCHGB:    {gc.SizeB | LeftRdwr | RightRdwr, 0, 0, 0},
   244  	x86.AXCHGL:    {gc.SizeL | LeftRdwr | RightRdwr, 0, 0, 0},
   245  	x86.AXCHGQ:    {gc.SizeQ | LeftRdwr | RightRdwr, 0, 0, 0},
   246  	x86.AXCHGW:    {gc.SizeW | LeftRdwr | RightRdwr, 0, 0, 0},
   247  	x86.AXORB:     {gc.SizeB | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   248  	x86.AXORL:     {gc.SizeL | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   249  	x86.AXORQ:     {gc.SizeQ | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   250  	x86.AXORW:     {gc.SizeW | gc.LeftRead | RightRdwr | gc.SetCarry, 0, 0, 0},
   251  }
   252  
   253  func progflags(p *obj.Prog) uint32 {
   254  	flags := progtable[p.As].Flags
   255  	if flags&gc.ImulAXDX != 0 && p.To.Type != obj.TYPE_NONE {
   256  		flags |= RightRdwr
   257  	}
   258  	return flags
   259  }
   260  
   261  func progcarryflags(p *obj.Prog) uint32 {
   262  	return progtable[p.As].Flags
   263  }
   264  
   265  func proginfo(p *obj.Prog) {
   266  	info := &p.Info
   267  	*info = progtable[p.As]
   268  	if info.Flags == 0 {
   269  		gc.Fatal("unknown instruction %v", p)
   270  	}
   271  
   272  	if (info.Flags&gc.ShiftCX != 0) && p.From.Type != obj.TYPE_CONST {
   273  		info.Reguse |= CX
   274  	}
   275  
   276  	if info.Flags&gc.ImulAXDX != 0 {
   277  		if p.To.Type == obj.TYPE_NONE {
   278  			info.Reguse |= AX
   279  			info.Regset |= AX | DX
   280  		} else {
   281  			info.Flags |= RightRdwr
   282  		}
   283  	}
   284  
   285  	// Addressing makes some registers used.
   286  	if p.From.Type == obj.TYPE_MEM && p.From.Name == obj.NAME_NONE {
   287  		info.Regindex |= RtoB(int(p.From.Reg))
   288  	}
   289  	if p.From.Index != x86.REG_NONE {
   290  		info.Regindex |= RtoB(int(p.From.Index))
   291  	}
   292  	if p.To.Type == obj.TYPE_MEM && p.To.Name == obj.NAME_NONE {
   293  		info.Regindex |= RtoB(int(p.To.Reg))
   294  	}
   295  	if p.To.Index != x86.REG_NONE {
   296  		info.Regindex |= RtoB(int(p.To.Index))
   297  	}
   298  	if gc.Ctxt.Flag_dynlink {
   299  		// When -dynlink is passed, many operations on external names (and
   300  		// also calling duffzero/duffcopy) use R15 as a scratch register.
   301  		if p.As == x86.ALEAQ || info.Flags == gc.Pseudo || p.As == obj.ACALL || p.As == obj.ARET || p.As == obj.AJMP {
   302  			return
   303  		}
   304  		if p.As == obj.ADUFFZERO || p.As == obj.ADUFFCOPY || (p.From.Name == obj.NAME_EXTERN && !p.From.Sym.Local) || (p.To.Name == obj.NAME_EXTERN && !p.To.Sym.Local) {
   305  			info.Reguse |= R15
   306  			info.Regset |= R15
   307  			return
   308  		}
   309  	}
   310  }