github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/ssa/rewritedec.go (about) 1 // Code generated from _gen/dec.rules using 'go generate'; DO NOT EDIT. 2 3 package ssa 4 5 import "github.com/go-asm/go/cmd/compile/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.IsPtrShaped() 50 // result: x 51 for { 52 x := v_0 53 if !(x.Type.IsPtrShaped()) { 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.IsPtrShaped() 66 // result: x 67 for { 68 if auxIntToInt64(v.AuxInt) != 0 { 69 break 70 } 71 x := v_0 72 if !(x.Type.IsPtrShaped()) { 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} _ _ mem) 587 // cond: t.Size() == 0 588 // result: mem 589 for { 590 t := auxToType(v.Aux) 591 mem := v_2 592 if !(t.Size() == 0) { 593 break 594 } 595 v.copyOf(mem) 596 return true 597 } 598 // match: (Store {t} dst (ComplexMake real imag) mem) 599 // cond: t.Size() == 8 600 // result: (Store {typ.Float32} (OffPtr <typ.Float32Ptr> [4] dst) imag (Store {typ.Float32} dst real mem)) 601 for { 602 t := auxToType(v.Aux) 603 dst := v_0 604 if v_1.Op != OpComplexMake { 605 break 606 } 607 imag := v_1.Args[1] 608 real := v_1.Args[0] 609 mem := v_2 610 if !(t.Size() == 8) { 611 break 612 } 613 v.reset(OpStore) 614 v.Aux = typeToAux(typ.Float32) 615 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr) 616 v0.AuxInt = int64ToAuxInt(4) 617 v0.AddArg(dst) 618 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 619 v1.Aux = typeToAux(typ.Float32) 620 v1.AddArg3(dst, real, mem) 621 v.AddArg3(v0, imag, v1) 622 return true 623 } 624 // match: (Store {t} dst (ComplexMake real imag) mem) 625 // cond: t.Size() == 16 626 // result: (Store {typ.Float64} (OffPtr <typ.Float64Ptr> [8] dst) imag (Store {typ.Float64} dst real mem)) 627 for { 628 t := auxToType(v.Aux) 629 dst := v_0 630 if v_1.Op != OpComplexMake { 631 break 632 } 633 imag := v_1.Args[1] 634 real := v_1.Args[0] 635 mem := v_2 636 if !(t.Size() == 16) { 637 break 638 } 639 v.reset(OpStore) 640 v.Aux = typeToAux(typ.Float64) 641 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr) 642 v0.AuxInt = int64ToAuxInt(8) 643 v0.AddArg(dst) 644 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 645 v1.Aux = typeToAux(typ.Float64) 646 v1.AddArg3(dst, real, mem) 647 v.AddArg3(v0, imag, v1) 648 return true 649 } 650 // match: (Store dst (StringMake ptr len) mem) 651 // result: (Store {typ.Int} (OffPtr <typ.IntPtr> [config.PtrSize] dst) len (Store {typ.BytePtr} dst ptr mem)) 652 for { 653 dst := v_0 654 if v_1.Op != OpStringMake { 655 break 656 } 657 len := v_1.Args[1] 658 ptr := v_1.Args[0] 659 mem := v_2 660 v.reset(OpStore) 661 v.Aux = typeToAux(typ.Int) 662 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr) 663 v0.AuxInt = int64ToAuxInt(config.PtrSize) 664 v0.AddArg(dst) 665 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 666 v1.Aux = typeToAux(typ.BytePtr) 667 v1.AddArg3(dst, ptr, mem) 668 v.AddArg3(v0, len, v1) 669 return true 670 } 671 // match: (Store {t} dst (SliceMake ptr len cap) mem) 672 // 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))) 673 for { 674 t := auxToType(v.Aux) 675 dst := v_0 676 if v_1.Op != OpSliceMake { 677 break 678 } 679 cap := v_1.Args[2] 680 ptr := v_1.Args[0] 681 len := v_1.Args[1] 682 mem := v_2 683 v.reset(OpStore) 684 v.Aux = typeToAux(typ.Int) 685 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr) 686 v0.AuxInt = int64ToAuxInt(2 * config.PtrSize) 687 v0.AddArg(dst) 688 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 689 v1.Aux = typeToAux(typ.Int) 690 v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr) 691 v2.AuxInt = int64ToAuxInt(config.PtrSize) 692 v2.AddArg(dst) 693 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 694 v3.Aux = typeToAux(t.Elem().PtrTo()) 695 v3.AddArg3(dst, ptr, mem) 696 v1.AddArg3(v2, len, v3) 697 v.AddArg3(v0, cap, v1) 698 return true 699 } 700 // match: (Store dst (IMake itab data) mem) 701 // result: (Store {typ.BytePtr} (OffPtr <typ.BytePtrPtr> [config.PtrSize] dst) data (Store {typ.Uintptr} dst itab mem)) 702 for { 703 dst := v_0 704 if v_1.Op != OpIMake { 705 break 706 } 707 data := v_1.Args[1] 708 itab := v_1.Args[0] 709 mem := v_2 710 v.reset(OpStore) 711 v.Aux = typeToAux(typ.BytePtr) 712 v0 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr) 713 v0.AuxInt = int64ToAuxInt(config.PtrSize) 714 v0.AddArg(dst) 715 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 716 v1.Aux = typeToAux(typ.Uintptr) 717 v1.AddArg3(dst, itab, mem) 718 v.AddArg3(v0, data, v1) 719 return true 720 } 721 // match: (Store dst (StructMake1 <t> f0) mem) 722 // result: (Store {t.FieldType(0)} (OffPtr <t.FieldType(0).PtrTo()> [0] dst) f0 mem) 723 for { 724 dst := v_0 725 if v_1.Op != OpStructMake1 { 726 break 727 } 728 t := v_1.Type 729 f0 := v_1.Args[0] 730 mem := v_2 731 v.reset(OpStore) 732 v.Aux = typeToAux(t.FieldType(0)) 733 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo()) 734 v0.AuxInt = int64ToAuxInt(0) 735 v0.AddArg(dst) 736 v.AddArg3(v0, f0, mem) 737 return true 738 } 739 // match: (Store dst (StructMake2 <t> f0 f1) mem) 740 // 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)) 741 for { 742 dst := v_0 743 if v_1.Op != OpStructMake2 { 744 break 745 } 746 t := v_1.Type 747 f1 := v_1.Args[1] 748 f0 := v_1.Args[0] 749 mem := v_2 750 v.reset(OpStore) 751 v.Aux = typeToAux(t.FieldType(1)) 752 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo()) 753 v0.AuxInt = int64ToAuxInt(t.FieldOff(1)) 754 v0.AddArg(dst) 755 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 756 v1.Aux = typeToAux(t.FieldType(0)) 757 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo()) 758 v2.AuxInt = int64ToAuxInt(0) 759 v2.AddArg(dst) 760 v1.AddArg3(v2, f0, mem) 761 v.AddArg3(v0, f1, v1) 762 return true 763 } 764 // match: (Store dst (StructMake3 <t> f0 f1 f2) mem) 765 // 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))) 766 for { 767 dst := v_0 768 if v_1.Op != OpStructMake3 { 769 break 770 } 771 t := v_1.Type 772 f2 := v_1.Args[2] 773 f0 := v_1.Args[0] 774 f1 := v_1.Args[1] 775 mem := v_2 776 v.reset(OpStore) 777 v.Aux = typeToAux(t.FieldType(2)) 778 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(2).PtrTo()) 779 v0.AuxInt = int64ToAuxInt(t.FieldOff(2)) 780 v0.AddArg(dst) 781 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 782 v1.Aux = typeToAux(t.FieldType(1)) 783 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo()) 784 v2.AuxInt = int64ToAuxInt(t.FieldOff(1)) 785 v2.AddArg(dst) 786 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 787 v3.Aux = typeToAux(t.FieldType(0)) 788 v4 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo()) 789 v4.AuxInt = int64ToAuxInt(0) 790 v4.AddArg(dst) 791 v3.AddArg3(v4, f0, mem) 792 v1.AddArg3(v2, f1, v3) 793 v.AddArg3(v0, f2, v1) 794 return true 795 } 796 // match: (Store dst (StructMake4 <t> f0 f1 f2 f3) mem) 797 // 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)))) 798 for { 799 dst := v_0 800 if v_1.Op != OpStructMake4 { 801 break 802 } 803 t := v_1.Type 804 f3 := v_1.Args[3] 805 f0 := v_1.Args[0] 806 f1 := v_1.Args[1] 807 f2 := v_1.Args[2] 808 mem := v_2 809 v.reset(OpStore) 810 v.Aux = typeToAux(t.FieldType(3)) 811 v0 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(3).PtrTo()) 812 v0.AuxInt = int64ToAuxInt(t.FieldOff(3)) 813 v0.AddArg(dst) 814 v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 815 v1.Aux = typeToAux(t.FieldType(2)) 816 v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(2).PtrTo()) 817 v2.AuxInt = int64ToAuxInt(t.FieldOff(2)) 818 v2.AddArg(dst) 819 v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 820 v3.Aux = typeToAux(t.FieldType(1)) 821 v4 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(1).PtrTo()) 822 v4.AuxInt = int64ToAuxInt(t.FieldOff(1)) 823 v4.AddArg(dst) 824 v5 := b.NewValue0(v.Pos, OpStore, types.TypeMem) 825 v5.Aux = typeToAux(t.FieldType(0)) 826 v6 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo()) 827 v6.AuxInt = int64ToAuxInt(0) 828 v6.AddArg(dst) 829 v5.AddArg3(v6, f0, mem) 830 v3.AddArg3(v4, f1, v5) 831 v1.AddArg3(v2, f2, v3) 832 v.AddArg3(v0, f3, v1) 833 return true 834 } 835 // match: (Store dst (ArrayMake1 e) mem) 836 // result: (Store {e.Type} dst e mem) 837 for { 838 dst := v_0 839 if v_1.Op != OpArrayMake1 { 840 break 841 } 842 e := v_1.Args[0] 843 mem := v_2 844 v.reset(OpStore) 845 v.Aux = typeToAux(e.Type) 846 v.AddArg3(dst, e, mem) 847 return true 848 } 849 return false 850 } 851 func rewriteValuedec_OpStringLen(v *Value) bool { 852 v_0 := v.Args[0] 853 b := v.Block 854 config := b.Func.Config 855 typ := &b.Func.Config.Types 856 // match: (StringLen (StringMake _ len)) 857 // result: len 858 for { 859 if v_0.Op != OpStringMake { 860 break 861 } 862 len := v_0.Args[1] 863 v.copyOf(len) 864 return true 865 } 866 // match: (StringLen x:(Load <t> ptr mem)) 867 // cond: t.IsString() 868 // result: @x.Block (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem) 869 for { 870 x := v_0 871 if x.Op != OpLoad { 872 break 873 } 874 t := x.Type 875 mem := x.Args[1] 876 ptr := x.Args[0] 877 if !(t.IsString()) { 878 break 879 } 880 b = x.Block 881 v0 := b.NewValue0(v.Pos, OpLoad, typ.Int) 882 v.copyOf(v0) 883 v1 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr) 884 v1.AuxInt = int64ToAuxInt(config.PtrSize) 885 v1.AddArg(ptr) 886 v0.AddArg2(v1, mem) 887 return true 888 } 889 return false 890 } 891 func rewriteValuedec_OpStringPtr(v *Value) bool { 892 v_0 := v.Args[0] 893 b := v.Block 894 typ := &b.Func.Config.Types 895 // match: (StringPtr (StringMake ptr _)) 896 // result: ptr 897 for { 898 if v_0.Op != OpStringMake { 899 break 900 } 901 ptr := v_0.Args[0] 902 v.copyOf(ptr) 903 return true 904 } 905 // match: (StringPtr x:(Load <t> ptr mem)) 906 // cond: t.IsString() 907 // result: @x.Block (Load <typ.BytePtr> ptr mem) 908 for { 909 x := v_0 910 if x.Op != OpLoad { 911 break 912 } 913 t := x.Type 914 mem := x.Args[1] 915 ptr := x.Args[0] 916 if !(t.IsString()) { 917 break 918 } 919 b = x.Block 920 v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr) 921 v.copyOf(v0) 922 v0.AddArg2(ptr, mem) 923 return true 924 } 925 return false 926 } 927 func rewriteValuedec_OpStructMake1(v *Value) bool { 928 v_0 := v.Args[0] 929 // match: (StructMake1 x) 930 // cond: x.Type.IsPtrShaped() 931 // result: x 932 for { 933 x := v_0 934 if !(x.Type.IsPtrShaped()) { 935 break 936 } 937 v.copyOf(x) 938 return true 939 } 940 return false 941 } 942 func rewriteValuedec_OpStructSelect(v *Value) bool { 943 v_0 := v.Args[0] 944 b := v.Block 945 // match: (StructSelect [0] (IData x)) 946 // result: (IData x) 947 for { 948 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpIData { 949 break 950 } 951 x := v_0.Args[0] 952 v.reset(OpIData) 953 v.AddArg(x) 954 return true 955 } 956 // match: (StructSelect (StructMake1 x)) 957 // result: x 958 for { 959 if v_0.Op != OpStructMake1 { 960 break 961 } 962 x := v_0.Args[0] 963 v.copyOf(x) 964 return true 965 } 966 // match: (StructSelect [0] (StructMake2 x _)) 967 // result: x 968 for { 969 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake2 { 970 break 971 } 972 x := v_0.Args[0] 973 v.copyOf(x) 974 return true 975 } 976 // match: (StructSelect [1] (StructMake2 _ x)) 977 // result: x 978 for { 979 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake2 { 980 break 981 } 982 x := v_0.Args[1] 983 v.copyOf(x) 984 return true 985 } 986 // match: (StructSelect [0] (StructMake3 x _ _)) 987 // result: x 988 for { 989 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake3 { 990 break 991 } 992 x := v_0.Args[0] 993 v.copyOf(x) 994 return true 995 } 996 // match: (StructSelect [1] (StructMake3 _ x _)) 997 // result: x 998 for { 999 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake3 { 1000 break 1001 } 1002 x := v_0.Args[1] 1003 v.copyOf(x) 1004 return true 1005 } 1006 // match: (StructSelect [2] (StructMake3 _ _ x)) 1007 // result: x 1008 for { 1009 if auxIntToInt64(v.AuxInt) != 2 || v_0.Op != OpStructMake3 { 1010 break 1011 } 1012 x := v_0.Args[2] 1013 v.copyOf(x) 1014 return true 1015 } 1016 // match: (StructSelect [0] (StructMake4 x _ _ _)) 1017 // result: x 1018 for { 1019 if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpStructMake4 { 1020 break 1021 } 1022 x := v_0.Args[0] 1023 v.copyOf(x) 1024 return true 1025 } 1026 // match: (StructSelect [1] (StructMake4 _ x _ _)) 1027 // result: x 1028 for { 1029 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpStructMake4 { 1030 break 1031 } 1032 x := v_0.Args[1] 1033 v.copyOf(x) 1034 return true 1035 } 1036 // match: (StructSelect [2] (StructMake4 _ _ x _)) 1037 // result: x 1038 for { 1039 if auxIntToInt64(v.AuxInt) != 2 || v_0.Op != OpStructMake4 { 1040 break 1041 } 1042 x := v_0.Args[2] 1043 v.copyOf(x) 1044 return true 1045 } 1046 // match: (StructSelect [3] (StructMake4 _ _ _ x)) 1047 // result: x 1048 for { 1049 if auxIntToInt64(v.AuxInt) != 3 || v_0.Op != OpStructMake4 { 1050 break 1051 } 1052 x := v_0.Args[3] 1053 v.copyOf(x) 1054 return true 1055 } 1056 // match: (StructSelect [0] x) 1057 // cond: x.Type.IsPtrShaped() 1058 // result: x 1059 for { 1060 if auxIntToInt64(v.AuxInt) != 0 { 1061 break 1062 } 1063 x := v_0 1064 if !(x.Type.IsPtrShaped()) { 1065 break 1066 } 1067 v.copyOf(x) 1068 return true 1069 } 1070 // match: (StructSelect [i] x:(Load <t> ptr mem)) 1071 // result: @x.Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.FieldOff(int(i))] ptr) mem) 1072 for { 1073 i := auxIntToInt64(v.AuxInt) 1074 x := v_0 1075 if x.Op != OpLoad { 1076 break 1077 } 1078 t := x.Type 1079 mem := x.Args[1] 1080 ptr := x.Args[0] 1081 b = x.Block 1082 v0 := b.NewValue0(v.Pos, OpLoad, v.Type) 1083 v.copyOf(v0) 1084 v1 := b.NewValue0(v.Pos, OpOffPtr, v.Type.PtrTo()) 1085 v1.AuxInt = int64ToAuxInt(t.FieldOff(int(i))) 1086 v1.AddArg(ptr) 1087 v0.AddArg2(v1, mem) 1088 return true 1089 } 1090 return false 1091 } 1092 func rewriteBlockdec(b *Block) bool { 1093 return false 1094 }