microregop.hh revision 4679
14679Sgblack@eecs.umich.edu/*
24679Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company
34679Sgblack@eecs.umich.edu * All rights reserved.
44679Sgblack@eecs.umich.edu *
54679Sgblack@eecs.umich.edu * Redistribution and use of this software in source and binary forms,
64679Sgblack@eecs.umich.edu * with or without modification, are permitted provided that the
74679Sgblack@eecs.umich.edu * following conditions are met:
84679Sgblack@eecs.umich.edu *
94679Sgblack@eecs.umich.edu * The software must be used only for Non-Commercial Use which means any
104679Sgblack@eecs.umich.edu * use which is NOT directed to receiving any direct monetary
114679Sgblack@eecs.umich.edu * compensation for, or commercial advantage from such use.  Illustrative
124679Sgblack@eecs.umich.edu * examples of non-commercial use are academic research, personal study,
134679Sgblack@eecs.umich.edu * teaching, education and corporate research & development.
144679Sgblack@eecs.umich.edu * Illustrative examples of commercial use are distributing products for
154679Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for
164679Sgblack@eecs.umich.edu * commercial advantage.
174679Sgblack@eecs.umich.edu *
184679Sgblack@eecs.umich.edu * If you wish to use this software or functionality therein that may be
194679Sgblack@eecs.umich.edu * covered by patents for commercial use, please contact:
204679Sgblack@eecs.umich.edu *     Director of Intellectual Property Licensing
214679Sgblack@eecs.umich.edu *     Office of Strategy and Technology
224679Sgblack@eecs.umich.edu *     Hewlett-Packard Company
234679Sgblack@eecs.umich.edu *     1501 Page Mill Road
244679Sgblack@eecs.umich.edu *     Palo Alto, California  94304
254679Sgblack@eecs.umich.edu *
264679Sgblack@eecs.umich.edu * Redistributions of source code must retain the above copyright notice,
274679Sgblack@eecs.umich.edu * this list of conditions and the following disclaimer.  Redistributions
284679Sgblack@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of
294679Sgblack@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or
304679Sgblack@eecs.umich.edu * other materials provided with the distribution.  Neither the name of
314679Sgblack@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
324679Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
334679Sgblack@eecs.umich.edu * this software without specific prior written permission.  No right of
344679Sgblack@eecs.umich.edu * sublicense is granted herewith.  Derivatives of the software and
354679Sgblack@eecs.umich.edu * output created using the software may be prepared, but only for
364679Sgblack@eecs.umich.edu * Non-Commercial Uses.  Derivatives of the software may be shared with
374679Sgblack@eecs.umich.edu * others provided: (i) the others agree to abide by the list of
384679Sgblack@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions;
394679Sgblack@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright
404679Sgblack@eecs.umich.edu * notice to acknowledge the contribution from this software where
414679Sgblack@eecs.umich.edu * applicable, this list of conditions and the disclaimer below.
424679Sgblack@eecs.umich.edu *
434679Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
444679Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
454679Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
464679Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
474679Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
484679Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
494679Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
504679Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
514679Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
524679Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
534679Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
544679Sgblack@eecs.umich.edu *
554679Sgblack@eecs.umich.edu * Authors: Gabe Black
564679Sgblack@eecs.umich.edu */
574679Sgblack@eecs.umich.edu
584679Sgblack@eecs.umich.edu#ifndef __ARCH_X86_INSTS_MICROREGOP_HH__
594679Sgblack@eecs.umich.edu#define __ARCH_X86_INSTS_MICROREGOP_HH__
604679Sgblack@eecs.umich.edu
614679Sgblack@eecs.umich.edu#include "arch/x86/insts/microop.hh"
624679Sgblack@eecs.umich.edu
634679Sgblack@eecs.umich.edunamespace X86ISA
644679Sgblack@eecs.umich.edu{
654679Sgblack@eecs.umich.edu    /**
664679Sgblack@eecs.umich.edu     * Base classes for RegOps which provides a generateDisassembly method.
674679Sgblack@eecs.umich.edu     */
684679Sgblack@eecs.umich.edu    class RegOp : public X86MicroopBase
694679Sgblack@eecs.umich.edu    {
704679Sgblack@eecs.umich.edu      protected:
714679Sgblack@eecs.umich.edu        const RegIndex src1;
724679Sgblack@eecs.umich.edu        const RegIndex src2;
734679Sgblack@eecs.umich.edu        const RegIndex dest;
744679Sgblack@eecs.umich.edu        const bool setStatus;
754679Sgblack@eecs.umich.edu        const uint8_t dataSize;
764679Sgblack@eecs.umich.edu        const uint8_t ext;
774679Sgblack@eecs.umich.edu
784679Sgblack@eecs.umich.edu        // Constructor
794679Sgblack@eecs.umich.edu        RegOp(ExtMachInst _machInst,
804679Sgblack@eecs.umich.edu                const char *mnem, const char *_instMnem,
814679Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed,
824679Sgblack@eecs.umich.edu                bool isFirst, bool isLast,
834679Sgblack@eecs.umich.edu                RegIndex _src1, RegIndex _src2, RegIndex _dest,
844679Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext,
854679Sgblack@eecs.umich.edu                OpClass __opClass) :
864679Sgblack@eecs.umich.edu            X86MicroopBase(_machInst, mnem, _instMnem,
874679Sgblack@eecs.umich.edu                    isMicro, isDelayed, isFirst, isLast,
884679Sgblack@eecs.umich.edu                    __opClass),
894679Sgblack@eecs.umich.edu            src1(_src1), src2(_src2), dest(_dest),
904679Sgblack@eecs.umich.edu            setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
914679Sgblack@eecs.umich.edu        {
924679Sgblack@eecs.umich.edu        }
934679Sgblack@eecs.umich.edu
944679Sgblack@eecs.umich.edu        std::string generateDisassembly(Addr pc,
954679Sgblack@eecs.umich.edu            const SymbolTable *symtab) const;
964679Sgblack@eecs.umich.edu    };
974679Sgblack@eecs.umich.edu
984679Sgblack@eecs.umich.edu    class RegOpImm : public X86MicroopBase
994679Sgblack@eecs.umich.edu    {
1004679Sgblack@eecs.umich.edu      protected:
1014679Sgblack@eecs.umich.edu        const RegIndex src1;
1024679Sgblack@eecs.umich.edu        const uint8_t imm8;
1034679Sgblack@eecs.umich.edu        const RegIndex dest;
1044679Sgblack@eecs.umich.edu        const bool setStatus;
1054679Sgblack@eecs.umich.edu        const uint8_t dataSize;
1064679Sgblack@eecs.umich.edu        const uint8_t ext;
1074679Sgblack@eecs.umich.edu
1084679Sgblack@eecs.umich.edu        // Constructor
1094679Sgblack@eecs.umich.edu        RegOpImm(ExtMachInst _machInst,
1104679Sgblack@eecs.umich.edu                const char * mnem, const char *_instMnem,
1114679Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed,
1124679Sgblack@eecs.umich.edu                bool isFirst, bool isLast,
1134679Sgblack@eecs.umich.edu                RegIndex _src1, uint8_t _imm8, RegIndex _dest,
1144679Sgblack@eecs.umich.edu                bool _setStatus, uint8_t _dataSize, uint8_t _ext,
1154679Sgblack@eecs.umich.edu                OpClass __opClass) :
1164679Sgblack@eecs.umich.edu            X86MicroopBase(_machInst, mnem, _instMnem,
1174679Sgblack@eecs.umich.edu                    isMicro, isDelayed, isFirst, isLast,
1184679Sgblack@eecs.umich.edu                    __opClass),
1194679Sgblack@eecs.umich.edu            src1(_src1), imm8(_imm8), dest(_dest),
1204679Sgblack@eecs.umich.edu            setStatus(_setStatus), dataSize(_dataSize), ext(_ext)
1214679Sgblack@eecs.umich.edu        {
1224679Sgblack@eecs.umich.edu        }
1234679Sgblack@eecs.umich.edu
1244679Sgblack@eecs.umich.edu        std::string generateDisassembly(Addr pc,
1254679Sgblack@eecs.umich.edu            const SymbolTable *symtab) const;
1264679Sgblack@eecs.umich.edu    };
1274679Sgblack@eecs.umich.edu}
1284679Sgblack@eecs.umich.edu
1294679Sgblack@eecs.umich.edu#endif //__ARCH_X86_INSTS_MICROREGOP_HH__
130