mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
[dev.typeparams] cmd/compile: remove ir.CallUse
Unneeded after the previous CL changed inlining to leave OINLCALL nodes in place. Change-Id: I9af09a86a21caa51a1117b3de17d7312dd702600 Reviewed-on: https://go-review.googlesource.com/c/go/+/332650 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
c45d0eaadb
commit
ea5369bac0
|
@ -142,17 +142,6 @@ func (n *BinaryExpr) SetOp(op Op) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A CallUse records how the result of the call is used:
|
|
||||||
type CallUse byte
|
|
||||||
|
|
||||||
const (
|
|
||||||
_ CallUse = iota
|
|
||||||
|
|
||||||
CallUseExpr // single expression result is used
|
|
||||||
CallUseList // list of results are used
|
|
||||||
CallUseStmt // results not used - call is a statement
|
|
||||||
)
|
|
||||||
|
|
||||||
// A CallExpr is a function call X(Args).
|
// A CallExpr is a function call X(Args).
|
||||||
type CallExpr struct {
|
type CallExpr struct {
|
||||||
miniExpr
|
miniExpr
|
||||||
|
@ -161,7 +150,6 @@ type CallExpr struct {
|
||||||
Args Nodes
|
Args Nodes
|
||||||
KeepAlive []*Name // vars to be kept alive until call returns
|
KeepAlive []*Name // vars to be kept alive until call returns
|
||||||
IsDDD bool
|
IsDDD bool
|
||||||
Use CallUse
|
|
||||||
NoInline bool
|
NoInline bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,6 @@ func Binary(pos src.XPos, op ir.Op, typ *types.Type, x, y ir.Node) ir.Node {
|
||||||
func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool) ir.Node {
|
func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool) ir.Node {
|
||||||
n := ir.NewCallExpr(pos, ir.OCALL, fun, args)
|
n := ir.NewCallExpr(pos, ir.OCALL, fun, args)
|
||||||
n.IsDDD = dots
|
n.IsDDD = dots
|
||||||
// n.Use will be changed to ir.CallUseStmt in g.stmt() if this call is
|
|
||||||
// just a statement (any return values are ignored).
|
|
||||||
n.Use = ir.CallUseExpr
|
|
||||||
|
|
||||||
if fun.Op() == ir.OTYPE {
|
if fun.Op() == ir.OTYPE {
|
||||||
// Actually a type conversion, not a function call.
|
// Actually a type conversion, not a function call.
|
||||||
|
|
|
@ -35,11 +35,7 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node {
|
||||||
case *syntax.BlockStmt:
|
case *syntax.BlockStmt:
|
||||||
return ir.NewBlockStmt(g.pos(stmt), g.blockStmt(stmt))
|
return ir.NewBlockStmt(g.pos(stmt), g.blockStmt(stmt))
|
||||||
case *syntax.ExprStmt:
|
case *syntax.ExprStmt:
|
||||||
x := g.expr(stmt.X)
|
return g.expr(stmt.X)
|
||||||
if call, ok := x.(*ir.CallExpr); ok {
|
|
||||||
call.Use = ir.CallUseStmt
|
|
||||||
}
|
|
||||||
return x
|
|
||||||
case *syntax.SendStmt:
|
case *syntax.SendStmt:
|
||||||
n := ir.NewSendStmt(g.pos(stmt), g.expr(stmt.Chan), g.expr(stmt.Value))
|
n := ir.NewSendStmt(g.pos(stmt), g.expr(stmt.Chan), g.expr(stmt.Value))
|
||||||
if n.Chan.Type().HasTParam() || n.Value.Type().HasTParam() {
|
if n.Chan.Type().HasTParam() || n.Value.Type().HasTParam() {
|
||||||
|
|
|
@ -326,7 +326,6 @@ assignOK:
|
||||||
stmt := stmt.(*ir.AssignListStmt)
|
stmt := stmt.(*ir.AssignListStmt)
|
||||||
stmt.SetOp(ir.OAS2FUNC)
|
stmt.SetOp(ir.OAS2FUNC)
|
||||||
r := rhs[0].(*ir.CallExpr)
|
r := rhs[0].(*ir.CallExpr)
|
||||||
r.Use = ir.CallUseList
|
|
||||||
rtyp := r.Type()
|
rtyp := r.Type()
|
||||||
|
|
||||||
mismatched := false
|
mismatched := false
|
||||||
|
|
|
@ -317,10 +317,6 @@ func tcFunc(n *ir.Func) {
|
||||||
|
|
||||||
// tcCall typechecks an OCALL node.
|
// tcCall typechecks an OCALL node.
|
||||||
func tcCall(n *ir.CallExpr, top int) ir.Node {
|
func tcCall(n *ir.CallExpr, top int) ir.Node {
|
||||||
n.Use = ir.CallUseExpr
|
|
||||||
if top == ctxStmt {
|
|
||||||
n.Use = ir.CallUseStmt
|
|
||||||
}
|
|
||||||
Stmts(n.Init()) // imported rewritten f(g()) calls (#30907)
|
Stmts(n.Init()) // imported rewritten f(g()) calls (#30907)
|
||||||
n.X = typecheck(n.X, ctxExpr|ctxType|ctxCallee)
|
n.X = typecheck(n.X, ctxExpr|ctxType|ctxCallee)
|
||||||
if n.X.Diag() {
|
if n.X.Diag() {
|
||||||
|
|
|
@ -1922,7 +1922,6 @@ func (w *exportWriter) expr(n ir.Node) {
|
||||||
w.bool(n.IsDDD)
|
w.bool(n.IsDDD)
|
||||||
if go117ExportTypes {
|
if go117ExportTypes {
|
||||||
w.exoticType(n.Type())
|
w.exoticType(n.Type())
|
||||||
w.uint64(uint64(n.Use))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ir.OMAKEMAP, ir.OMAKECHAN, ir.OMAKESLICE:
|
case ir.OMAKEMAP, ir.OMAKECHAN, ir.OMAKESLICE:
|
||||||
|
|
|
@ -1465,7 +1465,6 @@ func (r *importReader) node() ir.Node {
|
||||||
n.IsDDD = r.bool()
|
n.IsDDD = r.bool()
|
||||||
if go117ExportTypes {
|
if go117ExportTypes {
|
||||||
n.SetType(r.exoticType())
|
n.SetType(r.exoticType())
|
||||||
n.Use = ir.CallUse(r.uint64())
|
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,6 @@ assignOK:
|
||||||
stmt := stmt.(*ir.AssignListStmt)
|
stmt := stmt.(*ir.AssignListStmt)
|
||||||
stmt.SetOp(ir.OAS2FUNC)
|
stmt.SetOp(ir.OAS2FUNC)
|
||||||
r := rhs[0].(*ir.CallExpr)
|
r := rhs[0].(*ir.CallExpr)
|
||||||
r.Use = ir.CallUseList
|
|
||||||
rtyp := r.Type()
|
rtyp := r.Type()
|
||||||
|
|
||||||
mismatched := false
|
mismatched := false
|
||||||
|
|
Loading…
Reference in a new issue