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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
//===-- llvm/Instruction.def - File that describes Instructions -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains descriptions of the various LLVM instructions. This is
// used as a central place for enumerating the different instructions and
// should eventually be the place to put comments about the instructions.
//
//===----------------------------------------------------------------------===//
// NOTE: NO INCLUDE GUARD DESIRED!
// Provide definitions of macros so that users of this file do not have to define
// everything to use it...
//
#ifndef FIRST_TERM_INST
#define FIRST_TERM_INST(num)
#endif
#ifndef HANDLE_TERM_INST
#ifndef HANDLE_INST
#define HANDLE_TERM_INST(num, opcode, Class)
#else
#define HANDLE_TERM_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
#endif
#endif
#ifndef LAST_TERM_INST
#define LAST_TERM_INST(num)
#endif
#ifndef FIRST_BINARY_INST
#define FIRST_BINARY_INST(num)
#endif
#ifndef HANDLE_BINARY_INST
#ifndef HANDLE_INST
#define HANDLE_BINARY_INST(num, opcode, instclass)
#else
#define HANDLE_BINARY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
#endif
#endif
#ifndef LAST_BINARY_INST
#define LAST_BINARY_INST(num)
#endif
#ifndef FIRST_MEMORY_INST
#define FIRST_MEMORY_INST(num)
#endif
#ifndef HANDLE_MEMORY_INST
#ifndef HANDLE_INST
#define HANDLE_MEMORY_INST(num, opcode, Class)
#else
#define HANDLE_MEMORY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
#endif
#endif
#ifndef LAST_MEMORY_INST
#define LAST_MEMORY_INST(num)
#endif
#ifndef FIRST_OTHER_INST
#define FIRST_OTHER_INST(num)
#endif
#ifndef HANDLE_OTHER_INST
#ifndef HANDLE_INST
#define HANDLE_OTHER_INST(num, opcode, Class)
#else
#define HANDLE_OTHER_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
#endif
#endif
#ifndef LAST_OTHER_INST
#define LAST_OTHER_INST(num)
#endif
// Terminator Instructions - These instructions are used to terminate a basic
// block of the program. Every basic block must end with one of these
// instructions for it to be a well formed basic block.
//
FIRST_TERM_INST ( 1)
HANDLE_TERM_INST ( 1, Ret , ReturnInst)
HANDLE_TERM_INST ( 2, Br , BranchInst)
HANDLE_TERM_INST ( 3, Switch , SwitchInst)
HANDLE_TERM_INST ( 4, Invoke , InvokeInst)
HANDLE_TERM_INST ( 5, Unwind , UnwindInst)
HANDLE_TERM_INST ( 6, Unreachable, UnreachableInst)
LAST_TERM_INST ( 6)
// Standard binary operators...
FIRST_BINARY_INST( 7)
HANDLE_BINARY_INST( 7, Add , BinaryOperator)
HANDLE_BINARY_INST( 8, Sub , BinaryOperator)
HANDLE_BINARY_INST( 9, Mul , BinaryOperator)
HANDLE_BINARY_INST(10, Div , BinaryOperator)
HANDLE_BINARY_INST(11, Rem , BinaryOperator)
// Logical operators...
HANDLE_BINARY_INST(12, And , BinaryOperator)
HANDLE_BINARY_INST(13, Or , BinaryOperator)
HANDLE_BINARY_INST(14, Xor , BinaryOperator)
// Binary comparison operators...
HANDLE_BINARY_INST(15, SetEQ , SetCondInst)
HANDLE_BINARY_INST(16, SetNE , SetCondInst)
HANDLE_BINARY_INST(17, SetLE , SetCondInst)
HANDLE_BINARY_INST(18, SetGE , SetCondInst)
HANDLE_BINARY_INST(19, SetLT , SetCondInst)
HANDLE_BINARY_INST(20, SetGT , SetCondInst)
LAST_BINARY_INST(20)
// Memory operators...
FIRST_MEMORY_INST(21)
HANDLE_MEMORY_INST(21, Malloc, MallocInst) // Heap management instructions
HANDLE_MEMORY_INST(22, Free , FreeInst )
HANDLE_MEMORY_INST(23, Alloca, AllocaInst) // Stack management
HANDLE_MEMORY_INST(24, Load , LoadInst ) // Memory manipulation instrs
HANDLE_MEMORY_INST(25, Store , StoreInst )
HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst)
LAST_MEMORY_INST(26)
// Other operators...
FIRST_OTHER_INST(27)
HANDLE_OTHER_INST(27, PHI , PHINode ) // PHI node instruction
HANDLE_OTHER_INST(28, Cast , CastInst ) // Type cast
HANDLE_OTHER_INST(29, Call , CallInst ) // Call a function
HANDLE_OTHER_INST(30, Shl , ShiftInst ) // Shift operations
HANDLE_OTHER_INST(31, Shr , ShiftInst )
// 32 -> Empty slot used to be used for vanext in llvm 1.5 and before.
// 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before.
HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction
HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass
HANDLE_OTHER_INST(36, UserOp2, Instruction)
HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction
HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst) // extract packed element
LAST_OTHER_INST(38)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
#undef LAST_TERM_INST
#undef FIRST_BINARY_INST
#undef HANDLE_BINARY_INST
#undef LAST_BINARY_INST
#undef FIRST_MEMORY_INST
#undef HANDLE_MEMORY_INST
#undef LAST_MEMORY_INST
#undef FIRST_OTHER_INST
#undef HANDLE_OTHER_INST
#undef LAST_OTHER_INST
#ifdef HANDLE_INST
#undef HANDLE_INST
#endif
|