branch.hh revision 8909
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  public:
677149Sgblack@eecs.umich.edu    BranchImmCond(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
687149Sgblack@eecs.umich.edu                  int32_t _imm, ConditionCode _condCode) :
698909SAli.Saidi@ARM.com        BranchImm(mnem, _machInst, __opClass, _imm)
708909SAli.Saidi@ARM.com    {
718909SAli.Saidi@ARM.com        // Only update if this isn't part of an IT block
728909SAli.Saidi@ARM.com        if (!machInst.itstateMask)
738909SAli.Saidi@ARM.com            condCode = _condCode;
748909SAli.Saidi@ARM.com    }
757149Sgblack@eecs.umich.edu};
767149Sgblack@eecs.umich.edu
777149Sgblack@eecs.umich.edu// Branch to a target computed with a register
787149Sgblack@eecs.umich.educlass BranchReg : public PredOp
797149Sgblack@eecs.umich.edu{
807149Sgblack@eecs.umich.edu  protected:
817149Sgblack@eecs.umich.edu    IntRegIndex op1;
827149Sgblack@eecs.umich.edu
837149Sgblack@eecs.umich.edu  public:
847149Sgblack@eecs.umich.edu    BranchReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
857149Sgblack@eecs.umich.edu              IntRegIndex _op1) :
867149Sgblack@eecs.umich.edu        PredOp(mnem, _machInst, __opClass), op1(_op1)
877149Sgblack@eecs.umich.edu    {}
887149Sgblack@eecs.umich.edu};
897149Sgblack@eecs.umich.edu
907149Sgblack@eecs.umich.edu// Conditionally Branch to a target computed with a register
917149Sgblack@eecs.umich.educlass BranchRegCond : public BranchReg
927149Sgblack@eecs.umich.edu{
937149Sgblack@eecs.umich.edu  public:
947149Sgblack@eecs.umich.edu    BranchRegCond(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
957149Sgblack@eecs.umich.edu                  IntRegIndex _op1, ConditionCode _condCode) :
968909SAli.Saidi@ARM.com        BranchReg(mnem, _machInst, __opClass, _op1)
978909SAli.Saidi@ARM.com    {
988909SAli.Saidi@ARM.com        // Only update if this isn't part of an IT block
998909SAli.Saidi@ARM.com        if (!machInst.itstateMask)
1008909SAli.Saidi@ARM.com            condCode = _condCode;
1018909SAli.Saidi@ARM.com    }
1027149Sgblack@eecs.umich.edu};
1037149Sgblack@eecs.umich.edu
1047149Sgblack@eecs.umich.edu// Branch to a target computed with two registers
1057149Sgblack@eecs.umich.educlass BranchRegReg : public PredOp
1067149Sgblack@eecs.umich.edu{
1077149Sgblack@eecs.umich.edu  protected:
1087149Sgblack@eecs.umich.edu    IntRegIndex op1;
1097149Sgblack@eecs.umich.edu    IntRegIndex op2;
1107149Sgblack@eecs.umich.edu
1117149Sgblack@eecs.umich.edu  public:
1127149Sgblack@eecs.umich.edu    BranchRegReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
1137149Sgblack@eecs.umich.edu                 IntRegIndex _op1, IntRegIndex _op2) :
1147149Sgblack@eecs.umich.edu        PredOp(mnem, _machInst, __opClass), op1(_op1), op2(_op2)
1157149Sgblack@eecs.umich.edu    {}
1167149Sgblack@eecs.umich.edu};
1177149Sgblack@eecs.umich.edu
1187149Sgblack@eecs.umich.edu// Branch to a target computed with an immediate and a register
1197149Sgblack@eecs.umich.educlass BranchImmReg : public PredOp
1207149Sgblack@eecs.umich.edu{
1217149Sgblack@eecs.umich.edu  protected:
1227149Sgblack@eecs.umich.edu    int32_t imm;
1237149Sgblack@eecs.umich.edu    IntRegIndex op1;
1247149Sgblack@eecs.umich.edu
1257149Sgblack@eecs.umich.edu  public:
1267149Sgblack@eecs.umich.edu    BranchImmReg(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
1277149Sgblack@eecs.umich.edu                 int32_t _imm, IntRegIndex _op1) :
1287149Sgblack@eecs.umich.edu        PredOp(mnem, _machInst, __opClass), imm(_imm), op1(_op1)
1297149Sgblack@eecs.umich.edu    {}
1307149Sgblack@eecs.umich.edu};
1317149Sgblack@eecs.umich.edu
1326253Sgblack@eecs.umich.edu}
1336253Sgblack@eecs.umich.edu
1346253Sgblack@eecs.umich.edu#endif //__ARCH_ARM_INSTS_BRANCH_HH__
135