Generate an InstructionFormat enum.
This is a no-payload enum which will have the same variants as InstructionData. This makes it possible to talk about the format of an instruction without actually creating an InstructionData instance.
This commit is contained in:
@@ -335,6 +335,9 @@ class InstructionFormat(object):
|
||||
# Map (multiple_results, kind, kind, ...) -> InstructionFormat
|
||||
_registry = dict()
|
||||
|
||||
# All existing formats.
|
||||
all_formats = list()
|
||||
|
||||
def __init__(self, *kinds, **kwargs):
|
||||
self.name = kwargs.get('name', None)
|
||||
self.kinds = kinds
|
||||
@@ -346,6 +349,7 @@ class InstructionFormat(object):
|
||||
"Format '{}' has the same signature as existing format '{}'"
|
||||
.format(self.name, InstructionFormat._registry[sig]))
|
||||
InstructionFormat._registry[sig] = self
|
||||
InstructionFormat.all_formats.append(self)
|
||||
|
||||
@staticmethod
|
||||
def lookup(ins, outs):
|
||||
|
||||
Reference in New Issue
Block a user