branch.hh revision 8146
17149Sgblack@eecs.umich.edu/* 27149Sgblack@eecs.umich.edu * Copyright (c) 2010 ARM Limited 37149Sgblack@eecs.umich.edu * All rights reserved 47149Sgblack@eecs.umich.edu * 57149Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall 67149Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual 77149Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating 87149Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software 97149Sgblack@eecs.umich.edu * licensed hereunder. You may use the software subject to the license 107149Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated 117149Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software, 127149Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form. 137149Sgblack@eecs.umich.edu * 147149Sgblack@eecs.umich.edu * Copyright (c) 2007-2008 The Florida State University 156253Sgblack@eecs.umich.edu * All rights reserved. 166253Sgblack@eecs.umich.edu * 176253Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 186253Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 196253Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 206253Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 216253Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 226253Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 236253Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 246253Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 256253Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 266253Sgblack@eecs.umich.edu * this software without specific prior written permission. 276253Sgblack@eecs.umich.edu * 286253Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 296253Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 306253Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 316253Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 326253Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 336253Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 346253Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 356253Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 366253Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 376253Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 386253Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 396253Sgblack@eecs.umich.edu * 406253Sgblack@eecs.umich.edu * Authors: Stephen Hines 416253Sgblack@eecs.umich.edu */ 426253Sgblack@eecs.umich.edu#ifndef __ARCH_ARM_INSTS_BRANCH_HH__ 436253Sgblack@eecs.umich.edu#define __ARCH_ARM_INSTS_BRANCH_HH__ 446253Sgblack@eecs.umich.edu 456253Sgblack@eecs.umich.edu#include "arch/arm/insts/pred_inst.hh" 466253Sgblack@eecs.umich.edu 476253Sgblack@eecs.umich.edunamespace ArmISA 486253Sgblack@eecs.umich.edu{ 497149Sgblack@eecs.umich.edu// Branch to a target computed with an immediate 507149Sgblack@eecs.umich.educlass BranchImm : public PredOp 517149Sgblack@eecs.umich.edu{ 527149Sgblack@eecs.umich.edu protected: 537149Sgblack@eecs.umich.edu int32_t imm; 547149Sgblack@eecs.umich.edu 557149Sgblack@eecs.umich.edu public: 567149Sgblack@eecs.umich.edu BranchImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 577149Sgblack@eecs.umich.edu int32_t _imm) : 587149Sgblack@eecs.umich.edu PredOp(mnem, _machInst, __opClass), imm(_imm) 597149Sgblack@eecs.umich.edu {} 608146SAli.Saidi@ARM.com 617149Sgblack@eecs.umich.edu}; 627149Sgblack@eecs.umich.edu 637149Sgblack@eecs.umich.edu// Conditionally Branch to a target computed with an immediate 647149Sgblack@eecs.umich.educlass BranchImmCond : public BranchImm 657149Sgblack@eecs.umich.edu{ 667149Sgblack@eecs.umich.edu protected: 677149Sgblack@eecs.umich.edu // This will mask the condition code stored for PredOp. Ideally these two 687149Sgblack@eecs.umich.edu // class would cooperate, but they're not set up to do that at the moment. 697149Sgblack@eecs.umich.edu ConditionCode condCode; 707149Sgblack@eecs.umich.edu 717149Sgblack@eecs.umich.edu public: 727149Sgblack@eecs.umich.edu BranchImmCond(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 737149Sgblack@eecs.umich.edu int32_t _imm, ConditionCode _condCode) : 747149Sgblack@eecs.umich.edu BranchImm(mnem, _machInst, __opClass, _imm), condCode(_condCode) 757149Sgblack@eecs.umich.edu {} 767149Sgblack@eecs.umich.edu}; 777149Sgblack@eecs.umich.edu 787149Sgblack@eecs.umich.edu// Branch to a target computed with a register 797149Sgblack@eecs.umich.educlass BranchReg : public PredOp 807149Sgblack@eecs.umich.edu{ 817149Sgblack@eecs.umich.edu protected: 827149Sgblack@eecs.umich.edu IntRegIndex op1; 837149Sgblack@eecs.umich.edu 847149Sgblack@eecs.umich.edu public: 857149Sgblack@eecs.umich.edu BranchReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 867149Sgblack@eecs.umich.edu IntRegIndex _op1) : 877149Sgblack@eecs.umich.edu PredOp(mnem, _machInst, __opClass), op1(_op1) 887149Sgblack@eecs.umich.edu {} 897149Sgblack@eecs.umich.edu}; 907149Sgblack@eecs.umich.edu 917149Sgblack@eecs.umich.edu// Conditionally Branch to a target computed with a register 927149Sgblack@eecs.umich.educlass BranchRegCond : public BranchReg 937149Sgblack@eecs.umich.edu{ 947149Sgblack@eecs.umich.edu protected: 957149Sgblack@eecs.umich.edu // This will mask the condition code stored for PredOp. Ideally these two 967149Sgblack@eecs.umich.edu // class would cooperate, but they're not set up to do that at the moment. 977149Sgblack@eecs.umich.edu ConditionCode condCode; 987149Sgblack@eecs.umich.edu 997149Sgblack@eecs.umich.edu public: 1007149Sgblack@eecs.umich.edu BranchRegCond(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 1017149Sgblack@eecs.umich.edu IntRegIndex _op1, ConditionCode _condCode) : 1027149Sgblack@eecs.umich.edu BranchReg(mnem, _machInst, __opClass, _op1), condCode(_condCode) 1037149Sgblack@eecs.umich.edu {} 1047149Sgblack@eecs.umich.edu}; 1057149Sgblack@eecs.umich.edu 1067149Sgblack@eecs.umich.edu// Branch to a target computed with two registers 1077149Sgblack@eecs.umich.educlass BranchRegReg : public PredOp 1087149Sgblack@eecs.umich.edu{ 1097149Sgblack@eecs.umich.edu protected: 1107149Sgblack@eecs.umich.edu IntRegIndex op1; 1117149Sgblack@eecs.umich.edu IntRegIndex op2; 1127149Sgblack@eecs.umich.edu 1137149Sgblack@eecs.umich.edu public: 1147149Sgblack@eecs.umich.edu BranchRegReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 1157149Sgblack@eecs.umich.edu IntRegIndex _op1, IntRegIndex _op2) : 1167149Sgblack@eecs.umich.edu PredOp(mnem, _machInst, __opClass), op1(_op1), op2(_op2) 1177149Sgblack@eecs.umich.edu {} 1187149Sgblack@eecs.umich.edu}; 1197149Sgblack@eecs.umich.edu 1207149Sgblack@eecs.umich.edu// Branch to a target computed with an immediate and a register 1217149Sgblack@eecs.umich.educlass BranchImmReg : public PredOp 1227149Sgblack@eecs.umich.edu{ 1237149Sgblack@eecs.umich.edu protected: 1247149Sgblack@eecs.umich.edu int32_t imm; 1257149Sgblack@eecs.umich.edu IntRegIndex op1; 1267149Sgblack@eecs.umich.edu 1277149Sgblack@eecs.umich.edu public: 1287149Sgblack@eecs.umich.edu BranchImmReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass, 1297149Sgblack@eecs.umich.edu int32_t _imm, IntRegIndex _op1) : 1307149Sgblack@eecs.umich.edu PredOp(mnem, _machInst, __opClass), imm(_imm), op1(_op1) 1317149Sgblack@eecs.umich.edu {} 1327149Sgblack@eecs.umich.edu}; 1337149Sgblack@eecs.umich.edu 1346253Sgblack@eecs.umich.edu} 1356253Sgblack@eecs.umich.edu 1366253Sgblack@eecs.umich.edu#endif //__ARCH_ARM_INSTS_BRANCH_HH__ 137