This is a refactoring in preparation for other two changes that will allow scheduling models to define multiple register files. This is the first step towards fixing PR36662.
class RegisterFile (in Dispatch.h) now can be used to emulate multiple register files.
Internally, it tracks the number of temporary registers dynamically allocated by each register file (described by class RegisterFileInfo).
A RegisterFileInfo stores the number of temporary registers available, and the maximum number of temporary registers used at runtime. There is a RegisterFileInfo for every register file defined by the processor scheduling model. In the absence of register file definitions, a "default" RegisterFileInfo is created; the default RegisterFileInfo describes a register file with an unlimited number of temporaries.
Each register file is associated with a list of MCRegisterClass indices. Knowinb the register class indices allows to map physical registers to register files.
The long term goal is to allow processor models to optionally specify how many register files are implemented using the following tablegen syntax:
`def FPRegFile : RegisterFile<[RegisterClassA, RegisterClassB, ...], #NumTemps>`
Where: [RegisterClassA, RegisterClassB,...] is a list of RegisterClass records, and #NumTemps is the number of temporaries implemented by the register file.
This patch is a "NFCI" change that restructures the code in preparation for the future development to fix PR36662.
Once this patch is accepted, the plan is to send two other patches:
- A patch that adds the new tablegen syntax for defining RegisterFiles
- An llvm-mca patch that allows to query the model to obtain the register file descriptors.
Please let me know what you think.
Thanks,
Andrea