aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-03-01 11:02:48 -0500
committerDavid Chase <drchase@google.com>2021-03-03 15:01:05 +0000
commit3e524ee65addd8a30bbfb4fd69508d429fda6d4f (patch)
tree7d07d1c2c750da0414222178628c31c7b85915ec
parent9f33dc3ca1b7b6bdb1a8e83c24d490f579bbbdc8 (diff)
downloadgo-3e524ee65addd8a30bbfb4fd69508d429fda6d4f.tar.gz
go-3e524ee65addd8a30bbfb4fd69508d429fda6d4f.zip
cmd/compile: make modified Aux type for OpArgXXXX pass ssa/check
For #40724. Change-Id: I7d1e76139d187cd15a6e0df9d19542b7200589f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/297911 Trust: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
-rw-r--r--src/cmd/compile/internal/ssa/check.go6
-rw-r--r--src/cmd/compile/internal/ssa/gen/genericOps.go4
-rw-r--r--src/cmd/compile/internal/ssa/op.go41
-rw-r--r--src/cmd/compile/internal/ssa/opGen.go4
-rw-r--r--src/cmd/compile/internal/ssa/value.go2
5 files changed, 32 insertions, 25 deletions
diff --git a/src/cmd/compile/internal/ssa/check.go b/src/cmd/compile/internal/ssa/check.go
index 9e4aa6cd79..969fd96dbf 100644
--- a/src/cmd/compile/internal/ssa/check.go
+++ b/src/cmd/compile/internal/ssa/check.go
@@ -182,6 +182,12 @@ func checkFunc(f *Func) {
f.Fatalf("value %v has Aux type %T, want *AuxCall", v, v.Aux)
}
canHaveAux = true
+ case auxNameOffsetInt8:
+ if _, ok := v.Aux.(*AuxNameOffset); !ok {
+ f.Fatalf("value %v has Aux type %T, want *AuxNameOffset", v, v.Aux)
+ }
+ canHaveAux = true
+ canHaveAuxInt = true
case auxSym, auxTyp:
canHaveAux = true
case auxSymOff, auxSymValAndOff, auxTypSize:
diff --git a/src/cmd/compile/internal/ssa/gen/genericOps.go b/src/cmd/compile/internal/ssa/gen/genericOps.go
index b730c436cf..ee85156a42 100644
--- a/src/cmd/compile/internal/ssa/gen/genericOps.go
+++ b/src/cmd/compile/internal/ssa/gen/genericOps.go
@@ -336,8 +336,8 @@ var genericOps = []opData{
// Like Arg, these are generic ops that survive lowering. AuxInt is a register index, and the actual output register for each index is defined by the architecture.
// AuxInt = integer argument index (not a register number). ABI-specified spill loc obtained from function
- {name: "ArgIntReg", aux: "Int8", zeroWidth: true}, // argument to the function in an int reg.
- {name: "ArgFloatReg", aux: "Int8", zeroWidth: true}, // argument to the function in a float reg.
+ {name: "ArgIntReg", aux: "NameOffsetInt8", zeroWidth: true}, // argument to the function in an int reg.
+ {name: "ArgFloatReg", aux: "NameOffsetInt8", zeroWidth: true}, // argument to the function in a float reg.
// The address of a variable. arg0 is the base pointer.
// If the variable is a global, the base pointer will be SB and
diff --git a/src/cmd/compile/internal/ssa/op.go b/src/cmd/compile/internal/ssa/op.go
index f704848425..0bc7b0ca0d 100644
--- a/src/cmd/compile/internal/ssa/op.go
+++ b/src/cmd/compile/internal/ssa/op.go
@@ -240,26 +240,27 @@ func OwnAuxCall(fn *obj.LSym, args []Param, results []Param, paramResultInfo *ab
}
const (
- auxNone auxType = iota
- auxBool // auxInt is 0/1 for false/true
- auxInt8 // auxInt is an 8-bit integer
- auxInt16 // auxInt is a 16-bit integer
- auxInt32 // auxInt is a 32-bit integer
- auxInt64 // auxInt is a 64-bit integer
- auxInt128 // auxInt represents a 128-bit integer. Always 0.
- auxUInt8 // auxInt is an 8-bit unsigned integer
- auxFloat32 // auxInt is a float32 (encoded with math.Float64bits)
- auxFloat64 // auxInt is a float64 (encoded with math.Float64bits)
- auxFlagConstant // auxInt is a flagConstant
- auxString // aux is a string
- auxSym // aux is a symbol (a *gc.Node for locals, an *obj.LSym for globals, or nil for none)
- auxSymOff // aux is a symbol, auxInt is an offset
- auxSymValAndOff // aux is a symbol, auxInt is a ValAndOff
- auxTyp // aux is a type
- auxTypSize // aux is a type, auxInt is a size, must have Aux.(Type).Size() == AuxInt
- auxCCop // aux is a ssa.Op that represents a flags-to-bool conversion (e.g. LessThan)
- auxCall // aux is a *ssa.AuxCall
- auxCallOff // aux is a *ssa.AuxCall, AuxInt is int64 param (in+out) size
+ auxNone auxType = iota
+ auxBool // auxInt is 0/1 for false/true
+ auxInt8 // auxInt is an 8-bit integer
+ auxInt16 // auxInt is a 16-bit integer
+ auxInt32 // auxInt is a 32-bit integer
+ auxInt64 // auxInt is a 64-bit integer
+ auxInt128 // auxInt represents a 128-bit integer. Always 0.
+ auxUInt8 // auxInt is an 8-bit unsigned integer
+ auxFloat32 // auxInt is a float32 (encoded with math.Float64bits)
+ auxFloat64 // auxInt is a float64 (encoded with math.Float64bits)
+ auxFlagConstant // auxInt is a flagConstant
+ auxNameOffsetInt8 // aux is a &struct{Name ir.Name, Offset int64}; auxInt is index in parameter registers array
+ auxString // aux is a string
+ auxSym // aux is a symbol (a *gc.Node for locals, an *obj.LSym for globals, or nil for none)
+ auxSymOff // aux is a symbol, auxInt is an offset
+ auxSymValAndOff // aux is a symbol, auxInt is a ValAndOff
+ auxTyp // aux is a type
+ auxTypSize // aux is a type, auxInt is a size, must have Aux.(Type).Size() == AuxInt
+ auxCCop // aux is a ssa.Op that represents a flags-to-bool conversion (e.g. LessThan)
+ auxCall // aux is a *ssa.AuxCall
+ auxCallOff // aux is a *ssa.AuxCall, AuxInt is int64 param (in+out) size
// architecture specific aux types
auxARM64BitField // aux is an arm64 bitfield lsb and width packed into auxInt
diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go
index a26eec680f..a9565ffe4b 100644
--- a/src/cmd/compile/internal/ssa/opGen.go
+++ b/src/cmd/compile/internal/ssa/opGen.go
@@ -35445,14 +35445,14 @@ var opcodeTable = [...]opInfo{
},
{
name: "ArgIntReg",
- auxType: auxInt8,
+ auxType: auxNameOffsetInt8,
argLen: 0,
zeroWidth: true,
generic: true,
},
{
name: "ArgFloatReg",
- auxType: auxInt8,
+ auxType: auxNameOffsetInt8,
argLen: 0,
zeroWidth: true,
generic: true,
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index 55e4b684c1..127e4ce641 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -78,7 +78,7 @@ func (v *Value) String() string {
}
func (v *Value) AuxInt8() int8 {
- if opcodeTable[v.Op].auxType != auxInt8 {
+ if opcodeTable[v.Op].auxType != auxInt8 && opcodeTable[v.Op].auxType != auxNameOffsetInt8 {
v.Fatalf("op %s doesn't have an int8 aux field", v.Op)
}
return int8(v.AuxInt)