@@ -855,7 +855,7 @@ func storeOneArg(x *expandState, pos src.XPos, b *Block, locs []*LocalSlot, suff
855
855
// storeOneLoad creates a decomposed (one step) load that is then stored.
856
856
func storeOneLoad (x * expandState , pos src.XPos , b * Block , source , mem * Value , t * types.Type , offArg , offStore int64 , loadRegOffset Abi1RO , storeRc registerCursor ) * Value {
857
857
from := x .offsetFrom (source .Block , source .Args [0 ], offArg , types .NewPtr (t ))
858
- w := source . Block .NewValue2 (source .Pos , OpLoad , t , from , mem )
858
+ w := b .NewValue2 (source .Pos , OpLoad , t , from , mem )
859
859
return x .storeArgOrLoad (pos , b , w , mem , t , offStore , loadRegOffset , storeRc )
860
860
}
861
861
@@ -962,7 +962,7 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, source, mem *Value,
962
962
eltRO := x .regWidth (elt )
963
963
source .Type = t
964
964
for i := int64 (0 ); i < t .NumElem (); i ++ {
965
- sel := source . Block .NewValue1I (pos , OpArraySelect , elt , i , source )
965
+ sel := b .NewValue1I (pos , OpArraySelect , elt , i , source )
966
966
mem = x .storeArgOrLoad (pos , b , sel , mem , elt , storeOffset + i * elt .Size (), loadRegOffset , storeRc .at (t , 0 ))
967
967
loadRegOffset += eltRO
968
968
pos = pos .WithNotStmt ()
@@ -997,7 +997,7 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, source, mem *Value,
997
997
source .Type = t
998
998
for i := 0 ; i < t .NumFields (); i ++ {
999
999
fld := t .Field (i )
1000
- sel := source . Block .NewValue1I (pos , OpStructSelect , fld .Type , int64 (i ), source )
1000
+ sel := b .NewValue1I (pos , OpStructSelect , fld .Type , int64 (i ), source )
1001
1001
mem = x .storeArgOrLoad (pos , b , sel , mem , fld .Type , storeOffset + fld .Offset , loadRegOffset , storeRc .next (fld .Type ))
1002
1002
loadRegOffset += x .regWidth (fld .Type )
1003
1003
pos = pos .WithNotStmt ()
@@ -1009,48 +1009,48 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, source, mem *Value,
1009
1009
break
1010
1010
}
1011
1011
tHi , tLo := x .intPairTypes (t .Kind ())
1012
- sel := source . Block .NewValue1 (pos , OpInt64Hi , tHi , source )
1012
+ sel := b .NewValue1 (pos , OpInt64Hi , tHi , source )
1013
1013
mem = x .storeArgOrLoad (pos , b , sel , mem , tHi , storeOffset + x .hiOffset , loadRegOffset + x .hiRo , storeRc .plus (x .hiRo ))
1014
1014
pos = pos .WithNotStmt ()
1015
- sel = source . Block .NewValue1 (pos , OpInt64Lo , tLo , source )
1015
+ sel = b .NewValue1 (pos , OpInt64Lo , tLo , source )
1016
1016
return x .storeArgOrLoad (pos , b , sel , mem , tLo , storeOffset + x .lowOffset , loadRegOffset + x .loRo , storeRc .plus (x .hiRo ))
1017
1017
1018
1018
case types .TINTER :
1019
- sel := source . Block .NewValue1 (pos , OpITab , x .typs .BytePtr , source )
1019
+ sel := b .NewValue1 (pos , OpITab , x .typs .BytePtr , source )
1020
1020
mem = x .storeArgOrLoad (pos , b , sel , mem , x .typs .BytePtr , storeOffset , loadRegOffset , storeRc .next (x .typs .BytePtr ))
1021
1021
pos = pos .WithNotStmt ()
1022
- sel = source . Block .NewValue1 (pos , OpIData , x .typs .BytePtr , source )
1022
+ sel = b .NewValue1 (pos , OpIData , x .typs .BytePtr , source )
1023
1023
return x .storeArgOrLoad (pos , b , sel , mem , x .typs .BytePtr , storeOffset + x .ptrSize , loadRegOffset + RO_iface_data , storeRc )
1024
1024
1025
1025
case types .TSTRING :
1026
- sel := source . Block .NewValue1 (pos , OpStringPtr , x .typs .BytePtr , source )
1026
+ sel := b .NewValue1 (pos , OpStringPtr , x .typs .BytePtr , source )
1027
1027
mem = x .storeArgOrLoad (pos , b , sel , mem , x .typs .BytePtr , storeOffset , loadRegOffset , storeRc .next (x .typs .BytePtr ))
1028
1028
pos = pos .WithNotStmt ()
1029
- sel = source . Block .NewValue1 (pos , OpStringLen , x .typs .Int , source )
1029
+ sel = b .NewValue1 (pos , OpStringLen , x .typs .Int , source )
1030
1030
return x .storeArgOrLoad (pos , b , sel , mem , x .typs .Int , storeOffset + x .ptrSize , loadRegOffset + RO_string_len , storeRc )
1031
1031
1032
1032
case types .TSLICE :
1033
1033
et := types .NewPtr (t .Elem ())
1034
- sel := source . Block .NewValue1 (pos , OpSlicePtr , et , source )
1034
+ sel := b .NewValue1 (pos , OpSlicePtr , et , source )
1035
1035
mem = x .storeArgOrLoad (pos , b , sel , mem , et , storeOffset , loadRegOffset , storeRc .next (et ))
1036
1036
pos = pos .WithNotStmt ()
1037
- sel = source . Block .NewValue1 (pos , OpSliceLen , x .typs .Int , source )
1037
+ sel = b .NewValue1 (pos , OpSliceLen , x .typs .Int , source )
1038
1038
mem = x .storeArgOrLoad (pos , b , sel , mem , x .typs .Int , storeOffset + x .ptrSize , loadRegOffset + RO_slice_len , storeRc .next (x .typs .Int ))
1039
- sel = source . Block .NewValue1 (pos , OpSliceCap , x .typs .Int , source )
1039
+ sel = b .NewValue1 (pos , OpSliceCap , x .typs .Int , source )
1040
1040
return x .storeArgOrLoad (pos , b , sel , mem , x .typs .Int , storeOffset + 2 * x .ptrSize , loadRegOffset + RO_slice_cap , storeRc )
1041
1041
1042
1042
case types .TCOMPLEX64 :
1043
- sel := source . Block .NewValue1 (pos , OpComplexReal , x .typs .Float32 , source )
1043
+ sel := b .NewValue1 (pos , OpComplexReal , x .typs .Float32 , source )
1044
1044
mem = x .storeArgOrLoad (pos , b , sel , mem , x .typs .Float32 , storeOffset , loadRegOffset , storeRc .next (x .typs .Float32 ))
1045
1045
pos = pos .WithNotStmt ()
1046
- sel = source . Block .NewValue1 (pos , OpComplexImag , x .typs .Float32 , source )
1046
+ sel = b .NewValue1 (pos , OpComplexImag , x .typs .Float32 , source )
1047
1047
return x .storeArgOrLoad (pos , b , sel , mem , x .typs .Float32 , storeOffset + 4 , loadRegOffset + RO_complex_imag , storeRc )
1048
1048
1049
1049
case types .TCOMPLEX128 :
1050
- sel := source . Block .NewValue1 (pos , OpComplexReal , x .typs .Float64 , source )
1050
+ sel := b .NewValue1 (pos , OpComplexReal , x .typs .Float64 , source )
1051
1051
mem = x .storeArgOrLoad (pos , b , sel , mem , x .typs .Float64 , storeOffset , loadRegOffset , storeRc .next (x .typs .Float64 ))
1052
1052
pos = pos .WithNotStmt ()
1053
- sel = source . Block .NewValue1 (pos , OpComplexImag , x .typs .Float64 , source )
1053
+ sel = b .NewValue1 (pos , OpComplexImag , x .typs .Float64 , source )
1054
1054
return x .storeArgOrLoad (pos , b , sel , mem , x .typs .Float64 , storeOffset + 8 , loadRegOffset + RO_complex_imag , storeRc )
1055
1055
}
1056
1056
@@ -1113,6 +1113,9 @@ func (x *expandState) rewriteArgs(v *Value, firstArg int) {
1113
1113
}
1114
1114
}
1115
1115
}
1116
+ if x .debug > 1 {
1117
+ x .Printf ("...storeArg %s, %v, %d\n " , a .LongString (), aType , aOffset )
1118
+ }
1116
1119
// "Dereference" of addressed (probably not-SSA-eligible) value becomes Move
1117
1120
// TODO(register args) this will be more complicated with registers in the picture.
1118
1121
mem = x .rewriteDereference (v .Block , sp , a , mem , aOffset , aux .SizeOfArg (auxI ), aType , v .Pos )
0 commit comments