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=2fa3eb4cc11bcd71716f639deaadfb009cc5a4eb;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))