import isa and implicit operands
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user