ensure all stdlib opcodes are present
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
package load
|
||||
|
||||
import (
|
||||
"github.com/mmcloughlin/avo/internal/inst"
|
||||
)
|
||||
|
||||
// aliases defines a list of opcode aliases. Where possible these are extracted
|
||||
// from the code (see note below).
|
||||
var aliases = map[string]string{
|
||||
// The PSHUFD/PSHUFL alias is not recorded in the list of "Annoying aliases" below. However the instructions are identical.
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L1365
|
||||
//
|
||||
// {APSHUFL, yxshuf, Pq, opBytes{0x70, 00}},
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L1688
|
||||
//
|
||||
// {APSHUFD, yxshuf, Pq, opBytes{0x70, 0}},
|
||||
//
|
||||
"PSHUFD": "PSHUFL",
|
||||
}
|
||||
|
||||
// Go contains a list of self-proclaimed "Annoying aliases", as follows. We use
|
||||
// a script to automatically extract this list from the source code (see the
|
||||
// following go:generate line).
|
||||
// following go:generate line). Then we merge this with the manual list above.
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/asm/internal/arch/arch.go#L126-L182
|
||||
//
|
||||
@@ -66,3 +86,43 @@ package load
|
||||
//
|
||||
|
||||
//go:generate ./annoyingaliases.sh zannoyingaliases.go
|
||||
|
||||
func init() {
|
||||
for from, to := range annoyingaliases {
|
||||
aliases[from] = to
|
||||
}
|
||||
}
|
||||
|
||||
// extras is simply a list of extra instructions to add to the database.
|
||||
var extras = []*inst.Instruction{
|
||||
// MOVLQZX does not appear in either x86 CSV or Opcodes, but does appear in stdlib assembly.
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/runtime/asm_amd64.s#L451-L453
|
||||
//
|
||||
// TEXT ·reflectcall(SB), NOSPLIT, $0-32
|
||||
// MOVLQZX argsize+24(FP), CX
|
||||
// DISPATCH(runtime·call32, 32)
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L1217
|
||||
//
|
||||
// {AMOVLQZX, yml_rl, Px, opBytes{0x8b}},
|
||||
//
|
||||
// Reference: https://github.com/golang/go/blob/048c9164a0c5572df18325e377473e7893dbfb07/src/cmd/internal/obj/x86/asm6.go#L515-L517
|
||||
//
|
||||
// var yml_rl = []ytab{
|
||||
// {Zm_r, 1, argList{Yml, Yrl}},
|
||||
// }
|
||||
//
|
||||
{
|
||||
Opcode: "MOVLQZX",
|
||||
Summary: "Move with Zero-Extend",
|
||||
Forms: []inst.Form{
|
||||
{
|
||||
Operands: []inst.Operand{
|
||||
{Type: "m32", Action: inst.R},
|
||||
{Type: "r64", Action: inst.W},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user