sv_binutils: mark already visited instructions
authorDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Tue, 25 Jan 2022 19:54:52 +0000 (19:54 +0000)
committerDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Sat, 29 Jan 2022 14:33:41 +0000 (14:33 +0000)
src/openpower/sv/sv_binutils.py

index 7c9244b400d8a8841acf1ad4e53be0ed4b0f83ec..6846076346d3bafac8202cfd378a4ec75d3f30e8 100644 (file)
@@ -380,6 +380,7 @@ ISA = _SVP64RM()
 FIELDS = {field.name:field for field in _dataclasses.fields(Record)}
 FIELDS.update({field.name:field for field in _dataclasses.fields(Entry)})
 def parse(path, opcode_cls):
+    visited = set()
     for record in ISA.get_svp64_csv(path):
         opcode = opcode_cls(record.pop("opcode"))
         names = record.pop("comment").split("=")[-1]
@@ -411,7 +412,10 @@ def parse(path, opcode_cls):
 
                 record[key] = value
 
-            yield Entry(name=name, record=Record(**record))
+            if name not in visited:
+                yield Entry(name=name, record=Record(**record))
+
+            visited.add(name)
 
 
 def main(codegen):