Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: -S reports NOP as WORD $0 on mips and mips64 #18238

Closed
minux opened this issue Dec 7, 2016 · 3 comments
Closed

cmd/compile: -S reports NOP as WORD $0 on mips and mips64 #18238

minux opened this issue Dec 7, 2016 · 3 comments
Milestone

Comments

@minux
Copy link
Member

minux commented Dec 7, 2016

go tool compile -S reports NOPs in delay slots as "WORD $0",
and what's more, there are extra zero-length NOP pseduo
instructions in the output, which is very confusing.

e.g.

$ GOARCH=mips go tool compile -S $GOROOT/test/helloworld.go
"".main t=1 size=104 args=0x0 locals=0x8
        0x0000 00000 (../test/helloworld.go:11) TEXT    "".main(SB), $8-0
        0x0000 00000 (../test/helloworld.go:11) MOVW    8(g), R1
        0x0004 00004 (../test/helloworld.go:11) SGTU    R29, R1, R1
        0x0008 00008 (../test/helloworld.go:11) BNE     R1, 36
        0x000c 00012 (../test/helloworld.go:11) WORD    $0
        0x0010 00016 (../test/helloworld.go:11) MOVW    R31, R3
        0x0014 00020 (../test/helloworld.go:11) CALL    runtime.morestack_noctxt(SB)
        0x0018 00024 (../test/helloworld.go:11) WORD    $0   // a real NOP in delay slot
        0x001c 00028 (../test/helloworld.go:11) JMP     0
        0x0020 00032 (../test/helloworld.go:11) WORD    $0  // a real NOP in delay slot
        0x0024 00036 (../test/helloworld.go:11) NOP   // a pseudo NOP
        0x0024 00036 (../test/helloworld.go:11) MOVW    R31, -12(R29)
        0x0028 00040 (../test/helloworld.go:11) ADDU    $-12, R29
        0x002c 00044 (../test/helloworld.go:11) FUNCDATA        $0, gclocals·2002e13acf59079a1a5782c918894579(SB)
        0x002c 00044 (../test/helloworld.go:11) FUNCDATA        $1, gclocals·2002e13acf59079a1a5782c918894579(SB)
        0x002c 00044 (../test/helloworld.go:12) PCDATA  $0, $0

I propose that we don't emit pseudo NOP (NOPs that are added by compiler but
discard by cmd/internal/obj) and replace delay slot filling NOPs as "NOP".

@minux minux changed the title cmd/compile: -S reports NOP as WORD $0 on mips cmd/compile: -S reports NOP as WORD $0 on mips and mips64 Dec 7, 2016
@minux minux added this to the Go1.9 milestone Dec 7, 2016
@minux
Copy link
Member Author

minux commented Dec 7, 2016

/cc @cherrymui.

@cherrymui
Copy link
Member

The zero-sized pseudo NOP are printed on all architecture. We probably don't want to change it for MIPS.

CL https://go-review.googlesource.com/c/40297/ changes hardware NOP from WORD $0 to NOOP.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/40297 mentions this issue.

@golang golang locked and limited conversation to collaborators May 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants