registers.hh revision 13610
16691Stjones1@inf.ed.ac.uk/*
26691Stjones1@inf.ed.ac.uk * Copyright (c) 2009 The University of Edinburgh
36691Stjones1@inf.ed.ac.uk * All rights reserved.
46691Stjones1@inf.ed.ac.uk *
56691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without
66691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are
76691Stjones1@inf.ed.ac.uk * met: redistributions of source code must retain the above copyright
86691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer;
96691Stjones1@inf.ed.ac.uk * redistributions in binary form must reproduce the above copyright
106691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer in the
116691Stjones1@inf.ed.ac.uk * documentation and/or other materials provided with the distribution;
126691Stjones1@inf.ed.ac.uk * neither the name of the copyright holders nor the names of its
136691Stjones1@inf.ed.ac.uk * contributors may be used to endorse or promote products derived from
146691Stjones1@inf.ed.ac.uk * this software without specific prior written permission.
156691Stjones1@inf.ed.ac.uk *
166691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176691Stjones1@inf.ed.ac.uk * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186691Stjones1@inf.ed.ac.uk * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196691Stjones1@inf.ed.ac.uk * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206691Stjones1@inf.ed.ac.uk * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216691Stjones1@inf.ed.ac.uk * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226691Stjones1@inf.ed.ac.uk * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236691Stjones1@inf.ed.ac.uk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246691Stjones1@inf.ed.ac.uk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256691Stjones1@inf.ed.ac.uk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266691Stjones1@inf.ed.ac.uk * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276691Stjones1@inf.ed.ac.uk *
286691Stjones1@inf.ed.ac.uk * Authors: Timothy M. Jones
296691Stjones1@inf.ed.ac.uk */
306691Stjones1@inf.ed.ac.uk
316691Stjones1@inf.ed.ac.uk#ifndef __ARCH_POWER_REGISTERS_HH__
326691Stjones1@inf.ed.ac.uk#define __ARCH_POWER_REGISTERS_HH__
336691Stjones1@inf.ed.ac.uk
3413610Sgiacomo.gabrielli@arm.com#include "arch/generic/vec_pred_reg.hh"
3512109SRekai.GonzalezAlberquilla@arm.com#include "arch/generic/vec_reg.hh"
368961Sgblack@eecs.umich.edu#include "arch/power/generated/max_inst_regs.hh"
376691Stjones1@inf.ed.ac.uk#include "arch/power/miscregs.hh"
3813556Sgabeblack@google.com#include "base/types.hh"
396691Stjones1@inf.ed.ac.uk
406691Stjones1@inf.ed.ac.uknamespace PowerISA {
416691Stjones1@inf.ed.ac.uk
426691Stjones1@inf.ed.ac.ukusing PowerISAInst::MaxInstSrcRegs;
436691Stjones1@inf.ed.ac.ukusing PowerISAInst::MaxInstDestRegs;
449065Sandreas.hansson@arm.com
459065Sandreas.hansson@arm.com// Power writes a misc register outside of the isa parser, so it can't
469065Sandreas.hansson@arm.com// be detected by it. Manually add it here.
479065Sandreas.hansson@arm.comconst int MaxMiscDestRegs = PowerISAInst::MaxMiscDestRegs + 1;
486691Stjones1@inf.ed.ac.uk
4913556Sgabeblack@google.comtypedef RegVal IntReg;
506691Stjones1@inf.ed.ac.uk
516691Stjones1@inf.ed.ac.uk// Floating point register file entry type
5213556Sgabeblack@google.comtypedef RegVal FloatRegBits;
5313556Sgabeblack@google.comtypedef RegVal MiscReg;
546691Stjones1@inf.ed.ac.uk
559920Syasuko.eckert@amd.com// dummy typedef since we don't have CC regs
569920Syasuko.eckert@amd.comtypedef uint8_t CCReg;
579920Syasuko.eckert@amd.com
5813610Sgiacomo.gabrielli@arm.com// Not applicable to Power
5913610Sgiacomo.gabrielli@arm.comusing VecElem = ::DummyVecElem;
6013610Sgiacomo.gabrielli@arm.comusing VecReg = ::DummyVecReg;
6113610Sgiacomo.gabrielli@arm.comusing ConstVecReg = ::DummyConstVecReg;
6213610Sgiacomo.gabrielli@arm.comusing VecRegContainer = ::DummyVecRegContainer;
6313610Sgiacomo.gabrielli@arm.comconstexpr unsigned NumVecElemPerVecReg = ::DummyNumVecElemPerVecReg;
6413610Sgiacomo.gabrielli@arm.comconstexpr size_t VecRegSizeBytes = ::DummyVecRegSizeBytes;
6513610Sgiacomo.gabrielli@arm.com
6613610Sgiacomo.gabrielli@arm.com// Not applicable to Power
6713610Sgiacomo.gabrielli@arm.comusing VecPredReg = ::DummyVecPredReg;
6813610Sgiacomo.gabrielli@arm.comusing ConstVecPredReg = ::DummyConstVecPredReg;
6913610Sgiacomo.gabrielli@arm.comusing VecPredRegContainer = ::DummyVecPredRegContainer;
7013610Sgiacomo.gabrielli@arm.comconstexpr size_t VecPredRegSizeBits = ::DummyVecPredRegSizeBits;
7113610Sgiacomo.gabrielli@arm.comconstexpr bool VecPredRegHasPackedRepr = ::DummyVecPredRegHasPackedRepr;
7212109SRekai.GonzalezAlberquilla@arm.com
736691Stjones1@inf.ed.ac.uk// Constants Related to the number of registers
746691Stjones1@inf.ed.ac.ukconst int NumIntArchRegs = 32;
756691Stjones1@inf.ed.ac.uk
766691Stjones1@inf.ed.ac.uk// CR, XER, LR, CTR, FPSCR, RSV, RSV-LEN, RSV-ADDR
776691Stjones1@inf.ed.ac.uk// and zero register, which doesn't actually exist but needs a number
786691Stjones1@inf.ed.ac.ukconst int NumIntSpecialRegs = 9;
796691Stjones1@inf.ed.ac.ukconst int NumFloatArchRegs = 32;
806691Stjones1@inf.ed.ac.ukconst int NumFloatSpecialRegs = 0;
816691Stjones1@inf.ed.ac.ukconst int NumInternalProcRegs = 0;
826691Stjones1@inf.ed.ac.uk
836691Stjones1@inf.ed.ac.ukconst int NumIntRegs = NumIntArchRegs + NumIntSpecialRegs;
846691Stjones1@inf.ed.ac.ukconst int NumFloatRegs = NumFloatArchRegs + NumFloatSpecialRegs;
8513610Sgiacomo.gabrielli@arm.comconst int NumVecRegs = 1;  // Not applicable to Power
8613610Sgiacomo.gabrielli@arm.com                           // (1 to prevent warnings)
8713610Sgiacomo.gabrielli@arm.comconst int NumVecPredRegs = 1;  // Not applicable to Power
8813610Sgiacomo.gabrielli@arm.com                               // (1 to prevent warnings)
899920Syasuko.eckert@amd.comconst int NumCCRegs = 0;
906691Stjones1@inf.ed.ac.ukconst int NumMiscRegs = NUM_MISCREGS;
916691Stjones1@inf.ed.ac.uk
926691Stjones1@inf.ed.ac.uk// Semantically meaningful register indices
936691Stjones1@inf.ed.ac.ukconst int ReturnValueReg = 3;
946691Stjones1@inf.ed.ac.ukconst int ArgumentReg0 = 3;
956691Stjones1@inf.ed.ac.ukconst int ArgumentReg1 = 4;
966691Stjones1@inf.ed.ac.ukconst int ArgumentReg2 = 5;
976691Stjones1@inf.ed.ac.ukconst int ArgumentReg3 = 6;
986691Stjones1@inf.ed.ac.ukconst int ArgumentReg4 = 7;
996691Stjones1@inf.ed.ac.ukconst int FramePointerReg = 31;
1006691Stjones1@inf.ed.ac.ukconst int StackPointerReg = 1;
1016691Stjones1@inf.ed.ac.uk
1026691Stjones1@inf.ed.ac.uk// There isn't one in Power, but we need to define one somewhere
1036691Stjones1@inf.ed.ac.ukconst int ZeroReg = NumIntRegs - 1;
1046691Stjones1@inf.ed.ac.uk
1056691Stjones1@inf.ed.ac.ukconst int SyscallNumReg = 0;
1066691Stjones1@inf.ed.ac.ukconst int SyscallPseudoReturnReg = 3;
1076691Stjones1@inf.ed.ac.ukconst int SyscallSuccessReg = 3;
1086691Stjones1@inf.ed.ac.uk
1096691Stjones1@inf.ed.ac.ukenum MiscIntRegNums {
1106691Stjones1@inf.ed.ac.uk    INTREG_CR = NumIntArchRegs,
1116691Stjones1@inf.ed.ac.uk    INTREG_XER,
1126691Stjones1@inf.ed.ac.uk    INTREG_LR,
1136691Stjones1@inf.ed.ac.uk    INTREG_CTR,
1146691Stjones1@inf.ed.ac.uk    INTREG_FPSCR,
1156691Stjones1@inf.ed.ac.uk    INTREG_RSV,
1166691Stjones1@inf.ed.ac.uk    INTREG_RSV_LEN,
1176691Stjones1@inf.ed.ac.uk    INTREG_RSV_ADDR
1186691Stjones1@inf.ed.ac.uk};
1196691Stjones1@inf.ed.ac.uk
1207811Ssteve.reinhardt@amd.com} // namespace PowerISA
1216691Stjones1@inf.ed.ac.uk
1226691Stjones1@inf.ed.ac.uk#endif // __ARCH_POWER_REGISTERS_HH__
123