Add an EncRecipe meta-language class.

Move the CPUMode reference from EncRecipe to the Encoding itself, allowing
EncRecipes to be shared between CPU modes. At least RISC-V should be able to
share some recipes between RV32 and RV64 modes.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-03 12:06:21 -07:00
parent eed6adb413
commit 66f14138bb
2 changed files with 21 additions and 3 deletions

View File

@@ -673,6 +673,22 @@ class CPUMode(object):
self.target = target
class EncRecipe(object):
"""
A recipe for encoding instructions with a given format.
Many different instructions can be encoded by the same recipe, but they
must all have the same instruction format.
:param name: Short mnemonic name for this recipe.
:param format: All encoded instructions must have this
:py:class:`InstructionFormat`.
"""
def __init__(self, name, format):
self.name = name
self.format = format
# Import the fixed instruction formats now so they can be added to the
# registry.
importlib.import_module('cretonne.formats')