...
Run Format

Source file src/cmd/compile/internal/ssa/rewritedecArgs.go

Documentation: cmd/compile/internal/ssa

     1  // Code generated from gen/decArgs.rules; DO NOT EDIT.
     2  // generated with: cd gen; go run *.go
     3  
     4  package ssa
     5  
     6  import "fmt"
     7  import "math"
     8  import "cmd/internal/obj"
     9  import "cmd/internal/objabi"
    10  import "cmd/compile/internal/types"
    11  
    12  var _ = fmt.Println   // in case not otherwise used
    13  var _ = math.MinInt8  // in case not otherwise used
    14  var _ = obj.ANOP      // in case not otherwise used
    15  var _ = objabi.GOROOT // in case not otherwise used
    16  var _ = types.TypeMem // in case not otherwise used
    17  
    18  func rewriteValuedecArgs(v *Value) bool {
    19  	switch v.Op {
    20  	case OpArg:
    21  		return rewriteValuedecArgs_OpArg_0(v) || rewriteValuedecArgs_OpArg_10(v)
    22  	}
    23  	return false
    24  }
    25  func rewriteValuedecArgs_OpArg_0(v *Value) bool {
    26  	b := v.Block
    27  	_ = b
    28  	config := b.Func.Config
    29  	_ = config
    30  	fe := b.Func.fe
    31  	_ = fe
    32  	typ := &b.Func.Config.Types
    33  	_ = typ
    34  	// match: (Arg {n} [off])
    35  	// cond: v.Type.IsString()
    36  	// result: (StringMake (Arg <typ.BytePtr> {n} [off]) (Arg <typ.Int> {n} [off+config.PtrSize]))
    37  	for {
    38  		off := v.AuxInt
    39  		n := v.Aux
    40  		if !(v.Type.IsString()) {
    41  			break
    42  		}
    43  		v.reset(OpStringMake)
    44  		v0 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
    45  		v0.AuxInt = off
    46  		v0.Aux = n
    47  		v.AddArg(v0)
    48  		v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
    49  		v1.AuxInt = off + config.PtrSize
    50  		v1.Aux = n
    51  		v.AddArg(v1)
    52  		return true
    53  	}
    54  	// match: (Arg {n} [off])
    55  	// cond: v.Type.IsSlice()
    56  	// result: (SliceMake (Arg <v.Type.Elem().PtrTo()> {n} [off]) (Arg <typ.Int> {n} [off+config.PtrSize]) (Arg <typ.Int> {n} [off+2*config.PtrSize]))
    57  	for {
    58  		off := v.AuxInt
    59  		n := v.Aux
    60  		if !(v.Type.IsSlice()) {
    61  			break
    62  		}
    63  		v.reset(OpSliceMake)
    64  		v0 := b.NewValue0(v.Pos, OpArg, v.Type.Elem().PtrTo())
    65  		v0.AuxInt = off
    66  		v0.Aux = n
    67  		v.AddArg(v0)
    68  		v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
    69  		v1.AuxInt = off + config.PtrSize
    70  		v1.Aux = n
    71  		v.AddArg(v1)
    72  		v2 := b.NewValue0(v.Pos, OpArg, typ.Int)
    73  		v2.AuxInt = off + 2*config.PtrSize
    74  		v2.Aux = n
    75  		v.AddArg(v2)
    76  		return true
    77  	}
    78  	// match: (Arg {n} [off])
    79  	// cond: v.Type.IsInterface()
    80  	// result: (IMake (Arg <typ.Uintptr> {n} [off]) (Arg <typ.BytePtr> {n} [off+config.PtrSize]))
    81  	for {
    82  		off := v.AuxInt
    83  		n := v.Aux
    84  		if !(v.Type.IsInterface()) {
    85  			break
    86  		}
    87  		v.reset(OpIMake)
    88  		v0 := b.NewValue0(v.Pos, OpArg, typ.Uintptr)
    89  		v0.AuxInt = off
    90  		v0.Aux = n
    91  		v.AddArg(v0)
    92  		v1 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
    93  		v1.AuxInt = off + config.PtrSize
    94  		v1.Aux = n
    95  		v.AddArg(v1)
    96  		return true
    97  	}
    98  	// match: (Arg {n} [off])
    99  	// cond: v.Type.IsComplex() && v.Type.Size() == 16
   100  	// result: (ComplexMake (Arg <typ.Float64> {n} [off]) (Arg <typ.Float64> {n} [off+8]))
   101  	for {
   102  		off := v.AuxInt
   103  		n := v.Aux
   104  		if !(v.Type.IsComplex() && v.Type.Size() == 16) {
   105  			break
   106  		}
   107  		v.reset(OpComplexMake)
   108  		v0 := b.NewValue0(v.Pos, OpArg, typ.Float64)
   109  		v0.AuxInt = off
   110  		v0.Aux = n
   111  		v.AddArg(v0)
   112  		v1 := b.NewValue0(v.Pos, OpArg, typ.Float64)
   113  		v1.AuxInt = off + 8
   114  		v1.Aux = n
   115  		v.AddArg(v1)
   116  		return true
   117  	}
   118  	// match: (Arg {n} [off])
   119  	// cond: v.Type.IsComplex() && v.Type.Size() == 8
   120  	// result: (ComplexMake (Arg <typ.Float32> {n} [off]) (Arg <typ.Float32> {n} [off+4]))
   121  	for {
   122  		off := v.AuxInt
   123  		n := v.Aux
   124  		if !(v.Type.IsComplex() && v.Type.Size() == 8) {
   125  			break
   126  		}
   127  		v.reset(OpComplexMake)
   128  		v0 := b.NewValue0(v.Pos, OpArg, typ.Float32)
   129  		v0.AuxInt = off
   130  		v0.Aux = n
   131  		v.AddArg(v0)
   132  		v1 := b.NewValue0(v.Pos, OpArg, typ.Float32)
   133  		v1.AuxInt = off + 4
   134  		v1.Aux = n
   135  		v.AddArg(v1)
   136  		return true
   137  	}
   138  	// match: (Arg <t>)
   139  	// cond: t.IsStruct() && t.NumFields() == 0 && fe.CanSSA(t)
   140  	// result: (StructMake0)
   141  	for {
   142  		t := v.Type
   143  		if !(t.IsStruct() && t.NumFields() == 0 && fe.CanSSA(t)) {
   144  			break
   145  		}
   146  		v.reset(OpStructMake0)
   147  		return true
   148  	}
   149  	// match: (Arg <t> {n} [off])
   150  	// cond: t.IsStruct() && t.NumFields() == 1 && fe.CanSSA(t)
   151  	// result: (StructMake1 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]))
   152  	for {
   153  		t := v.Type
   154  		off := v.AuxInt
   155  		n := v.Aux
   156  		if !(t.IsStruct() && t.NumFields() == 1 && fe.CanSSA(t)) {
   157  			break
   158  		}
   159  		v.reset(OpStructMake1)
   160  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   161  		v0.AuxInt = off + t.FieldOff(0)
   162  		v0.Aux = n
   163  		v.AddArg(v0)
   164  		return true
   165  	}
   166  	// match: (Arg <t> {n} [off])
   167  	// cond: t.IsStruct() && t.NumFields() == 2 && fe.CanSSA(t)
   168  	// result: (StructMake2 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]))
   169  	for {
   170  		t := v.Type
   171  		off := v.AuxInt
   172  		n := v.Aux
   173  		if !(t.IsStruct() && t.NumFields() == 2 && fe.CanSSA(t)) {
   174  			break
   175  		}
   176  		v.reset(OpStructMake2)
   177  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   178  		v0.AuxInt = off + t.FieldOff(0)
   179  		v0.Aux = n
   180  		v.AddArg(v0)
   181  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   182  		v1.AuxInt = off + t.FieldOff(1)
   183  		v1.Aux = n
   184  		v.AddArg(v1)
   185  		return true
   186  	}
   187  	// match: (Arg <t> {n} [off])
   188  	// cond: t.IsStruct() && t.NumFields() == 3 && fe.CanSSA(t)
   189  	// result: (StructMake3 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]) (Arg <t.FieldType(2)> {n} [off+t.FieldOff(2)]))
   190  	for {
   191  		t := v.Type
   192  		off := v.AuxInt
   193  		n := v.Aux
   194  		if !(t.IsStruct() && t.NumFields() == 3 && fe.CanSSA(t)) {
   195  			break
   196  		}
   197  		v.reset(OpStructMake3)
   198  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   199  		v0.AuxInt = off + t.FieldOff(0)
   200  		v0.Aux = n
   201  		v.AddArg(v0)
   202  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   203  		v1.AuxInt = off + t.FieldOff(1)
   204  		v1.Aux = n
   205  		v.AddArg(v1)
   206  		v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
   207  		v2.AuxInt = off + t.FieldOff(2)
   208  		v2.Aux = n
   209  		v.AddArg(v2)
   210  		return true
   211  	}
   212  	// match: (Arg <t> {n} [off])
   213  	// cond: t.IsStruct() && t.NumFields() == 4 && fe.CanSSA(t)
   214  	// result: (StructMake4 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]) (Arg <t.FieldType(2)> {n} [off+t.FieldOff(2)]) (Arg <t.FieldType(3)> {n} [off+t.FieldOff(3)]))
   215  	for {
   216  		t := v.Type
   217  		off := v.AuxInt
   218  		n := v.Aux
   219  		if !(t.IsStruct() && t.NumFields() == 4 && fe.CanSSA(t)) {
   220  			break
   221  		}
   222  		v.reset(OpStructMake4)
   223  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   224  		v0.AuxInt = off + t.FieldOff(0)
   225  		v0.Aux = n
   226  		v.AddArg(v0)
   227  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   228  		v1.AuxInt = off + t.FieldOff(1)
   229  		v1.Aux = n
   230  		v.AddArg(v1)
   231  		v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
   232  		v2.AuxInt = off + t.FieldOff(2)
   233  		v2.Aux = n
   234  		v.AddArg(v2)
   235  		v3 := b.NewValue0(v.Pos, OpArg, t.FieldType(3))
   236  		v3.AuxInt = off + t.FieldOff(3)
   237  		v3.Aux = n
   238  		v.AddArg(v3)
   239  		return true
   240  	}
   241  	return false
   242  }
   243  func rewriteValuedecArgs_OpArg_10(v *Value) bool {
   244  	b := v.Block
   245  	_ = b
   246  	fe := b.Func.fe
   247  	_ = fe
   248  	// match: (Arg <t>)
   249  	// cond: t.IsArray() && t.NumElem() == 0
   250  	// result: (ArrayMake0)
   251  	for {
   252  		t := v.Type
   253  		if !(t.IsArray() && t.NumElem() == 0) {
   254  			break
   255  		}
   256  		v.reset(OpArrayMake0)
   257  		return true
   258  	}
   259  	// match: (Arg <t> {n} [off])
   260  	// cond: t.IsArray() && t.NumElem() == 1 && fe.CanSSA(t)
   261  	// result: (ArrayMake1 (Arg <t.Elem()> {n} [off]))
   262  	for {
   263  		t := v.Type
   264  		off := v.AuxInt
   265  		n := v.Aux
   266  		if !(t.IsArray() && t.NumElem() == 1 && fe.CanSSA(t)) {
   267  			break
   268  		}
   269  		v.reset(OpArrayMake1)
   270  		v0 := b.NewValue0(v.Pos, OpArg, t.Elem())
   271  		v0.AuxInt = off
   272  		v0.Aux = n
   273  		v.AddArg(v0)
   274  		return true
   275  	}
   276  	return false
   277  }
   278  func rewriteBlockdecArgs(b *Block) bool {
   279  	config := b.Func.Config
   280  	_ = config
   281  	fe := b.Func.fe
   282  	_ = fe
   283  	typ := &config.Types
   284  	_ = typ
   285  	switch b.Kind {
   286  	}
   287  	return false
   288  }
   289  

View as plain text