mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: use ISEL, cleanup use of zero & extensions
Abandoned earlier efforts to expose zero register, but left it in numbering to decrease squirrelyness of register allocator. ISELrelOp used in code generation of bool := x relOp y. Some patterns added to better elide zero case and some sign extension. Updates: #17109 Change-Id: Ida7839f0023ca8f0ffddc0545f0ac269e65b05d9 Reviewed-on: https://go-review.googlesource.com/29380 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
dcbbd319e9
commit
cddddbc623
12 changed files with 826 additions and 543 deletions
|
|
@ -485,7 +485,7 @@ func (s *regAllocState) init(f *Func) {
|
|||
if s.f.Config.ctxt.Flag_shared {
|
||||
switch s.f.Config.arch {
|
||||
case "ppc64le": // R2 already reserved.
|
||||
s.allocatable &^= 1 << 11 // R12 -- R0 is skipped in PPC64Ops.go
|
||||
s.allocatable &^= 1 << 12 // R12
|
||||
}
|
||||
}
|
||||
if s.f.Config.ctxt.Flag_dynlink {
|
||||
|
|
@ -495,7 +495,7 @@ func (s *regAllocState) init(f *Func) {
|
|||
case "arm":
|
||||
s.allocatable &^= 1 << 9 // R9
|
||||
case "ppc64le": // R2 already reserved.
|
||||
s.allocatable &^= 1 << 11 // R12 -- R0 is skipped in PPC64Ops.go
|
||||
s.allocatable &^= 1 << 12 // R12
|
||||
case "arm64":
|
||||
// nothing to do?
|
||||
case "386":
|
||||
|
|
@ -813,7 +813,9 @@ func (s *regAllocState) regalloc(f *Func) {
|
|||
continue
|
||||
}
|
||||
a := v.Args[idx]
|
||||
m := s.values[a.ID].regs &^ phiUsed
|
||||
// Some instructions target not-allocatable registers.
|
||||
// They're not suitable for further (phi-function) allocation.
|
||||
m := s.values[a.ID].regs &^ phiUsed & s.allocatable
|
||||
if m != 0 {
|
||||
r := pickReg(m)
|
||||
s.freeReg(r)
|
||||
|
|
@ -1942,7 +1944,7 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, line int32
|
|||
var x *Value
|
||||
if c == nil {
|
||||
if !e.s.values[vid].rematerializeable {
|
||||
e.s.f.Fatalf("can't find source for %s->%s: v%d\n", e.p, e.b, vid)
|
||||
e.s.f.Fatalf("can't find source for %s->%s: %s\n", e.p, e.b, v.LongString())
|
||||
}
|
||||
if dstReg {
|
||||
x = v.copyInto(e.p)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue