registers.hh revision 12109
112854Sgabeblack@google.com/* 212854Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan 312854Sgabeblack@google.com * All rights reserved. 412854Sgabeblack@google.com * 512854Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612854Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712854Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812854Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912854Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012854Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112854Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212854Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312854Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412854Sgabeblack@google.com * this software without specific prior written permission. 1512854Sgabeblack@google.com * 1612854Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712854Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812854Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912854Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012854Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112854Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212854Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312854Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412854Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512854Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612854Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712854Sgabeblack@google.com * 2812854Sgabeblack@google.com * Authors: Gabe Black 2912854Sgabeblack@google.com * Ali Saidi 3012854Sgabeblack@google.com */ 3112854Sgabeblack@google.com 3212854Sgabeblack@google.com#ifndef __ARCH_SPARC_REGISTERS_HH__ 3312854Sgabeblack@google.com#define __ARCH_SPARC_REGISTERS_HH__ 3412854Sgabeblack@google.com 3512854Sgabeblack@google.com#include "arch/generic/vec_reg.hh" 3612854Sgabeblack@google.com#include "arch/sparc/generated/max_inst_regs.hh" 3712854Sgabeblack@google.com#include "arch/sparc/miscregs.hh" 3812854Sgabeblack@google.com#include "arch/sparc/sparc_traits.hh" 3912854Sgabeblack@google.com#include "base/types.hh" 4012854Sgabeblack@google.com 4112854Sgabeblack@google.comnamespace SparcISA 4212854Sgabeblack@google.com{ 4312854Sgabeblack@google.com 4412854Sgabeblack@google.comusing SparcISAInst::MaxInstSrcRegs; 4512854Sgabeblack@google.comusing SparcISAInst::MaxInstDestRegs; 4612854Sgabeblack@google.comusing SparcISAInst::MaxMiscDestRegs; 4712854Sgabeblack@google.com 4812854Sgabeblack@google.comtypedef uint64_t IntReg; 4912854Sgabeblack@google.comtypedef uint64_t MiscReg; 5012854Sgabeblack@google.comtypedef float FloatReg; 5112854Sgabeblack@google.comtypedef uint32_t FloatRegBits; 5212854Sgabeblack@google.com 5312854Sgabeblack@google.com// dummy typedef since we don't have CC regs 5412854Sgabeblack@google.comtypedef uint8_t CCReg; 5512854Sgabeblack@google.com 5612854Sgabeblack@google.com// dummy typedefs since we don't have vector regs 5712854Sgabeblack@google.comconstexpr unsigned NumVecElemPerVecReg = 2; 5812854Sgabeblack@google.comusing VecElem = uint32_t; 5912854Sgabeblack@google.comusing VecReg = ::VecRegT<VecElem, NumVecElemPerVecReg, false>; 6012854Sgabeblack@google.comusing ConstVecReg = ::VecRegT<VecElem, NumVecElemPerVecReg, true>; 6112854Sgabeblack@google.comusing VecRegContainer = VecReg::Container; 6212854Sgabeblack@google.com// This has to be one to prevent warnings that are treated as errors 6312854Sgabeblack@google.comconstexpr unsigned NumVecRegs = 1; 6412854Sgabeblack@google.com 6512854Sgabeblack@google.comtypedef union 6612854Sgabeblack@google.com{ 6712854Sgabeblack@google.com IntReg intReg; 6812854Sgabeblack@google.com FloatReg fpreg; 6912854Sgabeblack@google.com MiscReg ctrlreg; 7012854Sgabeblack@google.com} AnyReg; 7112854Sgabeblack@google.com 7212854Sgabeblack@google.com// semantically meaningful register indices 7312854Sgabeblack@google.comconst int ZeroReg = 0; // architecturally meaningful 7412854Sgabeblack@google.com// the rest of these depend on the ABI 7512854Sgabeblack@google.comconst int ReturnAddressReg = 31; // post call, precall is 15 7612854Sgabeblack@google.comconst int ReturnValueReg = 8; // Post return, 24 is pre-return. 7712854Sgabeblack@google.comconst int StackPointerReg = 14; 7812854Sgabeblack@google.comconst int FramePointerReg = 30; 7912854Sgabeblack@google.com 8013160Sgabeblack@google.com// Some OS syscall use a second register (o1) to return a second value 8113160Sgabeblack@google.comconst int SyscallPseudoReturnReg = 9; 8212854Sgabeblack@google.com 8312854Sgabeblack@google.comconst int NumIntArchRegs = 32; 8412854Sgabeblack@google.comconst int NumIntRegs = (MaxGL + 1) * 8 + NWindows * 16 + NumMicroIntRegs; 8512854Sgabeblack@google.comconst int NumCCRegs = 0; 8612854Sgabeblack@google.com 8712854Sgabeblack@google.comconst int TotalNumRegs = NumIntRegs + NumFloatRegs + NumMiscRegs; 8812854Sgabeblack@google.com 8913160Sgabeblack@google.com} // namespace SparcISA 9013160Sgabeblack@google.com 9112854Sgabeblack@google.com#endif 9212854Sgabeblack@google.com