1
0
mirror of https://github.com/golang/go synced 2024-11-17 12:14:47 -07:00

cmd/compile/internal/ir: remove ODCLCONST and ODCLTYPE

These aren't constructed by the unified frontend.

Change-Id: Ied87baa9656920bd11055464bc605933ff448e21
Reviewed-on: https://go-review.googlesource.com/c/go/+/520264
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2023-08-16 17:29:41 -07:00 committed by Gopher Robot
parent ff47dd1d66
commit 36fc721419
9 changed files with 114 additions and 137 deletions

View File

@ -31,7 +31,7 @@ func (e *escape) stmt(n ir.Node) {
default: default:
base.Fatalf("unexpected stmt: %v", n) base.Fatalf("unexpected stmt: %v", n)
case ir.ODCLCONST, ir.ODCLTYPE, ir.OFALL, ir.OINLMARK: case ir.OFALL, ir.OINLMARK:
// nop // nop
case ir.OBREAK, ir.OCONTINUE, ir.OGOTO: case ir.OBREAK, ir.OCONTINUE, ir.OGOTO:

View File

@ -647,10 +647,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
// should try to account for that if we're going to account for captures. // should try to account for that if we're going to account for captures.
v.budget -= 15 v.budget -= 15
case ir.OGO, case ir.OGO, ir.ODEFER, ir.OTAILCALL:
ir.ODEFER,
ir.ODCLTYPE, // can't print yet
ir.OTAILCALL:
v.reason = "unhandled op " + n.Op().String() v.reason = "unhandled op " + n.Op().String()
return true return true
@ -682,7 +679,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
// This doesn't produce code, but the children might. // This doesn't produce code, but the children might.
v.budget++ // undo default cost v.budget++ // undo default cost
case ir.ODCLCONST, ir.OFALL, ir.OTYPE: case ir.OFALL, ir.OTYPE:
// These nodes don't produce code; omit from inlining budget. // These nodes don't produce code; omit from inlining budget.
return false return false

View File

@ -175,9 +175,7 @@ const (
ODCL // var X (declares X of type X.Type) ODCL // var X (declares X of type X.Type)
// Used during parsing but don't last. // Used during parsing but don't last.
ODCLFUNC // func f() or func (r) f() ODCLFUNC // func f() or func (r) f()
ODCLCONST // const pi = 3.14
ODCLTYPE // type Int int or type Int = int
ODELETE // delete(Args) ODELETE // delete(Args)
ODOT // X.Sel (X is of struct type) ODOT // X.Sel (X is of struct type)

View File

@ -58,119 +58,117 @@ func _() {
_ = x[OCOPY-47] _ = x[OCOPY-47]
_ = x[ODCL-48] _ = x[ODCL-48]
_ = x[ODCLFUNC-49] _ = x[ODCLFUNC-49]
_ = x[ODCLCONST-50] _ = x[ODELETE-50]
_ = x[ODCLTYPE-51] _ = x[ODOT-51]
_ = x[ODELETE-52] _ = x[ODOTPTR-52]
_ = x[ODOT-53] _ = x[ODOTMETH-53]
_ = x[ODOTPTR-54] _ = x[ODOTINTER-54]
_ = x[ODOTMETH-55] _ = x[OXDOT-55]
_ = x[ODOTINTER-56] _ = x[ODOTTYPE-56]
_ = x[OXDOT-57] _ = x[ODOTTYPE2-57]
_ = x[ODOTTYPE-58] _ = x[OEQ-58]
_ = x[ODOTTYPE2-59] _ = x[ONE-59]
_ = x[OEQ-60] _ = x[OLT-60]
_ = x[ONE-61] _ = x[OLE-61]
_ = x[OLT-62] _ = x[OGE-62]
_ = x[OLE-63] _ = x[OGT-63]
_ = x[OGE-64] _ = x[ODEREF-64]
_ = x[OGT-65] _ = x[OINDEX-65]
_ = x[ODEREF-66] _ = x[OINDEXMAP-66]
_ = x[OINDEX-67] _ = x[OKEY-67]
_ = x[OINDEXMAP-68] _ = x[OSTRUCTKEY-68]
_ = x[OKEY-69] _ = x[OLEN-69]
_ = x[OSTRUCTKEY-70] _ = x[OMAKE-70]
_ = x[OLEN-71] _ = x[OMAKECHAN-71]
_ = x[OMAKE-72] _ = x[OMAKEMAP-72]
_ = x[OMAKECHAN-73] _ = x[OMAKESLICE-73]
_ = x[OMAKEMAP-74] _ = x[OMAKESLICECOPY-74]
_ = x[OMAKESLICE-75] _ = x[OMUL-75]
_ = x[OMAKESLICECOPY-76] _ = x[ODIV-76]
_ = x[OMUL-77] _ = x[OMOD-77]
_ = x[ODIV-78] _ = x[OLSH-78]
_ = x[OMOD-79] _ = x[ORSH-79]
_ = x[OLSH-80] _ = x[OAND-80]
_ = x[ORSH-81] _ = x[OANDNOT-81]
_ = x[OAND-82] _ = x[ONEW-82]
_ = x[OANDNOT-83] _ = x[ONOT-83]
_ = x[ONEW-84] _ = x[OBITNOT-84]
_ = x[ONOT-85] _ = x[OPLUS-85]
_ = x[OBITNOT-86] _ = x[ONEG-86]
_ = x[OPLUS-87] _ = x[OOROR-87]
_ = x[ONEG-88] _ = x[OPANIC-88]
_ = x[OOROR-89] _ = x[OPRINT-89]
_ = x[OPANIC-90] _ = x[OPRINTN-90]
_ = x[OPRINT-91] _ = x[OPAREN-91]
_ = x[OPRINTN-92] _ = x[OSEND-92]
_ = x[OPAREN-93] _ = x[OSLICE-93]
_ = x[OSEND-94] _ = x[OSLICEARR-94]
_ = x[OSLICE-95] _ = x[OSLICESTR-95]
_ = x[OSLICEARR-96] _ = x[OSLICE3-96]
_ = x[OSLICESTR-97] _ = x[OSLICE3ARR-97]
_ = x[OSLICE3-98] _ = x[OSLICEHEADER-98]
_ = x[OSLICE3ARR-99] _ = x[OSTRINGHEADER-99]
_ = x[OSLICEHEADER-100] _ = x[ORECOVER-100]
_ = x[OSTRINGHEADER-101] _ = x[ORECOVERFP-101]
_ = x[ORECOVER-102] _ = x[ORECV-102]
_ = x[ORECOVERFP-103] _ = x[ORUNESTR-103]
_ = x[ORECV-104] _ = x[OSELRECV2-104]
_ = x[ORUNESTR-105] _ = x[OMIN-105]
_ = x[OSELRECV2-106] _ = x[OMAX-106]
_ = x[OMIN-107] _ = x[OREAL-107]
_ = x[OMAX-108] _ = x[OIMAG-108]
_ = x[OREAL-109] _ = x[OCOMPLEX-109]
_ = x[OIMAG-110] _ = x[OALIGNOF-110]
_ = x[OCOMPLEX-111] _ = x[OOFFSETOF-111]
_ = x[OALIGNOF-112] _ = x[OSIZEOF-112]
_ = x[OOFFSETOF-113] _ = x[OUNSAFEADD-113]
_ = x[OSIZEOF-114] _ = x[OUNSAFESLICE-114]
_ = x[OUNSAFEADD-115] _ = x[OUNSAFESLICEDATA-115]
_ = x[OUNSAFESLICE-116] _ = x[OUNSAFESTRING-116]
_ = x[OUNSAFESLICEDATA-117] _ = x[OUNSAFESTRINGDATA-117]
_ = x[OUNSAFESTRING-118] _ = x[OMETHEXPR-118]
_ = x[OUNSAFESTRINGDATA-119] _ = x[OMETHVALUE-119]
_ = x[OMETHEXPR-120] _ = x[OBLOCK-120]
_ = x[OMETHVALUE-121] _ = x[OBREAK-121]
_ = x[OBLOCK-122] _ = x[OCASE-122]
_ = x[OBREAK-123] _ = x[OCONTINUE-123]
_ = x[OCASE-124] _ = x[ODEFER-124]
_ = x[OCONTINUE-125] _ = x[OFALL-125]
_ = x[ODEFER-126] _ = x[OFOR-126]
_ = x[OFALL-127] _ = x[OGOTO-127]
_ = x[OFOR-128] _ = x[OIF-128]
_ = x[OGOTO-129] _ = x[OLABEL-129]
_ = x[OIF-130] _ = x[OGO-130]
_ = x[OLABEL-131] _ = x[ORANGE-131]
_ = x[OGO-132] _ = x[ORETURN-132]
_ = x[ORANGE-133] _ = x[OSELECT-133]
_ = x[ORETURN-134] _ = x[OSWITCH-134]
_ = x[OSELECT-135] _ = x[OTYPESW-135]
_ = x[OSWITCH-136] _ = x[OFUNCINST-136]
_ = x[OTYPESW-137] _ = x[OINLCALL-137]
_ = x[OFUNCINST-138] _ = x[OEFACE-138]
_ = x[OINLCALL-139] _ = x[OITAB-139]
_ = x[OEFACE-140] _ = x[OIDATA-140]
_ = x[OITAB-141] _ = x[OSPTR-141]
_ = x[OIDATA-142] _ = x[OCFUNC-142]
_ = x[OSPTR-143] _ = x[OCHECKNIL-143]
_ = x[OCFUNC-144] _ = x[ORESULT-144]
_ = x[OCHECKNIL-145] _ = x[OINLMARK-145]
_ = x[ORESULT-146] _ = x[OLINKSYMOFFSET-146]
_ = x[OINLMARK-147] _ = x[OJUMPTABLE-147]
_ = x[OLINKSYMOFFSET-148] _ = x[ODYNAMICDOTTYPE-148]
_ = x[OJUMPTABLE-149] _ = x[ODYNAMICDOTTYPE2-149]
_ = x[ODYNAMICDOTTYPE-150] _ = x[ODYNAMICTYPE-150]
_ = x[ODYNAMICDOTTYPE2-151] _ = x[OTAILCALL-151]
_ = x[ODYNAMICTYPE-152] _ = x[OGETG-152]
_ = x[OTAILCALL-153] _ = x[OGETCALLERPC-153]
_ = x[OGETG-154] _ = x[OGETCALLERSP-154]
_ = x[OGETCALLERPC-155] _ = x[OEND-155]
_ = x[OGETCALLERSP-156]
_ = x[OEND-157]
} }
const _Op_name = "XXXNAMENONAMETYPELITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCAPCLEARCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVIDATACONVNOPCOPYDCLDCLFUNCDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERSTRINGHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2MINMAXREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFUNSAFEADDUNSAFESLICEUNSAFESLICEDATAUNSAFESTRINGUNSAFESTRINGDATAMETHEXPRMETHVALUEBLOCKBREAKCASECONTINUEDEFERFALLFORGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTINLCALLEFACEITABIDATASPTRCFUNCCHECKNILRESULTINLMARKLINKSYMOFFSETJUMPTABLEDYNAMICDOTTYPEDYNAMICDOTTYPE2DYNAMICTYPETAILCALLGETGGETCALLERPCGETCALLERSPEND" const _Op_name = "XXXNAMENONAMETYPELITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCAPCLEARCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVIDATACONVNOPCOPYDCLDCLFUNCDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERSTRINGHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2MINMAXREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFUNSAFEADDUNSAFESLICEUNSAFESLICEDATAUNSAFESTRINGUNSAFESTRINGDATAMETHEXPRMETHVALUEBLOCKBREAKCASECONTINUEDEFERFALLFORGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTINLCALLEFACEITABIDATASPTRCFUNCCHECKNILRESULTINLMARKLINKSYMOFFSETJUMPTABLEDYNAMICDOTTYPEDYNAMICDOTTYPE2DYNAMICTYPETAILCALLGETGGETCALLERPCGETCALLERSPEND"
var _Op_index = [...]uint16{0, 3, 7, 13, 17, 24, 27, 30, 33, 35, 38, 44, 48, 54, 60, 69, 81, 90, 99, 111, 120, 129, 141, 143, 146, 156, 163, 170, 177, 181, 185, 193, 201, 210, 213, 218, 223, 230, 237, 243, 252, 260, 268, 274, 278, 287, 296, 303, 307, 310, 317, 325, 332, 338, 341, 347, 354, 362, 366, 373, 381, 383, 385, 387, 389, 391, 393, 398, 403, 411, 414, 423, 426, 430, 438, 445, 454, 467, 470, 473, 476, 479, 482, 485, 491, 494, 497, 503, 507, 510, 514, 519, 524, 530, 535, 539, 544, 552, 560, 566, 575, 586, 598, 605, 614, 618, 625, 633, 636, 639, 643, 647, 654, 661, 669, 675, 684, 695, 710, 722, 738, 746, 755, 760, 765, 769, 777, 782, 786, 789, 793, 795, 800, 802, 807, 813, 819, 825, 831, 839, 846, 851, 855, 860, 864, 869, 877, 883, 890, 903, 912, 926, 941, 952, 960, 964, 975, 986, 989} var _Op_index = [...]uint16{0, 3, 7, 13, 17, 24, 27, 30, 33, 35, 38, 44, 48, 54, 60, 69, 81, 90, 99, 111, 120, 129, 141, 143, 146, 156, 163, 170, 177, 181, 185, 193, 201, 210, 213, 218, 223, 230, 237, 243, 252, 260, 268, 274, 278, 287, 296, 303, 307, 310, 317, 323, 326, 332, 339, 347, 351, 358, 366, 368, 370, 372, 374, 376, 378, 383, 388, 396, 399, 408, 411, 415, 423, 430, 439, 452, 455, 458, 461, 464, 467, 470, 476, 479, 482, 488, 492, 495, 499, 504, 509, 515, 520, 524, 529, 537, 545, 551, 560, 571, 583, 590, 599, 603, 610, 618, 621, 624, 628, 632, 639, 646, 654, 660, 669, 680, 695, 707, 723, 731, 740, 745, 750, 754, 762, 767, 771, 774, 778, 780, 785, 787, 792, 798, 804, 810, 816, 824, 831, 836, 840, 845, 849, 854, 862, 868, 875, 888, 897, 911, 926, 937, 945, 949, 960, 971, 974}
func (i Op) String() string { func (i Op) String() string {
if i >= Op(len(_Op_index)-1) { if i >= Op(len(_Op_index)-1) {

View File

@ -23,7 +23,7 @@ func NewDecl(pos src.XPos, op Op, x *Name) *Decl {
switch op { switch op {
default: default:
panic("invalid Decl op " + op.String()) panic("invalid Decl op " + op.String())
case ODCL, ODCLCONST, ODCLTYPE: case ODCL:
n.op = op n.op = op
} }
return n return n

View File

@ -1440,8 +1440,7 @@ func (s *state) stmt(n ir.Node) {
n := n.(*ir.BlockStmt) n := n.(*ir.BlockStmt)
s.stmtList(n.List) s.stmtList(n.List)
// No-ops case ir.OFALL: // no-op
case ir.ODCLCONST, ir.ODCLTYPE, ir.OFALL:
// Expression statements // Expression statements
case ir.OCALLFUNC: case ir.OCALLFUNC:

View File

@ -802,17 +802,6 @@ func typecheck1(n ir.Node, top int) ir.Node {
case ir.ODCLFUNC: case ir.ODCLFUNC:
tcFunc(n.(*ir.Func)) tcFunc(n.(*ir.Func))
return n return n
case ir.ODCLCONST:
n := n.(*ir.Decl)
n.X = Expr(n.X).(*ir.Name)
return n
case ir.ODCLTYPE:
n := n.(*ir.Decl)
n.X = typecheck(n.X, ctxType).(*ir.Name)
types.CheckSize(n.X.Type())
return n
} }
// No return n here! // No return n here!

View File

@ -713,8 +713,6 @@ func (o *orderState) stmt(n ir.Node) {
case ir.OBREAK, case ir.OBREAK,
ir.OCONTINUE, ir.OCONTINUE,
ir.ODCL, ir.ODCL,
ir.ODCLCONST,
ir.ODCLTYPE,
ir.OFALL, ir.OFALL,
ir.OGOTO, ir.OGOTO,
ir.OLABEL, ir.OLABEL,

View File

@ -88,8 +88,6 @@ func walkStmt(n ir.Node) ir.Node {
ir.OLABEL, ir.OLABEL,
ir.OJUMPTABLE, ir.OJUMPTABLE,
ir.ODCL, ir.ODCL,
ir.ODCLCONST,
ir.ODCLTYPE,
ir.OCHECKNIL: ir.OCHECKNIL:
return n return n