/
InstructionCategories.C
125 lines (120 loc) · 3.6 KB
/
InstructionCategories.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* See the dyninst/COPYRIGHT file for copyright information.
*
* We provide the Paradyn Tools (below described as "Paradyn")
* on an AS IS basis, and do not warrant its validity or performance.
* We reserve the right to update, modify, or discontinue this
* software at any time. We shall have no obligation to supply such
* updates or modifications or any other form of support to you.
*
* By your use of Paradyn, you understand and agree that we (or any
* other person or entity with proprietary rights in Paradyn) are
* under no obligation to provide either maintenance services,
* update services, notices of latent defects, or correction of
* defects for Paradyn.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "InstructionCategories.h"
#include "entryIDs.h"
namespace Dyninst
{
namespace InstructionAPI
{
InsnCategory entryToCategory(entryID e)
{
switch(e)
{
case e_ret_near:
case e_ret_far:
case aarch64_op_ret:
return c_ReturnInsn;
case amdgpu_gfx908_op_S_ENDPGM: // special treatment for endpgm
case amdgpu_gfx90a_op_S_ENDPGM: // special treatment for endpgm
case amdgpu_gfx940_op_S_ENDPGM: // special treatment for endpgm
return c_GPUKernelExitInsn;
case e_call:
case aarch64_op_bl:
case aarch64_op_blr:
return c_CallInsn;
case e_jmp:
case e_jb:
case e_jb_jnaej_j:
case e_jbe:
case e_jcxz_jec:
case e_jl:
case e_jle:
case e_jnb:
case e_jnb_jae_j:
case e_jnbe:
case e_jnl:
case e_jnle:
case e_jno:
case e_jnp:
case e_jns:
case e_jnz:
case e_jo:
case e_jp:
case e_js:
case e_jz:
case e_loop:
case e_loope:
case e_loopne:
case aarch64_op_b_uncond:
case aarch64_op_b_cond:
case aarch64_op_tbz:
case aarch64_op_tbnz:
case aarch64_op_cbz:
case aarch64_op_cbnz:
case aarch64_op_br:
#include "amdgpu_branchinsn_table.h"
return c_BranchInsn;
case e_cmp:
case e_cmppd:
case e_cmpps:
case e_cmpsb:
case e_cmpsd:
case e_cmpss:
case e_cmpsw:
case e_cmpxchg:
case e_cmpxchg8b:
case power_op_cmp:
case power_op_cmpi:
case power_op_cmpl:
case power_op_cmpli:
return c_CompareInsn;
case e_prefetch:
case e_prefetchnta:
case e_prefetchT0:
case e_prefetchT1:
case e_prefetchT2:
case e_prefetch_w:
case e_prefetchw:
return c_PrefetchInsn;
case power_op_b:
case power_op_bc:
case power_op_bcctr:
case power_op_bclr:
return c_BranchInsn;
case e_sysenter:
return c_SysEnterInsn;
case e_syscall:
return c_SyscallInsn;
default:
return c_NoCategory;
}
}
}
}