2018-12-02 21:12:56 -08:00
|
|
|
package gen
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
pkg = "github.com/mmcloughlin/avo"
|
|
|
|
|
operandType = "operand.Op"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// implicitRegister returns avo syntax for the given implicit register type (from Opcodes XML).
|
|
|
|
|
func implicitRegister(t string) string {
|
|
|
|
|
r := strings.Replace(t, "mm", "", 1) // handles the "xmm0" type
|
|
|
|
|
return fmt.Sprintf("reg.%s", strings.ToUpper(r))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// checkername returns the name of the function that checks an operand of type t.
|
|
|
|
|
func checkername(t string) string {
|
2018-12-31 11:20:55 -08:00
|
|
|
return "operand.Is" + strings.ToUpper(t)
|
2018-12-02 21:12:56 -08:00
|
|
|
}
|