From 6216c9d83cace8400315d89bac7e52445c6b3cdb Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Tue, 16 Jan 2024 22:09:45 +0300 Subject: [PATCH] oppc/code: do not emit pseudocode unless necessary --- src/openpower/oppc/pc_code.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) -- 2.30.2