gem5 v24.0.0.0
Loading...
Searching...
No Matches
branch64.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef __ARCH_ARM_INSTS_BRANCH64_HH__
39#define __ARCH_ARM_INSTS_BRANCH64_HH__
40
42
43namespace gem5
44{
45
46namespace ArmISA
47{
48// Branch to a target computed with an immediate
50{
51 protected:
52 int64_t imm;
53
54 public:
55 BranchImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
56 int64_t _imm) :
57 ArmStaticInst(mnem, _machInst, __opClass), imm(_imm)
58 {}
59
60 std::unique_ptr<PCStateBase> branchTarget(
61 const PCStateBase &branch_pc) const override;
62
65
66 std::string generateDisassembly(
67 Addr pc, const loader::SymbolTable *symtab) const override;
68};
69
70// Conditionally Branch to a target computed with an immediate
72{
73 protected:
75
76 public:
77 BranchImmCond64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
78 int64_t _imm, ConditionCode _condCode) :
79 BranchImm64(mnem, _machInst, __opClass, _imm), condCode(_condCode)
80 {}
81
82 std::string generateDisassembly(
83 Addr pc, const loader::SymbolTable *symtab) const override;
84};
85
86// Branch to a target computed with two registers
88{
89 protected:
92
93 public:
94 BranchRegReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
95 RegIndex _op1, RegIndex _op2) :
96 ArmStaticInst(mnem, _machInst, __opClass), op1(_op1), op2(_op2)
97 {}
98
99 std::string generateDisassembly(
100 Addr pc, const loader::SymbolTable *symtab) const override;
101};
102
103// Branch to a target computed with a register
105{
106 protected:
108
109 public:
110 BranchReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
111 RegIndex _op1) :
112 ArmStaticInst(mnem, _machInst, __opClass), op1(_op1)
113 {}
114
115 std::string generateDisassembly(
116 Addr pc, const loader::SymbolTable *symtab) const override;
117};
118
119// Ret instruction
121{
122 public:
123 BranchRet64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
124 RegIndex _op1) :
125 BranchReg64(mnem, _machInst, __opClass, _op1)
126 {}
127
128 std::string generateDisassembly(
129 Addr pc, const loader::SymbolTable *symtab) const override;
130};
131
132// RetAA/RetAB instruction
134{
135 public:
136 BranchRetA64(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
137 BranchRegReg64(mnem, _machInst, __opClass, int_reg::X30, int_reg::Spx)
138 {}
139
140 std::string generateDisassembly(
141 Addr pc, const loader::SymbolTable *symtab) const override;
142};
143
144// Eret instruction
146{
147 public:
148 BranchEret64(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
149 ArmStaticInst(mnem, _machInst, __opClass)
150 {}
151
152 std::string generateDisassembly(
153 Addr pc, const loader::SymbolTable *symtab) const override;
154};
155
156// EretA/B instruction
158{
159 protected:
161
162 public:
163 BranchEretA64(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
164 ArmStaticInst(mnem, _machInst, __opClass), op1(int_reg::Spx)
165 {}
166
167 std::string generateDisassembly(
168 Addr pc, const loader::SymbolTable *symtab) const override;
169};
170// Branch to a target computed with an immediate and a register
172{
173 protected:
174 int64_t imm;
176
177 public:
178 BranchImmReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
179 int64_t _imm, RegIndex _op1) :
180 ArmStaticInst(mnem, _machInst, __opClass), imm(_imm), op1(_op1)
181 {}
182
183 std::unique_ptr<PCStateBase> branchTarget(
184 const PCStateBase &branch_pc) const override;
185
188
189 std::string generateDisassembly(
190 Addr pc, const loader::SymbolTable *symtab) const override;
191};
192
193// Branch to a target computed with two immediates
195{
196 protected:
197 int64_t imm1;
198 int64_t imm2;
200
201 public:
202 BranchImmImmReg64(const char *mnem, ExtMachInst _machInst,
203 OpClass __opClass, int64_t _imm1, int64_t _imm2,
204 RegIndex _op1) :
205 ArmStaticInst(mnem, _machInst, __opClass),
206 imm1(_imm1), imm2(_imm2), op1(_op1)
207 {}
208
209 std::unique_ptr<PCStateBase> branchTarget(
210 const PCStateBase &branch_pc) const override;
211
214
215 std::string generateDisassembly(
216 Addr pc, const loader::SymbolTable *symtab) const override;
217};
218
219} // namespace ArmISA
220} // namespace gem5
221
222#endif //__ARCH_ARM_INSTS_BRANCH_HH__
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:141
BranchEret64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition branch64.hh:148
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:150
BranchEretA64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition branch64.hh:163
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:87
BranchImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm)
Definition branch64.hh:55
std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &branch_pc) const override
Return the target address for a PC-relative branch.
Definition branch64.cc:47
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:77
BranchImmCond64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm, ConditionCode _condCode)
Definition branch64.hh:77
std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &branch_pc) const override
Return the target address for a PC-relative branch.
Definition branch64.cc:67
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:171
BranchImmImmReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm1, int64_t _imm2, RegIndex _op1)
Definition branch64.hh:202
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:159
std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &branch_pc) const override
Return the target address for a PC-relative branch.
Definition branch64.cc:57
BranchImmReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm, RegIndex _op1)
Definition branch64.hh:178
BranchReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _op1)
Definition branch64.hh:110
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:97
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:107
BranchRegReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _op1, RegIndex _op2)
Definition branch64.hh:94
BranchRet64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _op1)
Definition branch64.hh:123
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:119
BranchRetA64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition branch64.hh:136
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition branch64.cc:130
virtual std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &pc) const
Return the target address for a PC-relative branch.
ConditionCode
Definition cc.hh:104
Bitfield< 4 > pc
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:23:56 for gem5 by doxygen 1.11.0