From: Dmitry Selyutin Date: Sun, 4 Jun 2023 08:53:10 +0000 (+0300) Subject: insndb/db: change naming a bit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62db2ab5876ed049f241feec683ccaf3564ab0b2;p=openpower-isa.git insndb/db: change naming a bit --- diff --git a/src/openpower/insndb/db.py b/src/openpower/insndb/db.py index b8311f31..3b79a180 100644 --- a/src/openpower/insndb/db.py +++ b/src/openpower/insndb/db.py @@ -38,29 +38,29 @@ class ListVisitor(BaseVisitor): yield record -class ConcreteInstructionVisitor(BaseVisitor): +class InstructionVisitor(BaseVisitor): def __init__(self, insn, **_): self.__insn = insn return super().__init__() - def handler(self, record): + def concrete_record(self, record): raise NotImplementedError @contextlib.contextmanager def record(self, record): if record.name == self.__insn: - self.handler(record=record) + self.concrete_record(record=record) yield record -class OpcodesVisitor(ConcreteInstructionVisitor): - def handler(self, record): +class OpcodesVisitor(InstructionVisitor): + def concrete_record(self, record): for opcode in record.opcodes: print(opcode) -class OperandsVisitor(ConcreteInstructionVisitor): - def handler(self, record): +class OperandsVisitor(InstructionVisitor): + def concrete_record(self, record): for operand in record.dynamic_operands: print(operand.name) for operand in record.static_operands: @@ -68,8 +68,8 @@ class OperandsVisitor(ConcreteInstructionVisitor): print(operand.name, operand.value, sep="=") -class PCodeVisitor(ConcreteInstructionVisitor): - def handler(self, record): +class PCodeVisitor(InstructionVisitor): + def concrete_record(self, record): for line in record.pcode: print(line) @@ -103,7 +103,7 @@ def main(): for (command, (visitor, help)) in commands.items(): parser = main_subparser.add_parser(command, help=help) - if issubclass(visitor, ConcreteInstructionVisitor): + if issubclass(visitor, InstructionVisitor): parser.add_argument("insn", type=Instruction, metavar="INSN", help="instruction")