power_insn: cache operands
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 6 Nov 2022 09:29:55 +0000 (12:29 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
src/openpower/decoder/power_insn.py

index af6fb80cbc8a0b640e6a85349e7c48122621dbdb..72aea8bd1617893941303e07d08915d49d0b1b59 100644 (file)
@@ -691,21 +691,29 @@ class Record:
     def XO(self):
         return self.PO_XO[1]
 
-    @property
+    @cached_property
     def static_operands(self):
+        operands = []
         (PO, XO) = self.PO_XO
-        yield POStaticOperand(record=self,
-            name="PO", value=(PO.value & PO.mask))
+
+        operands.append(POStaticOperand(record=self,
+            name="PO", value=(PO.value & PO.mask)))
         if XO is not None:
-            yield XOStaticOperand(record=self,
-                name="XO", value=(XO.value & XO.mask))
+            operands.append(XOStaticOperand(record=self,
+                name="XO", value=(XO.value & XO.mask)))
         for (cls, kwargs) in self.mdwn.operands.static:
-            yield cls(record=self, **kwargs)
+            operands.append(cls(record=self, **kwargs))
 
-    @property
+        return tuple(operands)
+
+    @cached_property
     def dynamic_operands(self):
+        operands = []
+
         for (cls, kwargs) in self.mdwn.operands.dynamic:
-            yield cls(record=self, **kwargs)
+            operands.append(cls(record=self, **kwargs))
+
+        return tuple(operands)
 
     @property
     def opcodes(self):