1
0
mirror of https://github.com/golang/go synced 2024-11-14 08:50:22 -07:00
go/src/cmd/internal
Cherry Zhang f20944de78 cmd/compile: set/unset base register for better assembly print
For address of an auto or arg, on all non-x86 architectures
the assembler backend encodes the actual SP offset in the
instruction but leaves the offset in Prog unchanged. When the
assembly is printed in compile -S, it shows an offset
relative to pseudo FP/SP with an actual hardware SP base
register (e.g. R13 on ARM). This is confusing. Unset the
base register if it is indeed SP, so the assembly output is
consistent. If the base register isn't SP, it should be an
error and the error output contains the actual base register.

For address loading instructions, the base register isn't set
in the compiler on non-x86 architectures. Set it. Normally it
is SP and will be unset in the change mentioned above for
printing. If it is not, it will be an error and the error
output contains the actual base register.

No change in generated binary, only printed assembly. Passes
"go build -a -toolexec 'toolstash -cmp' std cmd" on all
architectures.

Fixes #21064.

Change-Id: Ifafe8d5f9b437efbe824b63b3cbc2f5f6cdc1fd5
Reviewed-on: https://go-review.googlesource.com/49432
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-08-02 12:24:02 +00:00
..
bio cmd/internal/obj: remove use of package bio 2016-04-14 17:58:33 +00:00
browser cmd/internal/browser: fix typo 2017-02-24 20:49:10 +00:00
dwarf cmd/internal/dwarf: update to DWARF4, emit frame_base 2017-05-26 21:29:21 +00:00
gcprog cmd/{asm,compile/internal}: delete dead code 2016-08-25 12:20:29 +00:00
goobj cmd/internal/objabi: fix the bug of shrinking SymType down to a uint8 2017-05-16 12:26:10 +00:00
obj cmd/compile: set/unset base register for better assembly print 2017-08-02 12:24:02 +00:00
objabi cmd/compile: omit X:framepointer in compile version 2017-07-17 16:36:49 +00:00
objfile cmd/internal: remove SymKind values that are only checked for, never set 2017-04-28 20:01:54 +00:00
src Revert "cmd/compile: output DWARF lexical blocks for local variables" 2017-04-07 19:52:26 +00:00
sys cmd: remove IntSize and Widthint 2017-04-22 17:43:43 +00:00