rename_map.hh (10537:47fe87b0cf97) rename_map.hh (10715:ced453290507)
1/*
1/*
2 * Copyright (c) 2015 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Authors: Kevin Lim
30 * Steve Reinhardt
31 */
32
33// Todo: Create destructor.
34// Have it so that there's a more meaningful name given to the variable
35// that marks the beginning of the FP registers.
36
37#ifndef __CPU_O3_RENAME_MAP_HH__
38#define __CPU_O3_RENAME_MAP_HH__
39
40#include <iostream>
41#include <utility>
42#include <vector>
43
44#include "arch/types.hh"
45#include "config/the_isa.hh"
46#include "cpu/o3/free_list.hh"
47#include "cpu/o3/regfile.hh"
48#include "cpu/reg_class.hh"
49
50/**
51 * Register rename map for a single class of registers (e.g., integer
52 * or floating point). Because the register class is implicitly
53 * determined by the rename map instance being accessed, all
54 * architectural register index parameters and values in this class
55 * are relative (e.g., %fp2 is just index 2).
56 */
57class SimpleRenameMap
58{
59 public:
60
61 typedef TheISA::RegIndex RegIndex;
62
63 private:
64
65 /** The acutal arch-to-phys register map */
66 std::vector<PhysRegIndex> map;
67
68 /**
69 * Pointer to the free list from which new physical registers
70 * should be allocated in rename()
71 */
72 SimpleFreeList *freeList;
73
74 /**
75 * The architectural index of the zero register. This register is
76 * mapped but read-only, so we ignore attempts to rename it via
77 * the rename() method. If there is no such register for this map
78 * table, it should be set to an invalid index so that it never
79 * matches.
80 */
81 RegIndex zeroReg;
82
83 public:
84
85 SimpleRenameMap();
86
87 ~SimpleRenameMap() {};
88
89 /**
90 * Because we have an array of rename maps (one per thread) in the CPU,
91 * it's awkward to initialize this object via the constructor.
92 * Instead, this method is used for initialization.
93 */
94 void init(unsigned size, SimpleFreeList *_freeList, RegIndex _zeroReg);
95
96 /**
97 * Pair of a physical register and a physical register. Used to
98 * return the physical register that a logical register has been
99 * renamed to, and the previous physical register that the same
100 * logical register was previously mapped to.
101 */
102 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo;
103
104 /**
105 * Tell rename map to get a new free physical register to remap
106 * the specified architectural register.
107 * @param arch_reg The architectural register to remap.
108 * @return A RenameInfo pair indicating both the new and previous
109 * physical registers.
110 */
111 RenameInfo rename(RegIndex arch_reg);
112
113 /**
114 * Look up the physical register mapped to an architectural register.
115 * @param arch_reg The architectural register to look up.
116 * @return The physical register it is currently mapped to.
117 */
118 PhysRegIndex lookup(RegIndex arch_reg) const
119 {
120 assert(arch_reg < map.size());
121 return map[arch_reg];
122 }
123
124 /**
125 * Update rename map with a specific mapping. Generally used to
126 * roll back to old mappings on a squash.
127 * @param arch_reg The architectural register to remap.
128 * @param phys_reg The physical register to remap it to.
129 */
130 void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
131 {
132 map[arch_reg] = phys_reg;
133 }
134
135 /** Return the number of free entries on the associated free list. */
136 unsigned numFreeEntries() const { return freeList->numFreeRegs(); }
137};
138
139
140/**
141 * Unified register rename map for all classes of registers. Wraps a
142 * set of class-specific rename maps. Methods that do not specify a
143 * register class (e.g., rename()) take unified register indices,
144 * while methods that do specify a register class (e.g., renameInt())
145 * take relative register indices. See http://gem5.org/Register_Indexing.
146 */
147class UnifiedRenameMap
148{
149 private:
150
151 /** The integer register rename map */
152 SimpleRenameMap intMap;
153
154 /** The floating-point register rename map */
155 SimpleRenameMap floatMap;
156
157 /**
158 * The register file object is used only to distinguish integer
159 * from floating-point physical register indices, which in turn is
160 * used only for assert statements that make sure the physical
161 * register indices that get passed in and handed out are of the
162 * proper class.
163 */
164 PhysRegFile *regFile;
165
166 /** The condition-code register rename map */
167 SimpleRenameMap ccMap;
168
169 public:
170 typedef TheISA::RegIndex RegIndex;
171
172 typedef SimpleRenameMap::RenameInfo RenameInfo;
173
174 /** Default constructor. init() must be called prior to use. */
175 UnifiedRenameMap() : regFile(nullptr) {};
176
177 /** Destructor. */
178 ~UnifiedRenameMap() {};
179
180 /** Initializes rename map with given parameters. */
181 void init(PhysRegFile *_regFile,
182 RegIndex _intZeroReg,
183 RegIndex _floatZeroReg,
184 UnifiedFreeList *freeList);
185
186 /**
187 * Tell rename map to get a new free physical register to remap
188 * the specified architectural register. This version takes a
189 * unified flattened architectural register index and calls the
190 * appropriate class-specific rename table.
191 * @param arch_reg The unified architectural register index to remap.
192 * @return A RenameInfo pair indicating both the new and previous
193 * physical registers.
194 */
195 RenameInfo rename(RegIndex arch_reg);
196
197 /**
198 * Perform rename() on an integer register, given a relative
199 * integer register index.
200 */
201 RenameInfo renameInt(RegIndex rel_arch_reg)
202 {
203 RenameInfo info = intMap.rename(rel_arch_reg);
204 assert(regFile->isIntPhysReg(info.first));
205 return info;
206 }
207
208 /**
209 * Perform rename() on a floating-point register, given a relative
210 * floating-point register index.
211 */
212 RenameInfo renameFloat(RegIndex rel_arch_reg)
213 {
214 RenameInfo info = floatMap.rename(rel_arch_reg);
215 assert(regFile->isFloatPhysReg(info.first));
216 return info;
217 }
218
219 /**
220 * Perform rename() on a condition-code register, given a relative
221 * condition-code register index.
222 */
223 RenameInfo renameCC(RegIndex rel_arch_reg)
224 {
225 RenameInfo info = ccMap.rename(rel_arch_reg);
226 assert(regFile->isCCPhysReg(info.first));
227 return info;
228 }
229
230 /**
231 * Perform rename() on a misc register, given a relative
232 * misc register index.
233 */
234 RenameInfo renameMisc(RegIndex rel_arch_reg)
235 {
236 // misc regs aren't really renamed, just remapped
237 PhysRegIndex phys_reg = lookupMisc(rel_arch_reg);
238 // Set the previous register to the same register; mainly it must be
239 // known that the prev reg was outside the range of normal registers
240 // so the free list can avoid adding it.
241 return RenameInfo(phys_reg, phys_reg);
242 }
243
244
245 /**
246 * Look up the physical register mapped to an architectural register.
247 * This version takes a unified flattened architectural register index
248 * and calls the appropriate class-specific rename table.
249 * @param arch_reg The unified architectural register to look up.
250 * @return The physical register it is currently mapped to.
251 */
252 PhysRegIndex lookup(RegIndex arch_reg) const;
253
254 /**
255 * Perform lookup() on an integer register, given a relative
256 * integer register index.
257 */
258 PhysRegIndex lookupInt(RegIndex rel_arch_reg) const
259 {
260 PhysRegIndex phys_reg = intMap.lookup(rel_arch_reg);
261 assert(regFile->isIntPhysReg(phys_reg));
262 return phys_reg;
263 }
264
265 /**
266 * Perform lookup() on a floating-point register, given a relative
267 * floating-point register index.
268 */
269 PhysRegIndex lookupFloat(RegIndex rel_arch_reg) const
270 {
271 PhysRegIndex phys_reg = floatMap.lookup(rel_arch_reg);
272 assert(regFile->isFloatPhysReg(phys_reg));
273 return phys_reg;
274 }
275
276 /**
277 * Perform lookup() on a condition-code register, given a relative
278 * condition-code register index.
279 */
280 PhysRegIndex lookupCC(RegIndex rel_arch_reg) const
281 {
282 PhysRegIndex phys_reg = ccMap.lookup(rel_arch_reg);
283 assert(regFile->isCCPhysReg(phys_reg));
284 return phys_reg;
285 }
286
287 /**
288 * Perform lookup() on a misc register, given a relative
289 * misc register index.
290 */
291 PhysRegIndex lookupMisc(RegIndex rel_arch_reg) const
292 {
293 // misc regs aren't really renamed, just given an index
294 // beyond the range of actual physical registers
295 PhysRegIndex phys_reg = rel_arch_reg + regFile->totalNumPhysRegs();
296 return phys_reg;
297 }
298
299 /**
300 * Update rename map with a specific mapping. Generally used to
301 * roll back to old mappings on a squash. This version takes a
302 * unified flattened architectural register index and calls the
303 * appropriate class-specific rename table.
304 * @param arch_reg The unified architectural register to remap.
305 * @param phys_reg The physical register to remap it to.
306 */
307 void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg);
308
309 /**
310 * Perform setEntry() on an integer register, given a relative
311 * integer register index.
312 */
313 void setIntEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
314 {
315 assert(regFile->isIntPhysReg(phys_reg));
316 intMap.setEntry(arch_reg, phys_reg);
317 }
318
319 /**
320 * Perform setEntry() on a floating-point register, given a relative
321 * floating-point register index.
322 */
323 void setFloatEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
324 {
325 assert(regFile->isFloatPhysReg(phys_reg));
326 floatMap.setEntry(arch_reg, phys_reg);
327 }
328
329 /**
330 * Perform setEntry() on a condition-code register, given a relative
331 * condition-code register index.
332 */
333 void setCCEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
334 {
335 assert(regFile->isCCPhysReg(phys_reg));
336 ccMap.setEntry(arch_reg, phys_reg);
337 }
338
339 /**
340 * Return the minimum number of free entries across all of the
341 * register classes. The minimum is used so we guarantee that
342 * this number of entries is available regardless of which class
343 * of registers is requested.
344 */
345 unsigned numFreeEntries() const
346 {
347 return std::min(intMap.numFreeEntries(), floatMap.numFreeEntries());
348 }
14 * Copyright (c) 2004-2005 The Regents of The University of Michigan
15 * Copyright (c) 2013 Advanced Micro Devices, Inc.
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;
22 * redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution;
25 * neither the name of the copyright holders nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * Authors: Kevin Lim
42 * Steve Reinhardt
43 */
44
45// Todo: Create destructor.
46// Have it so that there's a more meaningful name given to the variable
47// that marks the beginning of the FP registers.
48
49#ifndef __CPU_O3_RENAME_MAP_HH__
50#define __CPU_O3_RENAME_MAP_HH__
51
52#include <iostream>
53#include <utility>
54#include <vector>
55
56#include "arch/types.hh"
57#include "config/the_isa.hh"
58#include "cpu/o3/free_list.hh"
59#include "cpu/o3/regfile.hh"
60#include "cpu/reg_class.hh"
61
62/**
63 * Register rename map for a single class of registers (e.g., integer
64 * or floating point). Because the register class is implicitly
65 * determined by the rename map instance being accessed, all
66 * architectural register index parameters and values in this class
67 * are relative (e.g., %fp2 is just index 2).
68 */
69class SimpleRenameMap
70{
71 public:
72
73 typedef TheISA::RegIndex RegIndex;
74
75 private:
76
77 /** The acutal arch-to-phys register map */
78 std::vector<PhysRegIndex> map;
79
80 /**
81 * Pointer to the free list from which new physical registers
82 * should be allocated in rename()
83 */
84 SimpleFreeList *freeList;
85
86 /**
87 * The architectural index of the zero register. This register is
88 * mapped but read-only, so we ignore attempts to rename it via
89 * the rename() method. If there is no such register for this map
90 * table, it should be set to an invalid index so that it never
91 * matches.
92 */
93 RegIndex zeroReg;
94
95 public:
96
97 SimpleRenameMap();
98
99 ~SimpleRenameMap() {};
100
101 /**
102 * Because we have an array of rename maps (one per thread) in the CPU,
103 * it's awkward to initialize this object via the constructor.
104 * Instead, this method is used for initialization.
105 */
106 void init(unsigned size, SimpleFreeList *_freeList, RegIndex _zeroReg);
107
108 /**
109 * Pair of a physical register and a physical register. Used to
110 * return the physical register that a logical register has been
111 * renamed to, and the previous physical register that the same
112 * logical register was previously mapped to.
113 */
114 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo;
115
116 /**
117 * Tell rename map to get a new free physical register to remap
118 * the specified architectural register.
119 * @param arch_reg The architectural register to remap.
120 * @return A RenameInfo pair indicating both the new and previous
121 * physical registers.
122 */
123 RenameInfo rename(RegIndex arch_reg);
124
125 /**
126 * Look up the physical register mapped to an architectural register.
127 * @param arch_reg The architectural register to look up.
128 * @return The physical register it is currently mapped to.
129 */
130 PhysRegIndex lookup(RegIndex arch_reg) const
131 {
132 assert(arch_reg < map.size());
133 return map[arch_reg];
134 }
135
136 /**
137 * Update rename map with a specific mapping. Generally used to
138 * roll back to old mappings on a squash.
139 * @param arch_reg The architectural register to remap.
140 * @param phys_reg The physical register to remap it to.
141 */
142 void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
143 {
144 map[arch_reg] = phys_reg;
145 }
146
147 /** Return the number of free entries on the associated free list. */
148 unsigned numFreeEntries() const { return freeList->numFreeRegs(); }
149};
150
151
152/**
153 * Unified register rename map for all classes of registers. Wraps a
154 * set of class-specific rename maps. Methods that do not specify a
155 * register class (e.g., rename()) take unified register indices,
156 * while methods that do specify a register class (e.g., renameInt())
157 * take relative register indices. See http://gem5.org/Register_Indexing.
158 */
159class UnifiedRenameMap
160{
161 private:
162
163 /** The integer register rename map */
164 SimpleRenameMap intMap;
165
166 /** The floating-point register rename map */
167 SimpleRenameMap floatMap;
168
169 /**
170 * The register file object is used only to distinguish integer
171 * from floating-point physical register indices, which in turn is
172 * used only for assert statements that make sure the physical
173 * register indices that get passed in and handed out are of the
174 * proper class.
175 */
176 PhysRegFile *regFile;
177
178 /** The condition-code register rename map */
179 SimpleRenameMap ccMap;
180
181 public:
182 typedef TheISA::RegIndex RegIndex;
183
184 typedef SimpleRenameMap::RenameInfo RenameInfo;
185
186 /** Default constructor. init() must be called prior to use. */
187 UnifiedRenameMap() : regFile(nullptr) {};
188
189 /** Destructor. */
190 ~UnifiedRenameMap() {};
191
192 /** Initializes rename map with given parameters. */
193 void init(PhysRegFile *_regFile,
194 RegIndex _intZeroReg,
195 RegIndex _floatZeroReg,
196 UnifiedFreeList *freeList);
197
198 /**
199 * Tell rename map to get a new free physical register to remap
200 * the specified architectural register. This version takes a
201 * unified flattened architectural register index and calls the
202 * appropriate class-specific rename table.
203 * @param arch_reg The unified architectural register index to remap.
204 * @return A RenameInfo pair indicating both the new and previous
205 * physical registers.
206 */
207 RenameInfo rename(RegIndex arch_reg);
208
209 /**
210 * Perform rename() on an integer register, given a relative
211 * integer register index.
212 */
213 RenameInfo renameInt(RegIndex rel_arch_reg)
214 {
215 RenameInfo info = intMap.rename(rel_arch_reg);
216 assert(regFile->isIntPhysReg(info.first));
217 return info;
218 }
219
220 /**
221 * Perform rename() on a floating-point register, given a relative
222 * floating-point register index.
223 */
224 RenameInfo renameFloat(RegIndex rel_arch_reg)
225 {
226 RenameInfo info = floatMap.rename(rel_arch_reg);
227 assert(regFile->isFloatPhysReg(info.first));
228 return info;
229 }
230
231 /**
232 * Perform rename() on a condition-code register, given a relative
233 * condition-code register index.
234 */
235 RenameInfo renameCC(RegIndex rel_arch_reg)
236 {
237 RenameInfo info = ccMap.rename(rel_arch_reg);
238 assert(regFile->isCCPhysReg(info.first));
239 return info;
240 }
241
242 /**
243 * Perform rename() on a misc register, given a relative
244 * misc register index.
245 */
246 RenameInfo renameMisc(RegIndex rel_arch_reg)
247 {
248 // misc regs aren't really renamed, just remapped
249 PhysRegIndex phys_reg = lookupMisc(rel_arch_reg);
250 // Set the previous register to the same register; mainly it must be
251 // known that the prev reg was outside the range of normal registers
252 // so the free list can avoid adding it.
253 return RenameInfo(phys_reg, phys_reg);
254 }
255
256
257 /**
258 * Look up the physical register mapped to an architectural register.
259 * This version takes a unified flattened architectural register index
260 * and calls the appropriate class-specific rename table.
261 * @param arch_reg The unified architectural register to look up.
262 * @return The physical register it is currently mapped to.
263 */
264 PhysRegIndex lookup(RegIndex arch_reg) const;
265
266 /**
267 * Perform lookup() on an integer register, given a relative
268 * integer register index.
269 */
270 PhysRegIndex lookupInt(RegIndex rel_arch_reg) const
271 {
272 PhysRegIndex phys_reg = intMap.lookup(rel_arch_reg);
273 assert(regFile->isIntPhysReg(phys_reg));
274 return phys_reg;
275 }
276
277 /**
278 * Perform lookup() on a floating-point register, given a relative
279 * floating-point register index.
280 */
281 PhysRegIndex lookupFloat(RegIndex rel_arch_reg) const
282 {
283 PhysRegIndex phys_reg = floatMap.lookup(rel_arch_reg);
284 assert(regFile->isFloatPhysReg(phys_reg));
285 return phys_reg;
286 }
287
288 /**
289 * Perform lookup() on a condition-code register, given a relative
290 * condition-code register index.
291 */
292 PhysRegIndex lookupCC(RegIndex rel_arch_reg) const
293 {
294 PhysRegIndex phys_reg = ccMap.lookup(rel_arch_reg);
295 assert(regFile->isCCPhysReg(phys_reg));
296 return phys_reg;
297 }
298
299 /**
300 * Perform lookup() on a misc register, given a relative
301 * misc register index.
302 */
303 PhysRegIndex lookupMisc(RegIndex rel_arch_reg) const
304 {
305 // misc regs aren't really renamed, just given an index
306 // beyond the range of actual physical registers
307 PhysRegIndex phys_reg = rel_arch_reg + regFile->totalNumPhysRegs();
308 return phys_reg;
309 }
310
311 /**
312 * Update rename map with a specific mapping. Generally used to
313 * roll back to old mappings on a squash. This version takes a
314 * unified flattened architectural register index and calls the
315 * appropriate class-specific rename table.
316 * @param arch_reg The unified architectural register to remap.
317 * @param phys_reg The physical register to remap it to.
318 */
319 void setEntry(RegIndex arch_reg, PhysRegIndex phys_reg);
320
321 /**
322 * Perform setEntry() on an integer register, given a relative
323 * integer register index.
324 */
325 void setIntEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
326 {
327 assert(regFile->isIntPhysReg(phys_reg));
328 intMap.setEntry(arch_reg, phys_reg);
329 }
330
331 /**
332 * Perform setEntry() on a floating-point register, given a relative
333 * floating-point register index.
334 */
335 void setFloatEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
336 {
337 assert(regFile->isFloatPhysReg(phys_reg));
338 floatMap.setEntry(arch_reg, phys_reg);
339 }
340
341 /**
342 * Perform setEntry() on a condition-code register, given a relative
343 * condition-code register index.
344 */
345 void setCCEntry(RegIndex arch_reg, PhysRegIndex phys_reg)
346 {
347 assert(regFile->isCCPhysReg(phys_reg));
348 ccMap.setEntry(arch_reg, phys_reg);
349 }
350
351 /**
352 * Return the minimum number of free entries across all of the
353 * register classes. The minimum is used so we guarantee that
354 * this number of entries is available regardless of which class
355 * of registers is requested.
356 */
357 unsigned numFreeEntries() const
358 {
359 return std::min(intMap.numFreeEntries(), floatMap.numFreeEntries());
360 }
361
362 /**
363 * Return whether there are enough registers to serve the request.
364 */
365 bool canRename(uint32_t intRegs, uint32_t floatRegs, uint32_t ccRegs) const
366 {
367 return intRegs <= intMap.numFreeEntries() &&
368 floatRegs <= floatMap.numFreeEntries() &&
369 ccRegs <= ccMap.numFreeEntries();
370 }
371
349};
350
351#endif //__CPU_O3_RENAME_MAP_HH__
372};
373
374#endif //__CPU_O3_RENAME_MAP_HH__