diff --git a/internal/inst/types.go b/internal/inst/types.go index c0b10e2..20b6f2f 100644 --- a/internal/inst/types.go +++ b/internal/inst/types.go @@ -7,8 +7,9 @@ type Instruction struct { } type Form struct { - Operands []Operand - CPUID []string + ISA []string + Operands []Operand + ImplicitOperands []Operand } type Operand struct { @@ -16,6 +17,11 @@ type Operand struct { Action Action } +type ImplicitOperand struct { + Register string + Action Action +} + type Action uint8 const ( diff --git a/internal/load/load.go b/internal/load/load.go index 9e9b3bc..0bba60d 100644 --- a/internal/load/load.go +++ b/internal/load/load.go @@ -81,10 +81,6 @@ func (l *Loader) init() error { return err } - // for a, op := range l.alias { - // log.Printf("alias %#v -> %s", a, op) - // } - l.order = opcodescsv.BuildOrderMap(icsv) return nil @@ -279,8 +275,24 @@ func (l Loader) form(opcode string, f opcodesxml.Form) inst.Form { ops[0].Type = "imm2u" } + // Extract implicit operands. + var implicits []inst.ImplicitOperand + for _, implicit := range f.ImplicitOperands { + implicits = append(implicits, inst.ImplicitOperand{ + Register: implicit.ID, + Action: inst.ActionFromReadWrite(implicit.Input, implicit.Output), + }) + } + + // Extract ISA flags. + var isas []string + for _, isa := range f.ISA { + isas = append(isas, isa.ID) + } + return inst.Form{ Operands: ops, + ISA: isas, } }