1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:14:44 -07:00

cmd/compile: remove OREGISTER, Node.Reg

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>
This commit is contained in:
Josh Bleecher Snyder 2016-10-24 14:33:22 -07:00
parent 28269796c8
commit 1fcad29341
10 changed files with 18 additions and 44 deletions

View File

@ -1185,9 +1185,6 @@ func (p *exporter) expr(n *Node) {
// case ODDDARG: // case ODDDARG:
// unimplemented - handled by default case // unimplemented - handled by default case
// case OREGISTER:
// unimplemented - handled by default case
case OLITERAL: case OLITERAL:
if n.Val().Ctype() == CTNIL && n.Orig != nil && n.Orig != n { if n.Val().Ctype() == CTNIL && n.Orig != nil && n.Orig != n {
p.expr(n.Orig) p.expr(n.Orig)

View File

@ -837,9 +837,6 @@ func (p *importer) node() *Node {
// case ODDDARG: // case ODDDARG:
// unimplemented // unimplemented
// case OREGISTER:
// unimplemented
case OLITERAL: case OLITERAL:
typ := p.typ() typ := p.typ()
n := nodlit(p.value(typ)) n := nodlit(p.value(typ))

View File

@ -5,7 +5,6 @@
package gc package gc
import ( import (
"cmd/internal/obj"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -1138,9 +1137,6 @@ func (n *Node) exprfmt(s fmt.State, prec int) {
case ODDDARG: case ODDDARG:
fmt.Fprint(s, "... argument") fmt.Fprint(s, "... argument")
case OREGISTER:
fmt.Fprint(s, obj.Rconv(int(n.Reg)))
case OLITERAL: // this is a bit of a mess case OLITERAL: // this is a bit of a mess
if fmtmode == FErr { if fmtmode == FErr {
if n.Orig != nil && n.Orig != n { if n.Orig != nil && n.Orig != n {
@ -1511,8 +1507,8 @@ func (n *Node) nodedump(s fmt.State, flag FmtFlag) {
default: default:
fmt.Fprintf(s, "%v%j", n.Op, n) fmt.Fprintf(s, "%v%j", n.Op, n)
case OREGISTER, OINDREG: case OINDREGSP:
fmt.Fprintf(s, "%v-%v%j", n.Op, obj.Rconv(int(n.Reg)), n) fmt.Fprintf(s, "%v-SP%j", n.Op, n)
case OLITERAL: case OLITERAL:
fmt.Fprintf(s, "%v-%v%j", n.Op, n.Val(), n) fmt.Fprintf(s, "%v-%v%j", n.Op, n.Val(), n)

View File

@ -279,8 +279,7 @@ func nodarg(t interface{}, fp int) *Node {
Fatalf("bad fp") Fatalf("bad fp")
case 0: // preparing arguments for call case 0: // preparing arguments for call
n.Op = OINDREG n.Op = OINDREGSP
n.Reg = int16(Thearch.REGSP)
n.Xoffset += Ctxt.FixedFrameSize() n.Xoffset += Ctxt.FixedFrameSize()
case 1: // reading arguments inside call case 1: // reading arguments inside call

View File

@ -152,8 +152,7 @@ var opnames = []string{
OCHECKNIL: "CHECKNIL", OCHECKNIL: "CHECKNIL",
OVARKILL: "VARKILL", OVARKILL: "VARKILL",
OVARLIVE: "VARLIVE", OVARLIVE: "VARLIVE",
OREGISTER: "REGISTER", OINDREGSP: "INDREGSP",
OINDREG: "INDREG",
OCMP: "CMP", OCMP: "CMP",
ODEC: "DEC", ODEC: "DEC",
OINC: "INC", OINC: "INC",

View File

@ -403,7 +403,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
OCHECKNIL, // always followed by a read. OCHECKNIL, // always followed by a read.
OCLOSUREVAR, // immutable pointer to captured variable OCLOSUREVAR, // immutable pointer to captured variable
ODOTMETH, // either part of CALLMETH or CALLPART (lowered to PTRLIT) 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 ODCL, // declarations (without value) cannot be races
ODCLCONST, ODCLCONST,
ODCLTYPE, ODCLTYPE,

View 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. // Make a fake node to mimic loading return value, ONLY for write barrier test.
// This is future-proofing against non-scalar 2-result intrinsics. // This is future-proofing against non-scalar 2-result intrinsics.
// Currently we only have scalar ones, which result in no write barrier. // 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.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) s.assign(n.List.Second(), v2, needwritebarrier(n.List.Second(), fakeret), false, n.Lineno, 0, false)
return 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. // Note we know the volatile result is false because you can't write &f() in Go.
return a return a
case OINDREG: case OINDREGSP:
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
}
addr := s.entryNewValue1I(ssa.OpOffPtr, ptrto(n.Type), n.Xoffset, s.sp) addr := s.entryNewValue1I(ssa.OpOffPtr, ptrto(n.Type), n.Xoffset, s.sp)
return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem()) 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]) s.Fatalf("variable address class %v not implemented", classnames[n.Class])
return nil, false return nil, false
} }
case OINDREG: case OINDREGSP:
// indirect off a register // indirect off REGSP
// used for storing/loading arguments/returns to/from callees // 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 return s.entryNewValue1I(ssa.OpOffPtr, t, n.Xoffset, s.sp), true
case OINDEX: case OINDEX:
if n.Left.Type.IsSlice() { if n.Left.Type.IsSlice() {

View File

@ -1160,7 +1160,7 @@ func ullmancalc(n *Node) {
} }
switch n.Op { switch n.Op {
case OREGISTER, OLITERAL, ONAME: case OLITERAL, ONAME:
ul = 1 ul = 1
if n.Class == PAUTOHEAP { if n.Class == PAUTOHEAP {
ul++ ul++

View File

@ -35,7 +35,7 @@ type Node struct {
// Various. Usually an offset into a struct. For example: // Various. Usually an offset into a struct. For example:
// - ONAME nodes that refer to local variables use it to identify their stack frame position. // - 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. // - OSTRUCTKEY uses it to store the named field's offset.
// - OXCASE and OXFALL use it to validate the use of fallthrough. // - OXCASE and OXFALL use it to validate the use of fallthrough.
// Possibly still more uses. If you find any, document them. // Possibly still more uses. If you find any, document them.
@ -43,9 +43,6 @@ type Node struct {
Lineno int32 Lineno int32
// OREGISTER, OINDREG
Reg int16
Esc uint16 // EscXXX Esc uint16 // EscXXX
Op Op Op Op
@ -472,10 +469,7 @@ const (
OCHECKNIL // emit code to ensure pointer/interface not nil OCHECKNIL // emit code to ensure pointer/interface not nil
OVARKILL // variable is dead OVARKILL // variable is dead
OVARLIVE // variable is alive OVARLIVE // variable is alive
OINDREGSP // offset plus indirect of REGSP, such as 8(SP).
// thearch-specific registers
OREGISTER // a register, such as AX.
OINDREG // offset plus indirect of a register, such as 8(SP).
// arch-specific opcodes // arch-specific opcodes
OCMP // compare: ACMP. OCMP // compare: ACMP.

View File

@ -128,8 +128,8 @@ func adjustargs(n *Node, adjust int) {
continue continue
} }
if lhs.Op != OINDREG { if lhs.Op != OINDREGSP {
yyerror("call argument store does not use OINDREG") yyerror("call argument store does not use OINDREGSP")
} }
// can't really check this in machine-indep code. // can't really check this in machine-indep code.
@ -512,7 +512,7 @@ opswitch:
case OTYPE, case OTYPE,
ONONAME, ONONAME,
OINDREG, OINDREGSP,
OEMPTY, OEMPTY,
OGETG: OGETG:
@ -2166,7 +2166,7 @@ func callnew(t *Type) *Node {
func iscallret(n *Node) bool { func iscallret(n *Node) bool {
n = outervalue(n) n = outervalue(n)
return n.Op == OINDREG && n.Reg == int16(Thearch.REGSP) return n.Op == OINDREGSP
} }
func isstack(n *Node) bool { func isstack(n *Node) bool {
@ -2182,8 +2182,8 @@ func isstack(n *Node) bool {
} }
switch n.Op { switch n.Op {
case OINDREG: case OINDREGSP:
return n.Reg == int16(Thearch.REGSP) return true
case ONAME: case ONAME:
switch n.Class { switch n.Class {