1
0
mirror of https://github.com/golang/go synced 2024-11-11 17:51:49 -07:00

cmd/compile: remove ir.OGETCALLERPC

Nothing ever creates this op, so it can be safely removed. Note that SSA
still intrinsifies runtime.getcallerpc.

The similar ir.OGETCALLERSP is still used for defer handling in
typecheck/func.go:tcRecover.

For #54766.

Change-Id: I6bdb2072af2c068080ae977c0cbd4684d0c7c752
Reviewed-on: https://go-review.googlesource.com/c/go/+/613496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2024-09-16 13:17:39 -04:00 committed by Gopher Robot
parent 5b2f71a2c3
commit 72739bbfa6
8 changed files with 9 additions and 15 deletions

View File

@ -38,7 +38,7 @@ func (e *escape) exprSkipInit(k hole, n ir.Node) {
default: default:
base.Fatalf("unexpected expr: %s %v", n.Op().String(), n) base.Fatalf("unexpected expr: %s %v", n.Op().String(), n)
case ir.OLITERAL, ir.ONIL, ir.OGETG, ir.OGETCALLERPC, ir.OGETCALLERSP, ir.OTYPE, ir.OMETHEXPR, ir.OLINKSYMOFFSET: case ir.OLITERAL, ir.ONIL, ir.OGETG, ir.OGETCALLERSP, ir.OTYPE, ir.OMETHEXPR, ir.OLINKSYMOFFSET:
// nop // nop
case ir.ONAME: case ir.ONAME:

View File

@ -211,7 +211,7 @@ func (n *CallExpr) SetOp(op Op) {
case OAPPEND, case OAPPEND,
OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, OCALL, OCALLFUNC, OCALLINTER, OCALLMETH,
ODELETE, ODELETE,
OGETG, OGETCALLERPC, OGETCALLERSP, OGETG, OGETCALLERSP,
OMAKE, OMAX, OMIN, OPRINT, OPRINTLN, OMAKE, OMAX, OMIN, OPRINT, OPRINTLN,
ORECOVER, ORECOVERFP: ORECOVER, ORECOVERFP:
n.op = op n.op = op

View File

@ -303,7 +303,6 @@ const (
// arch-specific opcodes // arch-specific opcodes
OTAILCALL // tail call to another function OTAILCALL // tail call to another function
OGETG // runtime.getg() (read g pointer) OGETG // runtime.getg() (read g pointer)
OGETCALLERPC // runtime.getcallerpc() (continuation PC in caller frame)
OGETCALLERSP // runtime.getcallersp() (stack pointer in caller frame) OGETCALLERSP // runtime.getcallersp() (stack pointer in caller frame)
OEND OEND

View File

@ -157,14 +157,13 @@ func _() {
_ = x[ODYNAMICTYPE-146] _ = x[ODYNAMICTYPE-146]
_ = x[OTAILCALL-147] _ = x[OTAILCALL-147]
_ = x[OGETG-148] _ = x[OGETG-148]
_ = x[OGETCALLERPC-149] _ = x[OGETCALLERSP-149]
_ = x[OGETCALLERSP-150] _ = x[OEND-150]
_ = x[OEND-151]
} }
const _Op_name = "XXXNAMENONAMETYPELITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCAPCLEARCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTLNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERSTRINGHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2MINMAXREALIMAGCOMPLEXUNSAFEADDUNSAFESLICEUNSAFESLICEDATAUNSAFESTRINGUNSAFESTRINGDATAMETHEXPRMETHVALUEBLOCKBREAKCASECONTINUEDEFERFALLFORGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWINLCALLMAKEFACEITABIDATASPTRCFUNCCHECKNILRESULTINLMARKLINKSYMOFFSETJUMPTABLEINTERFACESWITCHDYNAMICDOTTYPEDYNAMICDOTTYPE2DYNAMICTYPETAILCALLGETGGETCALLERPCGETCALLERSPEND" const _Op_name = "XXXNAMENONAMETYPELITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESSLICE2ARRSLICE2ARRPTRASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCAPCLEARCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTLNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERSTRINGHEADERRECOVERRECOVERFPRECVRUNESTRSELRECV2MINMAXREALIMAGCOMPLEXUNSAFEADDUNSAFESLICEUNSAFESLICEDATAUNSAFESTRINGUNSAFESTRINGDATAMETHEXPRMETHVALUEBLOCKBREAKCASECONTINUEDEFERFALLFORGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWINLCALLMAKEFACEITABIDATASPTRCFUNCCHECKNILRESULTINLMARKLINKSYMOFFSETJUMPTABLEINTERFACESWITCHDYNAMICDOTTYPEDYNAMICDOTTYPE2DYNAMICTYPETAILCALLGETGGETCALLERSPEND"
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, 294, 298, 301, 308, 314, 317, 323, 330, 338, 342, 349, 357, 359, 361, 363, 365, 367, 369, 374, 379, 387, 390, 399, 402, 406, 414, 421, 430, 443, 446, 449, 452, 455, 458, 461, 467, 470, 473, 479, 483, 486, 490, 495, 500, 507, 512, 516, 521, 529, 537, 543, 552, 563, 575, 582, 591, 595, 602, 610, 613, 616, 620, 624, 631, 640, 651, 666, 678, 694, 702, 711, 716, 721, 725, 733, 738, 742, 745, 749, 751, 756, 758, 763, 769, 775, 781, 787, 794, 802, 806, 811, 815, 820, 828, 834, 841, 854, 863, 878, 892, 907, 918, 926, 930, 941, 952, 955} 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, 294, 298, 301, 308, 314, 317, 323, 330, 338, 342, 349, 357, 359, 361, 363, 365, 367, 369, 374, 379, 387, 390, 399, 402, 406, 414, 421, 430, 443, 446, 449, 452, 455, 458, 461, 467, 470, 473, 479, 483, 486, 490, 495, 500, 507, 512, 516, 521, 529, 537, 543, 552, 563, 575, 582, 591, 595, 602, 610, 613, 616, 620, 624, 631, 640, 651, 666, 678, 694, 702, 711, 716, 721, 725, 733, 738, 742, 745, 749, 751, 756, 758, 763, 769, 775, 781, 787, 794, 802, 806, 811, 815, 820, 828, 834, 841, 854, 863, 878, 892, 907, 918, 926, 930, 941, 944}
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

@ -3459,10 +3459,6 @@ func (s *state) exprCheckPtr(n ir.Node, checkPtrOK bool) *ssa.Value {
n := n.(*ir.CallExpr) n := n.(*ir.CallExpr)
return s.newValue1(ssa.OpGetG, n.Type(), s.mem()) return s.newValue1(ssa.OpGetG, n.Type(), s.mem())
case ir.OGETCALLERPC:
n := n.(*ir.CallExpr)
return s.newValue0(ssa.OpGetCallerPC, n.Type())
case ir.OGETCALLERSP: case ir.OGETCALLERSP:
n := n.(*ir.CallExpr) n := n.(*ir.CallExpr)
return s.newValue1(ssa.OpGetCallerSP, n.Type(), s.mem()) return s.newValue1(ssa.OpGetCallerSP, n.Type(), s.mem())

View File

@ -490,7 +490,7 @@ func typecheck1(n ir.Node, top int) ir.Node {
n.SetType(types.Types[types.TUINTPTR]) n.SetType(types.Types[types.TUINTPTR])
return n return n
case ir.OGETCALLERPC, ir.OGETCALLERSP: case ir.OGETCALLERSP:
n := n.(*ir.CallExpr) n := n.(*ir.CallExpr)
if len(n.Args) != 0 { if len(n.Args) != 0 {
base.FatalfAt(n.Pos(), "unexpected arguments: %v", n) base.FatalfAt(n.Pos(), "unexpected arguments: %v", n)

View File

@ -87,7 +87,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
base.Fatalf("walkExpr: switch 1 unknown op %+v", n.Op()) base.Fatalf("walkExpr: switch 1 unknown op %+v", n.Op())
panic("unreachable") panic("unreachable")
case ir.OGETG, ir.OGETCALLERPC, ir.OGETCALLERSP: case ir.OGETG, ir.OGETCALLERSP:
return n return n
case ir.OTYPE, ir.ONAME, ir.OLITERAL, ir.ONIL, ir.OLINKSYMOFFSET: case ir.OTYPE, ir.ONAME, ir.OLITERAL, ir.ONIL, ir.OLINKSYMOFFSET:

View File

@ -342,7 +342,7 @@ func mayCall(n ir.Node) bool {
ir.OCAP, ir.OIMAG, ir.OLEN, ir.OREAL, ir.OCAP, ir.OIMAG, ir.OLEN, ir.OREAL,
ir.OCONVNOP, ir.ODOT, ir.OCONVNOP, ir.ODOT,
ir.OCFUNC, ir.OIDATA, ir.OITAB, ir.OSPTR, ir.OCFUNC, ir.OIDATA, ir.OITAB, ir.OSPTR,
ir.OBYTES2STRTMP, ir.OGETG, ir.OGETCALLERPC, ir.OGETCALLERSP, ir.OSLICEHEADER, ir.OSTRINGHEADER: ir.OBYTES2STRTMP, ir.OGETG, ir.OGETCALLERSP, ir.OSLICEHEADER, ir.OSTRINGHEADER:
// ok: operations that don't require function calls. // ok: operations that don't require function calls.
// Expand as needed. // Expand as needed.
} }