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
4913610Sgiacomo.gabrielli@arm.com// Not applicable to Power
5013610Sgiacomo.gabrielli@arm.comusing VecElem = ::DummyVecElem;
5113610Sgiacomo.gabrielli@arm.comusing VecReg = ::DummyVecReg;
5213610Sgiacomo.gabrielli@arm.comusing ConstVecReg = ::DummyConstVecReg;
5313610Sgiacomo.gabrielli@arm.comusing VecRegContainer = ::DummyVecRegContainer;
5413610Sgiacomo.gabrielli@arm.comconstexpr unsigned NumVecElemPerVecReg = ::DummyNumVecElemPerVecReg;
5513610Sgiacomo.gabrielli@arm.comconstexpr size_t VecRegSizeBytes = ::DummyVecRegSizeBytes;
5613610Sgiacomo.gabrielli@arm.com
5713610Sgiacomo.gabrielli@arm.com// Not applicable to Power
5813610Sgiacomo.gabrielli@arm.comusing VecPredReg = ::DummyVecPredReg;
5913610Sgiacomo.gabrielli@arm.comusing ConstVecPredReg = ::DummyConstVecPredReg;
6013610Sgiacomo.gabrielli@arm.comusing VecPredRegContainer = ::DummyVecPredRegContainer;
6113610Sgiacomo.gabrielli@arm.comconstexpr size_t VecPredRegSizeBits = ::DummyVecPredRegSizeBits;
6213610Sgiacomo.gabrielli@arm.comconstexpr bool VecPredRegHasPackedRepr = ::DummyVecPredRegHasPackedRepr;
6312109SRekai.GonzalezAlberquilla@arm.com
646691Stjones1@inf.ed.ac.uk// Constants Related to the number of registers
656691Stjones1@inf.ed.ac.ukconst int NumIntArchRegs = 32;
666691Stjones1@inf.ed.ac.uk
676691Stjones1@inf.ed.ac.uk// CR, XER, LR, CTR, FPSCR, RSV, RSV-LEN, RSV-ADDR
686691Stjones1@inf.ed.ac.uk// and zero register, which doesn't actually exist but needs a number
696691Stjones1@inf.ed.ac.ukconst int NumIntSpecialRegs = 9;
706691Stjones1@inf.ed.ac.ukconst int NumFloatArchRegs = 32;
716691Stjones1@inf.ed.ac.ukconst int NumFloatSpecialRegs = 0;
726691Stjones1@inf.ed.ac.ukconst int NumInternalProcRegs = 0;
736691Stjones1@inf.ed.ac.uk
746691Stjones1@inf.ed.ac.ukconst int NumIntRegs = NumIntArchRegs + NumIntSpecialRegs;
756691Stjones1@inf.ed.ac.ukconst int NumFloatRegs = NumFloatArchRegs + NumFloatSpecialRegs;
7613610Sgiacomo.gabrielli@arm.comconst int NumVecRegs = 1;  // Not applicable to Power
7713610Sgiacomo.gabrielli@arm.com                           // (1 to prevent warnings)
7813610Sgiacomo.gabrielli@arm.comconst int NumVecPredRegs = 1;  // Not applicable to Power
7913610Sgiacomo.gabrielli@arm.com                               // (1 to prevent warnings)
809920Syasuko.eckert@amd.comconst int NumCCRegs = 0;
816691Stjones1@inf.ed.ac.ukconst int NumMiscRegs = NUM_MISCREGS;
826691Stjones1@inf.ed.ac.uk
836691Stjones1@inf.ed.ac.uk// Semantically meaningful register indices
846691Stjones1@inf.ed.ac.ukconst int ReturnValueReg = 3;
856691Stjones1@inf.ed.ac.ukconst int ArgumentReg0 = 3;
866691Stjones1@inf.ed.ac.ukconst int ArgumentReg1 = 4;
876691Stjones1@inf.ed.ac.ukconst int ArgumentReg2 = 5;
886691Stjones1@inf.ed.ac.ukconst int ArgumentReg3 = 6;
896691Stjones1@inf.ed.ac.ukconst int ArgumentReg4 = 7;
906691Stjones1@inf.ed.ac.ukconst int FramePointerReg = 31;
916691Stjones1@inf.ed.ac.ukconst int StackPointerReg = 1;
926691Stjones1@inf.ed.ac.uk
936691Stjones1@inf.ed.ac.uk// There isn't one in Power, but we need to define one somewhere
946691Stjones1@inf.ed.ac.ukconst int ZeroReg = NumIntRegs - 1;
956691Stjones1@inf.ed.ac.uk
966691Stjones1@inf.ed.ac.ukconst int SyscallNumReg = 0;
976691Stjones1@inf.ed.ac.ukconst int SyscallPseudoReturnReg = 3;
986691Stjones1@inf.ed.ac.ukconst int SyscallSuccessReg = 3;
996691Stjones1@inf.ed.ac.uk
1006691Stjones1@inf.ed.ac.ukenum MiscIntRegNums {
1016691Stjones1@inf.ed.ac.uk    INTREG_CR = NumIntArchRegs,
1026691Stjones1@inf.ed.ac.uk    INTREG_XER,
1036691Stjones1@inf.ed.ac.uk    INTREG_LR,
1046691Stjones1@inf.ed.ac.uk    INTREG_CTR,
1056691Stjones1@inf.ed.ac.uk    INTREG_FPSCR,
1066691Stjones1@inf.ed.ac.uk    INTREG_RSV,
1076691Stjones1@inf.ed.ac.uk    INTREG_RSV_LEN,
1086691Stjones1@inf.ed.ac.uk    INTREG_RSV_ADDR
1096691Stjones1@inf.ed.ac.uk};
1106691Stjones1@inf.ed.ac.uk
1117811Ssteve.reinhardt@amd.com} // namespace PowerISA
1126691Stjones1@inf.ed.ac.uk
1136691Stjones1@inf.ed.ac.uk#endif // __ARCH_POWER_REGISTERS_HH__
114