summaryrefslogtreecommitdiff
path: root/src/cpu/o3/rename_map.cc
diff options
context:
space:
mode:
authorNathanael Premillieu <nathanael.premillieu@arm.com>2017-04-05 12:46:06 -0500
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-07-05 14:43:49 +0000
commit5e8287d2e2eaf058495442ea9e32fafc343a0b53 (patch)
tree7d0891b8984926f8e404d6ca8247f45695f9fc9b /src/cpu/o3/rename_map.cc
parent864f87f9c56a66dceeca0f4e9470fbaa3001b627 (diff)
downloadgem5-5e8287d2e2eaf058495442ea9e32fafc343a0b53.tar.xz
arch, cpu: Architectural Register structural indexing
Replace the unified register mapping with a structure associating a class and an index. It is now much easier to know which class of register the index is referring 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> [ Fix RISCV build issues ] Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2700
Diffstat (limited to 'src/cpu/o3/rename_map.cc')
-rw-r--r--src/cpu/o3/rename_map.cc48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/cpu/o3/rename_map.cc b/src/cpu/o3/rename_map.cc
index 18c20cf8c..6307b58de 100644
--- a/src/cpu/o3/rename_map.cc
+++ b/src/cpu/o3/rename_map.cc
@@ -104,79 +104,73 @@ UnifiedRenameMap::init(PhysRegFile *_regFile,
UnifiedRenameMap::RenameInfo
-UnifiedRenameMap::rename(RegIndex arch_reg)
+UnifiedRenameMap::rename(RegId arch_reg)
{
- RegIndex rel_arch_reg;
-
- switch (regIdxToClass(arch_reg, &rel_arch_reg)) {
+ switch (arch_reg.regClass) {
case IntRegClass:
- return renameInt(rel_arch_reg);
+ return renameInt(arch_reg.regIdx);
case FloatRegClass:
- return renameFloat(rel_arch_reg);
+ return renameFloat(arch_reg.regIdx);
case CCRegClass:
- return renameCC(rel_arch_reg);
+ return renameCC(arch_reg.regIdx);
case MiscRegClass:
- return renameMisc(rel_arch_reg);
+ return renameMisc(arch_reg.regIdx);
default:
panic("rename rename(): unknown reg class %s\n",
- RegClassStrings[regIdxToClass(arch_reg)]);
+ RegClassStrings[arch_reg.regClass]);
}
}
PhysRegIndex
-UnifiedRenameMap::lookup(RegIndex arch_reg) const
+UnifiedRenameMap::lookup(RegId arch_reg) const
{
- RegIndex rel_arch_reg;
-
- switch (regIdxToClass(arch_reg, &rel_arch_reg)) {
+ switch (arch_reg.regClass) {
case IntRegClass:
- return lookupInt(rel_arch_reg);
+ return lookupInt(arch_reg.regIdx);
case FloatRegClass:
- return lookupFloat(rel_arch_reg);
+ return lookupFloat(arch_reg.regIdx);
case CCRegClass:
- return lookupCC(rel_arch_reg);
+ return lookupCC(arch_reg.regIdx);
case MiscRegClass:
- return lookupMisc(rel_arch_reg);
+ return lookupMisc(arch_reg.regIdx);
default:
panic("rename lookup(): unknown reg class %s\n",
- RegClassStrings[regIdxToClass(arch_reg)]);
+ RegClassStrings[arch_reg.regClass]);
}
}
void
-UnifiedRenameMap::setEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
+UnifiedRenameMap::setEntry(RegId arch_reg, PhysRegIndex phys_reg)
{
- RegIndex rel_arch_reg;
-
- switch (regIdxToClass(arch_reg, &rel_arch_reg)) {
+ switch (arch_reg.regClass) {
case IntRegClass:
- return setIntEntry(rel_arch_reg, phys_reg);
+ return setIntEntry(arch_reg.regIdx, phys_reg);
case FloatRegClass:
- return setFloatEntry(rel_arch_reg, phys_reg);
+ return setFloatEntry(arch_reg.regIdx, phys_reg);
case CCRegClass:
- return setCCEntry(rel_arch_reg, phys_reg);
+ return setCCEntry(arch_reg.regIdx, phys_reg);
case MiscRegClass:
// Misc registers do not actually rename, so don't change
// their mappings. We end up here when a commit or squash
// tries to update or undo a hardwired misc reg nmapping,
// which should always be setting it to what it already is.
- assert(phys_reg == lookupMisc(rel_arch_reg));
+ assert(phys_reg == lookupMisc(arch_reg.regIdx));
return;
default:
panic("rename setEntry(): unknown reg class %s\n",
- RegClassStrings[regIdxToClass(arch_reg)]);
+ RegClassStrings[arch_reg.regClass]);
}
}