]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile: remove ir.CallUse
authorMatthew Dempsky <mdempsky@google.com>
Sat, 3 Jul 2021 12:27:54 +0000 (05:27 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 3 Jul 2021 17:46:01 +0000 (17:46 +0000)
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>

src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/stmt.go
src/cmd/compile/internal/noder/transform.go
src/cmd/compile/internal/typecheck/func.go
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
src/cmd/compile/internal/typecheck/stmt.go

index 4ff75e616d9664a5c5016d55cec67ef0d0a91e5b..9c800dcd1a79ef68c0310bbf797a86667bbaa8c6 100644 (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
 }
 
index 6ab318318bb3e64b383deb8ad8077631b8fb2dce..08affe44119a86c608155ff19326bcbdee01af6b 100644 (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.
index 32a1483b4aabeb2fddeb646fc897ccf216cc52cb..672a732187eb5c27040998f9e6262bdc366940bf 100644 (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() {
index 7a685c4b47038696f098f4d622fdb2c3d9d200cc..e02b7e758dbe4a2becb44fd9a49a8f2fbf10e098 100644 (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
index d0aad5ac0788e00a836968a18e85932dd7c9696d..68f0c20e526802b718eca23ba011587d6ef3e687 100644 (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() {
index b17af815ec8dfd6f59ea19739876f75b3d52f728..82bbda5228f544d7f39a5ea7a85356aaad15f329 100644 (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:
index a45bbfd1f82aafb95dc7030f891a5249b2fe97b4..17e60effd6870bbc48600879bfb9da72e1b5d93c 100644 (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
 
index f1275f29c07aa6c01dec8862e7739ec79a07fbd5..01434118222f20328cc639d250330dca033a1d40 100644 (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