operands.isa revision 6312:94b1a249422e
16019SN/A// -*- mode:c++ -*-
26019SN/A
37134Sgblack@eecs.umich.edu// Copyright (c) 2007-2008 The Florida State University
47134Sgblack@eecs.umich.edu// All rights reserved.
57134Sgblack@eecs.umich.edu//
67134Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
77134Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
87134Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
97134Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
107134Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
117134Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
127134Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
137134Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
147134Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
156019SN/A// this software without specific prior written permission.
166019SN/A//
176019SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186019SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196019SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206019SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216019SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226019SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236019SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246019SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256019SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266019SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276019SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286019SN/A//
296019SN/A// Authors: Stephen Hines
306019SN/A
316019SN/Adef operand_types {{
326019SN/A    'sb' : ('signed int', 8),
336019SN/A    'ub' : ('unsigned int', 8),
346019SN/A    'sh' : ('signed int', 16),
356019SN/A    'uh' : ('unsigned int', 16),
366019SN/A    'sw' : ('signed int', 32),
376019SN/A    'uw' : ('unsigned int', 32),
386019SN/A    'ud' : ('unsigned int', 64),
396019SN/A    'sf' : ('float', 32),
406019SN/A    'df' : ('float', 64)
416019SN/A}};
426308SN/A
436308SN/Alet {{
446309SN/A    maybePCRead = '''
456309SN/A        ((%(reg_idx)s == PCReg) ? (xc->readPC() + 8) :
466309SN/A         xc->%(func)s(this, %(op_idx)s))
476309SN/A    '''
486309SN/A    maybePCWrite = '''
497134Sgblack@eecs.umich.edu        ((%(reg_idx)s == PCReg) ? xc->setNextPC(%(final_val)s) :
507296Sgblack@eecs.umich.edu         xc->%(func)s(this, %(op_idx)s, %(final_val)s))
516309SN/A    '''
526309SN/A}};
537296Sgblack@eecs.umich.edu
548139SMatt.Horsnell@arm.comdef operands {{
556309SN/A    #General Purpose Integer Reg Operands
566309SN/A    'Rd': ('IntReg', 'uw', 'RD', 'IsInteger', 1, maybePCRead, maybePCWrite),
576309SN/A    'Rm': ('IntReg', 'uw', 'RM', 'IsInteger', 2, maybePCRead, maybePCWrite),
587342Sgblack@eecs.umich.edu    'Rs': ('IntReg', 'uw', 'RS', 'IsInteger', 3, maybePCRead, maybePCWrite),
597174Sgblack@eecs.umich.edu    'Rn': ('IntReg', 'uw', 'RN', 'IsInteger', 4, maybePCRead, maybePCWrite),
607639Sgblack@eecs.umich.edu
617639Sgblack@eecs.umich.edu    #Destination register for load/store double instructions
627644Sali.saidi@arm.com    'Rdo': ('IntReg', 'uw', '(RD & ~1)', 'IsInteger', 4, maybePCRead, maybePCWrite),
638139SMatt.Horsnell@arm.com    'Rde': ('IntReg', 'uw', '(RD | 1)', 'IsInteger', 5, maybePCRead, maybePCWrite),
647639Sgblack@eecs.umich.edu
657639Sgblack@eecs.umich.edu    'Raddr': ('IntReg', 'uw', '17', 'IsInteger', 6),
667639Sgblack@eecs.umich.edu    'Rhi': ('IntReg', 'uw', '18', 'IsInteger', 7),
677639Sgblack@eecs.umich.edu    'Rlo': ('IntReg', 'uw', '19', 'IsInteger', 8),
687639Sgblack@eecs.umich.edu    'LR': ('IntReg', 'uw', '14', 'IsInteger', 9),
697639Sgblack@eecs.umich.edu
707639Sgblack@eecs.umich.edu    #Register fields for microops
717644Sali.saidi@arm.com    'Ra' : ('IntReg', 'uw', 'ura', 'IsInteger', 11, maybePCRead, maybePCWrite),
728139SMatt.Horsnell@arm.com    'Rb' : ('IntReg', 'uw', 'urb', 'IsInteger', 12, maybePCRead, maybePCWrite),
737639Sgblack@eecs.umich.edu
747639Sgblack@eecs.umich.edu    #General Purpose Floating Point Reg Operands
757639Sgblack@eecs.umich.edu    'Fd': ('FloatReg', 'df', 'FD', 'IsFloating', 20),
767639Sgblack@eecs.umich.edu    'Fn': ('FloatReg', 'df', 'FN', 'IsFloating', 21),
777639Sgblack@eecs.umich.edu    'Fm': ('FloatReg', 'df', 'FM', 'IsFloating', 22),
787639Sgblack@eecs.umich.edu
797639Sgblack@eecs.umich.edu    #Memory Operand
807639Sgblack@eecs.umich.edu    'Mem': ('Mem', 'uw', None, ('IsMemRef', 'IsLoad', 'IsStore'), 30),
817639Sgblack@eecs.umich.edu
827644Sali.saidi@arm.com    'Cpsr': ('ControlReg', 'uw', 'MISCREG_CPSR', 'IsInteger', 40),
838139SMatt.Horsnell@arm.com    'Fpsr': ('ControlReg', 'uw', 'MISCREG_FPSR', 'IsInteger', 41),
847639Sgblack@eecs.umich.edu    'NPC': ('NPC', 'uw', None, (None, None, 'IsControl'), 42),
857639Sgblack@eecs.umich.edu    'NNPC': ('NNPC', 'uw', None, (None, None, 'IsControl'), 43),
867639Sgblack@eecs.umich.edu
877639Sgblack@eecs.umich.edu}};
887174Sgblack@eecs.umich.edu