operands.isa revision 7720
16019Shines@cs.fsu.edu// -*- mode:c++ -*- 27091Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited 37091Sgblack@eecs.umich.edu// All rights reserved 47091Sgblack@eecs.umich.edu// 57091Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall 67091Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual 77091Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating 87091Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software 97091Sgblack@eecs.umich.edu// licensed hereunder. You may use the software subject to the license 107091Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated 117091Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software, 127091Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form. 137091Sgblack@eecs.umich.edu// 146019Shines@cs.fsu.edu// Copyright (c) 2007-2008 The Florida State University 156019Shines@cs.fsu.edu// All rights reserved. 166019Shines@cs.fsu.edu// 176019Shines@cs.fsu.edu// Redistribution and use in source and binary forms, with or without 186019Shines@cs.fsu.edu// modification, are permitted provided that the following conditions are 196019Shines@cs.fsu.edu// met: redistributions of source code must retain the above copyright 206019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer; 216019Shines@cs.fsu.edu// redistributions in binary form must reproduce the above copyright 226019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer in the 236019Shines@cs.fsu.edu// documentation and/or other materials provided with the distribution; 246019Shines@cs.fsu.edu// neither the name of the copyright holders nor the names of its 256019Shines@cs.fsu.edu// contributors may be used to endorse or promote products derived from 266019Shines@cs.fsu.edu// this software without specific prior written permission. 276019Shines@cs.fsu.edu// 286019Shines@cs.fsu.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 296019Shines@cs.fsu.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 306019Shines@cs.fsu.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 316019Shines@cs.fsu.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 326019Shines@cs.fsu.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 336019Shines@cs.fsu.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 346019Shines@cs.fsu.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 356019Shines@cs.fsu.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 366019Shines@cs.fsu.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 376019Shines@cs.fsu.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 386019Shines@cs.fsu.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 396019Shines@cs.fsu.edu// 406019Shines@cs.fsu.edu// Authors: Stephen Hines 416019Shines@cs.fsu.edu 426019Shines@cs.fsu.edudef operand_types {{ 436019Shines@cs.fsu.edu 'sb' : ('signed int', 8), 446019Shines@cs.fsu.edu 'ub' : ('unsigned int', 8), 456019Shines@cs.fsu.edu 'sh' : ('signed int', 16), 466019Shines@cs.fsu.edu 'uh' : ('unsigned int', 16), 476019Shines@cs.fsu.edu 'sw' : ('signed int', 32), 486019Shines@cs.fsu.edu 'uw' : ('unsigned int', 32), 496019Shines@cs.fsu.edu 'ud' : ('unsigned int', 64), 507639Sgblack@eecs.umich.edu 'tud' : ('twin64 int', 64), 516019Shines@cs.fsu.edu 'sf' : ('float', 32), 526019Shines@cs.fsu.edu 'df' : ('float', 64) 536019Shines@cs.fsu.edu}}; 546019Shines@cs.fsu.edu 556312Sgblack@eecs.umich.edulet {{ 566312Sgblack@eecs.umich.edu maybePCRead = ''' 577720Sgblack@eecs.umich.edu ((%(reg_idx)s == PCReg) ? readPC(xc) : xc->%(func)s(this, %(op_idx)s)) 586312Sgblack@eecs.umich.edu ''' 597186Sgblack@eecs.umich.edu maybeAlignedPCRead = ''' 607720Sgblack@eecs.umich.edu ((%(reg_idx)s == PCReg) ? (roundDown(readPC(xc), 4)) : 617186Sgblack@eecs.umich.edu xc->%(func)s(this, %(op_idx)s)) 627186Sgblack@eecs.umich.edu ''' 636312Sgblack@eecs.umich.edu maybePCWrite = ''' 647093Sgblack@eecs.umich.edu ((%(reg_idx)s == PCReg) ? setNextPC(xc, %(final_val)s) : 656312Sgblack@eecs.umich.edu xc->%(func)s(this, %(op_idx)s, %(final_val)s)) 666312Sgblack@eecs.umich.edu ''' 677148Sgblack@eecs.umich.edu maybeIWPCWrite = ''' 687148Sgblack@eecs.umich.edu ((%(reg_idx)s == PCReg) ? setIWNextPC(xc, %(final_val)s) : 697148Sgblack@eecs.umich.edu xc->%(func)s(this, %(op_idx)s, %(final_val)s)) 707148Sgblack@eecs.umich.edu ''' 717184Sgblack@eecs.umich.edu maybeAIWPCWrite = ''' 727184Sgblack@eecs.umich.edu if (%(reg_idx)s == PCReg) { 737289Sgblack@eecs.umich.edu bool thumb = THUMB; 747289Sgblack@eecs.umich.edu if (thumb) { 757289Sgblack@eecs.umich.edu setNextPC(xc, %(final_val)s); 767289Sgblack@eecs.umich.edu } else { 777184Sgblack@eecs.umich.edu setIWNextPC(xc, %(final_val)s); 787184Sgblack@eecs.umich.edu } 797184Sgblack@eecs.umich.edu } else { 807184Sgblack@eecs.umich.edu xc->%(func)s(this, %(op_idx)s, %(final_val)s); 817184Sgblack@eecs.umich.edu } 827184Sgblack@eecs.umich.edu ''' 836312Sgblack@eecs.umich.edu}}; 846312Sgblack@eecs.umich.edu 856019Shines@cs.fsu.edudef operands {{ 867119Sgblack@eecs.umich.edu #Abstracted integer reg operands 877720Sgblack@eecs.umich.edu 'Dest': ('IntReg', 'uw', 'dest', 'IsInteger', 3, 887119Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 897720Sgblack@eecs.umich.edu 'FpDest': ('FloatReg', 'sf', '(dest + 0)', 'IsFloating', 3), 907720Sgblack@eecs.umich.edu 'FpDestP0': ('FloatReg', 'sf', '(dest + 0)', 'IsFloating', 3), 917720Sgblack@eecs.umich.edu 'FpDestP1': ('FloatReg', 'sf', '(dest + 1)', 'IsFloating', 3), 927720Sgblack@eecs.umich.edu 'FpDestP2': ('FloatReg', 'sf', '(dest + 2)', 'IsFloating', 3), 937720Sgblack@eecs.umich.edu 'FpDestP3': ('FloatReg', 'sf', '(dest + 3)', 'IsFloating', 3), 947720Sgblack@eecs.umich.edu 'FpDestP4': ('FloatReg', 'sf', '(dest + 4)', 'IsFloating', 3), 957720Sgblack@eecs.umich.edu 'FpDestP5': ('FloatReg', 'sf', '(dest + 5)', 'IsFloating', 3), 967720Sgblack@eecs.umich.edu 'FpDestP6': ('FloatReg', 'sf', '(dest + 6)', 'IsFloating', 3), 977720Sgblack@eecs.umich.edu 'FpDestP7': ('FloatReg', 'sf', '(dest + 7)', 'IsFloating', 3), 987720Sgblack@eecs.umich.edu 'FpDestS0P0': ('FloatReg', 'sf', '(dest + step * 0 + 0)', 'IsFloating', 3), 997720Sgblack@eecs.umich.edu 'FpDestS0P1': ('FloatReg', 'sf', '(dest + step * 0 + 1)', 'IsFloating', 3), 1007720Sgblack@eecs.umich.edu 'FpDestS1P0': ('FloatReg', 'sf', '(dest + step * 1 + 0)', 'IsFloating', 3), 1017720Sgblack@eecs.umich.edu 'FpDestS1P1': ('FloatReg', 'sf', '(dest + step * 1 + 1)', 'IsFloating', 3), 1027720Sgblack@eecs.umich.edu 'FpDestS2P0': ('FloatReg', 'sf', '(dest + step * 2 + 0)', 'IsFloating', 3), 1037720Sgblack@eecs.umich.edu 'FpDestS2P1': ('FloatReg', 'sf', '(dest + step * 2 + 1)', 'IsFloating', 3), 1047720Sgblack@eecs.umich.edu 'FpDestS3P0': ('FloatReg', 'sf', '(dest + step * 3 + 0)', 'IsFloating', 3), 1057720Sgblack@eecs.umich.edu 'FpDestS3P1': ('FloatReg', 'sf', '(dest + step * 3 + 1)', 'IsFloating', 3), 1067720Sgblack@eecs.umich.edu 'Result': ('IntReg', 'uw', 'result', 'IsInteger', 3, 1077303Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1087720Sgblack@eecs.umich.edu 'Dest2': ('IntReg', 'uw', 'dest2', 'IsInteger', 3, 1097279Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1107720Sgblack@eecs.umich.edu 'FpDest2': ('FloatReg', 'sf', '(dest2 + 0)', 'IsFloating', 3), 1117720Sgblack@eecs.umich.edu 'FpDest2P0': ('FloatReg', 'sf', '(dest2 + 0)', 'IsFloating', 3), 1127720Sgblack@eecs.umich.edu 'FpDest2P1': ('FloatReg', 'sf', '(dest2 + 1)', 'IsFloating', 3), 1137720Sgblack@eecs.umich.edu 'FpDest2P2': ('FloatReg', 'sf', '(dest2 + 2)', 'IsFloating', 3), 1147720Sgblack@eecs.umich.edu 'FpDest2P3': ('FloatReg', 'sf', '(dest2 + 3)', 'IsFloating', 3), 1157720Sgblack@eecs.umich.edu 'IWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 3, 1167148Sgblack@eecs.umich.edu maybePCRead, maybeIWPCWrite), 1177720Sgblack@eecs.umich.edu 'AIWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 3, 1187184Sgblack@eecs.umich.edu maybePCRead, maybeAIWPCWrite), 1197310Sgblack@eecs.umich.edu 'SpMode': ('IntReg', 'uw', 1207310Sgblack@eecs.umich.edu 'intRegInMode((OperatingMode)regMode, INTREG_SP)', 1217720Sgblack@eecs.umich.edu 'IsInteger', 3), 1227720Sgblack@eecs.umich.edu 'MiscDest': ('ControlReg', 'uw', 'dest', (None, None, 'IsControl'), 3), 1237720Sgblack@eecs.umich.edu 'Base': ('IntReg', 'uw', 'base', 'IsInteger', 1, 1247186Sgblack@eecs.umich.edu maybeAlignedPCRead, maybePCWrite), 1257720Sgblack@eecs.umich.edu 'Index': ('IntReg', 'uw', 'index', 'IsInteger', 3, 1267119Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1277720Sgblack@eecs.umich.edu 'Op1': ('IntReg', 'uw', 'op1', 'IsInteger', 3, 1287137Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1297720Sgblack@eecs.umich.edu 'FpOp1': ('FloatReg', 'sf', '(op1 + 0)', 'IsFloating', 3), 1307720Sgblack@eecs.umich.edu 'FpOp1P0': ('FloatReg', 'sf', '(op1 + 0)', 'IsFloating', 3), 1317720Sgblack@eecs.umich.edu 'FpOp1P1': ('FloatReg', 'sf', '(op1 + 1)', 'IsFloating', 3), 1327720Sgblack@eecs.umich.edu 'FpOp1P2': ('FloatReg', 'sf', '(op1 + 2)', 'IsFloating', 3), 1337720Sgblack@eecs.umich.edu 'FpOp1P3': ('FloatReg', 'sf', '(op1 + 3)', 'IsFloating', 3), 1347720Sgblack@eecs.umich.edu 'FpOp1P4': ('FloatReg', 'sf', '(op1 + 4)', 'IsFloating', 3), 1357720Sgblack@eecs.umich.edu 'FpOp1P5': ('FloatReg', 'sf', '(op1 + 5)', 'IsFloating', 3), 1367720Sgblack@eecs.umich.edu 'FpOp1P6': ('FloatReg', 'sf', '(op1 + 6)', 'IsFloating', 3), 1377720Sgblack@eecs.umich.edu 'FpOp1P7': ('FloatReg', 'sf', '(op1 + 7)', 'IsFloating', 3), 1387720Sgblack@eecs.umich.edu 'FpOp1S0P0': ('FloatReg', 'sf', '(op1 + step * 0 + 0)', 'IsFloating', 3), 1397720Sgblack@eecs.umich.edu 'FpOp1S0P1': ('FloatReg', 'sf', '(op1 + step * 0 + 1)', 'IsFloating', 3), 1407720Sgblack@eecs.umich.edu 'FpOp1S1P0': ('FloatReg', 'sf', '(op1 + step * 1 + 0)', 'IsFloating', 3), 1417720Sgblack@eecs.umich.edu 'FpOp1S1P1': ('FloatReg', 'sf', '(op1 + step * 1 + 1)', 'IsFloating', 3), 1427720Sgblack@eecs.umich.edu 'FpOp1S2P0': ('FloatReg', 'sf', '(op1 + step * 2 + 0)', 'IsFloating', 3), 1437720Sgblack@eecs.umich.edu 'FpOp1S2P1': ('FloatReg', 'sf', '(op1 + step * 2 + 1)', 'IsFloating', 3), 1447720Sgblack@eecs.umich.edu 'FpOp1S3P0': ('FloatReg', 'sf', '(op1 + step * 3 + 0)', 'IsFloating', 3), 1457720Sgblack@eecs.umich.edu 'FpOp1S3P1': ('FloatReg', 'sf', '(op1 + step * 3 + 1)', 'IsFloating', 3), 1467720Sgblack@eecs.umich.edu 'MiscOp1': ('ControlReg', 'uw', 'op1', (None, None, 'IsControl'), 3), 1477720Sgblack@eecs.umich.edu 'Op2': ('IntReg', 'uw', 'op2', 'IsInteger', 3, 1487137Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1497720Sgblack@eecs.umich.edu 'FpOp2': ('FloatReg', 'sf', '(op2 + 0)', 'IsFloating', 3), 1507720Sgblack@eecs.umich.edu 'FpOp2P0': ('FloatReg', 'sf', '(op2 + 0)', 'IsFloating', 3), 1517720Sgblack@eecs.umich.edu 'FpOp2P1': ('FloatReg', 'sf', '(op2 + 1)', 'IsFloating', 3), 1527720Sgblack@eecs.umich.edu 'FpOp2P2': ('FloatReg', 'sf', '(op2 + 2)', 'IsFloating', 3), 1537720Sgblack@eecs.umich.edu 'FpOp2P3': ('FloatReg', 'sf', '(op2 + 3)', 'IsFloating', 3), 1547720Sgblack@eecs.umich.edu 'Op3': ('IntReg', 'uw', 'op3', 'IsInteger', 3, 1557241Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1567720Sgblack@eecs.umich.edu 'Shift': ('IntReg', 'uw', 'shift', 'IsInteger', 3, 1577137Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1587720Sgblack@eecs.umich.edu 'Reg0': ('IntReg', 'uw', 'reg0', 'IsInteger', 3, 1597160Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1607720Sgblack@eecs.umich.edu 'Reg1': ('IntReg', 'uw', 'reg1', 'IsInteger', 3, 1617160Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1627720Sgblack@eecs.umich.edu 'Reg2': ('IntReg', 'uw', 'reg2', 'IsInteger', 3, 1637160Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1647720Sgblack@eecs.umich.edu 'Reg3': ('IntReg', 'uw', 'reg3', 'IsInteger', 3, 1657160Sgblack@eecs.umich.edu maybePCRead, maybePCWrite), 1666019Shines@cs.fsu.edu #General Purpose Integer Reg Operands 1677720Sgblack@eecs.umich.edu 'Rd': ('IntReg', 'uw', 'RD', 'IsInteger', 3, maybePCRead, maybePCWrite), 1687720Sgblack@eecs.umich.edu 'Rm': ('IntReg', 'uw', 'RM', 'IsInteger', 3, maybePCRead, maybePCWrite), 1697720Sgblack@eecs.umich.edu 'Rs': ('IntReg', 'uw', 'RS', 'IsInteger', 3, maybePCRead, maybePCWrite), 1707720Sgblack@eecs.umich.edu 'Rn': ('IntReg', 'uw', 'RN', 'IsInteger', 3, maybePCRead, maybePCWrite), 1717720Sgblack@eecs.umich.edu 'R7': ('IntReg', 'uw', '7', 'IsInteger', 3), 1727720Sgblack@eecs.umich.edu 'R0': ('IntReg', 'uw', '0', 'IsInteger', 3), 1736019Shines@cs.fsu.edu 1747720Sgblack@eecs.umich.edu 'LR': ('IntReg', 'uw', 'INTREG_LR', 'IsInteger', 3), 1757720Sgblack@eecs.umich.edu 'CondCodes': ('IntReg', 'uw', 'INTREG_CONDCODES', None, 3), 1767422Sgblack@eecs.umich.edu 'OptCondCodes': ('IntReg', 'uw', 1777422Sgblack@eecs.umich.edu '''(condCode == COND_AL || condCode == COND_UC) ? 1787720Sgblack@eecs.umich.edu INTREG_ZERO : INTREG_CONDCODES''', None, 3), 1797720Sgblack@eecs.umich.edu 'FpCondCodes': ('IntReg', 'uw', 'INTREG_FPCONDCODES', None, 3), 1806019Shines@cs.fsu.edu 1816308Sgblack@eecs.umich.edu #Register fields for microops 1827720Sgblack@eecs.umich.edu 'Ra' : ('IntReg', 'uw', 'ura', 'IsInteger', 3, maybePCRead, maybePCWrite), 1837720Sgblack@eecs.umich.edu 'IWRa' : ('IntReg', 'uw', 'ura', 'IsInteger', 3, 1847207Sgblack@eecs.umich.edu maybePCRead, maybeIWPCWrite), 1857720Sgblack@eecs.umich.edu 'Fa' : ('FloatReg', 'sf', 'ura', 'IsFloating', 3), 1867720Sgblack@eecs.umich.edu 'Rb' : ('IntReg', 'uw', 'urb', 'IsInteger', 3, maybePCRead, maybePCWrite), 1877720Sgblack@eecs.umich.edu 'Rc' : ('IntReg', 'uw', 'urc', 'IsInteger', 3, maybePCRead, maybePCWrite), 1886308Sgblack@eecs.umich.edu 1896019Shines@cs.fsu.edu #General Purpose Floating Point Reg Operands 1907720Sgblack@eecs.umich.edu 'Fd': ('FloatReg', 'df', 'FD', 'IsFloating', 3), 1917720Sgblack@eecs.umich.edu 'Fn': ('FloatReg', 'df', 'FN', 'IsFloating', 3), 1927720Sgblack@eecs.umich.edu 'Fm': ('FloatReg', 'df', 'FM', 'IsFloating', 3), 1936019Shines@cs.fsu.edu 1946019Shines@cs.fsu.edu #Memory Operand 1957720Sgblack@eecs.umich.edu 'Mem': ('Mem', 'uw', None, ('IsMemRef', 'IsLoad', 'IsStore'), 3), 1966019Shines@cs.fsu.edu 1977720Sgblack@eecs.umich.edu 'Cpsr': ('ControlReg', 'uw', 'MISCREG_CPSR', (None, None, 'IsControl'), 2), 1987720Sgblack@eecs.umich.edu 'Itstate': ('ControlReg', 'ub', 'MISCREG_ITSTATE', None, 3), 1997720Sgblack@eecs.umich.edu 'Spsr': ('ControlReg', 'uw', 'MISCREG_SPSR', None, 3), 2007720Sgblack@eecs.umich.edu 'Fpsr': ('ControlReg', 'uw', 'MISCREG_FPSR', None, 3), 2017720Sgblack@eecs.umich.edu 'Fpsid': ('ControlReg', 'uw', 'MISCREG_FPSID', None, 3), 2027720Sgblack@eecs.umich.edu 'Fpscr': ('ControlReg', 'uw', 'MISCREG_FPSCR', None, 3), 2037720Sgblack@eecs.umich.edu 'Cpacr': ('ControlReg', 'uw', 'MISCREG_CPACR', (None, None, 'IsControl'), 3), 2047720Sgblack@eecs.umich.edu 'Fpexc': ('ControlReg', 'uw', 'MISCREG_FPEXC', None, 3), 2057720Sgblack@eecs.umich.edu 'Sctlr': ('ControlReg', 'uw', 'MISCREG_SCTLR', None, 3), 2067720Sgblack@eecs.umich.edu 'SevMailbox': ('ControlReg', 'uw', 'MISCREG_SEV_MAILBOX', None, 3), 2077720Sgblack@eecs.umich.edu #PCS needs to have a sorting index (the number at the end) less than all 2087720Sgblack@eecs.umich.edu #the integer registers which might update the PC. That way if the flag 2097720Sgblack@eecs.umich.edu #bits of the pc state are updated and a branch happens through R15, the 2107720Sgblack@eecs.umich.edu #updates are layered properly and the R15 update isn't lost. 2117720Sgblack@eecs.umich.edu 'PCS': ('PCState', 'uw', None, (None, None, 'IsControl'), 0) 2126019Shines@cs.fsu.edu}}; 213