blob: 0b769991b3c09492965176745d398d98c8122837 [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};
31
buzbee091cc402014-03-31 10:14:40 -070032enum BitsUsed {
33 kSize32Bits,
34 kSize64Bits,
35 kSize128Bits,
36 kSize256Bits,
37 kSize512Bits,
38 kSize1024Bits,
39};
40
buzbeecbd6d442012-11-17 14:11:25 -080041enum SpecialTargetRegister {
buzbee02031b12012-11-23 09:41:35 -080042 kSelf, // Thread pointer.
43 kSuspend, // Used to reduce suspend checks for some targets.
buzbeecbd6d442012-11-17 14:11:25 -080044 kLr,
45 kPc,
46 kSp,
47 kArg0,
48 kArg1,
49 kArg2,
50 kArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070051 kArg4,
52 kArg5,
buzbee33ae5582014-06-12 14:56:32 -070053 kArg6,
54 kArg7,
buzbeecbd6d442012-11-17 14:11:25 -080055 kFArg0,
56 kFArg1,
57 kFArg2,
58 kFArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070059 kFArg4,
60 kFArg5,
61 kFArg6,
62 kFArg7,
Zheng Xu5667fdb2014-10-23 18:29:55 +080063 kFArg8,
64 kFArg9,
65 kFArg10,
66 kFArg11,
67 kFArg12,
68 kFArg13,
69 kFArg14,
70 kFArg15,
buzbeecbd6d442012-11-17 14:11:25 -080071 kRet0,
72 kRet1,
73 kInvokeTgt,
Jeff Hao88474b42013-10-23 16:24:40 -070074 kHiddenArg,
75 kHiddenFpArg,
buzbeecbd6d442012-11-17 14:11:25 -080076 kCount
77};
78
79enum RegLocationType {
Brian Carlstrom7934ac22013-07-26 10:54:15 -070080 kLocDalvikFrame = 0, // Normal Dalvik register
buzbeecbd6d442012-11-17 14:11:25 -080081 kLocPhysReg,
82 kLocCompilerTemp,
83 kLocInvalid
84};
85
86enum BBType {
buzbee0d829482013-10-11 15:24:55 -070087 kNullBlock,
buzbeecbd6d442012-11-17 14:11:25 -080088 kEntryBlock,
89 kDalvikByteCode,
90 kExitBlock,
91 kExceptionHandling,
92 kDead,
93};
94
buzbee02031b12012-11-23 09:41:35 -080095// Shared pseudo opcodes - must be < 0.
buzbeecbd6d442012-11-17 14:11:25 -080096enum LIRPseudoOpcode {
buzbeea169e1d2012-12-05 14:26:44 -080097 kPseudoExportedPC = -16,
98 kPseudoSafepointPC = -15,
99 kPseudoIntrinsicRetry = -14,
100 kPseudoSuspendTarget = -13,
101 kPseudoThrowTarget = -12,
102 kPseudoCaseLabel = -11,
103 kPseudoMethodEntry = -10,
104 kPseudoMethodExit = -9,
105 kPseudoBarrier = -8,
buzbeecbd6d442012-11-17 14:11:25 -0800106 kPseudoEntryBlock = -7,
107 kPseudoExitBlock = -6,
108 kPseudoTargetLabel = -5,
109 kPseudoDalvikByteCodeBoundary = -4,
110 kPseudoPseudoAlign4 = -3,
111 kPseudoEHBlockLabel = -2,
112 kPseudoNormalBlockLabel = -1,
113};
114
115enum ExtendedMIROpcode {
116 kMirOpFirst = kNumPackedOpcodes,
117 kMirOpPhi = kMirOpFirst,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700118
119 // @brief Copy from one VR to another.
120 // @details
121 // vA: destination VR
122 // vB: source VR
buzbeecbd6d442012-11-17 14:11:25 -0800123 kMirOpCopy,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700124
125 // @brief Used to do float comparison with less-than bias.
126 // @details Unlike cmpl-float, this does not store result of comparison in VR.
127 // vA: left-hand side VR for comparison.
128 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800129 kMirOpFusedCmplFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700130
131 // @brief Used to do float comparison with greater-than bias.
132 // @details Unlike cmpg-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 kMirOpFusedCmpgFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700136
137 // @brief Used to do double comparison with less-than bias.
138 // @details Unlike cmpl-double, this does not store result of comparison in VR.
139 // vA: left-hand side wide VR for comparison.
140 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800141 kMirOpFusedCmplDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700142
143 // @brief Used to do double comparison with greater-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 kMirOpFusedCmpgDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700148
149 // @brief Used to do comparison of 64-bit long integers.
150 // @details Unlike cmp-long, 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 kMirOpFusedCmpLong,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700154
155 // @brief This represents no-op.
buzbeecbd6d442012-11-17 14:11:25 -0800156 kMirOpNop,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700157
158 // @brief Do a null check on the object register.
159 // @details The backends may implement this implicitly or explicitly. This MIR is guaranteed
160 // to have the correct offset as an exception thrower.
161 // vA: object register
buzbeecbd6d442012-11-17 14:11:25 -0800162 kMirOpNullCheck,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700163
buzbeecbd6d442012-11-17 14:11:25 -0800164 kMirOpRangeCheck,
165 kMirOpDivZeroCheck,
166 kMirOpCheck,
buzbeea169e1d2012-12-05 14:26:44 -0800167 kMirOpCheckPart2,
buzbeef662a7c2013-02-12 16:19:43 -0800168 kMirOpSelect,
Mark Mendelld65c51a2014-04-29 16:55:20 -0400169
170 // Vector opcodes:
171 // TypeSize is an encoded field giving the element type and the vector size.
172 // It is encoded as OpSize << 16 | (number of bits in vector)
173 //
174 // Destination and source are integers that will be interpreted by the
175 // backend that supports Vector operations. Backends are permitted to support only
176 // certain vector register sizes.
177 //
178 // At this point, only two operand instructions are supported. Three operand instructions
179 // could be supported by using a bit in TypeSize and arg[0] where needed.
180
181 // @brief MIR to move constant data to a vector register
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700182 // vA: destination
183 // vB: number of bits in register
Mark Mendelld65c51a2014-04-29 16:55:20 -0400184 // args[0]~args[3]: up to 128 bits of data for initialization
185 kMirOpConstVector,
186
187 // @brief MIR to move a vectorized register to another
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700188 // vA: destination
189 // vB: source
190 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400191 kMirOpMoveVector,
192
193 // @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 -0700194 // vA: destination and source
195 // vB: source
196 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400197 kMirOpPackedMultiply,
198
199 // @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 -0700200 // vA: destination and source
201 // vB: source
202 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400203 kMirOpPackedAddition,
204
205 // @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 -0700206 // vA: destination and source
207 // vB: source
208 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400209 kMirOpPackedSubtract,
210
211 // @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 -0700212 // vA: destination and source
213 // vB: amount to shift
214 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400215 kMirOpPackedShiftLeft,
216
217 // @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 -0700218 // vA: destination and source
219 // vB: amount to shift
220 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400221 kMirOpPackedSignedShiftRight,
222
223 // @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 -0700224 // vA: destination and source
225 // vB: amount to shift
226 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400227 kMirOpPackedUnsignedShiftRight,
228
229 // @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 -0700230 // vA: destination and source
231 // vB: source
232 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400233 kMirOpPackedAnd,
234
235 // @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 -0700236 // vA: destination and source
237 // vB: source
238 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400239 kMirOpPackedOr,
240
241 // @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 -0700242 // vA: destination and source
243 // vB: source
244 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400245 kMirOpPackedXor,
246
247 // @brief Reduce a 128-bit packed element into a single VR by taking lower bits
248 // @details Instruction does a horizontal addition of the packed elements and then adds it to VR
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700249 // vA: destination and source VR (not vector register)
250 // vB: source (vector register)
251 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400252 kMirOpPackedAddReduce,
253
254 // @brief Extract a packed element into a single VR.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700255 // vA: destination VR (not vector register)
256 // vB: source (vector register)
257 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400258 // arg[0]: The index to use for extraction from vector register (which packed element)
259 kMirOpPackedReduce,
260
261 // @brief Create a vector value, with all TypeSize values equal to vC
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700262 // vA: destination vector register
263 // vB: source VR (not vector register)
264 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400265 kMirOpPackedSet,
266
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700267 // @brief Reserve a range of vector registers.
268 // vA: Start vector register to reserve.
269 // vB: Inclusive end vector register to reserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700270 // @note: The backend may choose to map vector numbers used in vector opcodes.
271 // Reserved registers are removed from the list of backend temporary pool.
272 kMirOpReserveVectorRegisters,
273
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700274 // @brief Free a range of reserved vector registers
275 // vA: Start vector register to unreserve.
276 // vB: Inclusive end vector register to unreserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700277 // @note: All currently reserved vector registers are returned to the temporary pool.
278 kMirOpReturnVectorRegisters,
279
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700280 // @brief Create a memory barrier.
281 // vA: a constant defined by enum MemBarrierKind.
282 kMirOpMemBarrier,
283
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700284 // @brief Used to fill a vector register with array values.
285 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
286 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
287 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
288 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
289 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
290 // vA: destination vector register
291 // vB: array register
292 // vC: index register
293 // arg[0]: TypeSize (most other vector opcodes have this in vC)
294 kMirOpPackedArrayGet,
295
296 // @brief Used to store a vector register into array.
297 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
298 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
299 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
300 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
301 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
302 // vA: source vector register
303 // vB: array register
304 // vC: index register
305 // arg[0]: TypeSize (most other vector opcodes have this in vC)
306 kMirOpPackedArrayPut,
307
buzbeecbd6d442012-11-17 14:11:25 -0800308 kMirOpLast,
309};
310
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700311enum MIROptimizationFlagPositions {
buzbeecbd6d442012-11-17 14:11:25 -0800312 kMIRIgnoreNullCheck = 0,
313 kMIRNullCheckOnly,
314 kMIRIgnoreRangeCheck,
315 kMIRRangeCheckOnly,
Vladimir Marko66c6d7b2014-10-16 15:41:48 +0100316 kMIRClassIsInitialized,
317 kMIRClassIsInDexCache,
Razvan A Lupusoru5c5676b2014-09-29 16:42:11 -0700318 kMirIgnoreDivZeroCheck,
buzbee02031b12012-11-23 09:41:35 -0800319 kMIRInlined, // Invoke is inlined (ie dead).
320 kMIRInlinedPred, // Invoke is inlined via prediction.
321 kMIRCallee, // Instruction is inlined from callee.
buzbeecbd6d442012-11-17 14:11:25 -0800322 kMIRIgnoreSuspendCheck,
323 kMIRDup,
Yevgeny Rouban423b1372014-10-15 17:32:25 +0700324 kMIRMark, // Temporary node mark can be used by
325 // opt passes for their private needs.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700326 kMIRStoreNonTemporal,
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700327 kMIRLastMIRFlag,
buzbeecbd6d442012-11-17 14:11:25 -0800328};
329
buzbee02031b12012-11-23 09:41:35 -0800330// For successor_block_list.
buzbeecbd6d442012-11-17 14:11:25 -0800331enum BlockListType {
332 kNotUsed = 0,
333 kCatch,
334 kPackedSwitch,
335 kSparseSwitch,
336};
337
338enum AssemblerStatus {
339 kSuccess,
340 kRetryAll,
341};
342
343enum OpSize {
buzbee695d13a2014-04-19 13:32:20 -0700344 kWord, // Natural word size of target (32/64).
345 k32,
346 k64,
347 kReference, // Object reference; compressed on 64-bit targets.
buzbeecbd6d442012-11-17 14:11:25 -0800348 kSingle,
349 kDouble,
350 kUnsignedHalf,
351 kSignedHalf,
352 kUnsignedByte,
353 kSignedByte,
354};
355
356std::ostream& operator<<(std::ostream& os, const OpSize& kind);
357
358enum OpKind {
359 kOpMov,
Razvan A Lupusorubd288c22013-12-20 17:27:23 -0800360 kOpCmov,
buzbeecbd6d442012-11-17 14:11:25 -0800361 kOpMvn,
362 kOpCmp,
363 kOpLsl,
364 kOpLsr,
365 kOpAsr,
366 kOpRor,
367 kOpNot,
368 kOpAnd,
369 kOpOr,
370 kOpXor,
371 kOpNeg,
372 kOpAdd,
373 kOpAdc,
374 kOpSub,
375 kOpSbc,
376 kOpRsub,
377 kOpMul,
378 kOpDiv,
379 kOpRem,
380 kOpBic,
381 kOpCmn,
382 kOpTst,
Vladimir Markoa8b4caf2013-10-24 15:08:57 +0100383 kOpRev,
384 kOpRevsh,
buzbeecbd6d442012-11-17 14:11:25 -0800385 kOpBkpt,
386 kOpBlx,
387 kOpPush,
388 kOpPop,
389 kOp2Char,
390 kOp2Short,
391 kOp2Byte,
392 kOpCondBr,
393 kOpUncondBr,
394 kOpBx,
395 kOpInvalid,
396};
397
Razvan A Lupusoru2c498d12014-01-29 16:02:57 -0800398enum MoveType {
399 kMov8GP, // Move 8-bit general purpose register.
400 kMov16GP, // Move 16-bit general purpose register.
401 kMov32GP, // Move 32-bit general purpose register.
402 kMov64GP, // Move 64-bit general purpose register.
403 kMov32FP, // Move 32-bit FP register.
404 kMov64FP, // Move 64-bit FP register.
405 kMovLo64FP, // Move low 32-bits of 64-bit FP register.
406 kMovHi64FP, // Move high 32-bits of 64-bit FP register.
407 kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region.
408 kMov128FP = kMovU128FP,
409 kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes.
410 kMovLo128FP, // Move low 64-bits of 128-bit FP register.
411 kMovHi128FP, // Move high 64-bits of 128-bit FP register.
412};
413
buzbeecbd6d442012-11-17 14:11:25 -0800414std::ostream& operator<<(std::ostream& os, const OpKind& kind);
415
416enum ConditionCode {
417 kCondEq, // equal
418 kCondNe, // not equal
Vladimir Marko58af1f92013-12-19 13:31:15 +0000419 kCondCs, // carry set
420 kCondCc, // carry clear
Vladimir Marko459f4df2013-12-20 17:03:09 +0000421 kCondUlt, // unsigned less than
422 kCondUge, // unsigned greater than or same
buzbeecbd6d442012-11-17 14:11:25 -0800423 kCondMi, // minus
424 kCondPl, // plus, positive or zero
425 kCondVs, // overflow
426 kCondVc, // no overflow
427 kCondHi, // unsigned greater than
428 kCondLs, // unsigned lower or same
429 kCondGe, // signed greater than or equal
430 kCondLt, // signed less than
431 kCondGt, // signed greater than
432 kCondLe, // signed less than or equal
433 kCondAl, // always
434 kCondNv, // never
435};
436
437std::ostream& operator<<(std::ostream& os, const ConditionCode& kind);
438
439// Target specific condition encodings
440enum ArmConditionCode {
441 kArmCondEq = 0x0, // 0000
442 kArmCondNe = 0x1, // 0001
443 kArmCondCs = 0x2, // 0010
444 kArmCondCc = 0x3, // 0011
445 kArmCondMi = 0x4, // 0100
446 kArmCondPl = 0x5, // 0101
447 kArmCondVs = 0x6, // 0110
448 kArmCondVc = 0x7, // 0111
449 kArmCondHi = 0x8, // 1000
450 kArmCondLs = 0x9, // 1001
451 kArmCondGe = 0xa, // 1010
452 kArmCondLt = 0xb, // 1011
453 kArmCondGt = 0xc, // 1100
454 kArmCondLe = 0xd, // 1101
455 kArmCondAl = 0xe, // 1110
456 kArmCondNv = 0xf, // 1111
457};
458
459std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind);
460
461enum X86ConditionCode {
462 kX86CondO = 0x0, // overflow
463 kX86CondNo = 0x1, // not overflow
464
465 kX86CondB = 0x2, // below
466 kX86CondNae = kX86CondB, // not-above-equal
467 kX86CondC = kX86CondB, // carry
468
469 kX86CondNb = 0x3, // not-below
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700470 kX86CondAe = kX86CondNb, // above-equal
471 kX86CondNc = kX86CondNb, // not-carry
buzbeecbd6d442012-11-17 14:11:25 -0800472
473 kX86CondZ = 0x4, // zero
474 kX86CondEq = kX86CondZ, // equal
475
476 kX86CondNz = 0x5, // not-zero
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700477 kX86CondNe = kX86CondNz, // not-equal
buzbeecbd6d442012-11-17 14:11:25 -0800478
479 kX86CondBe = 0x6, // below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700480 kX86CondNa = kX86CondBe, // not-above
buzbeecbd6d442012-11-17 14:11:25 -0800481
482 kX86CondNbe = 0x7, // not-below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700483 kX86CondA = kX86CondNbe, // above
buzbeecbd6d442012-11-17 14:11:25 -0800484
485 kX86CondS = 0x8, // sign
486 kX86CondNs = 0x9, // not-sign
487
488 kX86CondP = 0xa, // 8-bit parity even
489 kX86CondPE = kX86CondP,
490
491 kX86CondNp = 0xb, // 8-bit parity odd
492 kX86CondPo = kX86CondNp,
493
494 kX86CondL = 0xc, // less-than
495 kX86CondNge = kX86CondL, // not-greater-equal
496
497 kX86CondNl = 0xd, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700498 kX86CondGe = kX86CondNl, // not-greater-equal
buzbeecbd6d442012-11-17 14:11:25 -0800499
500 kX86CondLe = 0xe, // less-than-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700501 kX86CondNg = kX86CondLe, // not-greater
buzbeecbd6d442012-11-17 14:11:25 -0800502
503 kX86CondNle = 0xf, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700504 kX86CondG = kX86CondNle, // greater
buzbeecbd6d442012-11-17 14:11:25 -0800505};
506
507std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind);
508
buzbeecbd6d442012-11-17 14:11:25 -0800509enum DividePattern {
510 DivideNone,
511 Divide3,
512 Divide5,
513 Divide7,
514};
515
516std::ostream& operator<<(std::ostream& os, const DividePattern& pattern);
517
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800518/**
519 * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers").
Hans Boehm48f5c472014-06-27 14:50:10 -0700520 * @details We define the combined barrier types that are actually required
521 * by the Java Memory Model, rather than using exactly the terminology from
522 * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release
523 * primitives. Note that the JSR-133 cookbook generally does not deal with
524 * store atomicity issues, and the recipes there are not always entirely sufficient.
525 * The current recipe is as follows:
526 * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store.
527 * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.)
528 * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800529 * -# Use StoreStore barrier after all stores but before return from any constructor whose
Hans Boehm48f5c472014-06-27 14:50:10 -0700530 * class has final fields.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700531 * -# Use NTStoreStore to order non-temporal stores with respect to all later
532 * store-to-memory instructions. Only generated together with non-temporal stores.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800533 */
buzbee1bc37c62012-11-20 13:35:41 -0800534enum MemBarrierKind {
Hans Boehm48f5c472014-06-27 14:50:10 -0700535 kAnyStore,
536 kLoadAny,
buzbee1bc37c62012-11-20 13:35:41 -0800537 kStoreStore,
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700538 kAnyAny,
539 kNTStoreStore,
buzbee1bc37c62012-11-20 13:35:41 -0800540};
541
542std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
543
buzbee02031b12012-11-23 09:41:35 -0800544enum OpFeatureFlags {
545 kIsBranch = 0,
546 kNoOperand,
547 kIsUnaryOp,
548 kIsBinaryOp,
549 kIsTertiaryOp,
550 kIsQuadOp,
551 kIsQuinOp,
552 kIsSextupleOp,
553 kIsIT,
Serban Constantinescu63999682014-07-15 17:44:21 +0100554 kIsMoveOp,
buzbee02031b12012-11-23 09:41:35 -0800555 kMemLoad,
556 kMemStore,
Serban Constantinescu63999682014-07-15 17:44:21 +0100557 kMemVolatile,
558 kMemScaledx0,
559 kMemScaledx2,
560 kMemScaledx4,
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700561 kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes.
buzbee02031b12012-11-23 09:41:35 -0800562 kRegDef0,
563 kRegDef1,
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800564 kRegDef2,
buzbee02031b12012-11-23 09:41:35 -0800565 kRegDefA,
566 kRegDefD,
567 kRegDefFPCSList0,
568 kRegDefFPCSList2,
569 kRegDefList0,
570 kRegDefList1,
571 kRegDefList2,
572 kRegDefLR,
573 kRegDefSP,
574 kRegUse0,
575 kRegUse1,
576 kRegUse2,
577 kRegUse3,
578 kRegUse4,
579 kRegUseA,
580 kRegUseC,
581 kRegUseD,
Vladimir Marko70b797d2013-12-03 15:25:24 +0000582 kRegUseB,
buzbee02031b12012-11-23 09:41:35 -0800583 kRegUseFPCSList0,
584 kRegUseFPCSList2,
585 kRegUseList0,
586 kRegUseList1,
587 kRegUseLR,
588 kRegUsePC,
589 kRegUseSP,
590 kSetsCCodes,
Serguei Katkove90501d2014-03-12 15:56:54 +0700591 kUsesCCodes,
buzbee9da5c102014-03-28 12:59:18 -0700592 kUseFpStack,
593 kUseHi,
594 kUseLo,
595 kDefHi,
596 kDefLo
buzbee02031b12012-11-23 09:41:35 -0800597};
598
buzbeef662a7c2013-02-12 16:19:43 -0800599enum SelectInstructionKind {
600 kSelectNone,
601 kSelectConst,
602 kSelectMove,
603 kSelectGoto
604};
605
buzbeea5abf702013-04-12 14:39:29 -0700606std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind);
607
buzbeeb48819d2013-09-14 16:15:25 -0700608// LIR fixup kinds for Arm
609enum FixupKind {
610 kFixupNone,
611 kFixupLabel, // For labels we just adjust the offset.
Vladimir Marko306f0172014-01-07 18:21:20 +0000612 kFixupLoad, // Mostly for immediates.
buzbeeb48819d2013-09-14 16:15:25 -0700613 kFixupVLoad, // FP load which *may* be pc-relative.
614 kFixupCBxZ, // Cbz, Cbnz.
Zheng Xu5d7cdec2014-08-18 17:28:22 +0800615 kFixupTBxZ, // Tbz, Tbnz.
buzbeeb48819d2013-09-14 16:15:25 -0700616 kFixupPushPop, // Not really pc relative, but changes size based on args.
617 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};
627
628std::ostream& operator<<(std::ostream& os, const FixupKind& kind);
629
Andreas Gampe3c12c512014-06-24 18:46:29 +0000630enum VolatileKind {
631 kNotVolatile, // Load/Store is not volatile
632 kVolatile // Load/Store is volatile
633};
634
635std::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};
642
643std::ostream& operator<<(std::ostream& os, const WideKind& kind);
644
buzbeecbd6d442012-11-17 14:11:25 -0800645} // namespace art
646
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700647#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_