pysvp64dis: consider instruction name
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 12:13:06 +0000 (15:13 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 29 Aug 2022 19:38:11 +0000 (20:38 +0100)
src/openpower/sv/trans/pysvp64dis.py

index 5d11a79612395cda64ba37c593ed5ab0e5faa858..5a7bc6f7cda37b19060212696fb97ab4a5b6bf84 100644 (file)
@@ -42,7 +42,9 @@ class Instruction(_SelectableInt):
         return f"{self.__class__.__name__}({self.value:08x})"
 
     def __str__(self):
-        return f".long 0x{self.value:08x}"
+        if not self.dbrecord:
+            return f".long 0x{self.value:08x}"
+        return f".long 0x{self.value:08x} # {self.dbrecord.name}"
 
     @property
     def major(self):
@@ -67,7 +69,9 @@ class PrefixedInstruction(_SelectableInt):
         return f"{self.__class__.__name__}({self.value:016x})"
 
     def __str__(self):
-        return f".llong 0x{self.value:016x}"
+        if self.dbrecord is None:
+            return f".llong 0x{self.value:016x}"
+        return f".llong 0x{self.value:016x} # {self.dbrecord.name}"
 
     @cached_property
     def prefix(self):
@@ -105,7 +109,9 @@ class SVP64Instruction(PrefixedInstruction):
         return super().__init__(prefix, suffix, byteorder)
 
     def __str__(self):
-        return (super().__str__() + " # sv")
+        if self.dbrecord is None:
+            return f".llong 0x{self.value:016x}"
+        return f".llong 0x{self.value:016x} # sv.{self.dbrecord.name}"
 
     @cached_property
     def prefix(self):