Collect list of CPU modes in TargetISA.

Fix a typo nearby.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-25 11:36:30 -07:00
parent 4d1eb84037
commit c251f26d0d

View File

@@ -949,10 +949,11 @@ class TargetISA(object):
relevant for this ISA. relevant for this ISA.
""" """
def __init__(self, name, instrution_groups): def __init__(self, name, instruction_groups):
self.name = name self.name = name
self.settings = None self.settings = None
self.instruction_groups = instrution_groups self.instruction_groups = instruction_groups
self.cpumodes = list()
class CPUMode(object): class CPUMode(object):
@@ -970,6 +971,7 @@ class CPUMode(object):
self.name = name self.name = name
self.isa = isa self.isa = isa
self.encodings = [] self.encodings = []
isa.cpumodes.append(self)
def enc(self, *args, **kwargs): def enc(self, *args, **kwargs):
""" """
@@ -1032,17 +1034,15 @@ class Encoding(object):
self.instp = And.combine(recipe.instp, instp) self.instp = And.combine(recipe.instp, instp)
self.isap = And.combine(recipe.isap, instp) self.isap = And.combine(recipe.isap, instp)
@staticmethod def ctrl_typevar(self):
def _to_type_tuple(x): """
# Allow a single ValueType instance instead of the awkward singleton Get the controlling type variable for this encoding or `None`.
# tuple syntax. """
if isinstance(x, ValueType): if self.typevars:
x = (x,) return self.typevars[0]
else: else:
x = tuple(x) return None
for ty in x:
assert isinstance(ty, ValueType)
return x
# Import the fixed instruction formats now so they can be added to the # Import the fixed instruction formats now so they can be added to the
# registry. # registry.