mirror of
https://github.com/golang/go
synced 2024-10-05 22:21:23 -06:00
[dev.ssa] cmd/compile: don't generate zero values for ssa ops
Shorter code, easier to read, no pointless empty slices. Change-Id: Id410364b4f6924b5665188af3373a5e914117c38 Reviewed-on: https://go-review.googlesource.com/12480 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
ac1935b3a7
commit
8fb6358153
@ -112,26 +112,37 @@ func genOp() {
|
|||||||
for _, v := range a.ops {
|
for _, v := range a.ops {
|
||||||
fmt.Fprintln(w, "{")
|
fmt.Fprintln(w, "{")
|
||||||
fmt.Fprintf(w, "name:\"%s\",\n", v.name)
|
fmt.Fprintf(w, "name:\"%s\",\n", v.name)
|
||||||
|
if a.name == "generic" {
|
||||||
|
fmt.Fprintln(w, "generic:true,")
|
||||||
|
fmt.Fprintln(w, "},") // close op
|
||||||
|
// generic ops have no reg info or asm
|
||||||
|
continue
|
||||||
|
}
|
||||||
if v.asm != "" {
|
if v.asm != "" {
|
||||||
fmt.Fprintf(w, "asm: x86.A%s,\n", v.asm)
|
fmt.Fprintf(w, "asm: x86.A%s,\n", v.asm)
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "reg:regInfo{")
|
fmt.Fprintln(w, "reg:regInfo{")
|
||||||
|
// reg inputs
|
||||||
|
if len(v.reg.inputs) > 0 {
|
||||||
fmt.Fprintln(w, "inputs: []regMask{")
|
fmt.Fprintln(w, "inputs: []regMask{")
|
||||||
for _, r := range v.reg.inputs {
|
for _, r := range v.reg.inputs {
|
||||||
fmt.Fprintf(w, "%d,%s\n", r, a.regMaskComment(r))
|
fmt.Fprintf(w, "%d,%s\n", r, a.regMaskComment(r))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "},")
|
fmt.Fprintln(w, "},")
|
||||||
|
}
|
||||||
|
if v.reg.clobbers > 0 {
|
||||||
fmt.Fprintf(w, "clobbers: %d,%s\n", v.reg.clobbers, a.regMaskComment(v.reg.clobbers))
|
fmt.Fprintf(w, "clobbers: %d,%s\n", v.reg.clobbers, a.regMaskComment(v.reg.clobbers))
|
||||||
|
}
|
||||||
|
// reg outputs
|
||||||
|
if len(v.reg.outputs) > 0 {
|
||||||
fmt.Fprintln(w, "outputs: []regMask{")
|
fmt.Fprintln(w, "outputs: []regMask{")
|
||||||
for _, r := range v.reg.outputs {
|
for _, r := range v.reg.outputs {
|
||||||
fmt.Fprintf(w, "%d,%s\n", r, a.regMaskComment(r))
|
fmt.Fprintf(w, "%d,%s\n", r, a.regMaskComment(r))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "},")
|
fmt.Fprintln(w, "},")
|
||||||
fmt.Fprintln(w, "},")
|
|
||||||
if a.name == "generic" {
|
|
||||||
fmt.Fprintln(w, "generic:true,")
|
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "},")
|
fmt.Fprintln(w, "},") // close reg info
|
||||||
|
fmt.Fprintln(w, "},") // close op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "}")
|
fmt.Fprintln(w, "}")
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user