@@ -147,10 +147,10 @@ func genhash(t *types.Type) *obj.LSym {
147
147
148
148
// func sym(p *T, h uintptr) uintptr
149
149
args := []* ir.Field {
150
- namedfield ( "p" , types .NewPtr (t )),
151
- namedfield ( "h" , types .Types [types .TUINTPTR ]),
150
+ ir . NewField ( base . Pos , lookup ( "p" ), nil , types .NewPtr (t )),
151
+ ir . NewField ( base . Pos , lookup ( "h" ), nil , types .Types [types .TUINTPTR ]),
152
152
}
153
- results := []* ir.Field {anonfield ( types .Types [types .TUINTPTR ])}
153
+ results := []* ir.Field {ir . NewField ( base . Pos , nil , nil , types .Types [types .TUINTPTR ])}
154
154
tfn := ir .NewFuncType (base .Pos , nil , args , results )
155
155
156
156
fn := dclfunc (sym , tfn )
@@ -166,9 +166,9 @@ func genhash(t *types.Type) *obj.LSym {
166
166
167
167
// for i := 0; i < nelem; i++
168
168
ni := temp (types .Types [types .TINT ])
169
- init := ir .NewAssignStmt (base .Pos , ni , nodintconst (0 ))
170
- cond := ir .NewBinaryExpr (base .Pos , ir .OLT , ni , nodintconst (t .NumElem ()))
171
- post := ir .NewAssignStmt (base .Pos , ni , ir .NewBinaryExpr (base .Pos , ir .OADD , ni , nodintconst (1 )))
169
+ init := ir .NewAssignStmt (base .Pos , ni , ir . NewInt (0 ))
170
+ cond := ir .NewBinaryExpr (base .Pos , ir .OLT , ni , ir . NewInt (t .NumElem ()))
171
+ post := ir .NewAssignStmt (base .Pos , ni , ir .NewBinaryExpr (base .Pos , ir .OADD , ni , ir . NewInt (1 )))
172
172
loop := ir .NewForStmt (base .Pos , nil , cond , post , nil )
173
173
loop .PtrInit ().Append (init )
174
174
@@ -219,7 +219,7 @@ func genhash(t *types.Type) *obj.LSym {
219
219
na := nodAddr (nx )
220
220
call .Args .Append (na )
221
221
call .Args .Append (nh )
222
- call .Args .Append (nodintconst (size ))
222
+ call .Args .Append (ir . NewInt (size ))
223
223
fn .Body .Append (ir .NewAssignStmt (base .Pos , nh , call ))
224
224
225
225
i = next
@@ -239,9 +239,9 @@ func genhash(t *types.Type) *obj.LSym {
239
239
fn .SetDupok (true )
240
240
typecheckFunc (fn )
241
241
242
- Curfn = fn
242
+ ir . CurFunc = fn
243
243
typecheckslice (fn .Body , ctxStmt )
244
- Curfn = nil
244
+ ir . CurFunc = nil
245
245
246
246
if base .Debug .DclStack != 0 {
247
247
types .CheckDclstack ()
@@ -285,12 +285,12 @@ func hashfor(t *types.Type) ir.Node {
285
285
}
286
286
287
287
n := NewName (sym )
288
- setNodeNameFunc (n )
288
+ ir . MarkFunc (n )
289
289
n .SetType (functype (nil , []* ir.Field {
290
- anonfield ( types .NewPtr (t )),
291
- anonfield ( types .Types [types .TUINTPTR ]),
290
+ ir . NewField ( base . Pos , nil , nil , types .NewPtr (t )),
291
+ ir . NewField ( base . Pos , nil , nil , types .Types [types .TUINTPTR ]),
292
292
}, []* ir.Field {
293
- anonfield ( types .Types [types .TUINTPTR ]),
293
+ ir . NewField ( base . Pos , nil , nil , types .Types [types .TUINTPTR ]),
294
294
}))
295
295
return n
296
296
}
@@ -376,8 +376,8 @@ func geneq(t *types.Type) *obj.LSym {
376
376
377
377
// func sym(p, q *T) bool
378
378
tfn := ir .NewFuncType (base .Pos , nil ,
379
- []* ir.Field {namedfield ( "p" , types .NewPtr (t )), namedfield ( "q" , types .NewPtr (t ))},
380
- []* ir.Field {namedfield ( "r" , types .Types [types .TBOOL ])})
379
+ []* ir.Field {ir . NewField ( base . Pos , lookup ( "p" ), nil , types .NewPtr (t )), ir . NewField ( base . Pos , lookup ( "q" ), nil , types .NewPtr (t ))},
380
+ []* ir.Field {ir . NewField ( base . Pos , lookup ( "r" ), nil , types .Types [types .TBOOL ])})
381
381
382
382
fn := dclfunc (sym , tfn )
383
383
np := ir .AsNode (tfn .Type ().Params ().Field (0 ).Nname )
@@ -440,20 +440,20 @@ func geneq(t *types.Type) *obj.LSym {
440
440
// Generate a series of checks.
441
441
for i := int64 (0 ); i < nelem ; i ++ {
442
442
// if check {} else { goto neq }
443
- nif := ir .NewIfStmt (base .Pos , checkIdx (nodintconst (i )), nil , nil )
443
+ nif := ir .NewIfStmt (base .Pos , checkIdx (ir . NewInt (i )), nil , nil )
444
444
nif .Else .Append (ir .NewBranchStmt (base .Pos , ir .OGOTO , neq ))
445
445
fn .Body .Append (nif )
446
446
}
447
447
if last {
448
- fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , checkIdx (nodintconst (nelem ))))
448
+ fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , checkIdx (ir . NewInt (nelem ))))
449
449
}
450
450
} else {
451
451
// Generate a for loop.
452
452
// for i := 0; i < nelem; i++
453
453
i := temp (types .Types [types .TINT ])
454
- init := ir .NewAssignStmt (base .Pos , i , nodintconst (0 ))
455
- cond := ir .NewBinaryExpr (base .Pos , ir .OLT , i , nodintconst (nelem ))
456
- post := ir .NewAssignStmt (base .Pos , i , ir .NewBinaryExpr (base .Pos , ir .OADD , i , nodintconst (1 )))
454
+ init := ir .NewAssignStmt (base .Pos , i , ir . NewInt (0 ))
455
+ cond := ir .NewBinaryExpr (base .Pos , ir .OLT , i , ir . NewInt (nelem ))
456
+ post := ir .NewAssignStmt (base .Pos , i , ir .NewBinaryExpr (base .Pos , ir .OADD , i , ir . NewInt (1 )))
457
457
loop := ir .NewForStmt (base .Pos , nil , cond , post , nil )
458
458
loop .PtrInit ().Append (init )
459
459
// if eq(pi, qi) {} else { goto neq }
@@ -462,7 +462,7 @@ func geneq(t *types.Type) *obj.LSym {
462
462
loop .Body .Append (nif )
463
463
fn .Body .Append (loop )
464
464
if last {
465
- fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , nodbool (true )))
465
+ fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , ir . NewBool (true )))
466
466
}
467
467
}
468
468
}
@@ -572,7 +572,7 @@ func geneq(t *types.Type) *obj.LSym {
572
572
}
573
573
574
574
if len (flatConds ) == 0 {
575
- fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , nodbool (true )))
575
+ fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , ir . NewBool (true )))
576
576
} else {
577
577
for _ , c := range flatConds [:len (flatConds )- 1 ] {
578
578
// if cond {} else { goto neq }
@@ -594,7 +594,7 @@ func geneq(t *types.Type) *obj.LSym {
594
594
// r = false
595
595
// return (or goto ret)
596
596
fn .Body .Append (ir .NewLabelStmt (base .Pos , neq ))
597
- fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , nodbool (false )))
597
+ fn .Body .Append (ir .NewAssignStmt (base .Pos , nr , ir . NewBool (false )))
598
598
if EqCanPanic (t ) || anyCall (fn ) {
599
599
// Epilogue is large, so share it with the equal case.
600
600
fn .Body .Append (ir .NewBranchStmt (base .Pos , ir .OGOTO , ret ))
@@ -615,9 +615,9 @@ func geneq(t *types.Type) *obj.LSym {
615
615
fn .SetDupok (true )
616
616
typecheckFunc (fn )
617
617
618
- Curfn = fn
618
+ ir . CurFunc = fn
619
619
typecheckslice (fn .Body , ctxStmt )
620
- Curfn = nil
620
+ ir . CurFunc = nil
621
621
622
622
if base .Debug .DclStack != 0 {
623
623
types .CheckDclstack ()
@@ -726,7 +726,7 @@ func eqmem(p ir.Node, q ir.Node, field *types.Sym, size int64) ir.Node {
726
726
call .Args .Append (nx )
727
727
call .Args .Append (ny )
728
728
if needsize {
729
- call .Args .Append (nodintconst (size ))
729
+ call .Args .Append (ir . NewInt (size ))
730
730
}
731
731
732
732
return call
0 commit comments