112295Sgabeblack@google.com/* 212295Sgabeblack@google.com * Copyright (c) 2006-2007 The Regents of The University of Michigan 312295Sgabeblack@google.com * All rights reserved. 412295Sgabeblack@google.com * 512295Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612295Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712295Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812295Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912295Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012295Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112295Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212295Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312295Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412295Sgabeblack@google.com * this software without specific prior written permission. 1512295Sgabeblack@google.com * 1612295Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712295Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812295Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912295Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012295Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112295Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212295Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312295Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412295Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512295Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612295Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712295Sgabeblack@google.com * 2812295Sgabeblack@google.com * Authors: Ali Saidi 2912295Sgabeblack@google.com * Gabe Black 3012295Sgabeblack@google.com * Steve Reinhardt 3112295Sgabeblack@google.com */ 3212295Sgabeblack@google.com 3312295Sgabeblack@google.com#ifndef __ARCH_SPARC_INSTS_INTEGER_HH__ 3412295Sgabeblack@google.com#define __ARCH_SPARC_INSTS_INTEGER_HH__ 3512295Sgabeblack@google.com 3612295Sgabeblack@google.com#include "arch/sparc/insts/static_inst.hh" 3712295Sgabeblack@google.com 3812295Sgabeblack@google.comnamespace SparcISA 3912295Sgabeblack@google.com{ 4012295Sgabeblack@google.com 4112295Sgabeblack@google.com//////////////////////////////////////////////////////////////////// 4212295Sgabeblack@google.com// 4312295Sgabeblack@google.com// Integer operate instructions 4412295Sgabeblack@google.com// 4512295Sgabeblack@google.com 4612295Sgabeblack@google.com/** 4712295Sgabeblack@google.com * Base class for integer operations. 4812295Sgabeblack@google.com */ 4912295Sgabeblack@google.comclass IntOp : public SparcStaticInst 5012295Sgabeblack@google.com{ 5112295Sgabeblack@google.com protected: 5212295Sgabeblack@google.com using SparcStaticInst::SparcStaticInst; 5312295Sgabeblack@google.com 5412295Sgabeblack@google.com std::string generateDisassembly( 5512295Sgabeblack@google.com Addr pc, const SymbolTable *symtab) const override; 5612295Sgabeblack@google.com 5712295Sgabeblack@google.com virtual bool printPseudoOps(std::ostream &os, Addr pc, 5812295Sgabeblack@google.com const SymbolTable *symtab) const; 5912295Sgabeblack@google.com}; 6012295Sgabeblack@google.com 6112295Sgabeblack@google.com/** 6212295Sgabeblack@google.com * Base class for immediate integer operations. 6312295Sgabeblack@google.com */ 6412295Sgabeblack@google.comclass IntOpImm : public IntOp 6512295Sgabeblack@google.com{ 6612295Sgabeblack@google.com protected: 6712295Sgabeblack@google.com // Constructor 6812295Sgabeblack@google.com IntOpImm(const char *mnem, ExtMachInst _machInst, 6912295Sgabeblack@google.com OpClass __opClass, int64_t _imm) : 7012295Sgabeblack@google.com IntOp(mnem, _machInst, __opClass), imm(_imm) 7112295Sgabeblack@google.com {} 7212295Sgabeblack@google.com 7312295Sgabeblack@google.com int64_t imm; 7412295Sgabeblack@google.com 7512295Sgabeblack@google.com std::string generateDisassembly( 7612295Sgabeblack@google.com Addr pc, const SymbolTable *symtab) const override; 7712295Sgabeblack@google.com 7812295Sgabeblack@google.com bool printPseudoOps(std::ostream &os, Addr pc, 7912295Sgabeblack@google.com const SymbolTable *symtab) const override; 8012295Sgabeblack@google.com}; 8112295Sgabeblack@google.com 8212295Sgabeblack@google.com/** 8312295Sgabeblack@google.com * Base class for 10 bit immediate integer operations. 8412295Sgabeblack@google.com */ 8512295Sgabeblack@google.comclass IntOpImm10 : public IntOpImm 8612295Sgabeblack@google.com{ 8712295Sgabeblack@google.com protected: 8812295Sgabeblack@google.com // Constructor 8912295Sgabeblack@google.com IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 9012295Sgabeblack@google.com IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 9, 0))) 9112295Sgabeblack@google.com {} 9212295Sgabeblack@google.com}; 9312295Sgabeblack@google.com 9412295Sgabeblack@google.com/** 9512295Sgabeblack@google.com * Base class for 11 bit immediate integer operations. 9612295Sgabeblack@google.com */ 9712295Sgabeblack@google.comclass IntOpImm11 : public IntOpImm 9812295Sgabeblack@google.com{ 9912295Sgabeblack@google.com protected: 10012295Sgabeblack@google.com IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 10112295Sgabeblack@google.com IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 10, 0))) 10212295Sgabeblack@google.com {} 10312295Sgabeblack@google.com}; 10412295Sgabeblack@google.com 10512295Sgabeblack@google.com/** 10612295Sgabeblack@google.com * Base class for 13 bit immediate integer operations. 10712295Sgabeblack@google.com */ 10812295Sgabeblack@google.comclass IntOpImm13 : public IntOpImm 10912295Sgabeblack@google.com{ 11012295Sgabeblack@google.com protected: 11112295Sgabeblack@google.com IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 11212295Sgabeblack@google.com IntOpImm(mnem, _machInst, __opClass, sext<13>(bits(_machInst, 12, 0))) 11312295Sgabeblack@google.com {} 11412295Sgabeblack@google.com}; 11512295Sgabeblack@google.com 11612295Sgabeblack@google.com/** 11712295Sgabeblack@google.com * Base class for sethi. 11812295Sgabeblack@google.com */ 11912295Sgabeblack@google.comclass SetHi : public IntOpImm 12012295Sgabeblack@google.com{ 12112295Sgabeblack@google.com protected: 12212295Sgabeblack@google.com // Constructor 12312295Sgabeblack@google.com SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 12412295Sgabeblack@google.com IntOpImm(mnem, _machInst, __opClass, bits(_machInst, 21, 0) << 10) 12512295Sgabeblack@google.com {} 12612295Sgabeblack@google.com 12712295Sgabeblack@google.com std::string generateDisassembly( 12812295Sgabeblack@google.com Addr pc, const SymbolTable *symtab) const override; 12912295Sgabeblack@google.com}; 13012295Sgabeblack@google.com 13112295Sgabeblack@google.com} 13212295Sgabeblack@google.com 13312295Sgabeblack@google.com#endif // __ARCH_SPARCH_INSTS_INTEGER_HH__ 134