blob: c6c5ca7d4fd27836d3a4e9aca85dfb4d30764d9c [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,
buzbeecbd6d442012-11-17 14:11:25 -080063 kRet0,
64 kRet1,
65 kInvokeTgt,
Jeff Hao88474b42013-10-23 16:24:40 -070066 kHiddenArg,
67 kHiddenFpArg,
buzbeecbd6d442012-11-17 14:11:25 -080068 kCount
69};
70
71enum RegLocationType {
Brian Carlstrom7934ac22013-07-26 10:54:15 -070072 kLocDalvikFrame = 0, // Normal Dalvik register
buzbeecbd6d442012-11-17 14:11:25 -080073 kLocPhysReg,
74 kLocCompilerTemp,
75 kLocInvalid
76};
77
78enum BBType {
buzbee0d829482013-10-11 15:24:55 -070079 kNullBlock,
buzbeecbd6d442012-11-17 14:11:25 -080080 kEntryBlock,
81 kDalvikByteCode,
82 kExitBlock,
83 kExceptionHandling,
84 kDead,
85};
86
buzbee02031b12012-11-23 09:41:35 -080087// Shared pseudo opcodes - must be < 0.
buzbeecbd6d442012-11-17 14:11:25 -080088enum LIRPseudoOpcode {
buzbeea169e1d2012-12-05 14:26:44 -080089 kPseudoExportedPC = -16,
90 kPseudoSafepointPC = -15,
91 kPseudoIntrinsicRetry = -14,
92 kPseudoSuspendTarget = -13,
93 kPseudoThrowTarget = -12,
94 kPseudoCaseLabel = -11,
95 kPseudoMethodEntry = -10,
96 kPseudoMethodExit = -9,
97 kPseudoBarrier = -8,
buzbeecbd6d442012-11-17 14:11:25 -080098 kPseudoEntryBlock = -7,
99 kPseudoExitBlock = -6,
100 kPseudoTargetLabel = -5,
101 kPseudoDalvikByteCodeBoundary = -4,
102 kPseudoPseudoAlign4 = -3,
103 kPseudoEHBlockLabel = -2,
104 kPseudoNormalBlockLabel = -1,
105};
106
107enum ExtendedMIROpcode {
108 kMirOpFirst = kNumPackedOpcodes,
109 kMirOpPhi = kMirOpFirst,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700110
111 // @brief Copy from one VR to another.
112 // @details
113 // vA: destination VR
114 // vB: source VR
buzbeecbd6d442012-11-17 14:11:25 -0800115 kMirOpCopy,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700116
117 // @brief Used to do float comparison with less-than bias.
118 // @details Unlike cmpl-float, this does not store result of comparison in VR.
119 // vA: left-hand side VR for comparison.
120 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800121 kMirOpFusedCmplFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700122
123 // @brief Used to do float comparison with greater-than bias.
124 // @details Unlike cmpg-float, this does not store result of comparison in VR.
125 // vA: left-hand side VR for comparison.
126 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800127 kMirOpFusedCmpgFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700128
129 // @brief Used to do double comparison with less-than bias.
130 // @details Unlike cmpl-double, this does not store result of comparison in VR.
131 // vA: left-hand side wide VR for comparison.
132 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800133 kMirOpFusedCmplDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700134
135 // @brief Used to do double comparison with greater-than bias.
136 // @details Unlike cmpl-double, this does not store result of comparison in VR.
137 // vA: left-hand side wide VR for comparison.
138 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800139 kMirOpFusedCmpgDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700140
141 // @brief Used to do comparison of 64-bit long integers.
142 // @details Unlike cmp-long, this does not store result of comparison in VR.
143 // vA: left-hand side wide VR for comparison.
144 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800145 kMirOpFusedCmpLong,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700146
147 // @brief This represents no-op.
buzbeecbd6d442012-11-17 14:11:25 -0800148 kMirOpNop,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700149
150 // @brief Do a null check on the object register.
151 // @details The backends may implement this implicitly or explicitly. This MIR is guaranteed
152 // to have the correct offset as an exception thrower.
153 // vA: object register
buzbeecbd6d442012-11-17 14:11:25 -0800154 kMirOpNullCheck,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700155
buzbeecbd6d442012-11-17 14:11:25 -0800156 kMirOpRangeCheck,
157 kMirOpDivZeroCheck,
158 kMirOpCheck,
buzbeea169e1d2012-12-05 14:26:44 -0800159 kMirOpCheckPart2,
buzbeef662a7c2013-02-12 16:19:43 -0800160 kMirOpSelect,
Mark Mendelld65c51a2014-04-29 16:55:20 -0400161
162 // Vector opcodes:
163 // TypeSize is an encoded field giving the element type and the vector size.
164 // It is encoded as OpSize << 16 | (number of bits in vector)
165 //
166 // Destination and source are integers that will be interpreted by the
167 // backend that supports Vector operations. Backends are permitted to support only
168 // certain vector register sizes.
169 //
170 // At this point, only two operand instructions are supported. Three operand instructions
171 // could be supported by using a bit in TypeSize and arg[0] where needed.
172
173 // @brief MIR to move constant data to a vector register
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700174 // vA: destination
175 // vB: number of bits in register
Mark Mendelld65c51a2014-04-29 16:55:20 -0400176 // args[0]~args[3]: up to 128 bits of data for initialization
177 kMirOpConstVector,
178
179 // @brief MIR to move a vectorized register to another
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700180 // vA: destination
181 // vB: source
182 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400183 kMirOpMoveVector,
184
185 // @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 -0700186 // vA: destination and source
187 // vB: source
188 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400189 kMirOpPackedMultiply,
190
191 // @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 -0700192 // vA: destination and source
193 // vB: source
194 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400195 kMirOpPackedAddition,
196
197 // @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 -0700198 // vA: destination and source
199 // vB: source
200 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400201 kMirOpPackedSubtract,
202
203 // @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 -0700204 // vA: destination and source
205 // vB: amount to shift
206 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400207 kMirOpPackedShiftLeft,
208
209 // @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 -0700210 // vA: destination and source
211 // vB: amount to shift
212 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400213 kMirOpPackedSignedShiftRight,
214
215 // @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 -0700216 // vA: destination and source
217 // vB: amount to shift
218 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400219 kMirOpPackedUnsignedShiftRight,
220
221 // @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 -0700222 // vA: destination and source
223 // vB: source
224 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400225 kMirOpPackedAnd,
226
227 // @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 -0700228 // vA: destination and source
229 // vB: source
230 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400231 kMirOpPackedOr,
232
233 // @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 -0700234 // vA: destination and source
235 // vB: source
236 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400237 kMirOpPackedXor,
238
239 // @brief Reduce a 128-bit packed element into a single VR by taking lower bits
240 // @details Instruction does a horizontal addition of the packed elements and then adds it to VR
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700241 // vA: destination and source VR (not vector register)
242 // vB: source (vector register)
243 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400244 kMirOpPackedAddReduce,
245
246 // @brief Extract a packed element into a single VR.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700247 // vA: destination VR (not vector register)
248 // vB: source (vector register)
249 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400250 // arg[0]: The index to use for extraction from vector register (which packed element)
251 kMirOpPackedReduce,
252
253 // @brief Create a vector value, with all TypeSize values equal to vC
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700254 // vA: destination vector register
255 // vB: source VR (not vector register)
256 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400257 kMirOpPackedSet,
258
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700259 // @brief Reserve a range of vector registers.
260 // vA: Start vector register to reserve.
261 // vB: Inclusive end vector register to reserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700262 // @note: The backend may choose to map vector numbers used in vector opcodes.
263 // Reserved registers are removed from the list of backend temporary pool.
264 kMirOpReserveVectorRegisters,
265
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700266 // @brief Free a range of reserved vector registers
267 // vA: Start vector register to unreserve.
268 // vB: Inclusive end vector register to unreserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700269 // @note: All currently reserved vector registers are returned to the temporary pool.
270 kMirOpReturnVectorRegisters,
271
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700272 // @brief Create a memory barrier.
273 // vA: a constant defined by enum MemBarrierKind.
274 kMirOpMemBarrier,
275
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700276 // @brief Used to fill a vector register with array values.
277 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
278 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
279 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
280 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
281 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
282 // vA: destination vector register
283 // vB: array register
284 // vC: index register
285 // arg[0]: TypeSize (most other vector opcodes have this in vC)
286 kMirOpPackedArrayGet,
287
288 // @brief Used to store a vector register into array.
289 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
290 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
291 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
292 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
293 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
294 // vA: source vector register
295 // vB: array register
296 // vC: index register
297 // arg[0]: TypeSize (most other vector opcodes have this in vC)
298 kMirOpPackedArrayPut,
299
buzbeecbd6d442012-11-17 14:11:25 -0800300 kMirOpLast,
301};
302
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700303enum MIROptimizationFlagPositions {
buzbeecbd6d442012-11-17 14:11:25 -0800304 kMIRIgnoreNullCheck = 0,
305 kMIRNullCheckOnly,
306 kMIRIgnoreRangeCheck,
307 kMIRRangeCheckOnly,
Vladimir Markobfea9c22014-01-17 17:49:33 +0000308 kMIRIgnoreClInitCheck,
Razvan A Lupusoru5c5676b2014-09-29 16:42:11 -0700309 kMirIgnoreDivZeroCheck,
buzbee02031b12012-11-23 09:41:35 -0800310 kMIRInlined, // Invoke is inlined (ie dead).
311 kMIRInlinedPred, // Invoke is inlined via prediction.
312 kMIRCallee, // Instruction is inlined from callee.
buzbeecbd6d442012-11-17 14:11:25 -0800313 kMIRIgnoreSuspendCheck,
314 kMIRDup,
Yevgeny Rouban423b1372014-10-15 17:32:25 +0700315 kMIRMark, // Temporary node mark can be used by
316 // opt passes for their private needs.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700317 kMIRStoreNonTemporal,
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700318 kMIRLastMIRFlag,
buzbeecbd6d442012-11-17 14:11:25 -0800319};
320
buzbee02031b12012-11-23 09:41:35 -0800321// For successor_block_list.
buzbeecbd6d442012-11-17 14:11:25 -0800322enum BlockListType {
323 kNotUsed = 0,
324 kCatch,
325 kPackedSwitch,
326 kSparseSwitch,
327};
328
329enum AssemblerStatus {
330 kSuccess,
331 kRetryAll,
332};
333
334enum OpSize {
buzbee695d13a2014-04-19 13:32:20 -0700335 kWord, // Natural word size of target (32/64).
336 k32,
337 k64,
338 kReference, // Object reference; compressed on 64-bit targets.
buzbeecbd6d442012-11-17 14:11:25 -0800339 kSingle,
340 kDouble,
341 kUnsignedHalf,
342 kSignedHalf,
343 kUnsignedByte,
344 kSignedByte,
345};
346
347std::ostream& operator<<(std::ostream& os, const OpSize& kind);
348
349enum OpKind {
350 kOpMov,
Razvan A Lupusorubd288c22013-12-20 17:27:23 -0800351 kOpCmov,
buzbeecbd6d442012-11-17 14:11:25 -0800352 kOpMvn,
353 kOpCmp,
354 kOpLsl,
355 kOpLsr,
356 kOpAsr,
357 kOpRor,
358 kOpNot,
359 kOpAnd,
360 kOpOr,
361 kOpXor,
362 kOpNeg,
363 kOpAdd,
364 kOpAdc,
365 kOpSub,
366 kOpSbc,
367 kOpRsub,
368 kOpMul,
369 kOpDiv,
370 kOpRem,
371 kOpBic,
372 kOpCmn,
373 kOpTst,
Vladimir Markoa8b4caf2013-10-24 15:08:57 +0100374 kOpRev,
375 kOpRevsh,
buzbeecbd6d442012-11-17 14:11:25 -0800376 kOpBkpt,
377 kOpBlx,
378 kOpPush,
379 kOpPop,
380 kOp2Char,
381 kOp2Short,
382 kOp2Byte,
383 kOpCondBr,
384 kOpUncondBr,
385 kOpBx,
386 kOpInvalid,
387};
388
Razvan A Lupusoru2c498d12014-01-29 16:02:57 -0800389enum MoveType {
390 kMov8GP, // Move 8-bit general purpose register.
391 kMov16GP, // Move 16-bit general purpose register.
392 kMov32GP, // Move 32-bit general purpose register.
393 kMov64GP, // Move 64-bit general purpose register.
394 kMov32FP, // Move 32-bit FP register.
395 kMov64FP, // Move 64-bit FP register.
396 kMovLo64FP, // Move low 32-bits of 64-bit FP register.
397 kMovHi64FP, // Move high 32-bits of 64-bit FP register.
398 kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region.
399 kMov128FP = kMovU128FP,
400 kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes.
401 kMovLo128FP, // Move low 64-bits of 128-bit FP register.
402 kMovHi128FP, // Move high 64-bits of 128-bit FP register.
403};
404
buzbeecbd6d442012-11-17 14:11:25 -0800405std::ostream& operator<<(std::ostream& os, const OpKind& kind);
406
407enum ConditionCode {
408 kCondEq, // equal
409 kCondNe, // not equal
Vladimir Marko58af1f92013-12-19 13:31:15 +0000410 kCondCs, // carry set
411 kCondCc, // carry clear
Vladimir Marko459f4df2013-12-20 17:03:09 +0000412 kCondUlt, // unsigned less than
413 kCondUge, // unsigned greater than or same
buzbeecbd6d442012-11-17 14:11:25 -0800414 kCondMi, // minus
415 kCondPl, // plus, positive or zero
416 kCondVs, // overflow
417 kCondVc, // no overflow
418 kCondHi, // unsigned greater than
419 kCondLs, // unsigned lower or same
420 kCondGe, // signed greater than or equal
421 kCondLt, // signed less than
422 kCondGt, // signed greater than
423 kCondLe, // signed less than or equal
424 kCondAl, // always
425 kCondNv, // never
426};
427
428std::ostream& operator<<(std::ostream& os, const ConditionCode& kind);
429
430// Target specific condition encodings
431enum ArmConditionCode {
432 kArmCondEq = 0x0, // 0000
433 kArmCondNe = 0x1, // 0001
434 kArmCondCs = 0x2, // 0010
435 kArmCondCc = 0x3, // 0011
436 kArmCondMi = 0x4, // 0100
437 kArmCondPl = 0x5, // 0101
438 kArmCondVs = 0x6, // 0110
439 kArmCondVc = 0x7, // 0111
440 kArmCondHi = 0x8, // 1000
441 kArmCondLs = 0x9, // 1001
442 kArmCondGe = 0xa, // 1010
443 kArmCondLt = 0xb, // 1011
444 kArmCondGt = 0xc, // 1100
445 kArmCondLe = 0xd, // 1101
446 kArmCondAl = 0xe, // 1110
447 kArmCondNv = 0xf, // 1111
448};
449
450std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind);
451
452enum X86ConditionCode {
453 kX86CondO = 0x0, // overflow
454 kX86CondNo = 0x1, // not overflow
455
456 kX86CondB = 0x2, // below
457 kX86CondNae = kX86CondB, // not-above-equal
458 kX86CondC = kX86CondB, // carry
459
460 kX86CondNb = 0x3, // not-below
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700461 kX86CondAe = kX86CondNb, // above-equal
462 kX86CondNc = kX86CondNb, // not-carry
buzbeecbd6d442012-11-17 14:11:25 -0800463
464 kX86CondZ = 0x4, // zero
465 kX86CondEq = kX86CondZ, // equal
466
467 kX86CondNz = 0x5, // not-zero
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700468 kX86CondNe = kX86CondNz, // not-equal
buzbeecbd6d442012-11-17 14:11:25 -0800469
470 kX86CondBe = 0x6, // below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700471 kX86CondNa = kX86CondBe, // not-above
buzbeecbd6d442012-11-17 14:11:25 -0800472
473 kX86CondNbe = 0x7, // not-below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700474 kX86CondA = kX86CondNbe, // above
buzbeecbd6d442012-11-17 14:11:25 -0800475
476 kX86CondS = 0x8, // sign
477 kX86CondNs = 0x9, // not-sign
478
479 kX86CondP = 0xa, // 8-bit parity even
480 kX86CondPE = kX86CondP,
481
482 kX86CondNp = 0xb, // 8-bit parity odd
483 kX86CondPo = kX86CondNp,
484
485 kX86CondL = 0xc, // less-than
486 kX86CondNge = kX86CondL, // not-greater-equal
487
488 kX86CondNl = 0xd, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700489 kX86CondGe = kX86CondNl, // not-greater-equal
buzbeecbd6d442012-11-17 14:11:25 -0800490
491 kX86CondLe = 0xe, // less-than-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700492 kX86CondNg = kX86CondLe, // not-greater
buzbeecbd6d442012-11-17 14:11:25 -0800493
494 kX86CondNle = 0xf, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700495 kX86CondG = kX86CondNle, // greater
buzbeecbd6d442012-11-17 14:11:25 -0800496};
497
498std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind);
499
buzbeecbd6d442012-11-17 14:11:25 -0800500enum DividePattern {
501 DivideNone,
502 Divide3,
503 Divide5,
504 Divide7,
505};
506
507std::ostream& operator<<(std::ostream& os, const DividePattern& pattern);
508
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800509/**
510 * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers").
Hans Boehm48f5c472014-06-27 14:50:10 -0700511 * @details We define the combined barrier types that are actually required
512 * by the Java Memory Model, rather than using exactly the terminology from
513 * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release
514 * primitives. Note that the JSR-133 cookbook generally does not deal with
515 * store atomicity issues, and the recipes there are not always entirely sufficient.
516 * The current recipe is as follows:
517 * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store.
518 * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.)
519 * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800520 * -# Use StoreStore barrier after all stores but before return from any constructor whose
Hans Boehm48f5c472014-06-27 14:50:10 -0700521 * class has final fields.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700522 * -# Use NTStoreStore to order non-temporal stores with respect to all later
523 * store-to-memory instructions. Only generated together with non-temporal stores.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800524 */
buzbee1bc37c62012-11-20 13:35:41 -0800525enum MemBarrierKind {
Hans Boehm48f5c472014-06-27 14:50:10 -0700526 kAnyStore,
527 kLoadAny,
buzbee1bc37c62012-11-20 13:35:41 -0800528 kStoreStore,
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700529 kAnyAny,
530 kNTStoreStore,
buzbee1bc37c62012-11-20 13:35:41 -0800531};
532
533std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
534
buzbee02031b12012-11-23 09:41:35 -0800535enum OpFeatureFlags {
536 kIsBranch = 0,
537 kNoOperand,
538 kIsUnaryOp,
539 kIsBinaryOp,
540 kIsTertiaryOp,
541 kIsQuadOp,
542 kIsQuinOp,
543 kIsSextupleOp,
544 kIsIT,
Serban Constantinescu63999682014-07-15 17:44:21 +0100545 kIsMoveOp,
buzbee02031b12012-11-23 09:41:35 -0800546 kMemLoad,
547 kMemStore,
Serban Constantinescu63999682014-07-15 17:44:21 +0100548 kMemVolatile,
549 kMemScaledx0,
550 kMemScaledx2,
551 kMemScaledx4,
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700552 kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes.
buzbee02031b12012-11-23 09:41:35 -0800553 kRegDef0,
554 kRegDef1,
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800555 kRegDef2,
buzbee02031b12012-11-23 09:41:35 -0800556 kRegDefA,
557 kRegDefD,
558 kRegDefFPCSList0,
559 kRegDefFPCSList2,
560 kRegDefList0,
561 kRegDefList1,
562 kRegDefList2,
563 kRegDefLR,
564 kRegDefSP,
565 kRegUse0,
566 kRegUse1,
567 kRegUse2,
568 kRegUse3,
569 kRegUse4,
570 kRegUseA,
571 kRegUseC,
572 kRegUseD,
Vladimir Marko70b797d2013-12-03 15:25:24 +0000573 kRegUseB,
buzbee02031b12012-11-23 09:41:35 -0800574 kRegUseFPCSList0,
575 kRegUseFPCSList2,
576 kRegUseList0,
577 kRegUseList1,
578 kRegUseLR,
579 kRegUsePC,
580 kRegUseSP,
581 kSetsCCodes,
Serguei Katkove90501d2014-03-12 15:56:54 +0700582 kUsesCCodes,
buzbee9da5c102014-03-28 12:59:18 -0700583 kUseFpStack,
584 kUseHi,
585 kUseLo,
586 kDefHi,
587 kDefLo
buzbee02031b12012-11-23 09:41:35 -0800588};
589
buzbeef662a7c2013-02-12 16:19:43 -0800590enum SelectInstructionKind {
591 kSelectNone,
592 kSelectConst,
593 kSelectMove,
594 kSelectGoto
595};
596
buzbeea5abf702013-04-12 14:39:29 -0700597std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind);
598
buzbeeb48819d2013-09-14 16:15:25 -0700599// LIR fixup kinds for Arm
600enum FixupKind {
601 kFixupNone,
602 kFixupLabel, // For labels we just adjust the offset.
Vladimir Marko306f0172014-01-07 18:21:20 +0000603 kFixupLoad, // Mostly for immediates.
buzbeeb48819d2013-09-14 16:15:25 -0700604 kFixupVLoad, // FP load which *may* be pc-relative.
605 kFixupCBxZ, // Cbz, Cbnz.
Zheng Xu5d7cdec2014-08-18 17:28:22 +0800606 kFixupTBxZ, // Tbz, Tbnz.
buzbeeb48819d2013-09-14 16:15:25 -0700607 kFixupPushPop, // Not really pc relative, but changes size based on args.
608 kFixupCondBranch, // Conditional branch
609 kFixupT1Branch, // Thumb1 Unconditional branch
610 kFixupT2Branch, // Thumb2 Unconditional branch
611 kFixupBlx1, // Blx1 (start of Blx1/Blx2 pair).
612 kFixupBl1, // Bl1 (start of Bl1/Bl2 pair).
613 kFixupAdr, // Adr.
614 kFixupMovImmLST, // kThumb2MovImm16LST.
615 kFixupMovImmHST, // kThumb2MovImm16HST.
616 kFixupAlign4, // Align to 4-byte boundary.
617};
618
619std::ostream& operator<<(std::ostream& os, const FixupKind& kind);
620
Andreas Gampe3c12c512014-06-24 18:46:29 +0000621enum VolatileKind {
622 kNotVolatile, // Load/Store is not volatile
623 kVolatile // Load/Store is volatile
624};
625
626std::ostream& operator<<(std::ostream& os, const VolatileKind& kind);
627
Andreas Gampeccc60262014-07-04 18:02:38 -0700628enum WideKind {
629 kNotWide, // Non-wide view
630 kWide, // Wide view
631 kRef // Ref width
632};
633
634std::ostream& operator<<(std::ostream& os, const WideKind& kind);
635
buzbeecbd6d442012-11-17 14:11:25 -0800636} // namespace art
637
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700638#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_