Collect and number all active encoding recipes.

The recipes are shared across CPU modes.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-26 14:48:28 -07:00
parent 15b5576d99
commit 6a8a4c43c2

View File

@@ -976,9 +976,24 @@ class TargetISA(object):
:returns self:
"""
self._collect_encoding_recipes()
self._collect_instruction_predicates()
return self
def _collect_encoding_recipes(self):
"""
Collect and number all encoding recipes in use.
"""
self.all_recipes = list()
rcps = set()
for cpumode in self.cpumodes:
for enc in cpumode.encodings:
recipe = enc.recipe
if recipe not in rcps:
recipe.number = len(rcps)
rcps.add(recipe)
self.all_recipes.append(recipe)
def _collect_instruction_predicates(self):
"""
Collect and number all instruction predicates in use.