Use OrderedDict rather than explicit sorting.
This reduces churn in the generated files, making it easier to inspect changes.
This commit is contained in:
@@ -172,8 +172,7 @@ class TargetISA(object):
|
|||||||
"""
|
"""
|
||||||
for cpumode in self.cpumodes:
|
for cpumode in self.cpumodes:
|
||||||
self.legalize_code(cpumode.default_legalize)
|
self.legalize_code(cpumode.default_legalize)
|
||||||
for x in sorted(cpumode.type_legalize.values(),
|
for x in cpumode.type_legalize.values():
|
||||||
key=lambda x: x.name):
|
|
||||||
self.legalize_code(x)
|
self.legalize_code(x)
|
||||||
|
|
||||||
def legalize_code(self, xgrp):
|
def legalize_code(self, xgrp):
|
||||||
@@ -232,7 +231,7 @@ class CPUMode(object):
|
|||||||
# Tables for configuring legalization actions when no valid encoding
|
# Tables for configuring legalization actions when no valid encoding
|
||||||
# exists for an instruction.
|
# exists for an instruction.
|
||||||
self.default_legalize = None # type: XFormGroup
|
self.default_legalize = None # type: XFormGroup
|
||||||
self.type_legalize = dict() # type: Dict[ValueType, XFormGroup]
|
self.type_legalize = OrderedDict() # type: OrderedDict[ValueType, XFormGroup] # noqa
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
|
|||||||
@@ -600,8 +600,8 @@ def make_tables(cpumode):
|
|||||||
table[ty][inst].encodings.append(enc)
|
table[ty][inst].encodings.append(enc)
|
||||||
|
|
||||||
# Ensure there are level 1 table entries for all types with a custom
|
# Ensure there are level 1 table entries for all types with a custom
|
||||||
# legalize action. Try to be stable relative to dict ordering.
|
# legalize action.
|
||||||
for ty in sorted(cpumode.type_legalize.keys(), key=str):
|
for ty in cpumode.type_legalize.keys():
|
||||||
table[ty]
|
table[ty]
|
||||||
|
|
||||||
return table
|
return table
|
||||||
|
|||||||
Reference in New Issue
Block a user