arch, cpu: Architectural Register structural indexing
Review Request #3457 - Created April 28, 2016 and updated
| Information | |
|---|---|
| Andreas Sandberg | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 11464:d0b3c18e9e75 --------------------------- arch, cpu: Architectural Register structural indexing Replace the unified register mapping by a structure associating a class and an index. It is now much easier to know which class of register the index is refering to. Also, when adding a new class there is no need to modify existing ones. Change-Id: I55b3ac80763702aa2cd3ed2cbff0a75ef7620373 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Nice! It's great to see someone unafraid to take on big cleanup tasks like this. Several little things below that could be tweaked, but on the whole it's a very positive change! Thanks!
-
src/arch/arm/insts/branch64.cc (Diff revision 1) -
would be more compact (and more consistent with other functions, not to mention potentially more efficient) to just define a printIntReg() function rather than having to explicitly add IntRegClass here, then test the value later
-
src/arch/arm/insts/static_inst.cc (Diff revision 1) -
this is the switch you could get rid of if you switched to separate printIntReg() / printFloatReg() / printMiscReg() / printCCReg() functions
-
src/arch/isa_parser.py (Diff revision 1) -
why the extra parens?
-
src/arch/isa_parser.py (Diff revision 1) -
Since these strings get used over and over, I'd say we should create some module-level string variables, e.g.:
src_reg_constructor = '\n\t_srcRegIdx[_numSrcRegs++] = RegId(%s, %s);'
In fact, if we create a couple of class-level attributes for reg_class and reg_class_counter (e.g., '_numIntDestRegs'), then we can probably define a single common makeConstructor() method for the Operand class
-
src/arch/mips/isa/decoder.isa (Diff revision 1) -
might be worth defining a macro or helper function to clean this up... then again maybe not.
-
src/arch/x86/insts/static_inst.hh (Diff revision 1) -
would be nice to get rid of this eventually... please add a TODO comment explaining why it's too daunting to do here :)
-
src/cpu/o3/cpu.cc (Diff revision 1) -
could use the struct directly, I think, e.g.:
for (RegId reg_id(IntRegClass, 0); reg_id.regIdx < TheISA::NumIntRegs; reg_id.regIdx++) { [...] }not a huge deal here, but should avoid breaking the assignment across multiple lines in removeThread() below
-
src/cpu/o3/cpu.cc (Diff revision 1) -
if for some reason you do end up needing to break an assignment like this across two lines, I think it's cleaner to break it at the '='
-
src/cpu/reg_class.hh (Diff revision 1) -
use initializer list
: regClass(reg_class), regIdx(reg_idx)
-
src/cpu/reg_class.hh (Diff revision 1) -
blank lines between methods (here & below)
-
src/cpu/reg_class.hh (Diff revision 1) -
I find
return !(*this==that);
more intuitive (subjective though) -
src/cpu/reg_class.hh (Diff revision 1) -
I would prefer
return (regIdx == TheISA::ZeroReg && (regClass == IntRegClass || (THE_ISA == ALPHA_ISA && regClass == FloatRegClass)));
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+840 -773) |
