Make legalization actions configurable.

When an instruction doesn't have a valid encoding for the target ISA, it
needs to be legalized. Different legalization strategies can be
expressed as separate XFormGroup objects.

Make the choice of XFormGroup configurable per CPU mode, rather than
depending on a hard-coded default.

Add a CPUMode.legalize_type() method which assigns an XFormGroup to
controlling type variables and lets you set a default.

Add a `legalize` field to Level1Entry so the first-level hash table
lookup gives us the configured default legalization action for the
instruction's controlling type variable.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-24 11:21:12 -07:00
parent a06964fc0e
commit 127b22af5f
10 changed files with 229 additions and 41 deletions

View File

@@ -241,6 +241,10 @@ class XFormGroup(object):
self.name = name
self.__doc__ = doc
def __str__(self):
# type: () -> str
return self.name
def legalize(self, src, dst):
# type: (Union[Def, Apply], Rtl) -> None
"""