operands.isa revision 6360
14158Sgblack@eecs.umich.edu// Copyright (c) 2007 The Regents of The University of Michigan 24158Sgblack@eecs.umich.edu// All rights reserved. 34158Sgblack@eecs.umich.edu// 44158Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 54158Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 64158Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 74158Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 84158Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 94158Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 104158Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 114158Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 124158Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 134158Sgblack@eecs.umich.edu// this software without specific prior written permission. 144158Sgblack@eecs.umich.edu// 154158Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 164158Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 174158Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 184158Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 194158Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 204158Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 214158Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 224158Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 234158Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 244158Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 254158Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 264158Sgblack@eecs.umich.edu// 274158Sgblack@eecs.umich.edu// Authors: Gabe Black 284158Sgblack@eecs.umich.edu 295409Sgblack@eecs.umich.edu// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 304158Sgblack@eecs.umich.edu// All rights reserved. 314158Sgblack@eecs.umich.edu// 324158Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms, 334158Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the 344158Sgblack@eecs.umich.edu// following conditions are met: 354158Sgblack@eecs.umich.edu// 364158Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any 374158Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary 384158Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use. Illustrative 394158Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study, 404158Sgblack@eecs.umich.edu// teaching, education and corporate research & development. 414158Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for 424158Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for 434158Sgblack@eecs.umich.edu// commercial advantage. 444158Sgblack@eecs.umich.edu// 454158Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be 464158Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact: 474158Sgblack@eecs.umich.edu// Director of Intellectual Property Licensing 484158Sgblack@eecs.umich.edu// Office of Strategy and Technology 494158Sgblack@eecs.umich.edu// Hewlett-Packard Company 504158Sgblack@eecs.umich.edu// 1501 Page Mill Road 514158Sgblack@eecs.umich.edu// Palo Alto, California 94304 524158Sgblack@eecs.umich.edu// 534158Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice, 544158Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer. Redistributions 554158Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of 564158Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or 574158Sgblack@eecs.umich.edu// other materials provided with the distribution. Neither the name of 584158Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 594158Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 604158Sgblack@eecs.umich.edu// this software without specific prior written permission. No right of 614158Sgblack@eecs.umich.edu// sublicense is granted herewith. Derivatives of the software and 624158Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for 634158Sgblack@eecs.umich.edu// Non-Commercial Uses. Derivatives of the software may be shared with 644158Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of 654158Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions; 664158Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright 674158Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where 684158Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below. 694158Sgblack@eecs.umich.edu// 704158Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 714158Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 724158Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 734158Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 744158Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 754158Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 764158Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 774158Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 784158Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 794158Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 804158Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 814158Sgblack@eecs.umich.edu// 824158Sgblack@eecs.umich.edu// Authors: Gabe Black 834158Sgblack@eecs.umich.edu 844158Sgblack@eecs.umich.edudef operand_types {{ 854158Sgblack@eecs.umich.edu 'sb' : ('signed int', 8), 864158Sgblack@eecs.umich.edu 'ub' : ('unsigned int', 8), 874158Sgblack@eecs.umich.edu 'sw' : ('signed int', 16), 884158Sgblack@eecs.umich.edu 'uw' : ('unsigned int', 16), 894158Sgblack@eecs.umich.edu 'sdw' : ('signed int', 32), 904158Sgblack@eecs.umich.edu 'udw' : ('unsigned int', 32), 914158Sgblack@eecs.umich.edu 'sqw' : ('signed int', 64), 924158Sgblack@eecs.umich.edu 'uqw' : ('unsigned int', 64), 934158Sgblack@eecs.umich.edu 'sf' : ('float', 32), 944158Sgblack@eecs.umich.edu 'df' : ('float', 64), 954158Sgblack@eecs.umich.edu}}; 964158Sgblack@eecs.umich.edu 976360Sgblack@eecs.umich.edulet {{ 986360Sgblack@eecs.umich.edu def foldInt(idx, foldBit, id): 996360Sgblack@eecs.umich.edu return ('IntReg', 'uqw', 'INTREG_FOLDED(%s, %s)' % (idx, foldBit), 1006360Sgblack@eecs.umich.edu 'IsInteger', id) 1016360Sgblack@eecs.umich.edu def intReg(idx, id): 1026360Sgblack@eecs.umich.edu return ('IntReg', 'uqw', idx, 'IsInteger', id) 1036360Sgblack@eecs.umich.edu def impIntReg(idx, id): 1046360Sgblack@eecs.umich.edu return ('IntReg', 'uqw', 'INTREG_IMPLICIT(%s)' % idx, 'IsInteger', id) 1056360Sgblack@eecs.umich.edu def floatReg(idx, id): 1066360Sgblack@eecs.umich.edu return ('FloatReg', 'df', idx, 'IsFloating', id) 1076360Sgblack@eecs.umich.edu def controlReg(idx, id, ctype = 'uqw'): 1086360Sgblack@eecs.umich.edu return ('ControlReg', ctype, idx, 1096360Sgblack@eecs.umich.edu (None, None, ['IsSerializeAfter', 1106360Sgblack@eecs.umich.edu 'IsSerializing', 1116360Sgblack@eecs.umich.edu 'IsNonSpeculative']), 1126360Sgblack@eecs.umich.edu id) 1136360Sgblack@eecs.umich.edu}}; 1146360Sgblack@eecs.umich.edu 1154158Sgblack@eecs.umich.edudef operands {{ 1166360Sgblack@eecs.umich.edu 'SrcReg1': foldInt('src1', 'foldOBit', 1), 1176360Sgblack@eecs.umich.edu 'SSrcReg1': intReg('src1', 1), 1186360Sgblack@eecs.umich.edu 'SrcReg2': foldInt('src2', 'foldOBit', 2), 1196360Sgblack@eecs.umich.edu 'SSrcReg2': intReg('src2', 1), 1206360Sgblack@eecs.umich.edu 'Index': foldInt('index', 'foldABit', 3), 1216360Sgblack@eecs.umich.edu 'Base': foldInt('base', 'foldABit', 4), 1226360Sgblack@eecs.umich.edu 'DestReg': foldInt('dest', 'foldOBit', 5), 1236360Sgblack@eecs.umich.edu 'SDestReg': intReg('dest', 5), 1246360Sgblack@eecs.umich.edu 'Data': foldInt('data', 'foldOBit', 6), 1256360Sgblack@eecs.umich.edu 'ProdLow': impIntReg(0, 7), 1266360Sgblack@eecs.umich.edu 'ProdHi': impIntReg(1, 8), 1276360Sgblack@eecs.umich.edu 'Quotient': impIntReg(2, 9), 1286360Sgblack@eecs.umich.edu 'Remainder': impIntReg(3, 10), 1296360Sgblack@eecs.umich.edu 'Divisor': impIntReg(4, 11), 1306360Sgblack@eecs.umich.edu 'Rax': intReg('(INTREG_RAX)', 12), 1316360Sgblack@eecs.umich.edu 'Rbx': intReg('(INTREG_RBX)', 13), 1326360Sgblack@eecs.umich.edu 'Rcx': intReg('(INTREG_RCX)', 14), 1336360Sgblack@eecs.umich.edu 'Rdx': intReg('(INTREG_RDX)', 15), 1346360Sgblack@eecs.umich.edu 'Rsp': intReg('(INTREG_RSP)', 16), 1356360Sgblack@eecs.umich.edu 'Rbp': intReg('(INTREG_RBP)', 17), 1366360Sgblack@eecs.umich.edu 'Rsi': intReg('(INTREG_RSI)', 18), 1376360Sgblack@eecs.umich.edu 'Rdi': intReg('(INTREG_RDI)', 19), 1386360Sgblack@eecs.umich.edu 'FpSrcReg1': floatReg('src1', 20), 1396360Sgblack@eecs.umich.edu 'FpSrcReg2': floatReg('src2', 21), 1406360Sgblack@eecs.umich.edu 'FpDestReg': floatReg('dest', 22), 1416360Sgblack@eecs.umich.edu 'FpData': floatReg('data', 23), 1425026Sgblack@eecs.umich.edu 'RIP': ('NPC', 'uqw', None, (None, None, 'IsControl'), 50), 1435026Sgblack@eecs.umich.edu 'uIP': ('UPC', 'uqw', None, (None, None, 'IsControl'), 51), 1445026Sgblack@eecs.umich.edu 'nuIP': ('NUPC', 'uqw', None, (None, None, 'IsControl'), 52), 1455426Sgblack@eecs.umich.edu # This holds the condition code portion of the flag register. The 1465426Sgblack@eecs.umich.edu # nccFlagBits version holds the rest. 1476360Sgblack@eecs.umich.edu 'ccFlagBits': intReg('INTREG_PSEUDO(0)', 60), 1485426Sgblack@eecs.umich.edu # These register should needs to be more protected so that later 1495082Sgblack@eecs.umich.edu # instructions don't map their indexes with an old value. 1506360Sgblack@eecs.umich.edu 'nccFlagBits': controlReg('MISCREG_RFLAGS', 61), 1516360Sgblack@eecs.umich.edu 'TOP': controlReg('MISCREG_X87_TOP', 62, ctype='ub'), 1525294Sgblack@eecs.umich.edu # The segment base as used by memory instructions. 1536360Sgblack@eecs.umich.edu 'SegBase': controlReg('MISCREG_SEG_EFF_BASE(segment)', 70), 1545290Sgblack@eecs.umich.edu 1555294Sgblack@eecs.umich.edu # Operands to get and set registers indexed by the operands of the 1565294Sgblack@eecs.umich.edu # original instruction. 1576360Sgblack@eecs.umich.edu 'ControlDest': controlReg('MISCREG_CR(dest)', 100), 1586360Sgblack@eecs.umich.edu 'ControlSrc1': controlReg('MISCREG_CR(src1)', 101), 1596360Sgblack@eecs.umich.edu 'DebugDest': controlReg('MISCREG_DR(dest)', 102), 1606360Sgblack@eecs.umich.edu 'DebugSrc1': controlReg('MISCREG_DR(src1)', 103), 1616360Sgblack@eecs.umich.edu 'SegBaseDest': controlReg('MISCREG_SEG_BASE(dest)', 104), 1626360Sgblack@eecs.umich.edu 'SegBaseSrc1': controlReg('MISCREG_SEG_BASE(src1)', 105), 1636360Sgblack@eecs.umich.edu 'SegLimitDest': controlReg('MISCREG_SEG_LIMIT(dest)', 106), 1646360Sgblack@eecs.umich.edu 'SegLimitSrc1': controlReg('MISCREG_SEG_LIMIT(src1)', 107), 1656360Sgblack@eecs.umich.edu 'SegSelDest': controlReg('MISCREG_SEG_SEL(dest)', 108), 1666360Sgblack@eecs.umich.edu 'SegSelSrc1': controlReg('MISCREG_SEG_SEL(src1)', 109), 1676360Sgblack@eecs.umich.edu 'SegAttrDest': controlReg('MISCREG_SEG_ATTR(dest)', 110), 1686360Sgblack@eecs.umich.edu 'SegAttrSrc1': controlReg('MISCREG_SEG_ATTR(src1)', 111), 1695294Sgblack@eecs.umich.edu 1705294Sgblack@eecs.umich.edu # Operands to access specific control registers directly. 1716360Sgblack@eecs.umich.edu 'EferOp': controlReg('MISCREG_EFER', 200), 1726360Sgblack@eecs.umich.edu 'CR4Op': controlReg('MISCREG_CR4', 201), 1736360Sgblack@eecs.umich.edu 'DR7Op': controlReg('MISCREG_DR7', 202), 1746360Sgblack@eecs.umich.edu 'LDTRBase': controlReg('MISCREG_TSL_BASE', 203), 1756360Sgblack@eecs.umich.edu 'LDTRLimit': controlReg('MISCREG_TSL_LIMIT', 204), 1766360Sgblack@eecs.umich.edu 'LDTRSel': controlReg('MISCREG_TSL', 205), 1776360Sgblack@eecs.umich.edu 'GDTRBase': controlReg('MISCREG_TSG_BASE', 206), 1786360Sgblack@eecs.umich.edu 'GDTRLimit': controlReg('MISCREG_TSG_LIMIT', 207), 1796360Sgblack@eecs.umich.edu 'CSBase': controlReg('MISCREG_CS_EFF_BASE', 208), 1806360Sgblack@eecs.umich.edu 'CSAttr': controlReg('MISCREG_CS_ATTR', 209), 1816360Sgblack@eecs.umich.edu 'MiscRegDest': controlReg('dest', 210), 1826360Sgblack@eecs.umich.edu 'MiscRegSrc1': controlReg('src1', 211), 1836360Sgblack@eecs.umich.edu 'TscOp': controlReg('MISCREG_TSC', 212), 1846360Sgblack@eecs.umich.edu 'M5Reg': controlReg('MISCREG_M5_REG', 213), 1856360Sgblack@eecs.umich.edu 'Mem': ('Mem', 'uqw', None, \ 1866360Sgblack@eecs.umich.edu ('IsMemRef', 'IsLoad', 'IsStore'), 300) 1874158Sgblack@eecs.umich.edu}}; 188