From: Dmitry Selyutin Date: Thu, 22 Jun 2023 15:32:18 +0000 (+0300) Subject: insndb/core: introduce basic walker X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=884d655254925359d0f1afe47f5db2b4bca73df3;p=openpower-isa.git insndb/core: introduce basic walker --- diff --git a/src/openpower/insndb/core.py b/src/openpower/insndb/core.py index 01a029d1..e5b1b12e 100644 --- a/src/openpower/insndb/core.py +++ b/src/openpower/insndb/core.py @@ -12,6 +12,9 @@ import re as _re import types as _types import typing as _typing +import mdis.dispatcher +import mdis.walker + try: from functools import cached_property except ImportError: @@ -3707,3 +3710,9 @@ class Database: return self.__names.get(key) raise ValueError("instruction or name expected") + + +class Walker(mdis.walker.Walker): + @mdis.dispatcher.Hook(Database) + def dispatch_database(self, node): + yield from self(tuple(node))