blob: 1297ba9c7fa032e65980fcc72e313db3eb7ae832 [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};
41
buzbeecbd6d442012-11-17 14:11:25 -080042enum SpecialTargetRegister {
buzbee02031b12012-11-23 09:41:35 -080043 kSelf, // Thread pointer.
44 kSuspend, // Used to reduce suspend checks for some targets.
buzbeecbd6d442012-11-17 14:11:25 -080045 kLr,
46 kPc,
47 kSp,
48 kArg0,
49 kArg1,
50 kArg2,
51 kArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070052 kArg4,
53 kArg5,
buzbee33ae5582014-06-12 14:56:32 -070054 kArg6,
55 kArg7,
buzbeecbd6d442012-11-17 14:11:25 -080056 kFArg0,
57 kFArg1,
58 kFArg2,
59 kFArg3,
Dmitry Petrochenko58994cd2014-05-17 01:02:18 +070060 kFArg4,
61 kFArg5,
62 kFArg6,
63 kFArg7,
Zheng Xu5667fdb2014-10-23 18:29:55 +080064 kFArg8,
65 kFArg9,
66 kFArg10,
67 kFArg11,
68 kFArg12,
69 kFArg13,
70 kFArg14,
71 kFArg15,
buzbeecbd6d442012-11-17 14:11:25 -080072 kRet0,
73 kRet1,
74 kInvokeTgt,
Jeff Hao88474b42013-10-23 16:24:40 -070075 kHiddenArg,
76 kHiddenFpArg,
buzbeecbd6d442012-11-17 14:11:25 -080077 kCount
78};
79
80enum RegLocationType {
Brian Carlstrom7934ac22013-07-26 10:54:15 -070081 kLocDalvikFrame = 0, // Normal Dalvik register
buzbeecbd6d442012-11-17 14:11:25 -080082 kLocPhysReg,
83 kLocCompilerTemp,
84 kLocInvalid
85};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070086std::ostream& operator<<(std::ostream& os, const RegLocationType& rhs);
buzbeecbd6d442012-11-17 14:11:25 -080087
88enum BBType {
buzbee0d829482013-10-11 15:24:55 -070089 kNullBlock,
buzbeecbd6d442012-11-17 14:11:25 -080090 kEntryBlock,
91 kDalvikByteCode,
92 kExitBlock,
93 kExceptionHandling,
94 kDead,
95};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070096std::ostream& operator<<(std::ostream& os, const BBType& code);
buzbeecbd6d442012-11-17 14:11:25 -080097
buzbee02031b12012-11-23 09:41:35 -080098// Shared pseudo opcodes - must be < 0.
buzbeecbd6d442012-11-17 14:11:25 -080099enum LIRPseudoOpcode {
buzbeea169e1d2012-12-05 14:26:44 -0800100 kPseudoExportedPC = -16,
101 kPseudoSafepointPC = -15,
102 kPseudoIntrinsicRetry = -14,
103 kPseudoSuspendTarget = -13,
104 kPseudoThrowTarget = -12,
105 kPseudoCaseLabel = -11,
106 kPseudoMethodEntry = -10,
107 kPseudoMethodExit = -9,
108 kPseudoBarrier = -8,
buzbeecbd6d442012-11-17 14:11:25 -0800109 kPseudoEntryBlock = -7,
110 kPseudoExitBlock = -6,
111 kPseudoTargetLabel = -5,
112 kPseudoDalvikByteCodeBoundary = -4,
113 kPseudoPseudoAlign4 = -3,
114 kPseudoEHBlockLabel = -2,
115 kPseudoNormalBlockLabel = -1,
116};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700117std::ostream& operator<<(std::ostream& os, const LIRPseudoOpcode& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800118
119enum ExtendedMIROpcode {
120 kMirOpFirst = kNumPackedOpcodes,
121 kMirOpPhi = kMirOpFirst,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700122
123 // @brief Copy from one VR to another.
124 // @details
125 // vA: destination VR
126 // vB: source VR
buzbeecbd6d442012-11-17 14:11:25 -0800127 kMirOpCopy,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700128
129 // @brief Used to do float comparison with less-than bias.
130 // @details Unlike cmpl-float, this does not store result of comparison in VR.
131 // vA: left-hand side VR for comparison.
132 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800133 kMirOpFusedCmplFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700134
135 // @brief Used to do float comparison with greater-than bias.
136 // @details Unlike cmpg-float, this does not store result of comparison in VR.
137 // vA: left-hand side VR for comparison.
138 // vB: right-hand side VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800139 kMirOpFusedCmpgFloat,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700140
141 // @brief Used to do double comparison with less-than bias.
142 // @details Unlike cmpl-double, 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 kMirOpFusedCmplDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700146
147 // @brief Used to do double comparison with greater-than bias.
148 // @details Unlike cmpl-double, this does not store result of comparison in VR.
149 // vA: left-hand side wide VR for comparison.
150 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800151 kMirOpFusedCmpgDouble,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700152
153 // @brief Used to do comparison of 64-bit long integers.
154 // @details Unlike cmp-long, this does not store result of comparison in VR.
155 // vA: left-hand side wide VR for comparison.
156 // vB: right-hand side wide VR for comparison.
buzbeecbd6d442012-11-17 14:11:25 -0800157 kMirOpFusedCmpLong,
Razvan A Lupusoru1500e6f2014-08-22 15:39:50 -0700158
159 // @brief This represents no-op.
buzbeecbd6d442012-11-17 14:11:25 -0800160 kMirOpNop,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700161
162 // @brief Do a null check on the object register.
163 // @details The backends may implement this implicitly or explicitly. This MIR is guaranteed
164 // to have the correct offset as an exception thrower.
165 // vA: object register
buzbeecbd6d442012-11-17 14:11:25 -0800166 kMirOpNullCheck,
Razvan A Lupusoru76423242014-08-04 09:38:46 -0700167
buzbeecbd6d442012-11-17 14:11:25 -0800168 kMirOpRangeCheck,
169 kMirOpDivZeroCheck,
170 kMirOpCheck,
buzbeea169e1d2012-12-05 14:26:44 -0800171 kMirOpCheckPart2,
buzbeef662a7c2013-02-12 16:19:43 -0800172 kMirOpSelect,
Mark Mendelld65c51a2014-04-29 16:55:20 -0400173
174 // Vector opcodes:
175 // TypeSize is an encoded field giving the element type and the vector size.
176 // It is encoded as OpSize << 16 | (number of bits in vector)
177 //
178 // Destination and source are integers that will be interpreted by the
179 // backend that supports Vector operations. Backends are permitted to support only
180 // certain vector register sizes.
181 //
182 // At this point, only two operand instructions are supported. Three operand instructions
183 // could be supported by using a bit in TypeSize and arg[0] where needed.
184
185 // @brief MIR to move constant data to a vector register
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700186 // vA: destination
187 // vB: number of bits in register
Mark Mendelld65c51a2014-04-29 16:55:20 -0400188 // args[0]~args[3]: up to 128 bits of data for initialization
189 kMirOpConstVector,
190
191 // @brief MIR to move a vectorized register to another
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700192 // vA: destination
193 // vB: source
194 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400195 kMirOpMoveVector,
196
197 // @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 -0700198 // vA: destination and source
199 // vB: source
200 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400201 kMirOpPackedMultiply,
202
203 // @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 -0700204 // vA: destination and source
205 // vB: source
206 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400207 kMirOpPackedAddition,
208
209 // @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 -0700210 // vA: destination and source
211 // vB: source
212 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400213 kMirOpPackedSubtract,
214
215 // @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 -0700216 // vA: destination and source
217 // vB: amount to shift
218 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400219 kMirOpPackedShiftLeft,
220
221 // @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 -0700222 // vA: destination and source
223 // vB: amount to shift
224 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400225 kMirOpPackedSignedShiftRight,
226
227 // @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 -0700228 // vA: destination and source
229 // vB: amount to shift
230 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400231 kMirOpPackedUnsignedShiftRight,
232
233 // @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 -0700234 // vA: destination and source
235 // vB: source
236 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400237 kMirOpPackedAnd,
238
239 // @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 -0700240 // vA: destination and source
241 // vB: source
242 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400243 kMirOpPackedOr,
244
245 // @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 -0700246 // vA: destination and source
247 // vB: source
248 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400249 kMirOpPackedXor,
250
251 // @brief Reduce a 128-bit packed element into a single VR by taking lower bits
252 // @details Instruction does a horizontal addition of the packed elements and then adds it to VR
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700253 // vA: destination and source VR (not vector register)
254 // vB: source (vector register)
255 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400256 kMirOpPackedAddReduce,
257
258 // @brief Extract a packed element into a single VR.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700259 // vA: destination VR (not vector register)
260 // vB: source (vector register)
261 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400262 // arg[0]: The index to use for extraction from vector register (which packed element)
263 kMirOpPackedReduce,
264
265 // @brief Create a vector value, with all TypeSize values equal to vC
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700266 // vA: destination vector register
267 // vB: source VR (not vector register)
268 // vC: TypeSize
Mark Mendelld65c51a2014-04-29 16:55:20 -0400269 kMirOpPackedSet,
270
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700271 // @brief Reserve a range of vector registers.
272 // vA: Start vector register to reserve.
273 // vB: Inclusive end vector register to reserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700274 // @note: The backend may choose to map vector numbers used in vector opcodes.
275 // Reserved registers are removed from the list of backend temporary pool.
276 kMirOpReserveVectorRegisters,
277
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700278 // @brief Free a range of reserved vector registers
279 // vA: Start vector register to unreserve.
280 // vB: Inclusive end vector register to unreserve.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700281 // @note: All currently reserved vector registers are returned to the temporary pool.
282 kMirOpReturnVectorRegisters,
283
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700284 // @brief Create a memory barrier.
285 // vA: a constant defined by enum MemBarrierKind.
286 kMirOpMemBarrier,
287
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -0700288 // @brief Used to fill a vector register with array values.
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: destination vector register
295 // vB: array register
296 // vC: index register
297 // arg[0]: TypeSize (most other vector opcodes have this in vC)
298 kMirOpPackedArrayGet,
299
300 // @brief Used to store a vector register into array.
301 // @details Just as with normal arrays, access on null object register must ensure NullPointerException
302 // and invalid index must ensure ArrayIndexOutOfBoundsException. Exception behavior must be the same
303 // as the aget it replaced and must happen at same index. Therefore, it is generally recommended that
304 // before using this MIR, it is proven that exception is guaranteed to not be thrown and marked with
305 // MIR_IGNORE_NULL_CHECK and MIR_IGNORE_RANGE_CHECK.
306 // vA: source vector register
307 // vB: array register
308 // vC: index register
309 // arg[0]: TypeSize (most other vector opcodes have this in vC)
310 kMirOpPackedArrayPut,
311
buzbeecbd6d442012-11-17 14:11:25 -0800312 kMirOpLast,
313};
314
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700315enum MIROptimizationFlagPositions {
buzbeecbd6d442012-11-17 14:11:25 -0800316 kMIRIgnoreNullCheck = 0,
317 kMIRNullCheckOnly,
318 kMIRIgnoreRangeCheck,
319 kMIRRangeCheckOnly,
Vladimir Marko66c6d7b2014-10-16 15:41:48 +0100320 kMIRClassIsInitialized,
321 kMIRClassIsInDexCache,
Razvan A Lupusoru5c5676b2014-09-29 16:42:11 -0700322 kMirIgnoreDivZeroCheck,
buzbee02031b12012-11-23 09:41:35 -0800323 kMIRInlined, // Invoke is inlined (ie dead).
324 kMIRInlinedPred, // Invoke is inlined via prediction.
325 kMIRCallee, // Instruction is inlined from callee.
buzbeecbd6d442012-11-17 14:11:25 -0800326 kMIRIgnoreSuspendCheck,
327 kMIRDup,
Yevgeny Rouban423b1372014-10-15 17:32:25 +0700328 kMIRMark, // Temporary node mark can be used by
329 // opt passes for their private needs.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700330 kMIRStoreNonTemporal,
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700331 kMIRLastMIRFlag,
buzbeecbd6d442012-11-17 14:11:25 -0800332};
333
buzbee02031b12012-11-23 09:41:35 -0800334// For successor_block_list.
buzbeecbd6d442012-11-17 14:11:25 -0800335enum BlockListType {
336 kNotUsed = 0,
337 kCatch,
338 kPackedSwitch,
339 kSparseSwitch,
340};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700341std::ostream& operator<<(std::ostream& os, const BlockListType& rhs);
buzbeecbd6d442012-11-17 14:11:25 -0800342
343enum AssemblerStatus {
344 kSuccess,
345 kRetryAll,
346};
347
348enum OpSize {
buzbee695d13a2014-04-19 13:32:20 -0700349 kWord, // Natural word size of target (32/64).
350 k32,
351 k64,
352 kReference, // Object reference; compressed on 64-bit targets.
buzbeecbd6d442012-11-17 14:11:25 -0800353 kSingle,
354 kDouble,
355 kUnsignedHalf,
356 kSignedHalf,
357 kUnsignedByte,
358 kSignedByte,
359};
360
361std::ostream& operator<<(std::ostream& os, const OpSize& kind);
362
363enum OpKind {
364 kOpMov,
Razvan A Lupusorubd288c22013-12-20 17:27:23 -0800365 kOpCmov,
buzbeecbd6d442012-11-17 14:11:25 -0800366 kOpMvn,
367 kOpCmp,
368 kOpLsl,
369 kOpLsr,
370 kOpAsr,
371 kOpRor,
372 kOpNot,
373 kOpAnd,
374 kOpOr,
375 kOpXor,
376 kOpNeg,
377 kOpAdd,
378 kOpAdc,
379 kOpSub,
380 kOpSbc,
381 kOpRsub,
382 kOpMul,
383 kOpDiv,
384 kOpRem,
385 kOpBic,
386 kOpCmn,
387 kOpTst,
Vladimir Markoa8b4caf2013-10-24 15:08:57 +0100388 kOpRev,
389 kOpRevsh,
buzbeecbd6d442012-11-17 14:11:25 -0800390 kOpBkpt,
391 kOpBlx,
392 kOpPush,
393 kOpPop,
394 kOp2Char,
395 kOp2Short,
396 kOp2Byte,
397 kOpCondBr,
398 kOpUncondBr,
399 kOpBx,
400 kOpInvalid,
401};
402
Razvan A Lupusoru2c498d12014-01-29 16:02:57 -0800403enum MoveType {
404 kMov8GP, // Move 8-bit general purpose register.
405 kMov16GP, // Move 16-bit general purpose register.
406 kMov32GP, // Move 32-bit general purpose register.
407 kMov64GP, // Move 64-bit general purpose register.
408 kMov32FP, // Move 32-bit FP register.
409 kMov64FP, // Move 64-bit FP register.
410 kMovLo64FP, // Move low 32-bits of 64-bit FP register.
411 kMovHi64FP, // Move high 32-bits of 64-bit FP register.
412 kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region.
413 kMov128FP = kMovU128FP,
414 kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes.
415 kMovLo128FP, // Move low 64-bits of 128-bit FP register.
416 kMovHi128FP, // Move high 64-bits of 128-bit FP register.
417};
418
buzbeecbd6d442012-11-17 14:11:25 -0800419std::ostream& operator<<(std::ostream& os, const OpKind& kind);
420
421enum ConditionCode {
422 kCondEq, // equal
423 kCondNe, // not equal
Vladimir Marko58af1f92013-12-19 13:31:15 +0000424 kCondCs, // carry set
425 kCondCc, // carry clear
Vladimir Marko459f4df2013-12-20 17:03:09 +0000426 kCondUlt, // unsigned less than
427 kCondUge, // unsigned greater than or same
buzbeecbd6d442012-11-17 14:11:25 -0800428 kCondMi, // minus
429 kCondPl, // plus, positive or zero
430 kCondVs, // overflow
431 kCondVc, // no overflow
432 kCondHi, // unsigned greater than
433 kCondLs, // unsigned lower or same
434 kCondGe, // signed greater than or equal
435 kCondLt, // signed less than
436 kCondGt, // signed greater than
437 kCondLe, // signed less than or equal
438 kCondAl, // always
439 kCondNv, // never
440};
441
442std::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};
463
464std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind);
465
466enum X86ConditionCode {
467 kX86CondO = 0x0, // overflow
468 kX86CondNo = 0x1, // not overflow
469
470 kX86CondB = 0x2, // below
471 kX86CondNae = kX86CondB, // not-above-equal
472 kX86CondC = kX86CondB, // carry
473
474 kX86CondNb = 0x3, // not-below
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700475 kX86CondAe = kX86CondNb, // above-equal
476 kX86CondNc = kX86CondNb, // not-carry
buzbeecbd6d442012-11-17 14:11:25 -0800477
478 kX86CondZ = 0x4, // zero
479 kX86CondEq = kX86CondZ, // equal
480
481 kX86CondNz = 0x5, // not-zero
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700482 kX86CondNe = kX86CondNz, // not-equal
buzbeecbd6d442012-11-17 14:11:25 -0800483
484 kX86CondBe = 0x6, // below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700485 kX86CondNa = kX86CondBe, // not-above
buzbeecbd6d442012-11-17 14:11:25 -0800486
487 kX86CondNbe = 0x7, // not-below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700488 kX86CondA = kX86CondNbe, // above
buzbeecbd6d442012-11-17 14:11:25 -0800489
490 kX86CondS = 0x8, // sign
491 kX86CondNs = 0x9, // not-sign
492
493 kX86CondP = 0xa, // 8-bit parity even
494 kX86CondPE = kX86CondP,
495
496 kX86CondNp = 0xb, // 8-bit parity odd
497 kX86CondPo = kX86CondNp,
498
499 kX86CondL = 0xc, // less-than
500 kX86CondNge = kX86CondL, // not-greater-equal
501
502 kX86CondNl = 0xd, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700503 kX86CondGe = kX86CondNl, // not-greater-equal
buzbeecbd6d442012-11-17 14:11:25 -0800504
505 kX86CondLe = 0xe, // less-than-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700506 kX86CondNg = kX86CondLe, // not-greater
buzbeecbd6d442012-11-17 14:11:25 -0800507
508 kX86CondNle = 0xf, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700509 kX86CondG = kX86CondNle, // greater
buzbeecbd6d442012-11-17 14:11:25 -0800510};
511
512std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind);
513
buzbeecbd6d442012-11-17 14:11:25 -0800514enum DividePattern {
515 DivideNone,
516 Divide3,
517 Divide5,
518 Divide7,
519};
520
521std::ostream& operator<<(std::ostream& os, const DividePattern& pattern);
522
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800523/**
524 * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers").
Hans Boehm48f5c472014-06-27 14:50:10 -0700525 * @details We define the combined barrier types that are actually required
526 * by the Java Memory Model, rather than using exactly the terminology from
527 * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release
528 * primitives. Note that the JSR-133 cookbook generally does not deal with
529 * store atomicity issues, and the recipes there are not always entirely sufficient.
530 * The current recipe is as follows:
531 * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store.
532 * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.)
533 * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800534 * -# Use StoreStore barrier after all stores but before return from any constructor whose
Hans Boehm48f5c472014-06-27 14:50:10 -0700535 * class has final fields.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700536 * -# Use NTStoreStore to order non-temporal stores with respect to all later
537 * store-to-memory instructions. Only generated together with non-temporal stores.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800538 */
buzbee1bc37c62012-11-20 13:35:41 -0800539enum MemBarrierKind {
Hans Boehm48f5c472014-06-27 14:50:10 -0700540 kAnyStore,
541 kLoadAny,
buzbee1bc37c62012-11-20 13:35:41 -0800542 kStoreStore,
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700543 kAnyAny,
544 kNTStoreStore,
buzbee1bc37c62012-11-20 13:35:41 -0800545};
546
547std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
548
buzbee02031b12012-11-23 09:41:35 -0800549enum OpFeatureFlags {
550 kIsBranch = 0,
551 kNoOperand,
552 kIsUnaryOp,
553 kIsBinaryOp,
554 kIsTertiaryOp,
555 kIsQuadOp,
556 kIsQuinOp,
557 kIsSextupleOp,
558 kIsIT,
Serban Constantinescu63999682014-07-15 17:44:21 +0100559 kIsMoveOp,
buzbee02031b12012-11-23 09:41:35 -0800560 kMemLoad,
561 kMemStore,
Serban Constantinescu63999682014-07-15 17:44:21 +0100562 kMemVolatile,
563 kMemScaledx0,
564 kMemScaledx2,
565 kMemScaledx4,
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700566 kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes.
buzbee02031b12012-11-23 09:41:35 -0800567 kRegDef0,
568 kRegDef1,
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800569 kRegDef2,
buzbee02031b12012-11-23 09:41:35 -0800570 kRegDefA,
571 kRegDefD,
572 kRegDefFPCSList0,
573 kRegDefFPCSList2,
574 kRegDefList0,
575 kRegDefList1,
576 kRegDefList2,
577 kRegDefLR,
578 kRegDefSP,
579 kRegUse0,
580 kRegUse1,
581 kRegUse2,
582 kRegUse3,
583 kRegUse4,
584 kRegUseA,
585 kRegUseC,
586 kRegUseD,
Vladimir Marko70b797d2013-12-03 15:25:24 +0000587 kRegUseB,
buzbee02031b12012-11-23 09:41:35 -0800588 kRegUseFPCSList0,
589 kRegUseFPCSList2,
590 kRegUseList0,
591 kRegUseList1,
592 kRegUseLR,
593 kRegUsePC,
594 kRegUseSP,
595 kSetsCCodes,
Serguei Katkove90501d2014-03-12 15:56:54 +0700596 kUsesCCodes,
buzbee9da5c102014-03-28 12:59:18 -0700597 kUseFpStack,
598 kUseHi,
599 kUseLo,
600 kDefHi,
601 kDefLo
buzbee02031b12012-11-23 09:41:35 -0800602};
603
buzbeef662a7c2013-02-12 16:19:43 -0800604enum SelectInstructionKind {
605 kSelectNone,
606 kSelectConst,
607 kSelectMove,
608 kSelectGoto
609};
610
buzbeea5abf702013-04-12 14:39:29 -0700611std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind);
612
buzbeeb48819d2013-09-14 16:15:25 -0700613// LIR fixup kinds for Arm
614enum FixupKind {
615 kFixupNone,
616 kFixupLabel, // For labels we just adjust the offset.
Vladimir Marko306f0172014-01-07 18:21:20 +0000617 kFixupLoad, // Mostly for immediates.
buzbeeb48819d2013-09-14 16:15:25 -0700618 kFixupVLoad, // FP load which *may* be pc-relative.
619 kFixupCBxZ, // Cbz, Cbnz.
Zheng Xu5d7cdec2014-08-18 17:28:22 +0800620 kFixupTBxZ, // Tbz, Tbnz.
buzbeeb48819d2013-09-14 16:15:25 -0700621 kFixupPushPop, // Not really pc relative, but changes size based on args.
622 kFixupCondBranch, // Conditional branch
623 kFixupT1Branch, // Thumb1 Unconditional branch
624 kFixupT2Branch, // Thumb2 Unconditional branch
625 kFixupBlx1, // Blx1 (start of Blx1/Blx2 pair).
626 kFixupBl1, // Bl1 (start of Bl1/Bl2 pair).
627 kFixupAdr, // Adr.
628 kFixupMovImmLST, // kThumb2MovImm16LST.
629 kFixupMovImmHST, // kThumb2MovImm16HST.
630 kFixupAlign4, // Align to 4-byte boundary.
631};
632
633std::ostream& operator<<(std::ostream& os, const FixupKind& kind);
634
Andreas Gampe3c12c512014-06-24 18:46:29 +0000635enum VolatileKind {
636 kNotVolatile, // Load/Store is not volatile
637 kVolatile // Load/Store is volatile
638};
639
640std::ostream& operator<<(std::ostream& os, const VolatileKind& kind);
641
Andreas Gampeccc60262014-07-04 18:02:38 -0700642enum WideKind {
643 kNotWide, // Non-wide view
644 kWide, // Wide view
645 kRef // Ref width
646};
647
648std::ostream& operator<<(std::ostream& os, const WideKind& kind);
649
buzbeecbd6d442012-11-17 14:11:25 -0800650} // namespace art
651
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700652#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_