diff --git a/tealer/teal/basic_blocks.py b/tealer/teal/basic_blocks.py index d174d91..bed0eed 100644 --- a/tealer/teal/basic_blocks.py +++ b/tealer/teal/basic_blocks.py @@ -14,6 +14,7 @@ """ from typing import List, Optional, TYPE_CHECKING +import functools from tealer.teal.instructions.instructions import Instruction @@ -45,6 +46,7 @@ def add_instruction(self, instruction: Instruction) -> None: instruction: intruction to add to the basic block. """ + self.__str__.cache_clear() self._instructions.append(instruction) @property @@ -127,6 +129,7 @@ def teal(self) -> Optional["Teal"]: def teal(self, teal_instance: "Teal") -> None: self._teal = teal_instance + @functools.lru_cache(maxsize=None) def __str__(self) -> str: ret = "" for ins in self._instructions: