microop.hh revision 5083
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_MICROOP_HH__ 594679Sgblack@eecs.umich.edu#define __ARCH_X86_INSTS_MICROOP_HH__ 604679Sgblack@eecs.umich.edu 614679Sgblack@eecs.umich.edu#include "arch/x86/insts/static_inst.hh" 624679Sgblack@eecs.umich.edu 634679Sgblack@eecs.umich.edunamespace X86ISA 644679Sgblack@eecs.umich.edu{ 655083Sgblack@eecs.umich.edu namespace ConditionTests 665083Sgblack@eecs.umich.edu { 675083Sgblack@eecs.umich.edu enum CondTest { 685083Sgblack@eecs.umich.edu True, 695083Sgblack@eecs.umich.edu NotFalse = True, 705083Sgblack@eecs.umich.edu ECF, 715083Sgblack@eecs.umich.edu EZF, 725083Sgblack@eecs.umich.edu SZnZF, 735083Sgblack@eecs.umich.edu MSTRZ, 745083Sgblack@eecs.umich.edu STRZ, 755083Sgblack@eecs.umich.edu MSTRC, 765083Sgblack@eecs.umich.edu STRZnEZF, 775083Sgblack@eecs.umich.edu OF, 785083Sgblack@eecs.umich.edu CF, 795083Sgblack@eecs.umich.edu ZF, 805083Sgblack@eecs.umich.edu CvZF, 815083Sgblack@eecs.umich.edu SF, 825083Sgblack@eecs.umich.edu PF, 835083Sgblack@eecs.umich.edu SxOF, 845083Sgblack@eecs.umich.edu SxOvZF, 855083Sgblack@eecs.umich.edu 865083Sgblack@eecs.umich.edu False, 875083Sgblack@eecs.umich.edu NotTrue = False, 885083Sgblack@eecs.umich.edu NotECF, 895083Sgblack@eecs.umich.edu NotEZF, 905083Sgblack@eecs.umich.edu NotSZnZF, 915083Sgblack@eecs.umich.edu NotMSTRZ, 925083Sgblack@eecs.umich.edu NotSTRZ, 935083Sgblack@eecs.umich.edu NotMSTRC, 945083Sgblack@eecs.umich.edu STRnZnEZF, 955083Sgblack@eecs.umich.edu NotOF, 965083Sgblack@eecs.umich.edu NotCF, 975083Sgblack@eecs.umich.edu NotZF, 985083Sgblack@eecs.umich.edu NotCvZF, 995083Sgblack@eecs.umich.edu NotSF, 1005083Sgblack@eecs.umich.edu NotPF, 1015083Sgblack@eecs.umich.edu NotSxOF, 1025083Sgblack@eecs.umich.edu NotSxOvZF 1035083Sgblack@eecs.umich.edu }; 1045083Sgblack@eecs.umich.edu } 1055083Sgblack@eecs.umich.edu 1064679Sgblack@eecs.umich.edu //A class which is the base of all x86 micro ops. It provides a function to 1074679Sgblack@eecs.umich.edu //set necessary flags appropriately. 1084679Sgblack@eecs.umich.edu class X86MicroopBase : public X86StaticInst 1094679Sgblack@eecs.umich.edu { 1104679Sgblack@eecs.umich.edu protected: 1114679Sgblack@eecs.umich.edu const char * instMnem; 1124679Sgblack@eecs.umich.edu uint8_t opSize; 1134679Sgblack@eecs.umich.edu uint8_t addrSize; 1144679Sgblack@eecs.umich.edu 1154679Sgblack@eecs.umich.edu X86MicroopBase(ExtMachInst _machInst, 1164679Sgblack@eecs.umich.edu const char *mnem, const char *_instMnem, 1174679Sgblack@eecs.umich.edu bool isMicro, bool isDelayed, 1184679Sgblack@eecs.umich.edu bool isFirst, bool isLast, 1194679Sgblack@eecs.umich.edu OpClass __opClass) : 1204679Sgblack@eecs.umich.edu X86ISA::X86StaticInst(mnem, _machInst, __opClass), 1214679Sgblack@eecs.umich.edu instMnem(_instMnem) 1224679Sgblack@eecs.umich.edu { 1234679Sgblack@eecs.umich.edu flags[IsMicroop] = isMicro; 1244679Sgblack@eecs.umich.edu flags[IsDelayedCommit] = isDelayed; 1254679Sgblack@eecs.umich.edu flags[IsFirstMicroop] = isFirst; 1264679Sgblack@eecs.umich.edu flags[IsLastMicroop] = isLast; 1274679Sgblack@eecs.umich.edu } 1284679Sgblack@eecs.umich.edu 1294679Sgblack@eecs.umich.edu std::string generateDisassembly(Addr pc, 1304679Sgblack@eecs.umich.edu const SymbolTable *symtab) const 1314679Sgblack@eecs.umich.edu { 1324679Sgblack@eecs.umich.edu std::stringstream ss; 1334679Sgblack@eecs.umich.edu 1344679Sgblack@eecs.umich.edu ccprintf(ss, "\t%s.%s", instMnem, mnemonic); 1354679Sgblack@eecs.umich.edu 1364679Sgblack@eecs.umich.edu return ss.str(); 1374679Sgblack@eecs.umich.edu } 1385083Sgblack@eecs.umich.edu 1395083Sgblack@eecs.umich.edu bool checkCondition(uint64_t flags, int condition) const; 1404679Sgblack@eecs.umich.edu }; 1414679Sgblack@eecs.umich.edu} 1424679Sgblack@eecs.umich.edu 1434679Sgblack@eecs.umich.edu#endif //__ARCH_X86_INSTS_MICROOP_HH__ 144