2005-05-27 05:30:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Regents of The University of Michigan
|
2013-10-15 20:22:44 +02:00
|
|
|
* Copyright (c) 2013 Advanced Micro Devices, Inc.
|
2005-05-27 05:30:12 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Kevin Lim
|
2013-10-15 20:22:44 +02:00
|
|
|
* Steve Reinhardt
|
2005-05-27 05:30:12 +02:00
|
|
|
*/
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
// Todo: Create destructor.
|
Update to make multiple instruction issue and different latencies work.
Also change to ref counted DynInst.
SConscript:
Add branch predictor, BTB, load store queue, and storesets.
arch/isa_parser.py:
Specify the template parameter for AlphaDynInst
base/traceflags.py:
Add load store queue, store set, and mem dependence unit to the
list of trace flags.
cpu/base_dyn_inst.cc:
Change formating, add in debug statement.
cpu/base_dyn_inst.hh:
Change DynInst to be RefCounted, add flag to clear whether or not this
instruction can commit. This is likely to be removed in the future.
cpu/beta_cpu/alpha_dyn_inst.cc:
AlphaDynInst has been changed to be templated, so now this CC file
is just used to force instantiations of AlphaDynInst.
cpu/beta_cpu/alpha_dyn_inst.hh:
Changed AlphaDynInst to be templated on Impl. Removed some unnecessary
functions.
cpu/beta_cpu/alpha_full_cpu.cc:
AlphaFullCPU has been changed to be templated, so this CC file is now
just used to force instantation of AlphaFullCPU.
cpu/beta_cpu/alpha_full_cpu.hh:
Change AlphaFullCPU to be templated on Impl.
cpu/beta_cpu/alpha_impl.hh:
Update it to reflect AlphaDynInst and AlphaFullCPU being templated
on Impl. Also removed time buffers from here, as they are really
a part of the CPU and are thus in the CPU policy now.
cpu/beta_cpu/alpha_params.hh:
Make AlphaSimpleParams inherit from the BaseFullCPU so that it doesn't
need to specifically declare any parameters that are already in the
BaseFullCPU.
cpu/beta_cpu/comm.hh:
Changed the structure of the time buffer communication structs. Now
they include the size of the packet of instructions it is sending.
Added some parameters to the backwards communication struct, mainly
for squashing.
cpu/beta_cpu/commit.hh:
Update typenames to reflect change in location of time buffer structs.
Update DynInst to DynInstPtr (it is refcounted now).
cpu/beta_cpu/commit_impl.hh:
Formatting changes mainly. Also sends back proper information
on branch mispredicts so that the bpred unit can update itself.
Updated behavior for non-speculative instructions (stores, any
other non-spec instructions): once they reach the head of the ROB,
the ROB signals back to the IQ that it can go ahead and issue the
non-speculative instruction. The instruction itself is updated so that
commit won't try to commit it again until it is done executing.
cpu/beta_cpu/cpu_policy.hh:
Added branch prediction unit, mem dependence prediction unit, load
store queue. Moved time buffer structs from AlphaSimpleImpl to here.
cpu/beta_cpu/decode.hh:
Changed typedefs to reflect change in location of time buffer structs
and also the change from DynInst to ref counted DynInstPtr.
cpu/beta_cpu/decode_impl.hh:
Continues to buffer instructions even while unblocking now. Changed
how it loops through groups of instructions so it can properly block
during the middle of a group of instructions.
cpu/beta_cpu/fetch.hh:
Changed typedefs to reflect change in location of time buffer structs
and the change to ref counted DynInsts. Also added in branch
brediction unit.
cpu/beta_cpu/fetch_impl.hh:
Add in branch prediction. Changed how fetch checks inputs and its
current state to make for easier logic.
cpu/beta_cpu/free_list.cc:
Changed int regs and float regs to logically use one flat namespace.
Future change will be moving them to a single scoreboard to conserve
space.
cpu/beta_cpu/free_list.hh:
Mostly debugging statements. Might be removed for performance in future.
cpu/beta_cpu/full_cpu.cc:
Added in some debugging statements. Updated BaseFullCPU to take
a params object.
cpu/beta_cpu/full_cpu.hh:
Added params class within BaseCPU that other param classes will be
able to inherit from. Updated typedefs to reflect change in location
of time buffer structs and ref counted DynInst.
cpu/beta_cpu/iew.hh:
Updated typedefs to reflect change in location of time buffer structs
and use of ref counted DynInsts.
cpu/beta_cpu/iew_impl.hh:
Added in load store queue, updated iew to be able to execute non-
speculative instructions, instead of having them execute in commit.
cpu/beta_cpu/inst_queue.hh:
Updated change to ref counted DynInsts. Changed inst queue to hold
non-speculative instructions as well, which are issued only when
commit signals backwards that a nonspeculative instruction is at
the head of the ROB.
cpu/beta_cpu/inst_queue_impl.hh:
Updated to allow for non-speculative instructions to be in the inst
queue. Also added some debug functions.
cpu/beta_cpu/regfile.hh:
Added debugging statements, changed formatting.
cpu/beta_cpu/rename.hh:
Updated typedefs, added some functions to clean up code.
cpu/beta_cpu/rename_impl.hh:
Moved some code into functions to make it easier to read.
cpu/beta_cpu/rename_map.cc:
Changed int and float reg behavior to use a single flat namespace. In
the future, the rename maps can be combined to a single rename map to
save space.
cpu/beta_cpu/rename_map.hh:
Added destructor.
cpu/beta_cpu/rob.hh:
Updated it with change from DynInst to ref counted DynInst.
cpu/beta_cpu/rob_impl.hh:
Formatting, updated to use ref counted DynInst.
cpu/static_inst.hh:
Updated forward declaration for AlphaDynInst now that it is templated.
--HG--
extra : convert_revision : 1045f240ee9b6a4bd368e1806aca029ebbdc6dd3
2004-09-23 20:06:03 +02:00
|
|
|
// Have it so that there's a more meaningful name given to the variable
|
2004-08-20 20:54:07 +02:00
|
|
|
// that marks the beginning of the FP registers.
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
#ifndef __CPU_O3_RENAME_MAP_HH__
|
|
|
|
#define __CPU_O3_RENAME_MAP_HH__
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <utility>
|
2005-02-11 23:54:33 +01:00
|
|
|
#include <vector>
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-08-15 11:07:15 +02:00
|
|
|
#include "arch/types.hh"
|
2009-09-23 17:34:21 +02:00
|
|
|
#include "config/the_isa.hh"
|
|
|
|
#include "cpu/o3/free_list.hh"
|
2013-10-15 20:22:44 +02:00
|
|
|
#include "cpu/o3/regfile.hh"
|
|
|
|
#include "cpu/reg_class.hh"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register rename map for a single class of registers (e.g., integer
|
|
|
|
* or floating point). Because the register class is implicitly
|
|
|
|
* determined by the rename map instance being accessed, all
|
|
|
|
* architectural register index parameters and values in this class
|
|
|
|
* are relative (e.g., %fp2 is just index 2).
|
|
|
|
*/
|
2004-08-20 20:54:07 +02:00
|
|
|
class SimpleRenameMap
|
|
|
|
{
|
2013-10-15 20:22:44 +02:00
|
|
|
public:
|
|
|
|
|
Changes to untemplate StaticInst and StaticInstPtr, change the isa to a namespace instead of a class, an improvement to the architecture specific header file selection system, and fixed up a few include paths.
arch/alpha/alpha_linux_process.cc:
Added using directive for AlphaISA namespace
arch/alpha/alpha_memory.hh:
arch/alpha/isa/branch.isa:
cpu/pc_event.hh:
Added typedefs for Addr
arch/alpha/alpha_tru64_process.cc:
arch/alpha/arguments.cc:
Added using directive for AlphaISA
arch/alpha/ev5.hh:
Added an include of arch/alpha/isa_traits.hh, and a using directive for the AlphaISA namespace.
arch/alpha/faults.hh:
Added a typedef for the Addr type, and changed the formatting of the faults slightly.
arch/alpha/isa/main.isa:
Untemplatized StaticInst, added a using for namespace AlphaISA to show up in decoder.cc and the exec.ccs, relocated makeNop to decoder.hh
arch/alpha/isa/mem.isa:
Untemplatized StaticInst and StaticInstPtr
arch/alpha/isa/pal.isa:
cpu/base_dyn_inst.cc:
Untemplatized StaticInstPtr
arch/alpha/isa_traits.hh:
Changed variables to be externs instead of static since they are part of a namespace and not a class.
arch/alpha/stacktrace.cc:
Untemplatized StaticInstPtr, and added a using directive for AlphaISA.
arch/alpha/stacktrace.hh:
Added some typedefs for Addr and MachInst, and untemplatized StaticInstPtr
arch/alpha/vtophys.cc:
Added a using directive for AlphaISA
arch/alpha/vtophys.hh:
Added the AlphaISA namespace specifier where needed
arch/isa_parser.py:
Changed the placement of the definition of the decodeInst function to be outside the namespaceInst namespace.
base/loader/object_file.hh:
cpu/o3/bpred_unit.hh:
Added a typedef for Addr
base/loader/symtab.hh:
Added a typedef for Addr, and added a TheISA to Addr in another typedef
base/remote_gdb.cc:
Added a using namespace TheISA, and untemplatized StaticInstPtr
base/remote_gdb.hh:
Added typedefs for Addr and MachInst
cpu/base.cc:
Added TheISA specifier to some variables exported from the isa.
cpu/base.hh:
Added a typedef for Addr, and TheISA to some variables from the ISA
cpu/base_dyn_inst.hh:
Untemplatized StaticInstPtr, and added TheISA specifier to some variables from the ISA.
cpu/exec_context.hh:
Added some typedefs for types from the isa, and added TheISA specifier to some variables from the isa
cpu/exetrace.hh:
Added typedefs for some types from the ISA, and untemplatized StaticInstPtr
cpu/memtest/memtest.cc:
cpu/o3/btb.cc:
dev/baddev.cc:
dev/ide_ctrl.cc:
dev/ide_disk.cc:
dev/isa_fake.cc:
dev/ns_gige.cc:
dev/pciconfigall.cc:
dev/platform.cc:
dev/sinic.cc:
dev/uart8250.cc:
kern/freebsd/freebsd_system.cc:
kern/linux/linux_system.cc:
kern/system_events.cc:
kern/tru64/dump_mbuf.cc:
kern/tru64/tru64_events.cc:
sim/process.cc:
sim/pseudo_inst.cc:
sim/system.cc:
Added using namespace TheISA
cpu/memtest/memtest.hh:
cpu/trace/opt_cpu.hh:
cpu/trace/reader/itx_reader.hh:
dev/ide_disk.hh:
dev/pcidev.hh:
dev/platform.hh:
dev/tsunami.hh:
sim/system.hh:
sim/vptr.hh:
Added typedef for Addr
cpu/o3/2bit_local_pred.hh:
Changed the include to use arch/isa_traits.hh instead of arch/alpha/isa_traits.hh. Added typedef for Addr
cpu/o3/alpha_cpu.hh:
Added typedefs for Addr and IntReg
cpu/o3/alpha_cpu_impl.hh:
Added this-> to setNextPC to fix a problem since it didn't depend on template parameters any more. Removed "typename" where it was no longer needed.
cpu/o3/alpha_dyn_inst.hh:
Cleaned up some typedefs, and untemplatized StaticInst
cpu/o3/alpha_dyn_inst_impl.hh:
untemplatized StaticInstPtr
cpu/o3/alpha_impl.hh:
Fixed up a typedef of MachInst
cpu/o3/bpred_unit_impl.hh:
Added a using TheISA::MachInst to a function
cpu/o3/btb.hh:
Changed an include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr
cpu/o3/commit.hh:
Removed a typedef of Impl::ISA as ISA, since TheISA takes care of this now.
cpu/o3/cpu.cc:
Cleaned up namespace issues
cpu/o3/cpu.hh:
Cleaned up namespace usage
cpu/o3/decode.hh:
Removed typedef of ISA, and changed it to TheISA
cpu/o3/fetch.hh:
Fized up typedefs, and changed ISA to TheISA
cpu/o3/free_list.hh:
Changed include of arch/alpha/isa_traits.hh to arch/isa_traits.hh
cpu/o3/iew.hh:
Removed typedef of ISA
cpu/o3/iew_impl.hh:
Added TheISA namespace specifier to MachInst
cpu/o3/ras.hh:
Changed include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr.
cpu/o3/regfile.hh:
Changed ISA to TheISA, and added some typedefs for Addr, IntReg, FloatReg, and MiscRegFile
cpu/o3/rename.hh:
Changed ISA to TheISA, and added a typedef for RegIndex
cpu/o3/rename_map.hh:
Added an include for arch/isa_traits.hh, and a typedef for RegIndex
cpu/o3/rob.hh:
Added a typedef for RegIndex
cpu/o3/store_set.hh:
cpu/o3/tournament_pred.hh:
Changed an include of arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef of Addr
cpu/ozone/cpu.hh:
Changed ISA into TheISA, and untemplatized StaticInst
cpu/pc_event.cc:
Added namespace specifier TheISA to Addr types
cpu/profile.hh:
kern/kernel_stats.hh:
Added typedef for Addr, and untemplatized StaticInstPtr
cpu/simple/cpu.cc:
Changed using directive from LittleEndianGuest to AlphaISA, which will contain both namespaces. Added TheISA where needed, and untemplatized StaticInst
cpu/simple/cpu.hh:
Added a typedef for MachInst, and untemplatized StaticInst
cpu/static_inst.cc:
Untemplatized StaticInst
cpu/static_inst.hh:
Untemplatized StaticInst by using the TheISA namespace
dev/alpha_console.cc:
Added using namespace AlphaISA
dev/simple_disk.hh:
Added typedef for Addr and fixed up some formatting
dev/sinicreg.hh:
Added TheISA namespace specifier where needed
dev/tsunami.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Added using namespace TheISA. It might be better for it to be AlphaISA
dev/tsunami_cchip.cc:
Added typedef for TheISA. It might be better for it to be AlphaISA
kern/linux/aligned.hh:
sim/pseudo_inst.hh:
Added TheISA namespace specifier to Addr
kern/linux/linux_threadinfo.hh:
Added typedef for Addr, and TheISA namespace specifier to StackPointerReg
kern/tru64/mbuf.hh:
Added TheISA to Addr type in structs
sim/process.hh:
Added typedefs of Addr, RegFile, and MachInst
sim/syscall_emul.cc:
Added using namespace TheISA, and a cast of VMPageSize to the int type
sim/syscall_emul.hh:
Added typecast for Addr, and TheISA namespace specifier for where needed
--HG--
extra : convert_revision : 91d4f6ca33a73b21c1f1771d74bfdea3b80eff45
2006-02-19 08:34:37 +01:00
|
|
|
typedef TheISA::RegIndex RegIndex;
|
2013-10-15 20:22:44 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/** The acutal arch-to-phys register map */
|
|
|
|
std::vector<PhysRegIndex> map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pointer to the free list from which new physical registers
|
|
|
|
* should be allocated in rename()
|
|
|
|
*/
|
|
|
|
SimpleFreeList *freeList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The architectural index of the zero register. This register is
|
|
|
|
* mapped but read-only, so we ignore attempts to rename it via
|
|
|
|
* the rename() method. If there is no such register for this map
|
|
|
|
* table, it should be set to an invalid index so that it never
|
|
|
|
* matches.
|
|
|
|
*/
|
|
|
|
RegIndex zeroReg;
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
public:
|
2013-10-15 20:22:44 +02:00
|
|
|
|
|
|
|
SimpleRenameMap();
|
|
|
|
|
|
|
|
~SimpleRenameMap() {};
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
/**
|
2013-10-15 20:22:44 +02:00
|
|
|
* Because we have an array of rename maps (one per thread) in the CPU,
|
|
|
|
* it's awkward to initialize this object via the constructor.
|
|
|
|
* Instead, this method is used for initialization.
|
2004-08-20 20:54:07 +02:00
|
|
|
*/
|
2013-10-15 20:22:44 +02:00
|
|
|
void init(unsigned size, SimpleFreeList *_freeList, RegIndex _zeroReg);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pair of a physical register and a physical register. Used to
|
|
|
|
* return the physical register that a logical register has been
|
|
|
|
* renamed to, and the previous physical register that the same
|
|
|
|
* logical register was previously mapped to.
|
|
|
|
*/
|
2005-02-11 23:54:33 +01:00
|
|
|
typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Tell rename map to get a new free physical register to remap
|
|
|
|
* the specified architectural register.
|
|
|
|
* @param arch_reg The architectural register to remap.
|
|
|
|
* @return A RenameInfo pair indicating both the new and previous
|
|
|
|
* physical registers.
|
|
|
|
*/
|
|
|
|
RenameInfo rename(RegIndex arch_reg);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Look up the physical register mapped to an architectural register.
|
|
|
|
* @param arch_reg The architectural register to look up.
|
|
|
|
* @return The physical register it is currently mapped to.
|
|
|
|
*/
|
|
|
|
PhysRegIndex lookup(RegIndex arch_reg) const
|
|
|
|
{
|
|
|
|
assert(arch_reg < map.size());
|
|
|
|
return map[arch_reg];
|
|
|
|
}
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Update rename map with a specific mapping. Generally used to
|
|
|
|
* roll back to old mappings on a squash.
|
|
|
|
* @param arch_reg The architectural register to remap.
|
|
|
|
* @param phys_reg The physical register to remap it to.
|
|
|
|
*/
|
|
|
|
void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
|
|
|
|
{
|
|
|
|
map[arch_reg] = phys_reg;
|
|
|
|
}
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** Return the number of free entries on the associated free list. */
|
|
|
|
unsigned numFreeEntries() const { return freeList->numFreeRegs(); }
|
|
|
|
};
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Unified register rename map for all classes of registers. Wraps a
|
|
|
|
* set of class-specific rename maps. Methods that do not specify a
|
|
|
|
* register class (e.g., rename()) take unified register indices,
|
|
|
|
* while methods that do specify a register class (e.g., renameInt())
|
|
|
|
* take relative register indices. See http://gem5.org/Register_Indexing.
|
|
|
|
*/
|
|
|
|
class UnifiedRenameMap
|
|
|
|
{
|
|
|
|
private:
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** The integer register rename map */
|
|
|
|
SimpleRenameMap intMap;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** The floating-point register rename map */
|
|
|
|
SimpleRenameMap floatMap;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
/**
|
2013-10-15 20:22:44 +02:00
|
|
|
* The register file object is used only to distinguish integer
|
|
|
|
* from floating-point physical register indices, which in turn is
|
|
|
|
* used only for assert statements that make sure the physical
|
|
|
|
* register indices that get passed in and handed out are of the
|
|
|
|
* proper class.
|
2004-08-20 20:54:07 +02:00
|
|
|
*/
|
2013-10-15 20:22:44 +02:00
|
|
|
PhysRegFile *regFile;
|
|
|
|
|
|
|
|
public:
|
|
|
|
typedef TheISA::RegIndex RegIndex;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
typedef SimpleRenameMap::RenameInfo RenameInfo;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** Default constructor. init() must be called prior to use. */
|
|
|
|
UnifiedRenameMap() {};
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** Destructor. */
|
|
|
|
~UnifiedRenameMap() {};
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/** Initializes rename map with given parameters. */
|
|
|
|
void init(PhysRegFile *_regFile,
|
|
|
|
RegIndex _intZeroReg,
|
|
|
|
RegIndex _floatZeroReg,
|
|
|
|
UnifiedFreeList *freeList);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Tell rename map to get a new free physical register to remap
|
|
|
|
* the specified architectural register. This version takes a
|
|
|
|
* unified flattened architectural register index and calls the
|
|
|
|
* appropriate class-specific rename table.
|
|
|
|
* @param arch_reg The unified architectural register index to remap.
|
|
|
|
* @return A RenameInfo pair indicating both the new and previous
|
|
|
|
* physical registers.
|
|
|
|
*/
|
|
|
|
RenameInfo rename(RegIndex arch_reg);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform rename() on an integer register, given a relative
|
|
|
|
* integer register index.
|
|
|
|
*/
|
|
|
|
RenameInfo renameInt(RegIndex rel_arch_reg)
|
|
|
|
{
|
|
|
|
RenameInfo info = intMap.rename(rel_arch_reg);
|
|
|
|
assert(regFile->isIntPhysReg(info.first));
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform rename() on a floating-point register, given a relative
|
|
|
|
* floating-point register index.
|
|
|
|
*/
|
|
|
|
RenameInfo renameFloat(RegIndex rel_arch_reg)
|
|
|
|
{
|
|
|
|
RenameInfo info = floatMap.rename(rel_arch_reg);
|
|
|
|
assert(regFile->isFloatPhysReg(info.first));
|
|
|
|
return info;
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform rename() on a misc register, given a relative
|
|
|
|
* misc register index.
|
|
|
|
*/
|
|
|
|
RenameInfo renameMisc(RegIndex rel_arch_reg)
|
|
|
|
{
|
|
|
|
// misc regs aren't really renamed, just remapped
|
|
|
|
PhysRegIndex phys_reg = lookupMisc(rel_arch_reg);
|
|
|
|
// Set the previous register to the same register; mainly it must be
|
|
|
|
// known that the prev reg was outside the range of normal registers
|
|
|
|
// so the free list can avoid adding it.
|
|
|
|
return RenameInfo(phys_reg, phys_reg);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Look up the physical register mapped to an architectural register.
|
|
|
|
* This version takes a unified flattened architectural register index
|
|
|
|
* and calls the appropriate class-specific rename table.
|
|
|
|
* @param arch_reg The unified architectural register to look up.
|
|
|
|
* @return The physical register it is currently mapped to.
|
|
|
|
*/
|
|
|
|
PhysRegIndex lookup(RegIndex arch_reg) const;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform lookup() on an integer register, given a relative
|
|
|
|
* integer register index.
|
2004-08-20 20:54:07 +02:00
|
|
|
*/
|
2013-10-15 20:22:44 +02:00
|
|
|
PhysRegIndex lookupInt(RegIndex rel_arch_reg) const
|
|
|
|
{
|
|
|
|
PhysRegIndex phys_reg = intMap.lookup(rel_arch_reg);
|
|
|
|
assert(regFile->isIntPhysReg(phys_reg));
|
|
|
|
return phys_reg;
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform lookup() on a floating-point register, given a relative
|
|
|
|
* floating-point register index.
|
2004-08-20 20:54:07 +02:00
|
|
|
*/
|
2013-10-15 20:22:44 +02:00
|
|
|
PhysRegIndex lookupFloat(RegIndex rel_arch_reg) const
|
|
|
|
{
|
|
|
|
PhysRegIndex phys_reg = floatMap.lookup(rel_arch_reg);
|
|
|
|
assert(regFile->isFloatPhysReg(phys_reg));
|
|
|
|
return phys_reg;
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform lookup() on a misc register, given a relative
|
|
|
|
* misc register index.
|
|
|
|
*/
|
|
|
|
PhysRegIndex lookupMisc(RegIndex rel_arch_reg) const
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2013-10-15 20:22:44 +02:00
|
|
|
// misc regs aren't really renamed, just given an index
|
|
|
|
// beyond the range of actual physical registers
|
|
|
|
PhysRegIndex phys_reg = rel_arch_reg + regFile->totalNumPhysRegs();
|
|
|
|
return phys_reg;
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Update rename map with a specific mapping. Generally used to
|
|
|
|
* roll back to old mappings on a squash. This version takes a
|
|
|
|
* unified flattened architectural register index and calls the
|
|
|
|
* appropriate class-specific rename table.
|
|
|
|
* @param arch_reg The unified architectural register to remap.
|
|
|
|
* @param phys_reg The physical register to remap it to.
|
|
|
|
*/
|
|
|
|
void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform setEntry() on an integer register, given a relative
|
|
|
|
* integer register index.
|
|
|
|
*/
|
|
|
|
void setIntEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
|
|
|
|
{
|
|
|
|
assert(regFile->isIntPhysReg(phys_reg));
|
|
|
|
intMap.setEntry(arch_reg, phys_reg);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Perform setEntry() on a floating-point register, given a relative
|
|
|
|
* floating-point register index.
|
|
|
|
*/
|
|
|
|
void setFloatEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
|
|
|
|
{
|
|
|
|
assert(regFile->isFloatPhysReg(phys_reg));
|
|
|
|
floatMap.setEntry(arch_reg, phys_reg);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2013-10-15 20:22:44 +02:00
|
|
|
/**
|
|
|
|
* Return the minimum number of free entries across all of the
|
|
|
|
* register classes. The minimum is used so we guarantee that
|
|
|
|
* this number of entries is available regardless of which class
|
|
|
|
* of registers is requested.
|
|
|
|
*/
|
|
|
|
unsigned numFreeEntries() const
|
|
|
|
{
|
|
|
|
return std::min(intMap.numFreeEntries(), floatMap.numFreeEntries());
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
};
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
#endif //__CPU_O3_RENAME_MAP_HH__
|