blob: a3fe8ad038ad942e4d0a2a64128c474362273791 [file] [log] [blame]
buzbeecbd6d442012-11-17 14:11:25 -08001/*
2 * Copyright (C) 2012 The Android Open Source Project
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 */
16
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_DEX_COMPILER_ENUMS_H_
18#define ART_COMPILER_DEX_COMPILER_ENUMS_H_
buzbeecbd6d442012-11-17 14:11:25 -080019
20#include "dex_instruction.h"
21
22namespace art {
23
24enum RegisterClass {
Serban Constantinescu032d3772014-05-23 17:38:18 +010025 kInvalidRegClass,
buzbeecbd6d442012-11-17 14:11:25 -080026 kCoreReg,
27 kFPReg,
buzbeea0cd2d72014-06-01 09:33:49 -070028 kRefReg,
buzbeecbd6d442012-11-17 14:11:25 -080029 kAnyReg,
30};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070031std::ostream& operator<<(std::ostream& os, const RegisterClass& rhs);
buzbeecbd6d442012-11-17 14:11:25 -080032
buzbee091cc402014-03-31 10:14:40 -070033enum BitsUsed {
34 kSize32Bits,
35 kSize64Bits,
36 kSize128Bits,
37 kSize256Bits,
38 kSize512Bits,
39 kSize1024Bits,
40};
Ian Rogersb28c1c02014-11-08 11:21:21 -080041std::ostream& operator<<(std::ostream& os, const BitsUsed& rhs);
buzbee091cc402014-03-31 10:14:40 -070042
buzbeecbd6d442012-11-17 14:11:25 -080043enum SpecialTargetRegister {
buzbee02031b12012-11-23 09:41:35 -080044 kSelf, // Thread pointer.
45 kSuspend, // Used to reduce suspend checks for some targets.
buzbeecbd6d442012-11-17 14:11:25 -080046 kLr,
47 kPc,
48 kSp,
49 kArg0,
50 kArg1,
51 kArg2,
52 kArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070053 kArg4,
54 kArg5,
buzbee33ae5582014-06-12 14:56:32 -070055 kArg6,
56 kArg7,
buzbeecbd6d442012-11-17 14:11:25 -080057 kFArg0,
58 kFArg1,
59 kFArg2,
60 kFArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070061 kFArg4,
62 kFArg5,
63 kFArg6,
64 kFArg7,
Zheng Xu5667fdb2014-10-23 18:29:55 +080065 kFArg8,
66 kFArg9,
67 kFArg10,
68 kFArg11,
69 kFArg12,
70 kFArg13,
71 kFArg14,
72 kFArg15,
buzbeecbd6d442012-11-17 14:11:25 -080073 kRet0,
74 kRet1,
75 kInvokeTgt,
Jeff Hao88474b42013-10-23 16:24:40 -070076 kHiddenArg,
77 kHiddenFpArg,
buzbeecbd6d442012-11-17 14:11:25 -080078 kCount
79};
Ian Rogersb28c1c02014-11-08 11:21:21 -080080std::ostream& operator<<(std::ostream& os, const SpecialTargetRegister& code);
buzbeecbd6d442012-11-17 14:11:25 -080081
82enum RegLocationType {
Brian Carlstrom7934ac22013-07-26 10:54:15 -070083 kLocDalvikFrame = 0, // Normal Dalvik register
buzbeecbd6d442012-11-17 14:11:25 -080084 kLocPhysReg,
85 kLocCompilerTemp,
86 kLocInvalid
87};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070088std::ostream& operator<<(std::ostream& os, const RegLocationType& rhs);
buzbeecbd6d442012-11-17 14:11:25 -080089
90enum BBType {
buzbee0d829482013-10-11 15:24:55 -070091 kNullBlock,
buzbeecbd6d442012-11-17 14:11:25 -080092 kEntryBlock,
93 kDalvikByteCode,
94 kExitBlock,
95 kExceptionHandling,
96 kDead,
97};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070098std::ostream& operator<<(std::ostream& os, const BBType& code);
buzbeecbd6d442012-11-17 14:11:25 -080099
buzbee02031b12012-11-23 09:41:35 -0800100// Shared pseudo opcodes - must be < 0.
buzbeecbd6d442012-11-17 14:11:25 -0800101enum LIRPseudoOpcode {
buzbeea169e1d2012-12-05 14:26:44 -0800102 kPseudoExportedPC = -16,
103 kPseudoSafepointPC = -15,
104 kPseudoIntrinsicRetry = -14,
105 kPseudoSuspendTarget = -13,
106 kPseudoThrowTarget = -12,
107 kPseudoCaseLabel = -11,
108 kPseudoMethodEntry = -10,
109 kPseudoMethodExit = -9,
110 kPseudoBarrier = -8,
buzbeecbd6d442012-11-17 14:11:25 -0800111 kPseudoEntryBlock = -7,
112 kPseudoExitBlock = -6,
113 kPseudoTargetLabel = -5,
114 kPseudoDalvikByteCodeBoundary = -4,
115 kPseudoPseudoAlign4 = -3,
116 kPseudoEHBlockLabel = -2,
117 kPseudoNormalBlockLabel = -1,
118};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700119std::ostream& operator<<(std::ostream& os, const LIRPseudoOpcode& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800120
121enum ExtendedMIROpcode {
122 kMirOpFirst = kNumPackedOpcodes,
123 kMirOpPhi = kMirOpFirst,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700124
125 // @brief Copy from one VR to another.
126 // @details
127 // vA: destination VR
128 // vB: source VR
buzbeecbd6d442012-11-17 14:11:25 -0800129 kMirOpCopy,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700130
131 // @brief Used to do float comparison with less-than bias.
132 // @details Unlike cmpl-float, this does not store result of comparison in VR.
133 // vA: left-hand side VR for comparison.
134 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800135 kMirOpFusedCmplFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700136
137 // @brief Used to do float comparison with greater-than bias.
138 // @details Unlike cmpg-float, this does not store result of comparison in VR.
139 // vA: left-hand side VR for comparison.
140 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800141 kMirOpFusedCmpgFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700142
143 // @brief Used to do double comparison with less-than bias.
144 // @details Unlike cmpl-double, this does not store result of comparison in VR.
145 // vA: left-hand side wide VR for comparison.
146 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800147 kMirOpFusedCmplDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700148
149 // @brief Used to do double comparison with greater-than bias.
150 // @details Unlike cmpl-double, this does not store result of comparison in VR.
151 // vA: left-hand side wide VR for comparison.
152 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800153 kMirOpFusedCmpgDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700154
155 // @brief Used to do comparison of 64-bit long integers.
156 // @details Unlike cmp-long, this does not store result of comparison in VR.
157 // vA: left-hand side wide VR for comparison.
158 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800159 kMirOpFusedCmpLong,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700160
161 // @brief This represents no-op.
buzbeecbd6d442012-11-17 14:11:25 -0800162 kMirOpNop,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700163
164 // @brief Do a null check on the object register.
165 // @details The backends may implement this implicitly or explicitly. This MIR is guaranteed
166 // to have the correct offset as an exception thrower.
167 // vA: object register
buzbeecbd6d442012-11-17 14:11:25 -0800168 kMirOpNullCheck,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700169
buzbeecbd6d442012-11-17 14:11:25 -0800170 kMirOpRangeCheck,
171 kMirOpDivZeroCheck,
172 kMirOpCheck,
buzbeea169e1d2012-12-05 14:26:44 -0800173 kMirOpCheckPart2,
buzbeef662a7c2013-02-12 16:19:43 -0800174 kMirOpSelect,
Mark Mendelld65c51a2014-04-29 16:55:20 -0400175
176 // Vector opcodes:
177 // TypeSize is an encoded field giving the element type and the vector size.
178 // It is encoded as OpSize << 16 | (number of bits in vector)
179 //
180 // Destination and source are integers that will be interpreted by the
181 // backend that supports Vector operations. Backends are permitted to support only
182 // certain vector register sizes.
183 //
184 // At this point, only two operand instructions are supported. Three operand instructions
185 // could be supported by using a bit in TypeSize and arg[0] where needed.
186
187 // @brief MIR to move constant data to a vector register
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700188 // vA: destination
189 // vB: number of bits in register
Mark Mendelld65c51a2014-04-29 16:55:20 -0400190 // args[0]~args[3]: up to 128 bits of data for initialization
191 kMirOpConstVector,
192
193 // @brief MIR to move a vectorized register to another
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700194 // vA: destination
195 // vB: source
196 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400197 kMirOpMoveVector,
198
199 // @brief Packed multiply of units in two vector registers: vB = vB .* vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700200 // vA: destination and source
201 // vB: source
202 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400203 kMirOpPackedMultiply,
204
205 // @brief Packed addition of units in two vector registers: vB = vB .+ vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700206 // vA: destination and source
207 // vB: source
208 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400209 kMirOpPackedAddition,
210
211 // @brief Packed subtraction of units in two vector registers: vB = vB .- vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700212 // vA: destination and source
213 // vB: source
214 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400215 kMirOpPackedSubtract,
216
217 // @brief Packed shift left of units in two vector registers: vB = vB .<< vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700218 // vA: destination and source
219 // vB: amount to shift
220 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400221 kMirOpPackedShiftLeft,
222
223 // @brief Packed signed shift right of units in two vector registers: vB = vB .>> vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700224 // vA: destination and source
225 // vB: amount to shift
226 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400227 kMirOpPackedSignedShiftRight,
228
229 // @brief Packed unsigned shift right of units in two vector registers: vB = vB .>>> vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700230 // vA: destination and source
231 // vB: amount to shift
232 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400233 kMirOpPackedUnsignedShiftRight,
234
235 // @brief Packed bitwise and of units in two vector registers: vB = vB .& vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700236 // vA: destination and source
237 // vB: source
238 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400239 kMirOpPackedAnd,
240
241 // @brief Packed bitwise or of units in two vector registers: vB = vB .| vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700242 // vA: destination and source
243 // vB: source
244 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400245 kMirOpPackedOr,
246
247 // @brief Packed bitwise xor of units in two vector registers: vB = vB .^ vC using vA to know the type of the vector.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700248 // vA: destination and source
249 // vB: source
250 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400251 kMirOpPackedXor,
252
253 // @brief Reduce a 128-bit packed element into a single VR by taking lower bits
254 // @details Instruction does a horizontal addition of the packed elements and then adds it to VR
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700255 // vA: destination and source VR (not vector register)
256 // vB: source (vector register)
257 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400258 kMirOpPackedAddReduce,
259
260 // @brief Extract a packed element into a single VR.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700261 // vA: destination VR (not vector register)
262 // vB: source (vector register)
263 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400264 // arg[0]: The index to use for extraction from vector register (which packed element)
265 kMirOpPackedReduce,
266
267 // @brief Create a vector value, with all TypeSize values equal to vC
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700268 // vA: destination vector register
269 // vB: source VR (not vector register)
270 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400271 kMirOpPackedSet,
272
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700273 // @brief Reserve a range of vector registers.
274 // vA: Start vector register to reserve.
275 // vB: Inclusive end vector register to reserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700276 // @note: The backend may choose to map vector numbers used in vector opcodes.
277 // Reserved registers are removed from the list of backend temporary pool.
278 kMirOpReserveVectorRegisters,
279
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700280 // @brief Free a range of reserved vector registers
281 // vA: Start vector register to unreserve.
282 // vB: Inclusive end vector register to unreserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700283 // @note: All currently reserved vector registers are returned to the temporary pool.
284 kMirOpReturnVectorRegisters,
285
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700286 // @brief Create a memory barrier.
287 // vA: a constant defined by enum MemBarrierKind.
288 kMirOpMemBarrier,
289
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700290 // @brief Used to fill a vector register with array values.
291 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
292 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
293 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
294 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
295 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
296 // vA: destination vector register
297 // vB: array register
298 // vC: index register
299 // arg[0]: TypeSize (most other vector opcodes have this in vC)
300 kMirOpPackedArrayGet,
301
302 // @brief Used to store a vector register into array.
303 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
304 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
305 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
306 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
307 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
308 // vA: source vector register
309 // vB: array register
310 // vC: index register
311 // arg[0]: TypeSize (most other vector opcodes have this in vC)
312 kMirOpPackedArrayPut,
313
buzbeecbd6d442012-11-17 14:11:25 -0800314 kMirOpLast,
315};
316
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700317enum MIROptimizationFlagPositions {
buzbeecbd6d442012-11-17 14:11:25 -0800318 kMIRIgnoreNullCheck = 0,
buzbeecbd6d442012-11-17 14:11:25 -0800319 kMIRIgnoreRangeCheck,
Vladimir Marko743b98c2014-11-24 19:45:41 +0000320 kMIRStoreNonNullValue, // Storing non-null value, always mark GC card.
Vladimir Marko66c6d7b2014-10-16 15:41:48 +0100321 kMIRClassIsInitialized,
322 kMIRClassIsInDexCache,
Razvan A Lupusoru5c5676b2014-09-29 16:42:11 -0700323 kMirIgnoreDivZeroCheck,
buzbee02031b12012-11-23 09:41:35 -0800324 kMIRInlined, // Invoke is inlined (ie dead).
325 kMIRInlinedPred, // Invoke is inlined via prediction.
326 kMIRCallee, // Instruction is inlined from callee.
buzbeecbd6d442012-11-17 14:11:25 -0800327 kMIRIgnoreSuspendCheck,
328 kMIRDup,
Yevgeny Rouban423b1372014-10-15 17:32:25 +0700329 kMIRMark, // Temporary node mark can be used by
330 // opt passes for their private needs.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700331 kMIRStoreNonTemporal,
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700332 kMIRLastMIRFlag,
buzbeecbd6d442012-11-17 14:11:25 -0800333};
334
buzbee02031b12012-11-23 09:41:35 -0800335// For successor_block_list.
buzbeecbd6d442012-11-17 14:11:25 -0800336enum BlockListType {
337 kNotUsed = 0,
338 kCatch,
339 kPackedSwitch,
340 kSparseSwitch,
341};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700342std::ostream& operator<<(std::ostream& os, const BlockListType& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800343
344enum AssemblerStatus {
345 kSuccess,
346 kRetryAll,
347};
Ian Rogersb28c1c02014-11-08 11:21:21 -0800348std::ostream& operator<<(std::ostream& os, const AssemblerStatus& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800349
350enum OpSize {
buzbee695d13a2014-04-19 13:32:20 -0700351 kWord, // Natural word size of target (32/64).
352 k32,
353 k64,
354 kReference, // Object reference; compressed on 64-bit targets.
buzbeecbd6d442012-11-17 14:11:25 -0800355 kSingle,
356 kDouble,
357 kUnsignedHalf,
358 kSignedHalf,
359 kUnsignedByte,
360 kSignedByte,
361};
buzbeecbd6d442012-11-17 14:11:25 -0800362std::ostream& operator<<(std::ostream& os, const OpSize& kind);
363
364enum OpKind {
365 kOpMov,
Razvan A Lupusorubd288c22013-12-20 17:27:23 -0800366 kOpCmov,
buzbeecbd6d442012-11-17 14:11:25 -0800367 kOpMvn,
368 kOpCmp,
369 kOpLsl,
370 kOpLsr,
371 kOpAsr,
372 kOpRor,
373 kOpNot,
374 kOpAnd,
375 kOpOr,
376 kOpXor,
377 kOpNeg,
378 kOpAdd,
379 kOpAdc,
380 kOpSub,
381 kOpSbc,
382 kOpRsub,
383 kOpMul,
384 kOpDiv,
385 kOpRem,
386 kOpBic,
387 kOpCmn,
388 kOpTst,
Vladimir Markoa8b4caf2013-10-24 15:08:57 +0100389 kOpRev,
390 kOpRevsh,
buzbeecbd6d442012-11-17 14:11:25 -0800391 kOpBkpt,
392 kOpBlx,
393 kOpPush,
394 kOpPop,
395 kOp2Char,
396 kOp2Short,
397 kOp2Byte,
398 kOpCondBr,
399 kOpUncondBr,
400 kOpBx,
401 kOpInvalid,
402};
Ian Rogersb28c1c02014-11-08 11:21:21 -0800403std::ostream& operator<<(std::ostream& os, const OpKind& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800404
Razvan A Lupusoru2c498d12014-01-29 16:02:57 -0800405enum MoveType {
406 kMov8GP, // Move 8-bit general purpose register.
407 kMov16GP, // Move 16-bit general purpose register.
408 kMov32GP, // Move 32-bit general purpose register.
409 kMov64GP, // Move 64-bit general purpose register.
410 kMov32FP, // Move 32-bit FP register.
411 kMov64FP, // Move 64-bit FP register.
412 kMovLo64FP, // Move low 32-bits of 64-bit FP register.
413 kMovHi64FP, // Move high 32-bits of 64-bit FP register.
414 kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region.
415 kMov128FP = kMovU128FP,
416 kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes.
417 kMovLo128FP, // Move low 64-bits of 128-bit FP register.
418 kMovHi128FP, // Move high 64-bits of 128-bit FP register.
419};
Ian Rogersb28c1c02014-11-08 11:21:21 -0800420std::ostream& operator<<(std::ostream& os, const MoveType& kind);
buzbeecbd6d442012-11-17 14:11:25 -0800421
422enum ConditionCode {
423 kCondEq, // equal
424 kCondNe, // not equal
Vladimir Marko58af1f92013-12-19 13:31:15 +0000425 kCondCs, // carry set
426 kCondCc, // carry clear
Vladimir Marko459f4df2013-12-20 17:03:09 +0000427 kCondUlt, // unsigned less than
428 kCondUge, // unsigned greater than or same
buzbeecbd6d442012-11-17 14:11:25 -0800429 kCondMi, // minus
430 kCondPl, // plus, positive or zero
431 kCondVs, // overflow
432 kCondVc, // no overflow
433 kCondHi, // unsigned greater than
434 kCondLs, // unsigned lower or same
435 kCondGe, // signed greater than or equal
436 kCondLt, // signed less than
437 kCondGt, // signed greater than
438 kCondLe, // signed less than or equal
439 kCondAl, // always
440 kCondNv, // never
441};
buzbeecbd6d442012-11-17 14:11:25 -0800442std::ostream& operator<<(std::ostream& os, const ConditionCode& kind);
443
444// Target specific condition encodings
445enum ArmConditionCode {
446 kArmCondEq = 0x0, // 0000
447 kArmCondNe = 0x1, // 0001
448 kArmCondCs = 0x2, // 0010
449 kArmCondCc = 0x3, // 0011
450 kArmCondMi = 0x4, // 0100
451 kArmCondPl = 0x5, // 0101
452 kArmCondVs = 0x6, // 0110
453 kArmCondVc = 0x7, // 0111
454 kArmCondHi = 0x8, // 1000
455 kArmCondLs = 0x9, // 1001
456 kArmCondGe = 0xa, // 1010
457 kArmCondLt = 0xb, // 1011
458 kArmCondGt = 0xc, // 1100
459 kArmCondLe = 0xd, // 1101
460 kArmCondAl = 0xe, // 1110
461 kArmCondNv = 0xf, // 1111
462};
buzbeecbd6d442012-11-17 14:11:25 -0800463std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind);
464
465enum X86ConditionCode {
466 kX86CondO = 0x0, // overflow
467 kX86CondNo = 0x1, // not overflow
468
469 kX86CondB = 0x2, // below
470 kX86CondNae = kX86CondB, // not-above-equal
471 kX86CondC = kX86CondB, // carry
472
473 kX86CondNb = 0x3, // not-below
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700474 kX86CondAe = kX86CondNb, // above-equal
475 kX86CondNc = kX86CondNb, // not-carry
buzbeecbd6d442012-11-17 14:11:25 -0800476
477 kX86CondZ = 0x4, // zero
478 kX86CondEq = kX86CondZ, // equal
479
480 kX86CondNz = 0x5, // not-zero
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700481 kX86CondNe = kX86CondNz, // not-equal
buzbeecbd6d442012-11-17 14:11:25 -0800482
483 kX86CondBe = 0x6, // below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700484 kX86CondNa = kX86CondBe, // not-above
buzbeecbd6d442012-11-17 14:11:25 -0800485
486 kX86CondNbe = 0x7, // not-below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700487 kX86CondA = kX86CondNbe, // above
buzbeecbd6d442012-11-17 14:11:25 -0800488
489 kX86CondS = 0x8, // sign
490 kX86CondNs = 0x9, // not-sign
491
492 kX86CondP = 0xa, // 8-bit parity even
493 kX86CondPE = kX86CondP,
494
495 kX86CondNp = 0xb, // 8-bit parity odd
496 kX86CondPo = kX86CondNp,
497
498 kX86CondL = 0xc, // less-than
499 kX86CondNge = kX86CondL, // not-greater-equal
500
501 kX86CondNl = 0xd, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700502 kX86CondGe = kX86CondNl, // not-greater-equal
buzbeecbd6d442012-11-17 14:11:25 -0800503
504 kX86CondLe = 0xe, // less-than-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700505 kX86CondNg = kX86CondLe, // not-greater
buzbeecbd6d442012-11-17 14:11:25 -0800506
507 kX86CondNle = 0xf, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700508 kX86CondG = kX86CondNle, // greater
buzbeecbd6d442012-11-17 14:11:25 -0800509};
buzbeecbd6d442012-11-17 14:11:25 -0800510std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind);
511
buzbeecbd6d442012-11-17 14:11:25 -0800512enum DividePattern {
513 DivideNone,
514 Divide3,
515 Divide5,
516 Divide7,
517};
buzbeecbd6d442012-11-17 14:11:25 -0800518std::ostream& operator<<(std::ostream& os, const DividePattern& pattern);
519
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800520/**
521 * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers").
Hans Boehm48f5c472014-06-27 14:50:10 -0700522 * @details We define the combined barrier types that are actually required
523 * by the Java Memory Model, rather than using exactly the terminology from
524 * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release
525 * primitives. Note that the JSR-133 cookbook generally does not deal with
526 * store atomicity issues, and the recipes there are not always entirely sufficient.
527 * The current recipe is as follows:
528 * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store.
529 * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.)
530 * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800531 * -# Use StoreStore barrier after all stores but before return from any constructor whose
Hans Boehm48f5c472014-06-27 14:50:10 -0700532 * class has final fields.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700533 * -# Use NTStoreStore to order non-temporal stores with respect to all later
534 * store-to-memory instructions. Only generated together with non-temporal stores.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800535 */
buzbee1bc37c62012-11-20 13:35:41 -0800536enum MemBarrierKind {
Hans Boehm48f5c472014-06-27 14:50:10 -0700537 kAnyStore,
538 kLoadAny,
buzbee1bc37c62012-11-20 13:35:41 -0800539 kStoreStore,
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700540 kAnyAny,
541 kNTStoreStore,
buzbee1bc37c62012-11-20 13:35:41 -0800542};
buzbee1bc37c62012-11-20 13:35:41 -0800543std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
544
buzbee02031b12012-11-23 09:41:35 -0800545enum OpFeatureFlags {
546 kIsBranch = 0,
547 kNoOperand,
548 kIsUnaryOp,
549 kIsBinaryOp,
550 kIsTertiaryOp,
551 kIsQuadOp,
552 kIsQuinOp,
553 kIsSextupleOp,
554 kIsIT,
Serban Constantinescu63999682014-07-15 17:44:21 +0100555 kIsMoveOp,
buzbee02031b12012-11-23 09:41:35 -0800556 kMemLoad,
557 kMemStore,
Serban Constantinescu63999682014-07-15 17:44:21 +0100558 kMemVolatile,
559 kMemScaledx0,
560 kMemScaledx2,
561 kMemScaledx4,
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700562 kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes.
buzbee02031b12012-11-23 09:41:35 -0800563 kRegDef0,
564 kRegDef1,
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800565 kRegDef2,
buzbee02031b12012-11-23 09:41:35 -0800566 kRegDefA,
567 kRegDefD,
568 kRegDefFPCSList0,
569 kRegDefFPCSList2,
570 kRegDefList0,
571 kRegDefList1,
572 kRegDefList2,
573 kRegDefLR,
574 kRegDefSP,
575 kRegUse0,
576 kRegUse1,
577 kRegUse2,
578 kRegUse3,
579 kRegUse4,
580 kRegUseA,
581 kRegUseC,
582 kRegUseD,
Vladimir Marko70b797d2013-12-03 15:25:24 +0000583 kRegUseB,
buzbee02031b12012-11-23 09:41:35 -0800584 kRegUseFPCSList0,
585 kRegUseFPCSList2,
586 kRegUseList0,
587 kRegUseList1,
588 kRegUseLR,
589 kRegUsePC,
590 kRegUseSP,
591 kSetsCCodes,
Serguei Katkove90501d2014-03-12 15:56:54 +0700592 kUsesCCodes,
buzbee9da5c102014-03-28 12:59:18 -0700593 kUseFpStack,
594 kUseHi,
595 kUseLo,
596 kDefHi,
597 kDefLo
buzbee02031b12012-11-23 09:41:35 -0800598};
Ian Rogersb28c1c02014-11-08 11:21:21 -0800599std::ostream& operator<<(std::ostream& os, const OpFeatureFlags& rhs);
buzbee02031b12012-11-23 09:41:35 -0800600
buzbeef662a7c2013-02-12 16:19:43 -0800601enum SelectInstructionKind {
602 kSelectNone,
603 kSelectConst,
604 kSelectMove,
605 kSelectGoto
606};
buzbeea5abf702013-04-12 14:39:29 -0700607std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind);
608
Mark Mendell27dee8b2014-12-01 19:06:12 -0500609// LIR fixup kinds for Arm and X86.
buzbeeb48819d2013-09-14 16:15:25 -0700610enum FixupKind {
611 kFixupNone,
Matteo Franchin65420b22014-10-27 13:29:30 +0000612 kFixupLabel, // For labels we just adjust the offset.
613 kFixupLoad, // Mostly for immediates.
614 kFixupVLoad, // FP load which *may* be pc-relative.
615 kFixupCBxZ, // Cbz, Cbnz.
616 kFixupTBxZ, // Tbz, Tbnz.
Matteo Franchin65420b22014-10-27 13:29:30 +0000617 kFixupCondBranch, // Conditional branch
618 kFixupT1Branch, // Thumb1 Unconditional branch
619 kFixupT2Branch, // Thumb2 Unconditional branch
620 kFixupBlx1, // Blx1 (start of Blx1/Blx2 pair).
621 kFixupBl1, // Bl1 (start of Bl1/Bl2 pair).
622 kFixupAdr, // Adr.
623 kFixupMovImmLST, // kThumb2MovImm16LST.
624 kFixupMovImmHST, // kThumb2MovImm16HST.
625 kFixupAlign4, // Align to 4-byte boundary.
626 kFixupA53Erratum835769, // Cortex A53 Erratum 835769.
Mark Mendell27dee8b2014-12-01 19:06:12 -0500627 kFixupSwitchTable, // X86_64 packed switch table.
buzbeeb48819d2013-09-14 16:15:25 -0700628};
buzbeeb48819d2013-09-14 16:15:25 -0700629std::ostream& operator<<(std::ostream& os, const FixupKind& kind);
630
Andreas Gampe3c12c512014-06-24 18:46:29 +0000631enum VolatileKind {
632 kNotVolatile, // Load/Store is not volatile
633 kVolatile // Load/Store is volatile
634};
Andreas Gampe3c12c512014-06-24 18:46:29 +0000635std::ostream& operator<<(std::ostream& os, const VolatileKind& kind);
636
Andreas Gampeccc60262014-07-04 18:02:38 -0700637enum WideKind {
638 kNotWide, // Non-wide view
639 kWide, // Wide view
640 kRef // Ref width
641};
Andreas Gampeccc60262014-07-04 18:02:38 -0700642std::ostream& operator<<(std::ostream& os, const WideKind& kind);
643
buzbeecbd6d442012-11-17 14:11:25 -0800644} // namespace art
645
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700646#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_