mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: move all usage of delayTransform out of helpers.go
So next CL will make delayTransform to become irgen's method, because the delay transform logic also depends on irgen.topFuncIsGeneric field. For #48609 Change-Id: I660ed19856bd06c3b6f4279a9184db96175dea2d Reviewed-on: https://go-review.googlesource.com/c/go/+/351854 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
f6b5ffb5e1
commit
c94543b85f
2 changed files with 33 additions and 26 deletions
|
|
@ -89,20 +89,16 @@ func Assert(pos src.XPos, x ir.Node, typ *types.Type) ir.Node {
|
|||
return typed(typ, ir.NewTypeAssertExpr(pos, x, nil))
|
||||
}
|
||||
|
||||
func Binary(pos src.XPos, op ir.Op, typ *types.Type, x, y ir.Node) ir.Node {
|
||||
func Binary(pos src.XPos, op ir.Op, typ *types.Type, x, y ir.Node) *ir.BinaryExpr {
|
||||
switch op {
|
||||
case ir.OANDAND, ir.OOROR:
|
||||
return typed(x.Type(), ir.NewLogicalExpr(pos, op, x, y))
|
||||
case ir.OADD:
|
||||
n := ir.NewBinaryExpr(pos, op, x, y)
|
||||
typed(typ, n)
|
||||
r := ir.Node(n)
|
||||
if !delayTransform() {
|
||||
r = transformAdd(n)
|
||||
}
|
||||
return r
|
||||
return n
|
||||
default:
|
||||
return typed(x.Type(), ir.NewBinaryExpr(pos, op, x, y))
|
||||
n := ir.NewBinaryExpr(pos, op, x, y)
|
||||
typed(x.Type(), n)
|
||||
return n
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -195,12 +191,9 @@ func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool)
|
|||
return n
|
||||
}
|
||||
|
||||
func Compare(pos src.XPos, typ *types.Type, op ir.Op, x, y ir.Node) ir.Node {
|
||||
func Compare(pos src.XPos, typ *types.Type, op ir.Op, x, y ir.Node) *ir.BinaryExpr {
|
||||
n := ir.NewBinaryExpr(pos, op, x, y)
|
||||
typed(typ, n)
|
||||
if !delayTransform() {
|
||||
transformCompare(n)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
|
@ -270,26 +263,19 @@ func method(typ *types.Type, index int) *types.Field {
|
|||
return types.ReceiverBaseType(typ).Methods().Index(index)
|
||||
}
|
||||
|
||||
func Index(pos src.XPos, typ *types.Type, x, index ir.Node) ir.Node {
|
||||
func Index(pos src.XPos, typ *types.Type, x, index ir.Node) *ir.IndexExpr {
|
||||
n := ir.NewIndexExpr(pos, x, index)
|
||||
typed(typ, n)
|
||||
if !delayTransform() {
|
||||
// transformIndex will modify n.Type() for OINDEXMAP.
|
||||
transformIndex(n)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func Slice(pos src.XPos, typ *types.Type, x, low, high, max ir.Node) ir.Node {
|
||||
func Slice(pos src.XPos, typ *types.Type, x, low, high, max ir.Node) *ir.SliceExpr {
|
||||
op := ir.OSLICE
|
||||
if max != nil {
|
||||
op = ir.OSLICE3
|
||||
}
|
||||
n := ir.NewSliceExpr(pos, op, x, low, high, max)
|
||||
typed(typ, n)
|
||||
if !delayTransform() {
|
||||
transformSlice(n)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue