]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewritedec.go
cmd/compile: expand calls cleanup
[gostls13.git] / src / cmd / compile / internal / ssa / rewritedec.go
1 // Code generated from _gen/dec.rules using 'go generate'; DO NOT EDIT.
2
3 package ssa
4
5 import "cmd/compile/internal/types"
6
7 func rewriteValuedec(v *Value) bool {
8         switch v.Op {
9         case OpArrayMake1:
10                 return rewriteValuedec_OpArrayMake1(v)
11         case OpArraySelect:
12                 return rewriteValuedec_OpArraySelect(v)
13         case OpComplexImag:
14                 return rewriteValuedec_OpComplexImag(v)
15         case OpComplexReal:
16                 return rewriteValuedec_OpComplexReal(v)
17         case OpIData:
18                 return rewriteValuedec_OpIData(v)
19         case OpIMake:
20                 return rewriteValuedec_OpIMake(v)
21         case OpITab:
22                 return rewriteValuedec_OpITab(v)
23         case OpLoad:
24                 return rewriteValuedec_OpLoad(v)
25         case OpSliceCap:
26                 return rewriteValuedec_OpSliceCap(v)
27         case OpSliceLen:
28                 return rewriteValuedec_OpSliceLen(v)
29         case OpSlicePtr:
30                 return rewriteValuedec_OpSlicePtr(v)
31         case OpSlicePtrUnchecked:
32                 return rewriteValuedec_OpSlicePtrUnchecked(v)
33         case OpStore:
34                 return rewriteValuedec_OpStore(v)
35         case OpStringLen:
36                 return rewriteValuedec_OpStringLen(v)
37         case OpStringPtr:
38                 return rewriteValuedec_OpStringPtr(v)
39         case OpStructMake1:
40                 return rewriteValuedec_OpStructMake1(v)
41         case OpStructSelect:
42                 return rewriteValuedec_OpStructSelect(v)
43         }
44         return false
45 }
46 func rewriteValuedec_OpArrayMake1(v *Value) bool {
47         v_0 := v.Args[0]
48         // match: (ArrayMake1 x)
49         // cond: x.Type.IsPtr()
50         // result: x
51         for {
52                 x := v_0
53                 if !(x.Type.IsPtr()) {
54                         break
55                 }
56                 v.copyOf(x)
57                 return true
58         }
59         return false
60 }
61 func rewriteValuedec_OpArraySelect(v *Value) bool {
62         v_0 := v.Args[0]
63         b := v.Block
64         // match: (ArraySelect [0] x)
65         // cond: x.Type.IsPtr()
66         // result: x
67         for {
68                 if auxIntToInt64(v.AuxInt) != 0 {
69                         break
70                 }
71                 x := v_0
72                 if !(x.Type.IsPtr()) {
73                         break
74                 }
75                 v.copyOf(x)
76                 return true
77         }
78         // match: (ArraySelect (ArrayMake1 x))
79         // result: x
80         for {
81                 if v_0.Op != OpArrayMake1 {
82                         break
83                 }
84                 x := v_0.Args[0]
85                 v.copyOf(x)
86                 return true
87         }
88         // match: (ArraySelect [0] (IData x))
89         // result: (IData x)
90         for {
91                 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpIData {
92                         break
93                 }
94                 x := v_0.Args[0]
95                 v.reset(OpIData)
96                 v.AddArg(x)
97                 return true
98         }
99         // match: (ArraySelect [i] x:(Load <t> ptr mem))
100         // result: @x.Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.Elem().Size()*i] ptr) mem)
101         for {
102                 i := auxIntToInt64(v.AuxInt)
103                 x := v_0
104                 if x.Op != OpLoad {
105                         break
106                 }
107                 t := x.Type
108                 mem := x.Args[1]
109                 ptr := x.Args[0]
110                 b = x.Block
111                 v0 := b.NewValue0(v.Pos, OpLoad, v.Type)
112                 v.copyOf(v0)
113                 v1 := b.NewValue0(v.Pos, OpOffPtr, v.Type.PtrTo())
114                 v1.AuxInt = int64ToAuxInt(t.Elem().Size() * i)
115                 v1.AddArg(ptr)
116                 v0.AddArg2(v1, mem)
117                 return true
118         }
119         return false
120 }
121 func rewriteValuedec_OpComplexImag(v *Value) bool {
122         v_0 := v.Args[0]
123         b := v.Block
124         typ := &b.Func.Config.Types
125         // match: (ComplexImag (ComplexMake _ imag ))
126         // result: imag
127         for {
128                 if v_0.Op != OpComplexMake {
129                         break
130                 }
131                 imag := v_0.Args[1]
132                 v.copyOf(imag)
133                 return true
134         }
135         // match: (ComplexImag x:(Load <t> ptr mem))
136         // cond: t.IsComplex() && t.Size() == 8
137         // result: @x.Block (Load <typ.Float32> (OffPtr <typ.Float32Ptr> [4] ptr) mem)
138         for {
139                 x := v_0
140                 if x.Op != OpLoad {
141                         break
142                 }
143                 t := x.Type
144                 mem := x.Args[1]
145                 ptr := x.Args[0]
146                 if !(t.IsComplex() && t.Size() == 8) {
147                         break
148                 }
149                 b = x.Block
150                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
151                 v.copyOf(v0)
152                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
153                 v1.AuxInt = int64ToAuxInt(4)
154                 v1.AddArg(ptr)
155                 v0.AddArg2(v1, mem)
156                 return true
157         }
158         // match: (ComplexImag x:(Load <t> ptr mem))
159         // cond: t.IsComplex() && t.Size() == 16
160         // result: @x.Block (Load <typ.Float64> (OffPtr <typ.Float64Ptr> [8] ptr) mem)
161         for {
162                 x := v_0
163                 if x.Op != OpLoad {
164                         break
165                 }
166                 t := x.Type
167                 mem := x.Args[1]
168                 ptr := x.Args[0]
169                 if !(t.IsComplex() && t.Size() == 16) {
170                         break
171                 }
172                 b = x.Block
173                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
174                 v.copyOf(v0)
175                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
176                 v1.AuxInt = int64ToAuxInt(8)
177                 v1.AddArg(ptr)
178                 v0.AddArg2(v1, mem)
179                 return true
180         }
181         return false
182 }
183 func rewriteValuedec_OpComplexReal(v *Value) bool {
184         v_0 := v.Args[0]
185         b := v.Block
186         typ := &b.Func.Config.Types
187         // match: (ComplexReal (ComplexMake real _ ))
188         // result: real
189         for {
190                 if v_0.Op != OpComplexMake {
191                         break
192                 }
193                 real := v_0.Args[0]
194                 v.copyOf(real)
195                 return true
196         }
197         // match: (ComplexReal x:(Load <t> ptr mem))
198         // cond: t.IsComplex() && t.Size() == 8
199         // result: @x.Block (Load <typ.Float32> ptr mem)
200         for {
201                 x := v_0
202                 if x.Op != OpLoad {
203                         break
204                 }
205                 t := x.Type
206                 mem := x.Args[1]
207                 ptr := x.Args[0]
208                 if !(t.IsComplex() && t.Size() == 8) {
209                         break
210                 }
211                 b = x.Block
212                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
213                 v.copyOf(v0)
214                 v0.AddArg2(ptr, mem)
215                 return true
216         }
217         // match: (ComplexReal x:(Load <t> ptr mem))
218         // cond: t.IsComplex() && t.Size() == 16
219         // result: @x.Block (Load <typ.Float64> ptr mem)
220         for {
221                 x := v_0
222                 if x.Op != OpLoad {
223                         break
224                 }
225                 t := x.Type
226                 mem := x.Args[1]
227                 ptr := x.Args[0]
228                 if !(t.IsComplex() && t.Size() == 16) {
229                         break
230                 }
231                 b = x.Block
232                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
233                 v.copyOf(v0)
234                 v0.AddArg2(ptr, mem)
235                 return true
236         }
237         return false
238 }
239 func rewriteValuedec_OpIData(v *Value) bool {
240         v_0 := v.Args[0]
241         b := v.Block
242         config := b.Func.Config
243         typ := &b.Func.Config.Types
244         // match: (IData (IMake _ data))
245         // result: data
246         for {
247                 if v_0.Op != OpIMake {
248                         break
249                 }
250                 data := v_0.Args[1]
251                 v.copyOf(data)
252                 return true
253         }
254         // match: (IData x:(Load <t> ptr mem))
255         // cond: t.IsInterface()
256         // result: @x.Block (Load <typ.BytePtr> (OffPtr <typ.BytePtrPtr> [config.PtrSize] ptr) mem)
257         for {
258                 x := v_0
259                 if x.Op != OpLoad {
260                         break
261                 }
262                 t := x.Type
263                 mem := x.Args[1]
264                 ptr := x.Args[0]
265                 if !(t.IsInterface()) {
266                         break
267                 }
268                 b = x.Block
269                 v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
270                 v.copyOf(v0)
271                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
272                 v1.AuxInt = int64ToAuxInt(config.PtrSize)
273                 v1.AddArg(ptr)
274                 v0.AddArg2(v1, mem)
275                 return true
276         }
277         return false
278 }
279 func rewriteValuedec_OpIMake(v *Value) bool {
280         v_1 := v.Args[1]
281         v_0 := v.Args[0]
282         // match: (IMake _typ (StructMake1 val))
283         // result: (IMake _typ val)
284         for {
285                 _typ := v_0
286                 if v_1.Op != OpStructMake1 {
287                         break
288                 }
289                 val := v_1.Args[0]
290                 v.reset(OpIMake)
291                 v.AddArg2(_typ, val)
292                 return true
293         }
294         return false
295 }
296 func rewriteValuedec_OpITab(v *Value) bool {
297         v_0 := v.Args[0]
298         b := v.Block
299         typ := &b.Func.Config.Types
300         // match: (ITab (IMake itab _))
301         // result: itab
302         for {
303                 if v_0.Op != OpIMake {
304                         break
305                 }
306                 itab := v_0.Args[0]
307                 v.copyOf(itab)
308                 return true
309         }
310         // match: (ITab x:(Load <t> ptr mem))
311         // cond: t.IsInterface()
312         // result: @x.Block (Load <typ.Uintptr> ptr mem)
313         for {
314                 x := v_0
315                 if x.Op != OpLoad {
316                         break
317                 }
318                 t := x.Type
319                 mem := x.Args[1]
320                 ptr := x.Args[0]
321                 if !(t.IsInterface()) {
322                         break
323                 }
324                 b = x.Block
325                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Uintptr)
326                 v.copyOf(v0)
327                 v0.AddArg2(ptr, mem)
328                 return true
329         }
330         return false
331 }
332 func rewriteValuedec_OpLoad(v *Value) bool {
333         v_1 := v.Args[1]
334         v_0 := v.Args[0]
335         b := v.Block
336         config := b.Func.Config
337         typ := &b.Func.Config.Types
338         // match: (Load <t> ptr mem)
339         // cond: t.IsComplex() && t.Size() == 8
340         // result: (ComplexMake (Load <typ.Float32> ptr mem) (Load <typ.Float32> (OffPtr <typ.Float32Ptr> [4] ptr) mem) )
341         for {
342                 t := v.Type
343                 ptr := v_0
344                 mem := v_1
345                 if !(t.IsComplex() && t.Size() == 8) {
346                         break
347                 }
348                 v.reset(OpComplexMake)
349                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
350                 v0.AddArg2(ptr, mem)
351                 v1 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
352                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
353                 v2.AuxInt = int64ToAuxInt(4)
354                 v2.AddArg(ptr)
355                 v1.AddArg2(v2, mem)
356                 v.AddArg2(v0, v1)
357                 return true
358         }
359         // match: (Load <t> ptr mem)
360         // cond: t.IsComplex() && t.Size() == 16
361         // result: (ComplexMake (Load <typ.Float64> ptr mem) (Load <typ.Float64> (OffPtr <typ.Float64Ptr> [8] ptr) mem) )
362         for {
363                 t := v.Type
364                 ptr := v_0
365                 mem := v_1
366                 if !(t.IsComplex() && t.Size() == 16) {
367                         break
368                 }
369                 v.reset(OpComplexMake)
370                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
371                 v0.AddArg2(ptr, mem)
372                 v1 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
373                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
374                 v2.AuxInt = int64ToAuxInt(8)
375                 v2.AddArg(ptr)
376                 v1.AddArg2(v2, mem)
377                 v.AddArg2(v0, v1)
378                 return true
379         }
380         // match: (Load <t> ptr mem)
381         // cond: t.IsString()
382         // result: (StringMake (Load <typ.BytePtr> ptr mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem))
383         for {
384                 t := v.Type
385                 ptr := v_0
386                 mem := v_1
387                 if !(t.IsString()) {
388                         break
389                 }
390                 v.reset(OpStringMake)
391                 v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
392                 v0.AddArg2(ptr, mem)
393                 v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
394                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
395                 v2.AuxInt = int64ToAuxInt(config.PtrSize)
396                 v2.AddArg(ptr)
397                 v1.AddArg2(v2, mem)
398                 v.AddArg2(v0, v1)
399                 return true
400         }
401         // match: (Load <t> ptr mem)
402         // cond: t.IsSlice()
403         // result: (SliceMake (Load <t.Elem().PtrTo()> ptr mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [2*config.PtrSize] ptr) mem))
404         for {
405                 t := v.Type
406                 ptr := v_0
407                 mem := v_1
408                 if !(t.IsSlice()) {
409                         break
410                 }
411                 v.reset(OpSliceMake)
412                 v0 := b.NewValue0(v.Pos, OpLoad, t.Elem().PtrTo())
413                 v0.AddArg2(ptr, mem)
414                 v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
415                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
416                 v2.AuxInt = int64ToAuxInt(config.PtrSize)
417                 v2.AddArg(ptr)
418                 v1.AddArg2(v2, mem)
419                 v3 := b.NewValue0(v.Pos, OpLoad, typ.Int)
420                 v4 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
421                 v4.AuxInt = int64ToAuxInt(2 * config.PtrSize)
422                 v4.AddArg(ptr)
423                 v3.AddArg2(v4, mem)
424                 v.AddArg3(v0, v1, v3)
425                 return true
426         }
427         // match: (Load <t> ptr mem)
428         // cond: t.IsInterface()
429         // result: (IMake (Load <typ.Uintptr> ptr mem) (Load <typ.BytePtr> (OffPtr <typ.BytePtrPtr> [config.PtrSize] ptr) mem))
430         for {
431                 t := v.Type
432                 ptr := v_0
433                 mem := v_1
434                 if !(t.IsInterface()) {
435                         break
436                 }
437                 v.reset(OpIMake)
438                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Uintptr)
439                 v0.AddArg2(ptr, mem)
440                 v1 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
441                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
442                 v2.AuxInt = int64ToAuxInt(config.PtrSize)
443                 v2.AddArg(ptr)
444                 v1.AddArg2(v2, mem)
445                 v.AddArg2(v0, v1)
446                 return true
447         }
448         return false
449 }
450 func rewriteValuedec_OpSliceCap(v *Value) bool {
451         v_0 := v.Args[0]
452         b := v.Block
453         config := b.Func.Config
454         typ := &b.Func.Config.Types
455         // match: (SliceCap (SliceMake _ _ cap))
456         // result: cap
457         for {
458                 if v_0.Op != OpSliceMake {
459                         break
460                 }
461                 cap := v_0.Args[2]
462                 v.copyOf(cap)
463                 return true
464         }
465         // match: (SliceCap x:(Load <t> ptr mem))
466         // cond: t.IsSlice()
467         // result: @x.Block (Load <typ.Int> (OffPtr <typ.IntPtr> [2*config.PtrSize] ptr) mem)
468         for {
469                 x := v_0
470                 if x.Op != OpLoad {
471                         break
472                 }
473                 t := x.Type
474                 mem := x.Args[1]
475                 ptr := x.Args[0]
476                 if !(t.IsSlice()) {
477                         break
478                 }
479                 b = x.Block
480                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Int)
481                 v.copyOf(v0)
482                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
483                 v1.AuxInt = int64ToAuxInt(2 * config.PtrSize)
484                 v1.AddArg(ptr)
485                 v0.AddArg2(v1, mem)
486                 return true
487         }
488         return false
489 }
490 func rewriteValuedec_OpSliceLen(v *Value) bool {
491         v_0 := v.Args[0]
492         b := v.Block
493         config := b.Func.Config
494         typ := &b.Func.Config.Types
495         // match: (SliceLen (SliceMake _ len _))
496         // result: len
497         for {
498                 if v_0.Op != OpSliceMake {
499                         break
500                 }
501                 len := v_0.Args[1]
502                 v.copyOf(len)
503                 return true
504         }
505         // match: (SliceLen x:(Load <t> ptr mem))
506         // cond: t.IsSlice()
507         // result: @x.Block (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem)
508         for {
509                 x := v_0
510                 if x.Op != OpLoad {
511                         break
512                 }
513                 t := x.Type
514                 mem := x.Args[1]
515                 ptr := x.Args[0]
516                 if !(t.IsSlice()) {
517                         break
518                 }
519                 b = x.Block
520                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Int)
521                 v.copyOf(v0)
522                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
523                 v1.AuxInt = int64ToAuxInt(config.PtrSize)
524                 v1.AddArg(ptr)
525                 v0.AddArg2(v1, mem)
526                 return true
527         }
528         return false
529 }
530 func rewriteValuedec_OpSlicePtr(v *Value) bool {
531         v_0 := v.Args[0]
532         b := v.Block
533         // match: (SlicePtr (SliceMake ptr _ _ ))
534         // result: ptr
535         for {
536                 if v_0.Op != OpSliceMake {
537                         break
538                 }
539                 ptr := v_0.Args[0]
540                 v.copyOf(ptr)
541                 return true
542         }
543         // match: (SlicePtr x:(Load <t> ptr mem))
544         // cond: t.IsSlice()
545         // result: @x.Block (Load <t.Elem().PtrTo()> ptr mem)
546         for {
547                 x := v_0
548                 if x.Op != OpLoad {
549                         break
550                 }
551                 t := x.Type
552                 mem := x.Args[1]
553                 ptr := x.Args[0]
554                 if !(t.IsSlice()) {
555                         break
556                 }
557                 b = x.Block
558                 v0 := b.NewValue0(v.Pos, OpLoad, t.Elem().PtrTo())
559                 v.copyOf(v0)
560                 v0.AddArg2(ptr, mem)
561                 return true
562         }
563         return false
564 }
565 func rewriteValuedec_OpSlicePtrUnchecked(v *Value) bool {
566         v_0 := v.Args[0]
567         // match: (SlicePtrUnchecked (SliceMake ptr _ _ ))
568         // result: ptr
569         for {
570                 if v_0.Op != OpSliceMake {
571                         break
572                 }
573                 ptr := v_0.Args[0]
574                 v.copyOf(ptr)
575                 return true
576         }
577         return false
578 }
579 func rewriteValuedec_OpStore(v *Value) bool {
580         v_2 := v.Args[2]
581         v_1 := v.Args[1]
582         v_0 := v.Args[0]
583         b := v.Block
584         config := b.Func.Config
585         typ := &b.Func.Config.Types
586         // match: (Store {t} dst (ComplexMake real imag) mem)
587         // cond: t.Size() == 8
588         // result: (Store {typ.Float32} (OffPtr <typ.Float32Ptr> [4] dst) imag (Store {typ.Float32} dst real mem))
589         for {
590                 t := auxToType(v.Aux)
591                 dst := v_0
592                 if v_1.Op != OpComplexMake {
593                         break
594                 }
595                 imag := v_1.Args[1]
596                 real := v_1.Args[0]
597                 mem := v_2
598                 if !(t.Size() == 8) {
599                         break
600                 }
601                 v.reset(OpStore)
602                 v.Aux = typeToAux(typ.Float32)
603                 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
604                 v0.AuxInt = int64ToAuxInt(4)
605                 v0.AddArg(dst)
606                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
607                 v1.Aux = typeToAux(typ.Float32)
608                 v1.AddArg3(dst, real, mem)
609                 v.AddArg3(v0, imag, v1)
610                 return true
611         }
612         // match: (Store {t} dst (ComplexMake real imag) mem)
613         // cond: t.Size() == 16
614         // result: (Store {typ.Float64} (OffPtr <typ.Float64Ptr> [8] dst) imag (Store {typ.Float64} dst real mem))
615         for {
616                 t := auxToType(v.Aux)
617                 dst := v_0
618                 if v_1.Op != OpComplexMake {
619                         break
620                 }
621                 imag := v_1.Args[1]
622                 real := v_1.Args[0]
623                 mem := v_2
624                 if !(t.Size() == 16) {
625                         break
626                 }
627                 v.reset(OpStore)
628                 v.Aux = typeToAux(typ.Float64)
629                 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
630                 v0.AuxInt = int64ToAuxInt(8)
631                 v0.AddArg(dst)
632                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
633                 v1.Aux = typeToAux(typ.Float64)
634                 v1.AddArg3(dst, real, mem)
635                 v.AddArg3(v0, imag, v1)
636                 return true
637         }
638         // match: (Store dst (StringMake ptr len) mem)
639         // result: (Store {typ.Int} (OffPtr <typ.IntPtr> [config.PtrSize] dst) len (Store {typ.BytePtr} dst ptr mem))
640         for {
641                 dst := v_0
642                 if v_1.Op != OpStringMake {
643                         break
644                 }
645                 len := v_1.Args[1]
646                 ptr := v_1.Args[0]
647                 mem := v_2
648                 v.reset(OpStore)
649                 v.Aux = typeToAux(typ.Int)
650                 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
651                 v0.AuxInt = int64ToAuxInt(config.PtrSize)
652                 v0.AddArg(dst)
653                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
654                 v1.Aux = typeToAux(typ.BytePtr)
655                 v1.AddArg3(dst, ptr, mem)
656                 v.AddArg3(v0, len, v1)
657                 return true
658         }
659         // match: (Store {t} dst (SliceMake ptr len cap) mem)
660         // result: (Store {typ.Int} (OffPtr <typ.IntPtr> [2*config.PtrSize] dst) cap (Store {typ.Int} (OffPtr <typ.IntPtr> [config.PtrSize] dst) len (Store {t.Elem().PtrTo()} dst ptr mem)))
661         for {
662                 t := auxToType(v.Aux)
663                 dst := v_0
664                 if v_1.Op != OpSliceMake {
665                         break
666                 }
667                 cap := v_1.Args[2]
668                 ptr := v_1.Args[0]
669                 len := v_1.Args[1]
670                 mem := v_2
671                 v.reset(OpStore)
672                 v.Aux = typeToAux(typ.Int)
673                 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
674                 v0.AuxInt = int64ToAuxInt(2 * config.PtrSize)
675                 v0.AddArg(dst)
676                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
677                 v1.Aux = typeToAux(typ.Int)
678                 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
679                 v2.AuxInt = int64ToAuxInt(config.PtrSize)
680                 v2.AddArg(dst)
681                 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
682                 v3.Aux = typeToAux(t.Elem().PtrTo())
683                 v3.AddArg3(dst, ptr, mem)
684                 v1.AddArg3(v2, len, v3)
685                 v.AddArg3(v0, cap, v1)
686                 return true
687         }
688         // match: (Store dst (IMake itab data) mem)
689         // result: (Store {typ.BytePtr} (OffPtr <typ.BytePtrPtr> [config.PtrSize] dst) data (Store {typ.Uintptr} dst itab mem))
690         for {
691                 dst := v_0
692                 if v_1.Op != OpIMake {
693                         break
694                 }
695                 data := v_1.Args[1]
696                 itab := v_1.Args[0]
697                 mem := v_2
698                 v.reset(OpStore)
699                 v.Aux = typeToAux(typ.BytePtr)
700                 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
701                 v0.AuxInt = int64ToAuxInt(config.PtrSize)
702                 v0.AddArg(dst)
703                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
704                 v1.Aux = typeToAux(typ.Uintptr)
705                 v1.AddArg3(dst, itab, mem)
706                 v.AddArg3(v0, data, v1)
707                 return true
708         }
709         // match: (Store dst (StructMake1 <t> f0) mem)
710         // result: (Store {t.FieldType(0)} (OffPtr <t.FieldType(0).PtrTo()> [0] dst) f0 mem)
711         for {
712                 dst := v_0
713                 if v_1.Op != OpStructMake1 {
714                         break
715                 }
716                 t := v_1.Type
717                 f0 := v_1.Args[0]
718                 mem := v_2
719                 v.reset(OpStore)
720                 v.Aux = typeToAux(t.FieldType(0))
721                 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo())
722                 v0.AuxInt = int64ToAuxInt(0)
723                 v0.AddArg(dst)
724                 v.AddArg3(v0, f0, mem)
725                 return true
726         }
727         // match: (Store dst (StructMake2 <t> f0 f1) mem)
728         // result: (Store {t.FieldType(1)} (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store {t.FieldType(0)} (OffPtr <t.FieldType(0).PtrTo()> [0] dst) f0 mem))
729         for {
730                 dst := v_0
731                 if v_1.Op != OpStructMake2 {
732                         break
733                 }
734                 t := v_1.Type
735                 f1 := v_1.Args[1]
736                 f0 := v_1.Args[0]
737                 mem := v_2
738                 v.reset(OpStore)
739                 v.Aux = typeToAux(t.FieldType(1))
740                 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo())
741                 v0.AuxInt = int64ToAuxInt(t.FieldOff(1))
742                 v0.AddArg(dst)
743                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
744                 v1.Aux = typeToAux(t.FieldType(0))
745                 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo())
746                 v2.AuxInt = int64ToAuxInt(0)
747                 v2.AddArg(dst)
748                 v1.AddArg3(v2, f0, mem)
749                 v.AddArg3(v0, f1, v1)
750                 return true
751         }
752         // match: (Store dst (StructMake3 <t> f0 f1 f2) mem)
753         // result: (Store {t.FieldType(2)} (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] dst) f2 (Store {t.FieldType(1)} (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store {t.FieldType(0)} (OffPtr <t.FieldType(0).PtrTo()> [0] dst) f0 mem)))
754         for {
755                 dst := v_0
756                 if v_1.Op != OpStructMake3 {
757                         break
758                 }
759                 t := v_1.Type
760                 f2 := v_1.Args[2]
761                 f0 := v_1.Args[0]
762                 f1 := v_1.Args[1]
763                 mem := v_2
764                 v.reset(OpStore)
765                 v.Aux = typeToAux(t.FieldType(2))
766                 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(2).PtrTo())
767                 v0.AuxInt = int64ToAuxInt(t.FieldOff(2))
768                 v0.AddArg(dst)
769                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
770                 v1.Aux = typeToAux(t.FieldType(1))
771                 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo())
772                 v2.AuxInt = int64ToAuxInt(t.FieldOff(1))
773                 v2.AddArg(dst)
774                 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
775                 v3.Aux = typeToAux(t.FieldType(0))
776                 v4 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo())
777                 v4.AuxInt = int64ToAuxInt(0)
778                 v4.AddArg(dst)
779                 v3.AddArg3(v4, f0, mem)
780                 v1.AddArg3(v2, f1, v3)
781                 v.AddArg3(v0, f2, v1)
782                 return true
783         }
784         // match: (Store dst (StructMake4 <t> f0 f1 f2 f3) mem)
785         // result: (Store {t.FieldType(3)} (OffPtr <t.FieldType(3).PtrTo()> [t.FieldOff(3)] dst) f3 (Store {t.FieldType(2)} (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] dst) f2 (Store {t.FieldType(1)} (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store {t.FieldType(0)} (OffPtr <t.FieldType(0).PtrTo()> [0] dst) f0 mem))))
786         for {
787                 dst := v_0
788                 if v_1.Op != OpStructMake4 {
789                         break
790                 }
791                 t := v_1.Type
792                 f3 := v_1.Args[3]
793                 f0 := v_1.Args[0]
794                 f1 := v_1.Args[1]
795                 f2 := v_1.Args[2]
796                 mem := v_2
797                 v.reset(OpStore)
798                 v.Aux = typeToAux(t.FieldType(3))
799                 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(3).PtrTo())
800                 v0.AuxInt = int64ToAuxInt(t.FieldOff(3))
801                 v0.AddArg(dst)
802                 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
803                 v1.Aux = typeToAux(t.FieldType(2))
804                 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(2).PtrTo())
805                 v2.AuxInt = int64ToAuxInt(t.FieldOff(2))
806                 v2.AddArg(dst)
807                 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
808                 v3.Aux = typeToAux(t.FieldType(1))
809                 v4 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo())
810                 v4.AuxInt = int64ToAuxInt(t.FieldOff(1))
811                 v4.AddArg(dst)
812                 v5 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
813                 v5.Aux = typeToAux(t.FieldType(0))
814                 v6 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo())
815                 v6.AuxInt = int64ToAuxInt(0)
816                 v6.AddArg(dst)
817                 v5.AddArg3(v6, f0, mem)
818                 v3.AddArg3(v4, f1, v5)
819                 v1.AddArg3(v2, f2, v3)
820                 v.AddArg3(v0, f3, v1)
821                 return true
822         }
823         // match: (Store dst (ArrayMake1 e) mem)
824         // result: (Store {e.Type} dst e mem)
825         for {
826                 dst := v_0
827                 if v_1.Op != OpArrayMake1 {
828                         break
829                 }
830                 e := v_1.Args[0]
831                 mem := v_2
832                 v.reset(OpStore)
833                 v.Aux = typeToAux(e.Type)
834                 v.AddArg3(dst, e, mem)
835                 return true
836         }
837         return false
838 }
839 func rewriteValuedec_OpStringLen(v *Value) bool {
840         v_0 := v.Args[0]
841         b := v.Block
842         config := b.Func.Config
843         typ := &b.Func.Config.Types
844         // match: (StringLen (StringMake _ len))
845         // result: len
846         for {
847                 if v_0.Op != OpStringMake {
848                         break
849                 }
850                 len := v_0.Args[1]
851                 v.copyOf(len)
852                 return true
853         }
854         // match: (StringLen x:(Load <t> ptr mem))
855         // cond: t.IsString()
856         // result: @x.Block (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem)
857         for {
858                 x := v_0
859                 if x.Op != OpLoad {
860                         break
861                 }
862                 t := x.Type
863                 mem := x.Args[1]
864                 ptr := x.Args[0]
865                 if !(t.IsString()) {
866                         break
867                 }
868                 b = x.Block
869                 v0 := b.NewValue0(v.Pos, OpLoad, typ.Int)
870                 v.copyOf(v0)
871                 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
872                 v1.AuxInt = int64ToAuxInt(config.PtrSize)
873                 v1.AddArg(ptr)
874                 v0.AddArg2(v1, mem)
875                 return true
876         }
877         return false
878 }
879 func rewriteValuedec_OpStringPtr(v *Value) bool {
880         v_0 := v.Args[0]
881         b := v.Block
882         typ := &b.Func.Config.Types
883         // match: (StringPtr (StringMake ptr _))
884         // result: ptr
885         for {
886                 if v_0.Op != OpStringMake {
887                         break
888                 }
889                 ptr := v_0.Args[0]
890                 v.copyOf(ptr)
891                 return true
892         }
893         // match: (StringPtr x:(Load <t> ptr mem))
894         // cond: t.IsString()
895         // result: @x.Block (Load <typ.BytePtr> ptr mem)
896         for {
897                 x := v_0
898                 if x.Op != OpLoad {
899                         break
900                 }
901                 t := x.Type
902                 mem := x.Args[1]
903                 ptr := x.Args[0]
904                 if !(t.IsString()) {
905                         break
906                 }
907                 b = x.Block
908                 v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
909                 v.copyOf(v0)
910                 v0.AddArg2(ptr, mem)
911                 return true
912         }
913         return false
914 }
915 func rewriteValuedec_OpStructMake1(v *Value) bool {
916         v_0 := v.Args[0]
917         // match: (StructMake1 x)
918         // cond: x.Type.IsPtr()
919         // result: x
920         for {
921                 x := v_0
922                 if !(x.Type.IsPtr()) {
923                         break
924                 }
925                 v.copyOf(x)
926                 return true
927         }
928         return false
929 }
930 func rewriteValuedec_OpStructSelect(v *Value) bool {
931         v_0 := v.Args[0]
932         b := v.Block
933         // match: (StructSelect [0] (IData x))
934         // result: (IData x)
935         for {
936                 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpIData {
937                         break
938                 }
939                 x := v_0.Args[0]
940                 v.reset(OpIData)
941                 v.AddArg(x)
942                 return true
943         }
944         // match: (StructSelect (StructMake1 x))
945         // result: x
946         for {
947                 if v_0.Op != OpStructMake1 {
948                         break
949                 }
950                 x := v_0.Args[0]
951                 v.copyOf(x)
952                 return true
953         }
954         // match: (StructSelect [0] (StructMake2 x _))
955         // result: x
956         for {
957                 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake2 {
958                         break
959                 }
960                 x := v_0.Args[0]
961                 v.copyOf(x)
962                 return true
963         }
964         // match: (StructSelect [1] (StructMake2 _ x))
965         // result: x
966         for {
967                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake2 {
968                         break
969                 }
970                 x := v_0.Args[1]
971                 v.copyOf(x)
972                 return true
973         }
974         // match: (StructSelect [0] (StructMake3 x _ _))
975         // result: x
976         for {
977                 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake3 {
978                         break
979                 }
980                 x := v_0.Args[0]
981                 v.copyOf(x)
982                 return true
983         }
984         // match: (StructSelect [1] (StructMake3 _ x _))
985         // result: x
986         for {
987                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake3 {
988                         break
989                 }
990                 x := v_0.Args[1]
991                 v.copyOf(x)
992                 return true
993         }
994         // match: (StructSelect [2] (StructMake3 _ _ x))
995         // result: x
996         for {
997                 if auxIntToInt64(v.AuxInt) != 2 || v_0.Op != OpStructMake3 {
998                         break
999                 }
1000                 x := v_0.Args[2]
1001                 v.copyOf(x)
1002                 return true
1003         }
1004         // match: (StructSelect [0] (StructMake4 x _ _ _))
1005         // result: x
1006         for {
1007                 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake4 {
1008                         break
1009                 }
1010                 x := v_0.Args[0]
1011                 v.copyOf(x)
1012                 return true
1013         }
1014         // match: (StructSelect [1] (StructMake4 _ x _ _))
1015         // result: x
1016         for {
1017                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake4 {
1018                         break
1019                 }
1020                 x := v_0.Args[1]
1021                 v.copyOf(x)
1022                 return true
1023         }
1024         // match: (StructSelect [2] (StructMake4 _ _ x _))
1025         // result: x
1026         for {
1027                 if auxIntToInt64(v.AuxInt) != 2 || v_0.Op != OpStructMake4 {
1028                         break
1029                 }
1030                 x := v_0.Args[2]
1031                 v.copyOf(x)
1032                 return true
1033         }
1034         // match: (StructSelect [3] (StructMake4 _ _ _ x))
1035         // result: x
1036         for {
1037                 if auxIntToInt64(v.AuxInt) != 3 || v_0.Op != OpStructMake4 {
1038                         break
1039                 }
1040                 x := v_0.Args[3]
1041                 v.copyOf(x)
1042                 return true
1043         }
1044         // match: (StructSelect [0] x)
1045         // cond: x.Type.IsPtr()
1046         // result: x
1047         for {
1048                 if auxIntToInt64(v.AuxInt) != 0 {
1049                         break
1050                 }
1051                 x := v_0
1052                 if !(x.Type.IsPtr()) {
1053                         break
1054                 }
1055                 v.copyOf(x)
1056                 return true
1057         }
1058         // match: (StructSelect [i] x:(Load <t> ptr mem))
1059         // result: @x.Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.FieldOff(int(i))] ptr) mem)
1060         for {
1061                 i := auxIntToInt64(v.AuxInt)
1062                 x := v_0
1063                 if x.Op != OpLoad {
1064                         break
1065                 }
1066                 t := x.Type
1067                 mem := x.Args[1]
1068                 ptr := x.Args[0]
1069                 b = x.Block
1070                 v0 := b.NewValue0(v.Pos, OpLoad, v.Type)
1071                 v.copyOf(v0)
1072                 v1 := b.NewValue0(v.Pos, OpOffPtr, v.Type.PtrTo())
1073                 v1.AuxInt = int64ToAuxInt(t.FieldOff(int(i)))
1074                 v1.AddArg(ptr)
1075                 v0.AddArg2(v1, mem)
1076                 return true
1077         }
1078         return false
1079 }
1080 func rewriteBlockdec(b *Block) bool {
1081         return false
1082 }