branch.isa revision 7848
12068SN/A// -*- mode:c++ -*- 22068SN/A 32068SN/A// Copyright (c) 2010 ARM Limited 42068SN/A// All rights reserved 52068SN/A// 62068SN/A// The license below extends only to copyright in the software and shall 72068SN/A// not be construed as granting a license to any other intellectual 82068SN/A// property including but not limited to intellectual property relating 92068SN/A// to a hardware implementation of the functionality of the software 102068SN/A// licensed hereunder. You may use the software subject to the license 112068SN/A// terms below provided that you ensure that this notice is replicated 122068SN/A// unmodified and in its entirety in all distributions of the software, 132068SN/A// modified or unmodified, in source code or in binary form. 142068SN/A// 152068SN/A// Redistribution and use in source and binary forms, with or without 162068SN/A// modification, are permitted provided that the following conditions are 172068SN/A// met: redistributions of source code must retain the above copyright 182068SN/A// notice, this list of conditions and the following disclaimer; 192068SN/A// redistributions in binary form must reproduce the above copyright 202068SN/A// notice, this list of conditions and the following disclaimer in the 212068SN/A// documentation and/or other materials provided with the distribution; 222068SN/A// neither the name of the copyright holders nor the names of its 232068SN/A// contributors may be used to endorse or promote products derived from 242068SN/A// this software without specific prior written permission. 252068SN/A// 262068SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 272068SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 282665Ssaidi@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 292665Ssaidi@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 302068SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 312649Ssaidi@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 322649Ssaidi@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 332649Ssaidi@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 342649Ssaidi@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 357799Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 367799Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 377799Sgblack@eecs.umich.edu// 382649Ssaidi@eecs.umich.edu// Authors: Gabe Black 392649Ssaidi@eecs.umich.edu 402068SN/Adef template BranchImmDeclare {{ 412068SN/Aclass %(class_name)s : public %(base_class)s 422068SN/A{ 432090SN/A public: 442090SN/A // Constructor 452132SN/A %(class_name)s(ExtMachInst machInst, int32_t _imm); 462068SN/A %(BasicExecDeclare)s 477799Sgblack@eecs.umich.edu}; 488738Sgblack@eecs.umich.edu}}; 492147SN/A 502068SN/Adef template BranchImmConstructor {{ 512068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 522068SN/A int32_t _imm) 532068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _imm) 542068SN/A { 552068SN/A %(constructor)s; 562068SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 572068SN/A for (int x = 0; x < _numDestRegs; x++) { 582068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 592068SN/A } 602068SN/A } 612068SN/A } 622068SN/A}}; 632068SN/A 642068SN/Adef template BranchImmCondDeclare {{ 652068SN/Aclass %(class_name)s : public %(base_class)s 662068SN/A{ 677799Sgblack@eecs.umich.edu public: 682068SN/A // Constructor 697799Sgblack@eecs.umich.edu %(class_name)s(ExtMachInst machInst, int32_t _imm, 707799Sgblack@eecs.umich.edu ConditionCode _condCode); 717799Sgblack@eecs.umich.edu %(BasicExecDeclare)s 722068SN/A}; 732068SN/A}}; 742068SN/A 752068SN/Adef template BranchImmCondConstructor {{ 762068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 772068SN/A int32_t _imm, 782068SN/A ConditionCode _condCode) 792068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 807799Sgblack@eecs.umich.edu _imm, _condCode) 812068SN/A { 827799Sgblack@eecs.umich.edu %(constructor)s; 837799Sgblack@eecs.umich.edu if (!(condCode == COND_AL || condCode == COND_UC)) { 842068SN/A for (int x = 0; x < _numDestRegs; x++) { 852068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 862068SN/A } 872068SN/A } 882068SN/A } 892068SN/A}}; 902068SN/A 912068SN/Adef template BranchRegDeclare {{ 922068SN/Aclass %(class_name)s : public %(base_class)s 932068SN/A{ 942068SN/A public: 952068SN/A // Constructor 962068SN/A %(class_name)s(ExtMachInst machInst, IntRegIndex _op1); 972068SN/A %(BasicExecDeclare)s 982068SN/A}; 992068SN/A}}; 1002068SN/A 1012068SN/Adef template BranchRegConstructor {{ 1022068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1032068SN/A IntRegIndex _op1) 1042068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1) 1052068SN/A { 1062068SN/A %(constructor)s; 1072068SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1082068SN/A for (int x = 0; x < _numDestRegs; x++) { 1092068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1102068SN/A } 1112068SN/A } 1122068SN/A } 1132227SN/A}}; 1142068SN/A 1152068SN/Adef template BranchRegCondDeclare {{ 1162068SN/Aclass %(class_name)s : public %(base_class)s 1172068SN/A{ 1182068SN/A public: 1192068SN/A // Constructor 1202068SN/A %(class_name)s(ExtMachInst machInst, IntRegIndex _op1, 1212068SN/A ConditionCode _condCode); 1222068SN/A %(BasicExecDeclare)s 1232068SN/A}; 1242068SN/A}}; 1252068SN/A 1262068SN/Adef template BranchRegCondConstructor {{ 1272068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1282068SN/A IntRegIndex _op1, 1292068SN/A ConditionCode _condCode) 1302068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 1312068SN/A _op1, _condCode) 1322068SN/A { 1332068SN/A %(constructor)s; 1342068SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1352068SN/A for (int x = 0; x < _numDestRegs; x++) { 1362068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1372068SN/A } 1382068SN/A } 1392068SN/A } 1402068SN/A}}; 1412068SN/A 1422068SN/Adef template BranchRegRegDeclare {{ 1432068SN/Aclass %(class_name)s : public %(base_class)s 1442068SN/A{ 1452068SN/A public: 1462068SN/A // Constructor 1472068SN/A %(class_name)s(ExtMachInst machInst, 1482068SN/A IntRegIndex _op1, IntRegIndex _op2); 1492068SN/A %(BasicExecDeclare)s 1502068SN/A}; 1512068SN/A}}; 1529918Ssteve.reinhardt@amd.com 1532068SN/Adef template BranchTableDeclare {{ 1542068SN/Aclass %(class_name)s : public %(base_class)s 1552068SN/A{ 1562068SN/A public: 1572068SN/A // Constructor 1582068SN/A %(class_name)s(ExtMachInst machInst, 1592068SN/A IntRegIndex _op1, IntRegIndex _op2); 1602068SN/A %(BasicExecDeclare)s 1612068SN/A 1622068SN/A %(InitiateAccDeclare)s 1632068SN/A 1642068SN/A %(CompleteAccDeclare)s 1652068SN/A}; 1662068SN/A}}; 1672068SN/A 1682068SN/Adef template BranchRegRegConstructor {{ 1692068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1702068SN/A IntRegIndex _op1, 1712068SN/A IntRegIndex _op2) 1722068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1, _op2) 1732068SN/A { 1742068SN/A %(constructor)s; 1752068SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 1762068SN/A for (int x = 0; x < _numDestRegs; x++) { 1772068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 1782068SN/A } 1792068SN/A } 1802068SN/A } 1812068SN/A}}; 1822068SN/A 1832068SN/Adef template BranchImmRegDeclare {{ 1842068SN/Aclass %(class_name)s : public %(base_class)s 1852068SN/A{ 1862068SN/A public: 1872068SN/A // Constructor 1887799Sgblack@eecs.umich.edu %(class_name)s(ExtMachInst machInst, 1897799Sgblack@eecs.umich.edu int32_t imm, IntRegIndex _op1); 1907799Sgblack@eecs.umich.edu %(BasicExecDeclare)s 1917799Sgblack@eecs.umich.edu}; 1922068SN/A}}; 1932068SN/A 1942068SN/Adef template BranchImmRegConstructor {{ 1952068SN/A inline %(class_name)s::%(class_name)s(ExtMachInst machInst, 1962068SN/A int32_t _imm, 1972068SN/A IntRegIndex _op1) 1982068SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _imm, _op1) 1992068SN/A { 2002068SN/A %(constructor)s; 2012068SN/A if (!(condCode == COND_AL || condCode == COND_UC)) { 2022068SN/A for (int x = 0; x < _numDestRegs; x++) { 2032068SN/A _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 2042068SN/A } 2052068SN/A } 2062132SN/A } 2072068SN/A}}; 2082068SN/A