]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove OREGISTER, Node.Reg
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 24 Oct 2016 21:33:22 +0000 (14:33 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 24 Oct 2016 22:30:17 +0000 (22:30 +0000)
OREGISTER is unused.

All remaining uses of Node.Reg use REGSP.

Change-Id: I51cf06826867e576baabd568e04f96d2634f5cad
Reviewed-on: https://go-review.googlesource.com/31856
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/opnames.go
src/cmd/compile/internal/gc/racewalk.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go

index c40a338a8d21a2d5038f32e636f35666e8913efa..a6312cec90a30e993579b51889003ccc2d9adff5 100644 (file)
@@ -1185,9 +1185,6 @@ func (p *exporter) expr(n *Node) {
        // case ODDDARG:
        //      unimplemented - handled by default case
 
-       // case OREGISTER:
-       //      unimplemented - handled by default case
-
        case OLITERAL:
                if n.Val().Ctype() == CTNIL && n.Orig != nil && n.Orig != n {
                        p.expr(n.Orig)
index d898cae4f184eeb839f4aa47dd28a9737a94e6de..35eb5b1a399ef7987c22cec34607d6f694a68b46 100644 (file)
@@ -837,9 +837,6 @@ func (p *importer) node() *Node {
        // case ODDDARG:
        //      unimplemented
 
-       // case OREGISTER:
-       //      unimplemented
-
        case OLITERAL:
                typ := p.typ()
                n := nodlit(p.value(typ))
index 22c96f1e5afd6058a18f78aaefd1ccbbd80d159d..53d3875645fb86271e37b92f83e464c096877b35 100644 (file)
@@ -5,7 +5,6 @@
 package gc
 
 import (
-       "cmd/internal/obj"
        "fmt"
        "strconv"
        "strings"
@@ -1138,9 +1137,6 @@ func (n *Node) exprfmt(s fmt.State, prec int) {
        case ODDDARG:
                fmt.Fprint(s, "... argument")
 
-       case OREGISTER:
-               fmt.Fprint(s, obj.Rconv(int(n.Reg)))
-
        case OLITERAL: // this is a bit of a mess
                if fmtmode == FErr {
                        if n.Orig != nil && n.Orig != n {
@@ -1511,8 +1507,8 @@ func (n *Node) nodedump(s fmt.State, flag FmtFlag) {
        default:
                fmt.Fprintf(s, "%v%j", n.Op, n)
 
-       case OREGISTER, OINDREG:
-               fmt.Fprintf(s, "%v-%v%j", n.Op, obj.Rconv(int(n.Reg)), n)
+       case OINDREGSP:
+               fmt.Fprintf(s, "%v-SP%j", n.Op, n)
 
        case OLITERAL:
                fmt.Fprintf(s, "%v-%v%j", n.Op, n.Val(), n)
index fec983d515230d390ff2c3051d1f16ca3bd60ad7..fb6402206b6b20ead5a1b9b01cfccb6e748e0e03 100644 (file)
@@ -279,8 +279,7 @@ func nodarg(t interface{}, fp int) *Node {
                Fatalf("bad fp")
 
        case 0: // preparing arguments for call
-               n.Op = OINDREG
-               n.Reg = int16(Thearch.REGSP)
+               n.Op = OINDREGSP
                n.Xoffset += Ctxt.FixedFrameSize()
 
        case 1: // reading arguments inside call
index ef54abdd66110e51b891283e696269e1edc3d328..bd56506e4d329d4a46271c6147daddf5a3e00f15 100644 (file)
@@ -152,8 +152,7 @@ var opnames = []string{
        OCHECKNIL:        "CHECKNIL",
        OVARKILL:         "VARKILL",
        OVARLIVE:         "VARLIVE",
-       OREGISTER:        "REGISTER",
-       OINDREG:          "INDREG",
+       OINDREGSP:        "INDREGSP",
        OCMP:             "CMP",
        ODEC:             "DEC",
        OINC:             "INC",
index c8ab6038aa9372341e67b655687b59b5da484440..8f13c7ac9290d74fd2d12b620786fb6fe3ccbeef 100644 (file)
@@ -403,7 +403,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
                OCHECKNIL,   // always followed by a read.
                OCLOSUREVAR, // immutable pointer to captured variable
                ODOTMETH,    // either part of CALLMETH or CALLPART (lowered to PTRLIT)
-               OINDREG,     // at this stage, only n(SP) nodes from nodarg
+               OINDREGSP,   // at this stage, only n(SP) nodes from nodarg
                ODCL,        // declarations (without value) cannot be races
                ODCLCONST,
                ODCLTYPE,
index 196bd9c038809ac4abcb3f0e86e581ced5ec6274..452d449f2130c9025c50faf216e0c7ce2ed31125 100644 (file)
@@ -556,7 +556,7 @@ func (s *state) stmt(n *Node) {
                // Make a fake node to mimic loading return value, ONLY for write barrier test.
                // This is future-proofing against non-scalar 2-result intrinsics.
                // Currently we only have scalar ones, which result in no write barrier.
-               fakeret := &Node{Op: OINDREG, Reg: int16(Thearch.REGSP)}
+               fakeret := &Node{Op: OINDREGSP}
                s.assign(n.List.First(), v1, needwritebarrier(n.List.First(), fakeret), false, n.Lineno, 0, false)
                s.assign(n.List.Second(), v2, needwritebarrier(n.List.Second(), fakeret), false, n.Lineno, 0, false)
                return
@@ -1921,11 +1921,7 @@ func (s *state) expr(n *Node) *ssa.Value {
                // Note we know the volatile result is false because you can't write &f() in Go.
                return a
 
-       case OINDREG:
-               if int(n.Reg) != Thearch.REGSP {
-                       s.Fatalf("OINDREG of non-SP register %s in expr: %v", obj.Rconv(int(n.Reg)), n)
-                       return nil
-               }
+       case OINDREGSP:
                addr := s.entryNewValue1I(ssa.OpOffPtr, ptrto(n.Type), n.Xoffset, s.sp)
                return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem())
 
@@ -3018,13 +3014,9 @@ func (s *state) addr(n *Node, bounded bool) (*ssa.Value, bool) {
                        s.Fatalf("variable address class %v not implemented", classnames[n.Class])
                        return nil, false
                }
-       case OINDREG:
-               // indirect off a register
+       case OINDREGSP:
+               // indirect off REGSP
                // used for storing/loading arguments/returns to/from callees
-               if int(n.Reg) != Thearch.REGSP {
-                       s.Fatalf("OINDREG of non-SP register %s in addr: %v", obj.Rconv(int(n.Reg)), n)
-                       return nil, false
-               }
                return s.entryNewValue1I(ssa.OpOffPtr, t, n.Xoffset, s.sp), true
        case OINDEX:
                if n.Left.Type.IsSlice() {
index 2f2c134d74c367dfac183c647d74a50c878f3f42..a73be08ebaedf4ef591913f46fbd9305c7490f77 100644 (file)
@@ -1160,7 +1160,7 @@ func ullmancalc(n *Node) {
        }
 
        switch n.Op {
-       case OREGISTER, OLITERAL, ONAME:
+       case OLITERAL, ONAME:
                ul = 1
                if n.Class == PAUTOHEAP {
                        ul++
index da8671eac27dcf57c26b966902d4b403fd916d40..ef5b66ab0c29e6ca1ff6b4ed2ad2bc09d8426291 100644 (file)
@@ -35,7 +35,7 @@ type Node struct {
 
        // Various. Usually an offset into a struct. For example:
        // - ONAME nodes that refer to local variables use it to identify their stack frame position.
-       // - ODOT, ODOTPTR, and OINDREG use it to indicate offset relative to their base address.
+       // - ODOT, ODOTPTR, and OINDREGSP use it to indicate offset relative to their base address.
        // - OSTRUCTKEY uses it to store the named field's offset.
        // - OXCASE and OXFALL use it to validate the use of fallthrough.
        // Possibly still more uses. If you find any, document them.
@@ -43,9 +43,6 @@ type Node struct {
 
        Lineno int32
 
-       // OREGISTER, OINDREG
-       Reg int16
-
        Esc uint16 // EscXXX
 
        Op        Op
@@ -472,10 +469,7 @@ const (
        OCHECKNIL   // emit code to ensure pointer/interface not nil
        OVARKILL    // variable is dead
        OVARLIVE    // variable is alive
-
-       // thearch-specific registers
-       OREGISTER // a register, such as AX.
-       OINDREG   // offset plus indirect of a register, such as 8(SP).
+       OINDREGSP   // offset plus indirect of REGSP, such as 8(SP).
 
        // arch-specific opcodes
        OCMP    // compare: ACMP.
index e2699d1f0a98027a29d5bc09d2e1caf1763b98d6..6a00287b2d40ee0252a01a4262742208c66680aa 100644 (file)
@@ -128,8 +128,8 @@ func adjustargs(n *Node, adjust int) {
                        continue
                }
 
-               if lhs.Op != OINDREG {
-                       yyerror("call argument store does not use OINDREG")
+               if lhs.Op != OINDREGSP {
+                       yyerror("call argument store does not use OINDREGSP")
                }
 
                // can't really check this in machine-indep code.
@@ -512,7 +512,7 @@ opswitch:
 
        case OTYPE,
                ONONAME,
-               OINDREG,
+               OINDREGSP,
                OEMPTY,
                OGETG:
 
@@ -2166,7 +2166,7 @@ func callnew(t *Type) *Node {
 
 func iscallret(n *Node) bool {
        n = outervalue(n)
-       return n.Op == OINDREG && n.Reg == int16(Thearch.REGSP)
+       return n.Op == OINDREGSP
 }
 
 func isstack(n *Node) bool {
@@ -2182,8 +2182,8 @@ func isstack(n *Node) bool {
        }
 
        switch n.Op {
-       case OINDREG:
-               return n.Reg == int16(Thearch.REGSP)
+       case OINDREGSP:
+               return true
 
        case ONAME:
                switch n.Class {