From 48a0e441f76ed6173c00f5fcf37e23983ab4bcdb Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 6 Nov 2022 12:29:55 +0300 Subject: [PATCH] power_insn: cache operands --- src/openpower/decoder/power_insn.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index af6fb80c..72aea8bd 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -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): -- 2.30.2