registers.hh revision 9920:028e4da64b42
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#ifndef __ARCH_ALPHA_REGISTERS_HH__
32#define __ARCH_ALPHA_REGISTERS_HH__
33
34#include "arch/alpha/generated/max_inst_regs.hh"
35#include "arch/alpha/ipr.hh"
36#include "base/types.hh"
37
38namespace AlphaISA {
39
40using AlphaISAInst::MaxInstSrcRegs;
41using AlphaISAInst::MaxInstDestRegs;
42
43// Locked read/write flags are can't be detected by the ISA parser
44const int MaxMiscDestRegs = AlphaISAInst::MaxMiscDestRegs + 1;
45
46typedef uint8_t RegIndex;
47typedef uint64_t IntReg;
48
49// floating point register file entry type
50typedef double FloatReg;
51typedef uint64_t FloatRegBits;
52
53// control register file contents
54typedef uint64_t MiscReg;
55
56// dummy typedef since we don't have CC regs
57typedef uint8_t CCReg;
58
59union AnyReg
60{
61    IntReg  intreg;
62    FloatReg   fpreg;
63    MiscReg ctrlreg;
64};
65
66enum MiscRegIndex
67{
68    MISCREG_FPCR = NumInternalProcRegs,
69    MISCREG_UNIQ,
70    MISCREG_LOCKFLAG,
71    MISCREG_LOCKADDR,
72    MISCREG_INTR,
73    NUM_MISCREGS
74};
75
76// semantically meaningful register indices
77const RegIndex ZeroReg = 31;     // architecturally meaningful
78// the rest of these depend on the ABI
79const RegIndex StackPointerReg = 30;
80const RegIndex GlobalPointerReg = 29;
81const RegIndex ProcedureValueReg = 27;
82const RegIndex ReturnAddressReg = 26;
83const RegIndex ReturnValueReg = 0;
84const RegIndex FramePointerReg = 15;
85
86const RegIndex SyscallNumReg = 0;
87const RegIndex FirstArgumentReg = 16;
88const RegIndex SyscallPseudoReturnReg = 20;
89const RegIndex SyscallSuccessReg = 19;
90
91const int NumIntArchRegs = 32;
92const int NumPALShadowRegs = 8;
93const int NumFloatArchRegs = 32;
94
95const int NumIntRegs = NumIntArchRegs + NumPALShadowRegs;
96const int NumFloatRegs = NumFloatArchRegs;
97const int NumCCRegs = 0;
98const int NumMiscRegs = NUM_MISCREGS;
99
100const int TotalNumRegs =
101    NumIntRegs + NumFloatRegs + NumMiscRegs;
102
103// These enumerate all the registers for dependence tracking.
104enum DependenceTags {
105    // 0..31 are the integer regs 0..31
106    // 32..63 are the FP regs 0..31, i.e. use (reg + FP_Reg_Base)
107    FP_Reg_Base = NumIntRegs,
108    CC_Reg_Base = FP_Reg_Base + NumFloatRegs,
109    Misc_Reg_Base = CC_Reg_Base + NumCCRegs, // NumCCRegs == 0
110    Max_Reg_Index = Misc_Reg_Base + NumMiscRegs + NumInternalProcRegs
111};
112
113} // namespace AlphaISA
114
115#endif // __ARCH_ALPHA_REGFILE_HH__
116