)
from openpower.insndb.core import (
Database,
- Extra,
Record,
Records,
Visitor,
yield node
-class OpcodesVisitor(Visitor):
+# No use other than checking issubclass and adding an argument.
+class InstructionVisitor(Visitor):
+ pass
+
+class SVP64InstructionVisitor(InstructionVisitor):
+ pass
+
+
+class OpcodesVisitor(InstructionVisitor):
@visitormethod(Record)
def Record(self, node):
for opcode in node.opcodes:
yield node
-class OperandsVisitor(Visitor):
+class OperandsVisitor(InstructionVisitor):
@visitormethod(Record)
def Record(self, node):
if isinstance(node, Record):
yield node
-class PCodeVisitor(Visitor):
+class PCodeVisitor(InstructionVisitor):
@visitormethod(Record)
def Record(self, node):
if isinstance(node, Record):
yield node
-class ExtrasVisitor(Visitor):
+class ExtrasVisitor(SVP64InstructionVisitor):
@visitormethod(Record)
def Record(self, node):
for (name, extra) in node.extras.items():
for (command, (visitor, helper)) in commands.items():
parser = main_subparser.add_parser(command, help=helper)
- if command not in ("list",):
+ if issubclass(visitor, InstructionVisitor):
if command in ("extras",):
arg_cls = SVP64Instruction
else:
db = Database(find_wiki_dir())
records = next(db.walk(match=lambda node: isinstance(node, Records)))
- if command in ("list",):
+ if not isinstance(visitor, InstructionVisitor):
match = None
else:
insn = args.pop("insn")