Black Lives Matter. Support the Equal Justice Initiative.

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  func rewriteValuedecArgs(v *Value) bool {
     7  	switch v.Op {
     8  	case OpArg:
     9  		return rewriteValuedecArgs_OpArg(v)
    10  	}
    11  	return false
    12  }
    13  func rewriteValuedecArgs_OpArg(v *Value) bool {
    14  	b := v.Block
    15  	config := b.Func.Config
    16  	fe := b.Func.fe
    17  	typ := &b.Func.Config.Types
    18  	// match: (Arg {n} [off])
    19  	// cond: v.Type.IsString()
    20  	// result: (StringMake (Arg <typ.BytePtr> {n} [off]) (Arg <typ.Int> {n} [off+int32(config.PtrSize)]))
    21  	for {
    22  		off := auxIntToInt32(v.AuxInt)
    23  		n := auxToSym(v.Aux)
    24  		if !(v.Type.IsString()) {
    25  			break
    26  		}
    27  		v.reset(OpStringMake)
    28  		v0 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
    29  		v0.AuxInt = int32ToAuxInt(off)
    30  		v0.Aux = symToAux(n)
    31  		v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
    32  		v1.AuxInt = int32ToAuxInt(off + int32(config.PtrSize))
    33  		v1.Aux = symToAux(n)
    34  		v.AddArg2(v0, v1)
    35  		return true
    36  	}
    37  	// match: (Arg {n} [off])
    38  	// cond: v.Type.IsSlice()
    39  	// result: (SliceMake (Arg <v.Type.Elem().PtrTo()> {n} [off]) (Arg <typ.Int> {n} [off+int32(config.PtrSize)]) (Arg <typ.Int> {n} [off+2*int32(config.PtrSize)]))
    40  	for {
    41  		off := auxIntToInt32(v.AuxInt)
    42  		n := auxToSym(v.Aux)
    43  		if !(v.Type.IsSlice()) {
    44  			break
    45  		}
    46  		v.reset(OpSliceMake)
    47  		v0 := b.NewValue0(v.Pos, OpArg, v.Type.Elem().PtrTo())
    48  		v0.AuxInt = int32ToAuxInt(off)
    49  		v0.Aux = symToAux(n)
    50  		v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
    51  		v1.AuxInt = int32ToAuxInt(off + int32(config.PtrSize))
    52  		v1.Aux = symToAux(n)
    53  		v2 := b.NewValue0(v.Pos, OpArg, typ.Int)
    54  		v2.AuxInt = int32ToAuxInt(off + 2*int32(config.PtrSize))
    55  		v2.Aux = symToAux(n)
    56  		v.AddArg3(v0, v1, v2)
    57  		return true
    58  	}
    59  	// match: (Arg {n} [off])
    60  	// cond: v.Type.IsInterface()
    61  	// result: (IMake (Arg <typ.Uintptr> {n} [off]) (Arg <typ.BytePtr> {n} [off+int32(config.PtrSize)]))
    62  	for {
    63  		off := auxIntToInt32(v.AuxInt)
    64  		n := auxToSym(v.Aux)
    65  		if !(v.Type.IsInterface()) {
    66  			break
    67  		}
    68  		v.reset(OpIMake)
    69  		v0 := b.NewValue0(v.Pos, OpArg, typ.Uintptr)
    70  		v0.AuxInt = int32ToAuxInt(off)
    71  		v0.Aux = symToAux(n)
    72  		v1 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
    73  		v1.AuxInt = int32ToAuxInt(off + int32(config.PtrSize))
    74  		v1.Aux = symToAux(n)
    75  		v.AddArg2(v0, v1)
    76  		return true
    77  	}
    78  	// match: (Arg {n} [off])
    79  	// cond: v.Type.IsComplex() && v.Type.Size() == 16
    80  	// result: (ComplexMake (Arg <typ.Float64> {n} [off]) (Arg <typ.Float64> {n} [off+8]))
    81  	for {
    82  		off := auxIntToInt32(v.AuxInt)
    83  		n := auxToSym(v.Aux)
    84  		if !(v.Type.IsComplex() && v.Type.Size() == 16) {
    85  			break
    86  		}
    87  		v.reset(OpComplexMake)
    88  		v0 := b.NewValue0(v.Pos, OpArg, typ.Float64)
    89  		v0.AuxInt = int32ToAuxInt(off)
    90  		v0.Aux = symToAux(n)
    91  		v1 := b.NewValue0(v.Pos, OpArg, typ.Float64)
    92  		v1.AuxInt = int32ToAuxInt(off + 8)
    93  		v1.Aux = symToAux(n)
    94  		v.AddArg2(v0, v1)
    95  		return true
    96  	}
    97  	// match: (Arg {n} [off])
    98  	// cond: v.Type.IsComplex() && v.Type.Size() == 8
    99  	// result: (ComplexMake (Arg <typ.Float32> {n} [off]) (Arg <typ.Float32> {n} [off+4]))
   100  	for {
   101  		off := auxIntToInt32(v.AuxInt)
   102  		n := auxToSym(v.Aux)
   103  		if !(v.Type.IsComplex() && v.Type.Size() == 8) {
   104  			break
   105  		}
   106  		v.reset(OpComplexMake)
   107  		v0 := b.NewValue0(v.Pos, OpArg, typ.Float32)
   108  		v0.AuxInt = int32ToAuxInt(off)
   109  		v0.Aux = symToAux(n)
   110  		v1 := b.NewValue0(v.Pos, OpArg, typ.Float32)
   111  		v1.AuxInt = int32ToAuxInt(off + 4)
   112  		v1.Aux = symToAux(n)
   113  		v.AddArg2(v0, v1)
   114  		return true
   115  	}
   116  	// match: (Arg <t>)
   117  	// cond: t.IsStruct() && t.NumFields() == 0 && fe.CanSSA(t)
   118  	// result: (StructMake0)
   119  	for {
   120  		t := v.Type
   121  		if !(t.IsStruct() && t.NumFields() == 0 && fe.CanSSA(t)) {
   122  			break
   123  		}
   124  		v.reset(OpStructMake0)
   125  		return true
   126  	}
   127  	// match: (Arg <t> {n} [off])
   128  	// cond: t.IsStruct() && t.NumFields() == 1 && fe.CanSSA(t)
   129  	// result: (StructMake1 (Arg <t.FieldType(0)> {n} [off+int32(t.FieldOff(0))]))
   130  	for {
   131  		t := v.Type
   132  		off := auxIntToInt32(v.AuxInt)
   133  		n := auxToSym(v.Aux)
   134  		if !(t.IsStruct() && t.NumFields() == 1 && fe.CanSSA(t)) {
   135  			break
   136  		}
   137  		v.reset(OpStructMake1)
   138  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   139  		v0.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(0)))
   140  		v0.Aux = symToAux(n)
   141  		v.AddArg(v0)
   142  		return true
   143  	}
   144  	// match: (Arg <t> {n} [off])
   145  	// cond: t.IsStruct() && t.NumFields() == 2 && fe.CanSSA(t)
   146  	// result: (StructMake2 (Arg <t.FieldType(0)> {n} [off+int32(t.FieldOff(0))]) (Arg <t.FieldType(1)> {n} [off+int32(t.FieldOff(1))]))
   147  	for {
   148  		t := v.Type
   149  		off := auxIntToInt32(v.AuxInt)
   150  		n := auxToSym(v.Aux)
   151  		if !(t.IsStruct() && t.NumFields() == 2 && fe.CanSSA(t)) {
   152  			break
   153  		}
   154  		v.reset(OpStructMake2)
   155  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   156  		v0.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(0)))
   157  		v0.Aux = symToAux(n)
   158  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   159  		v1.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(1)))
   160  		v1.Aux = symToAux(n)
   161  		v.AddArg2(v0, v1)
   162  		return true
   163  	}
   164  	// match: (Arg <t> {n} [off])
   165  	// cond: t.IsStruct() && t.NumFields() == 3 && fe.CanSSA(t)
   166  	// result: (StructMake3 (Arg <t.FieldType(0)> {n} [off+int32(t.FieldOff(0))]) (Arg <t.FieldType(1)> {n} [off+int32(t.FieldOff(1))]) (Arg <t.FieldType(2)> {n} [off+int32(t.FieldOff(2))]))
   167  	for {
   168  		t := v.Type
   169  		off := auxIntToInt32(v.AuxInt)
   170  		n := auxToSym(v.Aux)
   171  		if !(t.IsStruct() && t.NumFields() == 3 && fe.CanSSA(t)) {
   172  			break
   173  		}
   174  		v.reset(OpStructMake3)
   175  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   176  		v0.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(0)))
   177  		v0.Aux = symToAux(n)
   178  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   179  		v1.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(1)))
   180  		v1.Aux = symToAux(n)
   181  		v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
   182  		v2.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(2)))
   183  		v2.Aux = symToAux(n)
   184  		v.AddArg3(v0, v1, v2)
   185  		return true
   186  	}
   187  	// match: (Arg <t> {n} [off])
   188  	// cond: t.IsStruct() && t.NumFields() == 4 && fe.CanSSA(t)
   189  	// result: (StructMake4 (Arg <t.FieldType(0)> {n} [off+int32(t.FieldOff(0))]) (Arg <t.FieldType(1)> {n} [off+int32(t.FieldOff(1))]) (Arg <t.FieldType(2)> {n} [off+int32(t.FieldOff(2))]) (Arg <t.FieldType(3)> {n} [off+int32(t.FieldOff(3))]))
   190  	for {
   191  		t := v.Type
   192  		off := auxIntToInt32(v.AuxInt)
   193  		n := auxToSym(v.Aux)
   194  		if !(t.IsStruct() && t.NumFields() == 4 && fe.CanSSA(t)) {
   195  			break
   196  		}
   197  		v.reset(OpStructMake4)
   198  		v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
   199  		v0.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(0)))
   200  		v0.Aux = symToAux(n)
   201  		v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
   202  		v1.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(1)))
   203  		v1.Aux = symToAux(n)
   204  		v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
   205  		v2.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(2)))
   206  		v2.Aux = symToAux(n)
   207  		v3 := b.NewValue0(v.Pos, OpArg, t.FieldType(3))
   208  		v3.AuxInt = int32ToAuxInt(off + int32(t.FieldOff(3)))
   209  		v3.Aux = symToAux(n)
   210  		v.AddArg4(v0, v1, v2, v3)
   211  		return true
   212  	}
   213  	// match: (Arg <t>)
   214  	// cond: t.IsArray() && t.NumElem() == 0
   215  	// result: (ArrayMake0)
   216  	for {
   217  		t := v.Type
   218  		if !(t.IsArray() && t.NumElem() == 0) {
   219  			break
   220  		}
   221  		v.reset(OpArrayMake0)
   222  		return true
   223  	}
   224  	// match: (Arg <t> {n} [off])
   225  	// cond: t.IsArray() && t.NumElem() == 1 && fe.CanSSA(t)
   226  	// result: (ArrayMake1 (Arg <t.Elem()> {n} [off]))
   227  	for {
   228  		t := v.Type
   229  		off := auxIntToInt32(v.AuxInt)
   230  		n := auxToSym(v.Aux)
   231  		if !(t.IsArray() && t.NumElem() == 1 && fe.CanSSA(t)) {
   232  			break
   233  		}
   234  		v.reset(OpArrayMake1)
   235  		v0 := b.NewValue0(v.Pos, OpArg, t.Elem())
   236  		v0.AuxInt = int32ToAuxInt(off)
   237  		v0.Aux = symToAux(n)
   238  		v.AddArg(v0)
   239  		return true
   240  	}
   241  	return false
   242  }
   243  func rewriteBlockdecArgs(b *Block) bool {
   244  	switch b.Kind {
   245  	}
   246  	return false
   247  }
   248  

View as plain text