From 870f7f23273d1d0d49af9ed09d82c42f2347ef07 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 23 May 2023 19:24:34 -0700 Subject: [PATCH] add support for adding extra uninit_regs from html comment I chose an html comment since it's not part of the proposed pseudocode like so: * blah RT,RA Pseudo-code: if rand() then RT <- 42 + (RA) --- src/openpower/decoder/pseudo/pagereader.py | 14 +++++++++++++- src/openpower/decoder/pseudo/pywriter.py | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/pseudo/pagereader.py b/src/openpower/decoder/pseudo/pagereader.py index 71301f2f..b2fca28e 100644 --- a/src/openpower/decoder/pseudo/pagereader.py +++ b/src/openpower/decoder/pseudo/pagereader.py @@ -45,12 +45,14 @@ this translates to: """ from openpower.util import log +from openpower.decoder.orderedset import OrderedSet from collections import namedtuple, OrderedDict from copy import copy import os import re -opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page") +opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page", + "extra_uninit_regs") Ops = namedtuple("Ops", opfields) @@ -302,6 +304,8 @@ class ISA: print(repr(l)) assert len(l) == 0, ("blank line not found %s" % l) + extra_uninit_regs = OrderedSet() + # get pseudocode # fix parser line numbers by prepending the right number of @@ -314,6 +318,13 @@ class ISA: if len(l) == 0: li.append(l) break + re_match = re.fullmatch(r" *", l) + if re_match: + for i in re_match[1].split(' '): + if i != "": + extra_uninit_regs.add(i) + li.append("") + continue if l.strip().startswith('