Commit 1cdf4bf3 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/ssa: add SymEffect attribute to SSA Ops

To replace the progeffects tables for liveness analysis.

Change-Id: Idc4b990665cb0a9aa300d62cdf8ad12e51c5b991
Reviewed-on: https://go-review.googlesource.com/38083
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 5f5d882f
......@@ -18,6 +18,7 @@ import (
"path"
"regexp"
"sort"
"strings"
)
type arch struct {
......@@ -53,6 +54,7 @@ type opData struct {
faultOnNilArg1 bool // this op will fault if arg1 is nil (and aux encodes a small offset)
usesScratch bool // this op requires scratch memory space
hasSideEffects bool // for "reasons", not to be eliminated. E.g., atomic store, #19182.
symEffect string // effect this op has on symbol in aux
}
type blockData struct {
......@@ -212,6 +214,12 @@ func genOp() {
if v.hasSideEffects {
fmt.Fprintln(w, "hasSideEffects: true,")
}
if v.symEffect != "" {
if !strings.HasPrefix(v.aux, "Sym") {
log.Fatalf("symEffect with aux %s not allowed", v.aux)
}
fmt.Fprintf(w, "symEffect: Sym%s,\n", v.symEffect)
}
if a.name == "generic" {
fmt.Fprintln(w, "generic:true,")
fmt.Fprintln(w, "},") // close op
......@@ -273,6 +281,9 @@ func genOp() {
fmt.Fprintln(w, "func (o Op) UsesScratch() bool { return opcodeTable[o].usesScratch }")
fmt.Fprintln(w, "func (o Op) SymEffect() SymEffect { return opcodeTable[o].symEffect }")
fmt.Fprintln(w, "func (o Op) IsCall() bool { return opcodeTable[o].call }")
// generate registers
for _, a := range archs {
if a.generic {
......
......@@ -35,6 +35,7 @@ type opInfo struct {
faultOnNilArg1 bool // this op will fault if arg1 is nil (and aux encodes a small offset)
usesScratch bool // this op requires scratch memory space
hasSideEffects bool // for "reasons", not to be eliminated. E.g., atomic store, #19182.
symEffect SymEffect // effect this op has on symbol in aux
}
type inputInfo struct {
......@@ -75,6 +76,20 @@ const (
auxSymInt32 // aux is a symbol, auxInt is a 32-bit integer
)
// A SymEffect describes the effect that an SSA Value has on the variable
// identified by the symbol in its Aux field.
type SymEffect int8
const (
SymRead SymEffect = 1 << iota
SymWrite
SymAddr
SymRdWr = SymRead | SymWrite
SymNone SymEffect = 0
)
// A ValAndOff is used by the several opcodes. It holds
// both a value and a pointer offset.
// A ValAndOff is intended to be encoded into an AuxInt field.
......
......@@ -21855,6 +21855,8 @@ var opcodeTable = [...]opInfo{
func (o Op) Asm() obj.As { return opcodeTable[o].asm }
func (o Op) String() string { return opcodeTable[o].name }
func (o Op) UsesScratch() bool { return opcodeTable[o].usesScratch }
func (o Op) SymEffect() SymEffect { return opcodeTable[o].symEffect }
func (o Op) IsCall() bool { return opcodeTable[o].call }
var registers386 = [...]Register{
{0, x86.REG_AX, "AX"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment