registers.hh revision 9046:a1104cc13db2
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
56union AnyReg
57{
58    IntReg  intreg;
59    FloatReg   fpreg;
60    MiscReg ctrlreg;
61};
62
63enum MiscRegIndex
64{
65    MISCREG_FPCR = NumInternalProcRegs,
66    MISCREG_UNIQ,
67    MISCREG_LOCKFLAG,
68    MISCREG_LOCKADDR,
69    MISCREG_INTR,
70    NUM_MISCREGS
71};
72
73// semantically meaningful register indices
74const RegIndex ZeroReg = 31;     // architecturally meaningful
75// the rest of these depend on the ABI
76const RegIndex StackPointerReg = 30;
77const RegIndex GlobalPointerReg = 29;
78const RegIndex ProcedureValueReg = 27;
79const RegIndex ReturnAddressReg = 26;
80const RegIndex ReturnValueReg = 0;
81const RegIndex FramePointerReg = 15;
82
83const RegIndex SyscallNumReg = 0;
84const RegIndex FirstArgumentReg = 16;
85const RegIndex SyscallPseudoReturnReg = 20;
86const RegIndex SyscallSuccessReg = 19;
87
88const int NumIntArchRegs = 32;
89const int NumPALShadowRegs = 8;
90const int NumFloatArchRegs = 32;
91const int NumMiscArchRegs = NUM_MISCREGS;
92
93const int NumIntRegs = NumIntArchRegs + NumPALShadowRegs;
94const int NumFloatRegs = NumFloatArchRegs;
95const int NumMiscRegs = NumMiscArchRegs;
96
97const int TotalNumRegs =
98    NumIntRegs + NumFloatRegs + NumMiscRegs;
99
100const int TotalDataRegs = NumIntRegs + NumFloatRegs;
101
102// These enumerate all the registers for dependence tracking.
103enum DependenceTags {
104    // 0..31 are the integer regs 0..31
105    // 32..63 are the FP regs 0..31, i.e. use (reg + FP_Base_DepTag)
106    FP_Base_DepTag = 40,
107    Ctrl_Base_DepTag = 72,
108    Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs + NumInternalProcRegs
109};
110
111} // namespace AlphaISA
112
113#endif // __ARCH_ALPHA_REGFILE_HH__
114