Line data Source code
1 : //===-- llvm/Instruction.def - File that describes Instructions -*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 : //
10 : // This file contains descriptions of the various LLVM instructions. This is
11 : // used as a central place for enumerating the different instructions and
12 : // should eventually be the place to put comments about the instructions.
13 : //
14 : //===----------------------------------------------------------------------===//
15 :
16 : // NOTE: NO INCLUDE GUARD DESIRED!
17 :
18 : // Provide definitions of macros so that users of this file do not have to
19 : // define everything to use it...
20 : //
21 : #ifndef FIRST_TERM_INST
22 : #define FIRST_TERM_INST(num)
23 : #endif
24 : #ifndef HANDLE_TERM_INST
25 : #ifndef HANDLE_INST
26 : #define HANDLE_TERM_INST(num, opcode, Class)
27 : #else
28 : #define HANDLE_TERM_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
29 : #endif
30 : #endif
31 : #ifndef LAST_TERM_INST
32 : #define LAST_TERM_INST(num)
33 : #endif
34 :
35 : #ifndef FIRST_BINARY_INST
36 : #define FIRST_BINARY_INST(num)
37 : #endif
38 : #ifndef HANDLE_BINARY_INST
39 : #ifndef HANDLE_INST
40 : #define HANDLE_BINARY_INST(num, opcode, instclass)
41 : #else
42 : #define HANDLE_BINARY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
43 : #endif
44 : #endif
45 : #ifndef LAST_BINARY_INST
46 : #define LAST_BINARY_INST(num)
47 : #endif
48 :
49 : #ifndef FIRST_MEMORY_INST
50 : #define FIRST_MEMORY_INST(num)
51 : #endif
52 : #ifndef HANDLE_MEMORY_INST
53 : #ifndef HANDLE_INST
54 : #define HANDLE_MEMORY_INST(num, opcode, Class)
55 : #else
56 : #define HANDLE_MEMORY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
57 : #endif
58 : #endif
59 : #ifndef LAST_MEMORY_INST
60 : #define LAST_MEMORY_INST(num)
61 : #endif
62 :
63 : #ifndef FIRST_CAST_INST
64 : #define FIRST_CAST_INST(num)
65 : #endif
66 : #ifndef HANDLE_CAST_INST
67 : #ifndef HANDLE_INST
68 : #define HANDLE_CAST_INST(num, opcode, Class)
69 : #else
70 : #define HANDLE_CAST_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
71 : #endif
72 : #endif
73 : #ifndef LAST_CAST_INST
74 : #define LAST_CAST_INST(num)
75 : #endif
76 :
77 : #ifndef FIRST_FUNCLETPAD_INST
78 : #define FIRST_FUNCLETPAD_INST(num)
79 : #endif
80 : #ifndef HANDLE_FUNCLETPAD_INST
81 : #ifndef HANDLE_INST
82 : #define HANDLE_FUNCLETPAD_INST(num, opcode, Class)
83 : #else
84 : #define HANDLE_FUNCLETPAD_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
85 : #endif
86 : #endif
87 : #ifndef LAST_FUNCLETPAD_INST
88 : #define LAST_FUNCLETPAD_INST(num)
89 : #endif
90 :
91 : #ifndef FIRST_OTHER_INST
92 : #define FIRST_OTHER_INST(num)
93 : #endif
94 : #ifndef HANDLE_OTHER_INST
95 : #ifndef HANDLE_INST
96 : #define HANDLE_OTHER_INST(num, opcode, Class)
97 : #else
98 : #define HANDLE_OTHER_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
99 : #endif
100 : #endif
101 : #ifndef LAST_OTHER_INST
102 : #define LAST_OTHER_INST(num)
103 : #endif
104 :
105 : #ifndef HANDLE_USER_INST
106 : #define HANDLE_USER_INST(num, opc, Class) HANDLE_OTHER_INST(num, opc, Class)
107 : #endif
108 :
109 : // Terminator Instructions - These instructions are used to terminate a basic
110 : // block of the program. Every basic block must end with one of these
111 : // instructions for it to be a well formed basic block.
112 : //
113 : FIRST_TERM_INST ( 1)
114 5398049 : HANDLE_TERM_INST ( 1, Ret , ReturnInst)
115 73466432 : HANDLE_TERM_INST ( 2, Br , BranchInst)
116 862006 : HANDLE_TERM_INST ( 3, Switch , SwitchInst)
117 14537 : HANDLE_TERM_INST ( 4, IndirectBr , IndirectBrInst)
118 22505753 : HANDLE_TERM_INST ( 5, Invoke , InvokeInst)
119 99309 : HANDLE_TERM_INST ( 6, Resume , ResumeInst)
120 495994 : HANDLE_TERM_INST ( 7, Unreachable , UnreachableInst)
121 1177 : HANDLE_TERM_INST ( 8, CleanupRet , CleanupReturnInst)
122 13322 : HANDLE_TERM_INST ( 9, CatchRet , CatchReturnInst)
123 10263 : HANDLE_TERM_INST (10, CatchSwitch , CatchSwitchInst)
124 : LAST_TERM_INST (10)
125 :
126 : // Standard binary operators...
127 : FIRST_BINARY_INST(11)
128 11557213 : HANDLE_BINARY_INST(11, Add , BinaryOperator)
129 107694 : HANDLE_BINARY_INST(12, FAdd , BinaryOperator)
130 452334 : HANDLE_BINARY_INST(13, Sub , BinaryOperator)
131 58720 : HANDLE_BINARY_INST(14, FSub , BinaryOperator)
132 160336 : HANDLE_BINARY_INST(15, Mul , BinaryOperator)
133 78992 : HANDLE_BINARY_INST(16, FMul , BinaryOperator)
134 40173 : HANDLE_BINARY_INST(17, UDiv , BinaryOperator)
135 134382 : HANDLE_BINARY_INST(18, SDiv , BinaryOperator)
136 29526 : HANDLE_BINARY_INST(19, FDiv , BinaryOperator)
137 48553 : HANDLE_BINARY_INST(20, URem , BinaryOperator)
138 14619 : HANDLE_BINARY_INST(21, SRem , BinaryOperator)
139 1584 : HANDLE_BINARY_INST(22, FRem , BinaryOperator)
140 :
141 : // Logical operators (integer operands)
142 145869 : HANDLE_BINARY_INST(23, Shl , BinaryOperator) // Shift left (logical)
143 118269 : HANDLE_BINARY_INST(24, LShr , BinaryOperator) // Shift right (logical)
144 100376 : HANDLE_BINARY_INST(25, AShr , BinaryOperator) // Shift right (arithmetic)
145 452431 : HANDLE_BINARY_INST(26, And , BinaryOperator)
146 161619 : HANDLE_BINARY_INST(27, Or , BinaryOperator)
147 170304 : HANDLE_BINARY_INST(28, Xor , BinaryOperator)
148 : LAST_BINARY_INST(28)
149 :
150 : // Memory operators...
151 : FIRST_MEMORY_INST(29)
152 19346343 : HANDLE_MEMORY_INST(29, Alloca, AllocaInst) // Stack management
153 29447634 : HANDLE_MEMORY_INST(30, Load , LoadInst ) // Memory manipulation instrs
154 28622785 : HANDLE_MEMORY_INST(31, Store , StoreInst )
155 11333638 : HANDLE_MEMORY_INST(32, GetElementPtr, GetElementPtrInst)
156 3657 : HANDLE_MEMORY_INST(33, Fence , FenceInst )
157 21456 : HANDLE_MEMORY_INST(34, AtomicCmpXchg , AtomicCmpXchgInst )
158 51941 : HANDLE_MEMORY_INST(35, AtomicRMW , AtomicRMWInst )
159 : LAST_MEMORY_INST(35)
160 :
161 : // Cast operators ...
162 : // NOTE: The order matters here because CastInst::isEliminableCastPair
163 : // NOTE: (see Instructions.cpp) encodes a table based on this ordering.
164 : FIRST_CAST_INST(36)
165 4923594 : HANDLE_CAST_INST(36, Trunc , TruncInst ) // Truncate integers
166 444536 : HANDLE_CAST_INST(37, ZExt , ZExtInst ) // Zero extend integers
167 213868 : HANDLE_CAST_INST(38, SExt , SExtInst ) // Sign extend integers
168 15639 : HANDLE_CAST_INST(39, FPToUI , FPToUIInst ) // floating point -> UInt
169 16008 : HANDLE_CAST_INST(40, FPToSI , FPToSIInst ) // floating point -> SInt
170 31919 : HANDLE_CAST_INST(41, UIToFP , UIToFPInst ) // UInt -> floating point
171 30510 : HANDLE_CAST_INST(42, SIToFP , SIToFPInst ) // SInt -> floating point
172 9788 : HANDLE_CAST_INST(43, FPTrunc , FPTruncInst ) // Truncate floating point
173 22116 : HANDLE_CAST_INST(44, FPExt , FPExtInst ) // Extend floating point
174 347301 : HANDLE_CAST_INST(45, PtrToInt, PtrToIntInst) // Pointer -> Integer
175 110032 : HANDLE_CAST_INST(46, IntToPtr, IntToPtrInst) // Integer -> Pointer
176 9451974 : HANDLE_CAST_INST(47, BitCast , BitCastInst ) // Type cast
177 4882 : HANDLE_CAST_INST(48, AddrSpaceCast, AddrSpaceCastInst) // addrspace cast
178 : LAST_CAST_INST(48)
179 :
180 : FIRST_FUNCLETPAD_INST(49)
181 1632 : HANDLE_FUNCLETPAD_INST(49, CleanupPad, CleanupPadInst)
182 1473 : HANDLE_FUNCLETPAD_INST(50, CatchPad , CatchPadInst)
183 : LAST_FUNCLETPAD_INST(50)
184 :
185 : // Other operators...
186 : FIRST_OTHER_INST(51)
187 2128183 : HANDLE_OTHER_INST(51, ICmp , ICmpInst ) // Integer comparison instruction
188 72936 : HANDLE_OTHER_INST(52, FCmp , FCmpInst ) // Floating point comparison instr.
189 2718864 : HANDLE_OTHER_INST(53, PHI , PHINode ) // PHI node instruction
190 10855964 : HANDLE_OTHER_INST(54, Call , CallInst ) // Call a function
191 247178 : HANDLE_OTHER_INST(55, Select , SelectInst ) // select instruction
192 0 : HANDLE_USER_INST (56, UserOp1, Instruction) // May be used internally in a pass
193 0 : HANDLE_USER_INST (57, UserOp2, Instruction) // Internal to passes only
194 447 : HANDLE_OTHER_INST(58, VAArg , VAArgInst ) // vaarg instruction
195 249282 : HANDLE_OTHER_INST(59, ExtractElement, ExtractElementInst)// extract from vector
196 216183 : HANDLE_OTHER_INST(60, InsertElement, InsertElementInst) // insert into vector
197 267025 : HANDLE_OTHER_INST(61, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
198 1496690 : HANDLE_OTHER_INST(62, ExtractValue, ExtractValueInst)// extract from aggregate
199 281669 : HANDLE_OTHER_INST(63, InsertValue, InsertValueInst) // insert into aggregate
200 1149683 : HANDLE_OTHER_INST(64, LandingPad, LandingPadInst) // Landing pad instruction.
201 : LAST_OTHER_INST(64)
202 :
203 : #undef FIRST_TERM_INST
204 : #undef HANDLE_TERM_INST
205 : #undef LAST_TERM_INST
206 :
207 : #undef FIRST_BINARY_INST
208 : #undef HANDLE_BINARY_INST
209 : #undef LAST_BINARY_INST
210 :
211 : #undef FIRST_MEMORY_INST
212 : #undef HANDLE_MEMORY_INST
213 : #undef LAST_MEMORY_INST
214 :
215 : #undef FIRST_CAST_INST
216 : #undef HANDLE_CAST_INST
217 : #undef LAST_CAST_INST
218 :
219 : #undef FIRST_FUNCLETPAD_INST
220 : #undef HANDLE_FUNCLETPAD_INST
221 : #undef LAST_FUNCLETPAD_INST
222 :
223 : #undef FIRST_OTHER_INST
224 : #undef HANDLE_OTHER_INST
225 : #undef LAST_OTHER_INST
226 :
227 : #undef HANDLE_USER_INST
228 :
229 : #ifdef HANDLE_INST
230 : #undef HANDLE_INST
231 : #endif
|