blob: 9c2a8ba96ae3c9c7c7b11d3db816d8d1c20913fa [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
Udayan Banerji60bfe7b2014-07-08 19:59:43 -0700259 // @brief Reserve N vector registers (named 0..N-1)
260 // vA: Number of registers
261 // @note: The backend may choose to map vector numbers used in vector opcodes.
262 // Reserved registers are removed from the list of backend temporary pool.
263 kMirOpReserveVectorRegisters,
264
265 // @brief Free Reserved vector registers
266 // @note: All currently reserved vector registers are returned to the temporary pool.
267 kMirOpReturnVectorRegisters,
268
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700269 // @brief Create a memory barrier.
270 // vA: a constant defined by enum MemBarrierKind.
271 kMirOpMemBarrier,
272
buzbeecbd6d442012-11-17 14:11:25 -0800273 kMirOpLast,
274};
275
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700276enum MIROptimizationFlagPositions {
buzbeecbd6d442012-11-17 14:11:25 -0800277 kMIRIgnoreNullCheck = 0,
278 kMIRNullCheckOnly,
279 kMIRIgnoreRangeCheck,
280 kMIRRangeCheckOnly,
Vladimir Markobfea9c22014-01-17 17:49:33 +0000281 kMIRIgnoreClInitCheck,
buzbee02031b12012-11-23 09:41:35 -0800282 kMIRInlined, // Invoke is inlined (ie dead).
283 kMIRInlinedPred, // Invoke is inlined via prediction.
284 kMIRCallee, // Instruction is inlined from callee.
buzbeecbd6d442012-11-17 14:11:25 -0800285 kMIRIgnoreSuspendCheck,
286 kMIRDup,
buzbee02031b12012-11-23 09:41:35 -0800287 kMIRMark, // Temporary node mark.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700288 kMIRStoreNonTemporal,
Jean Christophe Beyler89fde262014-04-30 11:40:07 -0700289 kMIRLastMIRFlag,
buzbeecbd6d442012-11-17 14:11:25 -0800290};
291
buzbee02031b12012-11-23 09:41:35 -0800292// For successor_block_list.
buzbeecbd6d442012-11-17 14:11:25 -0800293enum BlockListType {
294 kNotUsed = 0,
295 kCatch,
296 kPackedSwitch,
297 kSparseSwitch,
298};
299
300enum AssemblerStatus {
301 kSuccess,
302 kRetryAll,
303};
304
305enum OpSize {
buzbee695d13a2014-04-19 13:32:20 -0700306 kWord, // Natural word size of target (32/64).
307 k32,
308 k64,
309 kReference, // Object reference; compressed on 64-bit targets.
buzbeecbd6d442012-11-17 14:11:25 -0800310 kSingle,
311 kDouble,
312 kUnsignedHalf,
313 kSignedHalf,
314 kUnsignedByte,
315 kSignedByte,
316};
317
318std::ostream& operator<<(std::ostream& os, const OpSize& kind);
319
320enum OpKind {
321 kOpMov,
Razvan A Lupusorubd288c22013-12-20 17:27:23 -0800322 kOpCmov,
buzbeecbd6d442012-11-17 14:11:25 -0800323 kOpMvn,
324 kOpCmp,
325 kOpLsl,
326 kOpLsr,
327 kOpAsr,
328 kOpRor,
329 kOpNot,
330 kOpAnd,
331 kOpOr,
332 kOpXor,
333 kOpNeg,
334 kOpAdd,
335 kOpAdc,
336 kOpSub,
337 kOpSbc,
338 kOpRsub,
339 kOpMul,
340 kOpDiv,
341 kOpRem,
342 kOpBic,
343 kOpCmn,
344 kOpTst,
Vladimir Markoa8b4caf2013-10-24 15:08:57 +0100345 kOpRev,
346 kOpRevsh,
buzbeecbd6d442012-11-17 14:11:25 -0800347 kOpBkpt,
348 kOpBlx,
349 kOpPush,
350 kOpPop,
351 kOp2Char,
352 kOp2Short,
353 kOp2Byte,
354 kOpCondBr,
355 kOpUncondBr,
356 kOpBx,
357 kOpInvalid,
358};
359
Razvan A Lupusoru2c498d12014-01-29 16:02:57 -0800360enum MoveType {
361 kMov8GP, // Move 8-bit general purpose register.
362 kMov16GP, // Move 16-bit general purpose register.
363 kMov32GP, // Move 32-bit general purpose register.
364 kMov64GP, // Move 64-bit general purpose register.
365 kMov32FP, // Move 32-bit FP register.
366 kMov64FP, // Move 64-bit FP register.
367 kMovLo64FP, // Move low 32-bits of 64-bit FP register.
368 kMovHi64FP, // Move high 32-bits of 64-bit FP register.
369 kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region.
370 kMov128FP = kMovU128FP,
371 kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes.
372 kMovLo128FP, // Move low 64-bits of 128-bit FP register.
373 kMovHi128FP, // Move high 64-bits of 128-bit FP register.
374};
375
buzbeecbd6d442012-11-17 14:11:25 -0800376std::ostream& operator<<(std::ostream& os, const OpKind& kind);
377
378enum ConditionCode {
379 kCondEq, // equal
380 kCondNe, // not equal
Vladimir Marko58af1f92013-12-19 13:31:15 +0000381 kCondCs, // carry set
382 kCondCc, // carry clear
Vladimir Marko459f4df2013-12-20 17:03:09 +0000383 kCondUlt, // unsigned less than
384 kCondUge, // unsigned greater than or same
buzbeecbd6d442012-11-17 14:11:25 -0800385 kCondMi, // minus
386 kCondPl, // plus, positive or zero
387 kCondVs, // overflow
388 kCondVc, // no overflow
389 kCondHi, // unsigned greater than
390 kCondLs, // unsigned lower or same
391 kCondGe, // signed greater than or equal
392 kCondLt, // signed less than
393 kCondGt, // signed greater than
394 kCondLe, // signed less than or equal
395 kCondAl, // always
396 kCondNv, // never
397};
398
399std::ostream& operator<<(std::ostream& os, const ConditionCode& kind);
400
401// Target specific condition encodings
402enum ArmConditionCode {
403 kArmCondEq = 0x0, // 0000
404 kArmCondNe = 0x1, // 0001
405 kArmCondCs = 0x2, // 0010
406 kArmCondCc = 0x3, // 0011
407 kArmCondMi = 0x4, // 0100
408 kArmCondPl = 0x5, // 0101
409 kArmCondVs = 0x6, // 0110
410 kArmCondVc = 0x7, // 0111
411 kArmCondHi = 0x8, // 1000
412 kArmCondLs = 0x9, // 1001
413 kArmCondGe = 0xa, // 1010
414 kArmCondLt = 0xb, // 1011
415 kArmCondGt = 0xc, // 1100
416 kArmCondLe = 0xd, // 1101
417 kArmCondAl = 0xe, // 1110
418 kArmCondNv = 0xf, // 1111
419};
420
421std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind);
422
423enum X86ConditionCode {
424 kX86CondO = 0x0, // overflow
425 kX86CondNo = 0x1, // not overflow
426
427 kX86CondB = 0x2, // below
428 kX86CondNae = kX86CondB, // not-above-equal
429 kX86CondC = kX86CondB, // carry
430
431 kX86CondNb = 0x3, // not-below
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700432 kX86CondAe = kX86CondNb, // above-equal
433 kX86CondNc = kX86CondNb, // not-carry
buzbeecbd6d442012-11-17 14:11:25 -0800434
435 kX86CondZ = 0x4, // zero
436 kX86CondEq = kX86CondZ, // equal
437
438 kX86CondNz = 0x5, // not-zero
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700439 kX86CondNe = kX86CondNz, // not-equal
buzbeecbd6d442012-11-17 14:11:25 -0800440
441 kX86CondBe = 0x6, // below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700442 kX86CondNa = kX86CondBe, // not-above
buzbeecbd6d442012-11-17 14:11:25 -0800443
444 kX86CondNbe = 0x7, // not-below-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700445 kX86CondA = kX86CondNbe, // above
buzbeecbd6d442012-11-17 14:11:25 -0800446
447 kX86CondS = 0x8, // sign
448 kX86CondNs = 0x9, // not-sign
449
450 kX86CondP = 0xa, // 8-bit parity even
451 kX86CondPE = kX86CondP,
452
453 kX86CondNp = 0xb, // 8-bit parity odd
454 kX86CondPo = kX86CondNp,
455
456 kX86CondL = 0xc, // less-than
457 kX86CondNge = kX86CondL, // not-greater-equal
458
459 kX86CondNl = 0xd, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700460 kX86CondGe = kX86CondNl, // not-greater-equal
buzbeecbd6d442012-11-17 14:11:25 -0800461
462 kX86CondLe = 0xe, // less-than-equal
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700463 kX86CondNg = kX86CondLe, // not-greater
buzbeecbd6d442012-11-17 14:11:25 -0800464
465 kX86CondNle = 0xf, // not-less-than
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700466 kX86CondG = kX86CondNle, // greater
buzbeecbd6d442012-11-17 14:11:25 -0800467};
468
469std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind);
470
buzbeecbd6d442012-11-17 14:11:25 -0800471enum DividePattern {
472 DivideNone,
473 Divide3,
474 Divide5,
475 Divide7,
476};
477
478std::ostream& operator<<(std::ostream& os, const DividePattern& pattern);
479
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800480/**
481 * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers").
Hans Boehm48f5c472014-06-27 14:50:10 -0700482 * @details We define the combined barrier types that are actually required
483 * by the Java Memory Model, rather than using exactly the terminology from
484 * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release
485 * primitives. Note that the JSR-133 cookbook generally does not deal with
486 * store atomicity issues, and the recipes there are not always entirely sufficient.
487 * The current recipe is as follows:
488 * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store.
489 * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.)
490 * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800491 * -# Use StoreStore barrier after all stores but before return from any constructor whose
Hans Boehm48f5c472014-06-27 14:50:10 -0700492 * class has final fields.
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700493 * -# Use NTStoreStore to order non-temporal stores with respect to all later
494 * store-to-memory instructions. Only generated together with non-temporal stores.
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800495 */
buzbee1bc37c62012-11-20 13:35:41 -0800496enum MemBarrierKind {
Hans Boehm48f5c472014-06-27 14:50:10 -0700497 kAnyStore,
498 kLoadAny,
buzbee1bc37c62012-11-20 13:35:41 -0800499 kStoreStore,
Jean Christophe Beylerb5bce7c2014-07-25 12:32:18 -0700500 kAnyAny,
501 kNTStoreStore,
buzbee1bc37c62012-11-20 13:35:41 -0800502};
503
504std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind);
505
buzbee02031b12012-11-23 09:41:35 -0800506enum OpFeatureFlags {
507 kIsBranch = 0,
508 kNoOperand,
509 kIsUnaryOp,
510 kIsBinaryOp,
511 kIsTertiaryOp,
512 kIsQuadOp,
513 kIsQuinOp,
514 kIsSextupleOp,
515 kIsIT,
Serban Constantinescu63999682014-07-15 17:44:21 +0100516 kIsMoveOp,
buzbee02031b12012-11-23 09:41:35 -0800517 kMemLoad,
518 kMemStore,
Serban Constantinescu63999682014-07-15 17:44:21 +0100519 kMemVolatile,
520 kMemScaledx0,
521 kMemScaledx2,
522 kMemScaledx4,
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700523 kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes.
buzbee02031b12012-11-23 09:41:35 -0800524 kRegDef0,
525 kRegDef1,
Razvan A Lupusoru99ad7232014-02-25 17:41:08 -0800526 kRegDef2,
buzbee02031b12012-11-23 09:41:35 -0800527 kRegDefA,
528 kRegDefD,
529 kRegDefFPCSList0,
530 kRegDefFPCSList2,
531 kRegDefList0,
532 kRegDefList1,
533 kRegDefList2,
534 kRegDefLR,
535 kRegDefSP,
536 kRegUse0,
537 kRegUse1,
538 kRegUse2,
539 kRegUse3,
540 kRegUse4,
541 kRegUseA,
542 kRegUseC,
543 kRegUseD,
Vladimir Marko70b797d2013-12-03 15:25:24 +0000544 kRegUseB,
buzbee02031b12012-11-23 09:41:35 -0800545 kRegUseFPCSList0,
546 kRegUseFPCSList2,
547 kRegUseList0,
548 kRegUseList1,
549 kRegUseLR,
550 kRegUsePC,
551 kRegUseSP,
552 kSetsCCodes,
Serguei Katkove90501d2014-03-12 15:56:54 +0700553 kUsesCCodes,
buzbee9da5c102014-03-28 12:59:18 -0700554 kUseFpStack,
555 kUseHi,
556 kUseLo,
557 kDefHi,
558 kDefLo
buzbee02031b12012-11-23 09:41:35 -0800559};
560
buzbeef662a7c2013-02-12 16:19:43 -0800561enum SelectInstructionKind {
562 kSelectNone,
563 kSelectConst,
564 kSelectMove,
565 kSelectGoto
566};
567
buzbeea5abf702013-04-12 14:39:29 -0700568std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind);
569
buzbeeb48819d2013-09-14 16:15:25 -0700570// LIR fixup kinds for Arm
571enum FixupKind {
572 kFixupNone,
573 kFixupLabel, // For labels we just adjust the offset.
Vladimir Marko306f0172014-01-07 18:21:20 +0000574 kFixupLoad, // Mostly for immediates.
buzbeeb48819d2013-09-14 16:15:25 -0700575 kFixupVLoad, // FP load which *may* be pc-relative.
576 kFixupCBxZ, // Cbz, Cbnz.
Zheng Xu5d7cdec2014-08-18 17:28:22 +0800577 kFixupTBxZ, // Tbz, Tbnz.
buzbeeb48819d2013-09-14 16:15:25 -0700578 kFixupPushPop, // Not really pc relative, but changes size based on args.
579 kFixupCondBranch, // Conditional branch
580 kFixupT1Branch, // Thumb1 Unconditional branch
581 kFixupT2Branch, // Thumb2 Unconditional branch
582 kFixupBlx1, // Blx1 (start of Blx1/Blx2 pair).
583 kFixupBl1, // Bl1 (start of Bl1/Bl2 pair).
584 kFixupAdr, // Adr.
585 kFixupMovImmLST, // kThumb2MovImm16LST.
586 kFixupMovImmHST, // kThumb2MovImm16HST.
587 kFixupAlign4, // Align to 4-byte boundary.
588};
589
590std::ostream& operator<<(std::ostream& os, const FixupKind& kind);
591
Andreas Gampe3c12c512014-06-24 18:46:29 +0000592enum VolatileKind {
593 kNotVolatile, // Load/Store is not volatile
594 kVolatile // Load/Store is volatile
595};
596
597std::ostream& operator<<(std::ostream& os, const VolatileKind& kind);
598
Andreas Gampeccc60262014-07-04 18:02:38 -0700599enum WideKind {
600 kNotWide, // Non-wide view
601 kWide, // Wide view
602 kRef // Ref width
603};
604
605std::ostream& operator<<(std::ostream& os, const WideKind& kind);
606
buzbeecbd6d442012-11-17 14:11:25 -0800607} // namespace art
608
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700609#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_