1
0
mirror of https://github.com/golang/go synced 2024-11-17 08:04:46 -07: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:
Matthew Dempsky 2021-07-03 05:27:54 -07:00
parent c45d0eaadb
commit ea5369bac0
8 changed files with 1 additions and 28 deletions

View File

@ -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).
type CallExpr struct {
miniExpr
@ -161,7 +150,6 @@ type CallExpr struct {
Args Nodes
KeepAlive []*Name // vars to be kept alive until call returns
IsDDD bool
Use CallUse
NoInline bool
}

View File

@ -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 {
n := ir.NewCallExpr(pos, ir.OCALL, fun, args)
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 {
// Actually a type conversion, not a function call.

View File

@ -35,11 +35,7 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node {
case *syntax.BlockStmt:
return ir.NewBlockStmt(g.pos(stmt), g.blockStmt(stmt))
case *syntax.ExprStmt:
x := g.expr(stmt.X)
if call, ok := x.(*ir.CallExpr); ok {
call.Use = ir.CallUseStmt
}
return x
return g.expr(stmt.X)
case *syntax.SendStmt:
n := ir.NewSendStmt(g.pos(stmt), g.expr(stmt.Chan), g.expr(stmt.Value))
if n.Chan.Type().HasTParam() || n.Value.Type().HasTParam() {

View File

@ -326,7 +326,6 @@ assignOK:
stmt := stmt.(*ir.AssignListStmt)
stmt.SetOp(ir.OAS2FUNC)
r := rhs[0].(*ir.CallExpr)
r.Use = ir.CallUseList
rtyp := r.Type()
mismatched := false

View File

@ -317,10 +317,6 @@ func tcFunc(n *ir.Func) {
// tcCall typechecks an OCALL 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)
n.X = typecheck(n.X, ctxExpr|ctxType|ctxCallee)
if n.X.Diag() {

View File

@ -1922,7 +1922,6 @@ func (w *exportWriter) expr(n ir.Node) {
w.bool(n.IsDDD)
if go117ExportTypes {
w.exoticType(n.Type())
w.uint64(uint64(n.Use))
}
case ir.OMAKEMAP, ir.OMAKECHAN, ir.OMAKESLICE:

View File

@ -1465,7 +1465,6 @@ func (r *importReader) node() ir.Node {
n.IsDDD = r.bool()
if go117ExportTypes {
n.SetType(r.exoticType())
n.Use = ir.CallUse(r.uint64())
}
return n

View File

@ -201,7 +201,6 @@ assignOK:
stmt := stmt.(*ir.AssignListStmt)
stmt.SetOp(ir.OAS2FUNC)
r := rhs[0].(*ir.CallExpr)
r.Use = ir.CallUseList
rtyp := r.Type()
mismatched := false