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