]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile: simplify 386+PIC+globals a bit
authorKeith Randall <khr@golang.org>
Thu, 11 Aug 2016 19:56:36 +0000 (12:56 -0700)
committerKeith Randall <khr@golang.org>
Thu, 11 Aug 2016 20:34:47 +0000 (20:34 +0000)
commit94c8e59ae11d374cd8dd46afec4710ad10500ad9
treef0864b3977132a3bc16ba9555c159d686eb62bda
parent8f955d3664813c831b35cb02c6e7b48dd0341ece
[dev.ssa] cmd/compile: simplify 386+PIC+globals a bit

We shouldn't issue instructions like MOVL foo(SB), AX directly from the
SSA backend.  Instead we should do LEAL foo(SB), AX; MOVL (AX), AX.

This simplifies obj logic because now only LEAL needs to be treated
specially.  The register allocator uses the LEAL to in effect allocate
the temporary register required for the shared library thunk calls.

Also, the LEALs can now be CSEd.  So code like
    var g int
    func f() { g += 5 }
Requires only one thunk call instead of 2.

Change-Id: Ib87d465f617f73af437445871d0ea91a630b2355
Reviewed-on: https://go-review.googlesource.com/26814
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/gen/386.rules
src/cmd/compile/internal/ssa/rewrite386.go
src/cmd/internal/obj/x86/obj6.go