From: Dmitry Selyutin Date: Tue, 16 Jan 2024 19:09:45 +0000 (+0300) Subject: oppc/code: do not emit pseudocode unless necessary X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6216c9d83cace8400315d89bac7e52445c6b3cdb;p=openpower-isa.git oppc/code: do not emit pseudocode unless necessary --- diff --git a/src/openpower/oppc/pc_code.py b/src/openpower/oppc/pc_code.py index 04dcf236..bf15f57f 100644 --- a/src/openpower/oppc/pc_code.py +++ b/src/openpower/oppc/pc_code.py @@ -172,8 +172,9 @@ class CodeVisitor(pc_util.Visitor): @contextlib.contextmanager def pseudocode(self, node): - for (level, stmt) in self.__pseudocode[node]: - self[node].emit(stmt=f"/* {stmt} */", level=level) + if node in self.__pseudocode: + for (level, stmt) in self.__pseudocode[node]: + self[node].emit(stmt=f"/* {stmt} */", level=level) yield @pc_util.Hook(pc_ast.Scope)