My Project
opcodes.hh
Go to the documentation of this file.
1 /* ###
2  * IP: GHIDRA
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
18 
19 #ifndef __CPUI_OPCODES__
20 #define __CPUI_OPCODES__
21 
22 #include <string>
23 
24 using namespace std;
25 
35 enum OpCode {
36  CPUI_COPY = 1,
37  CPUI_LOAD = 2,
38  CPUI_STORE = 3,
39 
43 
44  CPUI_CALL = 7,
47  CPUI_RETURN = 10,
48 
49  // Integer/bit operations
50 
56  // This also indicates a borrow on unsigned substraction
60  CPUI_INT_ADD = 19,
61  CPUI_INT_SUB = 20,
67  CPUI_INT_XOR = 26,
68  CPUI_INT_AND = 27,
69  CPUI_INT_OR = 28,
74  CPUI_INT_DIV = 33,
76  CPUI_INT_REM = 35,
78 
82  CPUI_BOOL_OR = 40,
83 
84  // Floating point operations
85 
90  // Slot 45 is currently unused
92 
100 
107 
108  // Internal opcodes for simplification. Not
109  // typically generated in a direct translation.
110 
111  // Data-flow operations
114  CPUI_PIECE = 62,
116 
117  CPUI_CAST = 64,
118  CPUI_PTRADD = 65,
119  CPUI_PTRSUB = 66,
122  CPUI_NEW = 69,
123  CPUI_INSERT = 70,
126 
127  CPUI_MAX = 73
128 };
129 
130 extern const char *get_opname(OpCode opc);
131 extern OpCode get_opcode(const string &nm);
132 
133 extern OpCode get_booleanflip(OpCode opc,bool &reorder);
134 
135 #endif
Concatenate.
Definition: opcodes.hh:114
Convert between different floating-point sizes.
Definition: opcodes.hh:102
Convert an integer to a floating-point.
Definition: opcodes.hh:101
Load from a pointer into a specified address space.
Definition: opcodes.hh:37
Floating-point absolute value (abs)
Definition: opcodes.hh:98
Floating-point comparison, equality (==)
Definition: opcodes.hh:86
Test for signed borrow.
Definition: opcodes.hh:64
Integer comparison, in-equality (!=)
Definition: opcodes.hh:52
Boolean or (||)
Definition: opcodes.hh:82
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
Boolean exclusive-or (^^)
Definition: opcodes.hh:80
Boolean and (&&)
Definition: opcodes.hh:81
Zero extension.
Definition: opcodes.hh:58
Integer division, signed (/)
Definition: opcodes.hh:75
Logical/bitwise exclusive-or (^)
Definition: opcodes.hh:67
Floating-point comparison, less-than (<)
Definition: opcodes.hh:88
Integer comparison, signed less-than-or-equal (<=)
Definition: opcodes.hh:54
Copy with an indirect effect.
Definition: opcodes.hh:113
Phi-node operator.
Definition: opcodes.hh:112
Sign extension.
Definition: opcodes.hh:59
Round towards nearest.
Definition: opcodes.hh:106
Conditional branch.
Definition: opcodes.hh:41
Floating-point comparison, less-than-or-equal (<=)
Definition: opcodes.hh:89
Call to an absolute address.
Definition: opcodes.hh:44
Return from subroutine.
Definition: opcodes.hh:47
Round towards +infinity.
Definition: opcodes.hh:104
Test for signed carry.
Definition: opcodes.hh:63
OpCode get_opcode(const string &nm)
Convert a name string to the matching OpCode.
Definition: opcodes.cc:66
Test for unsigned carry.
Definition: opcodes.hh:62
Extract a bit-range.
Definition: opcodes.hh:124
Drill down to a sub-field (->)
Definition: opcodes.hh:119
Copy one operand to another.
Definition: opcodes.hh:36
const char * get_opname(OpCode opc)
Convert an OpCode to the name as a string.
Definition: opcodes.cc:58
Call through an indirect address.
Definition: opcodes.hh:45
Count the 1-bits.
Definition: opcodes.hh:125
Floating-point negation (-)
Definition: opcodes.hh:97
Round towards -infinity.
Definition: opcodes.hh:105
Integer comparison, unsigned less-than (<)
Definition: opcodes.hh:55
Not-a-number test (NaN)
Definition: opcodes.hh:91
Integer comparison, signed less-than (<)
Definition: opcodes.hh:53
Boolean negate (!)
Definition: opcodes.hh:79
Floating-point comparison, in-equality (!=)
Definition: opcodes.hh:87
User-defined operation.
Definition: opcodes.hh:46
Truncate.
Definition: opcodes.hh:115
Right shift, logical (>>)
Definition: opcodes.hh:71
Round towards zero.
Definition: opcodes.hh:103
Indirect branch (jumptable)
Definition: opcodes.hh:42
Look-up a segmented address.
Definition: opcodes.hh:120
Cast from one data-type to another.
Definition: opcodes.hh:117
Floating-point subtraction (-)
Definition: opcodes.hh:96
Allocate a new object (new)
Definition: opcodes.hh:122
Recover a value from the constant pool.
Definition: opcodes.hh:121
Index into an array ([])
Definition: opcodes.hh:118
Store at a pointer into a specified address space.
Definition: opcodes.hh:38
Insert a bit-range.
Definition: opcodes.hh:123
Integer comparison, unsigned less-than-or-equal (<=)
Definition: opcodes.hh:57
Integer division, unsigned (/)
Definition: opcodes.hh:74
Addition, signed or unsigned (+)
Definition: opcodes.hh:60
Floating-point addition (+)
Definition: opcodes.hh:93
Logical/bitwise negation (~)
Definition: opcodes.hh:66
Remainder/modulo, signed (%)
Definition: opcodes.hh:77
Subtraction, signed or unsigned (-)
Definition: opcodes.hh:61
Right shift, arithmetic (>>)
Definition: opcodes.hh:72
Integer comparison, equality (==)
Definition: opcodes.hh:51
OpCode get_booleanflip(OpCode opc, bool &reorder)
Get the complementary OpCode.
Definition: opcodes.cc:92
Floating-point division (/)
Definition: opcodes.hh:94
Remainder/modulo, unsigned (%)
Definition: opcodes.hh:76
Twos complement.
Definition: opcodes.hh:65
Floating-point multiplication (*)
Definition: opcodes.hh:95
Integer multiplication, signed and unsigned (*)
Definition: opcodes.hh:73
Logical/bitwise or (|)
Definition: opcodes.hh:69
Logical/bitwise and (&)
Definition: opcodes.hh:68
Floating-point square root (sqrt)
Definition: opcodes.hh:99
Value indicating the end of the op-code values.
Definition: opcodes.hh:127
Always branch.
Definition: opcodes.hh:40
Left shift (<<)
Definition: opcodes.hh:70