Remove the number field from the PredNode union type.

Predicate numbers are available in the maps
isa.settings.predicate_number and isa.instp_number instead.

Like the name field, predicate numbers don't interact well with
unique_pred().
This commit is contained in:
Jakob Stoklund Olesen
2017-07-26 11:01:47 -07:00
parent 98f0a8b8b4
commit ef812408f4
4 changed files with 21 additions and 31 deletions

View File

@@ -103,23 +103,17 @@ class TargetISA(object):
"""
Collect and number all predicates in use.
Sets `instp.number` for all used instruction predicates and places them
in `self.all_instps` in numerical order.
Ensures that all ISA predicates have an assigned bit number in
`self.settings`.
"""
self.all_instps = list() # type: List[PredNode]
instps = set() # type: Set[PredNode]
self.instp_number = OrderedDict() # type: OrderedDict[PredNode, int]
for cpumode in self.cpumodes:
for enc in cpumode.encodings:
instp = enc.instp
if instp and instp not in instps:
if instp and instp not in self.instp_number:
# assign predicate number starting from 0.
assert instp.number is None
instp.number = len(instps)
instps.add(instp)
self.all_instps.append(instp)
n = len(self.instp_number)
self.instp_number[instp] = n
# All referenced ISA predicates must have a number in
# `self.settings`. This may cause some parent predicates to be