Add a RegClassMask typedef and a MAX_TOPRCS constant.
Avoid spreading u32 as a bitmask of register classes throughout the code. Enforce the limit of 32 register classes total. This could easily be raised if needed. The MAX_TOPRCS constant is the highest possible number of top-level register classes in an ISA. The RegClassData.toprc field is always smaller than this limit.
This commit is contained in:
@@ -119,6 +119,11 @@ class TargetISA(object):
|
||||
bank.finish_regclasses()
|
||||
self.regclasses.extend(bank.toprcs)
|
||||
|
||||
# The limit on the number of top-level register classes can be raised.
|
||||
# This should be coordinated with the `MAX_TOPRCS` constant in
|
||||
# `isa/registers.rs`.
|
||||
assert len(self.regclasses) <= 4, "Too many top-level register classes"
|
||||
|
||||
# Collect all of the non-top-level register classes.
|
||||
# They are numbered strictly after the top-level classes.
|
||||
for bank in self.regbanks:
|
||||
@@ -128,6 +133,11 @@ class TargetISA(object):
|
||||
for idx, rc in enumerate(self.regclasses):
|
||||
rc.index = idx
|
||||
|
||||
# The limit on the number of register classes can be changed. It should
|
||||
# be coordinated with the `RegClassMask` and `RegClassIndex` types in
|
||||
# `isa/registers.rs`.
|
||||
assert len(self.regclasses) <= 32, "Too many register classes"
|
||||
|
||||
|
||||
class CPUMode(object):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user