working on code
[bigint-presentation-code.git] / src / bigint_presentation_code / register_allocator.py
index 76fc966ccfbf721a85132f8ff2c2a1a0b880e881..0539f0a87a2226c937db3b99b8a500c2f5b010bf 100644 (file)
@@ -5,7 +5,7 @@ this uses an algorithm based on:
 [Retargetable Graph-Coloring Register Allocation for Irregular Architectures](https://user.it.uu.se/~svenolof/wpo/AllocSCOPES2003.20030626b.pdf)
 """
 
-from functools import reduce
+from functools import lru_cache, reduce
 from itertools import combinations, count
 from typing import Callable, Container, Iterable, Iterator, Mapping, TextIO, Tuple
 
@@ -296,6 +296,7 @@ class MergedSSAVal(metaclass=InternedMeta):
                             return lhs, rhs
         return None
 
+    @lru_cache(maxsize=None, typed=True)
     def copy_merged(self, lhs_loc, rhs, rhs_loc, copy_relation):
         # type: (Loc | None, MergedSSAVal, Loc | None, _CopyRelation) -> MergedSSAVal
         cr_lhs, cr_rhs = copy_relation