buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 1 | /* |
| 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 Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_DEX_COMPILER_ENUMS_H_ |
| 18 | #define ART_COMPILER_DEX_COMPILER_ENUMS_H_ |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 19 | |
| 20 | #include "dex_instruction.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | enum RegisterClass { |
Serban Constantinescu | 032d377 | 2014-05-23 17:38:18 +0100 | [diff] [blame] | 25 | kInvalidRegClass, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 26 | kCoreReg, |
| 27 | kFPReg, |
buzbee | a0cd2d7 | 2014-06-01 09:33:49 -0700 | [diff] [blame] | 28 | kRefReg, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 29 | kAnyReg, |
| 30 | }; |
| 31 | |
buzbee | 091cc40 | 2014-03-31 10:14:40 -0700 | [diff] [blame] | 32 | enum BitsUsed { |
| 33 | kSize32Bits, |
| 34 | kSize64Bits, |
| 35 | kSize128Bits, |
| 36 | kSize256Bits, |
| 37 | kSize512Bits, |
| 38 | kSize1024Bits, |
| 39 | }; |
| 40 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 41 | enum SpecialTargetRegister { |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 42 | kSelf, // Thread pointer. |
| 43 | kSuspend, // Used to reduce suspend checks for some targets. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 44 | kLr, |
| 45 | kPc, |
| 46 | kSp, |
| 47 | kArg0, |
| 48 | kArg1, |
| 49 | kArg2, |
| 50 | kArg3, |
Dmitry Petrochenko | 58994cd | 2014-05-17 01:02:18 +0700 | [diff] [blame] | 51 | kArg4, |
| 52 | kArg5, |
buzbee | 33ae558 | 2014-06-12 14:56:32 -0700 | [diff] [blame] | 53 | kArg6, |
| 54 | kArg7, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 55 | kFArg0, |
| 56 | kFArg1, |
| 57 | kFArg2, |
| 58 | kFArg3, |
Dmitry Petrochenko | 58994cd | 2014-05-17 01:02:18 +0700 | [diff] [blame] | 59 | kFArg4, |
| 60 | kFArg5, |
| 61 | kFArg6, |
| 62 | kFArg7, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 63 | kRet0, |
| 64 | kRet1, |
| 65 | kInvokeTgt, |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 66 | kHiddenArg, |
| 67 | kHiddenFpArg, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 68 | kCount |
| 69 | }; |
| 70 | |
| 71 | enum RegLocationType { |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 72 | kLocDalvikFrame = 0, // Normal Dalvik register |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 73 | kLocPhysReg, |
| 74 | kLocCompilerTemp, |
| 75 | kLocInvalid |
| 76 | }; |
| 77 | |
| 78 | enum BBType { |
buzbee | 0d82948 | 2013-10-11 15:24:55 -0700 | [diff] [blame] | 79 | kNullBlock, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 80 | kEntryBlock, |
| 81 | kDalvikByteCode, |
| 82 | kExitBlock, |
| 83 | kExceptionHandling, |
| 84 | kDead, |
| 85 | }; |
| 86 | |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 87 | // Shared pseudo opcodes - must be < 0. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 88 | enum LIRPseudoOpcode { |
buzbee | a169e1d | 2012-12-05 14:26:44 -0800 | [diff] [blame] | 89 | 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, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 98 | kPseudoEntryBlock = -7, |
| 99 | kPseudoExitBlock = -6, |
| 100 | kPseudoTargetLabel = -5, |
| 101 | kPseudoDalvikByteCodeBoundary = -4, |
| 102 | kPseudoPseudoAlign4 = -3, |
| 103 | kPseudoEHBlockLabel = -2, |
| 104 | kPseudoNormalBlockLabel = -1, |
| 105 | }; |
| 106 | |
| 107 | enum ExtendedMIROpcode { |
| 108 | kMirOpFirst = kNumPackedOpcodes, |
| 109 | kMirOpPhi = kMirOpFirst, |
| 110 | kMirOpCopy, |
| 111 | kMirOpFusedCmplFloat, |
| 112 | kMirOpFusedCmpgFloat, |
| 113 | kMirOpFusedCmplDouble, |
| 114 | kMirOpFusedCmpgDouble, |
| 115 | kMirOpFusedCmpLong, |
| 116 | kMirOpNop, |
| 117 | kMirOpNullCheck, |
| 118 | kMirOpRangeCheck, |
| 119 | kMirOpDivZeroCheck, |
| 120 | kMirOpCheck, |
buzbee | a169e1d | 2012-12-05 14:26:44 -0800 | [diff] [blame] | 121 | kMirOpCheckPart2, |
buzbee | f662a7c | 2013-02-12 16:19:43 -0800 | [diff] [blame] | 122 | kMirOpSelect, |
Mark Mendell | d65c51a | 2014-04-29 16:55:20 -0400 | [diff] [blame] | 123 | |
| 124 | // Vector opcodes: |
| 125 | // TypeSize is an encoded field giving the element type and the vector size. |
| 126 | // It is encoded as OpSize << 16 | (number of bits in vector) |
| 127 | // |
| 128 | // Destination and source are integers that will be interpreted by the |
| 129 | // backend that supports Vector operations. Backends are permitted to support only |
| 130 | // certain vector register sizes. |
| 131 | // |
| 132 | // At this point, only two operand instructions are supported. Three operand instructions |
| 133 | // could be supported by using a bit in TypeSize and arg[0] where needed. |
| 134 | |
| 135 | // @brief MIR to move constant data to a vector register |
| 136 | // vA: number of bits in register |
| 137 | // vB: destination |
| 138 | // args[0]~args[3]: up to 128 bits of data for initialization |
| 139 | kMirOpConstVector, |
| 140 | |
| 141 | // @brief MIR to move a vectorized register to another |
| 142 | // vA: TypeSize |
| 143 | // vB: destination |
| 144 | // vC: source |
| 145 | kMirOpMoveVector, |
| 146 | |
| 147 | // @brief Packed multiply of units in two vector registers: vB = vB .* vC using vA to know the type of the vector. |
| 148 | // vA: TypeSize |
| 149 | // vB: destination and source |
| 150 | // vC: source |
| 151 | kMirOpPackedMultiply, |
| 152 | |
| 153 | // @brief Packed addition of units in two vector registers: vB = vB .+ vC using vA to know the type of the vector. |
| 154 | // vA: TypeSize |
| 155 | // vB: destination and source |
| 156 | // vC: source |
| 157 | kMirOpPackedAddition, |
| 158 | |
| 159 | // @brief Packed subtraction of units in two vector registers: vB = vB .- vC using vA to know the type of the vector. |
| 160 | // vA: TypeSize |
| 161 | // vB: destination and source |
| 162 | // vC: source |
| 163 | kMirOpPackedSubtract, |
| 164 | |
| 165 | // @brief Packed shift left of units in two vector registers: vB = vB .<< vC using vA to know the type of the vector. |
| 166 | // vA: TypeSize |
| 167 | // vB: destination and source |
| 168 | // vC: immediate |
| 169 | kMirOpPackedShiftLeft, |
| 170 | |
| 171 | // @brief Packed signed shift right of units in two vector registers: vB = vB .>> vC using vA to know the type of the vector. |
| 172 | // vA: TypeSize |
| 173 | // vB: destination and source |
| 174 | // vC: immediate |
| 175 | kMirOpPackedSignedShiftRight, |
| 176 | |
| 177 | // @brief Packed unsigned shift right of units in two vector registers: vB = vB .>>> vC using vA to know the type of the vector. |
| 178 | // vA: TypeSize |
| 179 | // vB: destination and source |
| 180 | // vC: immediate |
| 181 | kMirOpPackedUnsignedShiftRight, |
| 182 | |
| 183 | // @brief Packed bitwise and of units in two vector registers: vB = vB .& vC using vA to know the type of the vector. |
| 184 | // vA: TypeSize |
| 185 | // vB: destination and source |
| 186 | // vC: source |
| 187 | kMirOpPackedAnd, |
| 188 | |
| 189 | // @brief Packed bitwise or of units in two vector registers: vB = vB .| vC using vA to know the type of the vector. |
| 190 | // vA: TypeSize |
| 191 | // vB: destination and source |
| 192 | // vC: source |
| 193 | kMirOpPackedOr, |
| 194 | |
| 195 | // @brief Packed bitwise xor of units in two vector registers: vB = vB .^ vC using vA to know the type of the vector. |
| 196 | // vA: TypeSize |
| 197 | // vB: destination and source |
| 198 | // vC: source |
| 199 | kMirOpPackedXor, |
| 200 | |
| 201 | // @brief Reduce a 128-bit packed element into a single VR by taking lower bits |
| 202 | // @details Instruction does a horizontal addition of the packed elements and then adds it to VR |
| 203 | // vA: TypeSize |
| 204 | // vB: destination and source VR (not vector register) |
| 205 | // vC: source (vector register) |
| 206 | kMirOpPackedAddReduce, |
| 207 | |
| 208 | // @brief Extract a packed element into a single VR. |
| 209 | // vA: TypeSize |
| 210 | // vB: destination VR (not vector register) |
| 211 | // vC: source (vector register) |
| 212 | // arg[0]: The index to use for extraction from vector register (which packed element) |
| 213 | kMirOpPackedReduce, |
| 214 | |
| 215 | // @brief Create a vector value, with all TypeSize values equal to vC |
| 216 | // vA: TypeSize |
| 217 | // vB: destination vector register |
| 218 | // vC: source VR (not vector register) |
| 219 | kMirOpPackedSet, |
| 220 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 221 | kMirOpLast, |
| 222 | }; |
| 223 | |
Jean Christophe Beyler | 89fde26 | 2014-04-30 11:40:07 -0700 | [diff] [blame] | 224 | enum MIROptimizationFlagPositions { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 225 | kMIRIgnoreNullCheck = 0, |
| 226 | kMIRNullCheckOnly, |
| 227 | kMIRIgnoreRangeCheck, |
| 228 | kMIRRangeCheckOnly, |
Vladimir Marko | bfea9c2 | 2014-01-17 17:49:33 +0000 | [diff] [blame] | 229 | kMIRIgnoreClInitCheck, |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 230 | kMIRInlined, // Invoke is inlined (ie dead). |
| 231 | kMIRInlinedPred, // Invoke is inlined via prediction. |
| 232 | kMIRCallee, // Instruction is inlined from callee. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 233 | kMIRIgnoreSuspendCheck, |
| 234 | kMIRDup, |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 235 | kMIRMark, // Temporary node mark. |
Jean Christophe Beyler | 89fde26 | 2014-04-30 11:40:07 -0700 | [diff] [blame] | 236 | kMIRLastMIRFlag, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 237 | }; |
| 238 | |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 239 | // For successor_block_list. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 240 | enum BlockListType { |
| 241 | kNotUsed = 0, |
| 242 | kCatch, |
| 243 | kPackedSwitch, |
| 244 | kSparseSwitch, |
| 245 | }; |
| 246 | |
| 247 | enum AssemblerStatus { |
| 248 | kSuccess, |
| 249 | kRetryAll, |
| 250 | }; |
| 251 | |
| 252 | enum OpSize { |
buzbee | 695d13a | 2014-04-19 13:32:20 -0700 | [diff] [blame] | 253 | kWord, // Natural word size of target (32/64). |
| 254 | k32, |
| 255 | k64, |
| 256 | kReference, // Object reference; compressed on 64-bit targets. |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 257 | kSingle, |
| 258 | kDouble, |
| 259 | kUnsignedHalf, |
| 260 | kSignedHalf, |
| 261 | kUnsignedByte, |
| 262 | kSignedByte, |
| 263 | }; |
| 264 | |
| 265 | std::ostream& operator<<(std::ostream& os, const OpSize& kind); |
| 266 | |
| 267 | enum OpKind { |
| 268 | kOpMov, |
Razvan A Lupusoru | bd288c2 | 2013-12-20 17:27:23 -0800 | [diff] [blame] | 269 | kOpCmov, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 270 | kOpMvn, |
| 271 | kOpCmp, |
| 272 | kOpLsl, |
| 273 | kOpLsr, |
| 274 | kOpAsr, |
| 275 | kOpRor, |
| 276 | kOpNot, |
| 277 | kOpAnd, |
| 278 | kOpOr, |
| 279 | kOpXor, |
| 280 | kOpNeg, |
| 281 | kOpAdd, |
| 282 | kOpAdc, |
| 283 | kOpSub, |
| 284 | kOpSbc, |
| 285 | kOpRsub, |
| 286 | kOpMul, |
| 287 | kOpDiv, |
| 288 | kOpRem, |
| 289 | kOpBic, |
| 290 | kOpCmn, |
| 291 | kOpTst, |
Vladimir Marko | a8b4caf | 2013-10-24 15:08:57 +0100 | [diff] [blame] | 292 | kOpRev, |
| 293 | kOpRevsh, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 294 | kOpBkpt, |
| 295 | kOpBlx, |
| 296 | kOpPush, |
| 297 | kOpPop, |
| 298 | kOp2Char, |
| 299 | kOp2Short, |
| 300 | kOp2Byte, |
| 301 | kOpCondBr, |
| 302 | kOpUncondBr, |
| 303 | kOpBx, |
| 304 | kOpInvalid, |
| 305 | }; |
| 306 | |
Razvan A Lupusoru | 2c498d1 | 2014-01-29 16:02:57 -0800 | [diff] [blame] | 307 | enum MoveType { |
| 308 | kMov8GP, // Move 8-bit general purpose register. |
| 309 | kMov16GP, // Move 16-bit general purpose register. |
| 310 | kMov32GP, // Move 32-bit general purpose register. |
| 311 | kMov64GP, // Move 64-bit general purpose register. |
| 312 | kMov32FP, // Move 32-bit FP register. |
| 313 | kMov64FP, // Move 64-bit FP register. |
| 314 | kMovLo64FP, // Move low 32-bits of 64-bit FP register. |
| 315 | kMovHi64FP, // Move high 32-bits of 64-bit FP register. |
| 316 | kMovU128FP, // Move 128-bit FP register to/from possibly unaligned region. |
| 317 | kMov128FP = kMovU128FP, |
| 318 | kMovA128FP, // Move 128-bit FP register to/from region surely aligned to 16-bytes. |
| 319 | kMovLo128FP, // Move low 64-bits of 128-bit FP register. |
| 320 | kMovHi128FP, // Move high 64-bits of 128-bit FP register. |
| 321 | }; |
| 322 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 323 | std::ostream& operator<<(std::ostream& os, const OpKind& kind); |
| 324 | |
| 325 | enum ConditionCode { |
| 326 | kCondEq, // equal |
| 327 | kCondNe, // not equal |
Vladimir Marko | 58af1f9 | 2013-12-19 13:31:15 +0000 | [diff] [blame] | 328 | kCondCs, // carry set |
| 329 | kCondCc, // carry clear |
Vladimir Marko | 459f4df | 2013-12-20 17:03:09 +0000 | [diff] [blame] | 330 | kCondUlt, // unsigned less than |
| 331 | kCondUge, // unsigned greater than or same |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 332 | kCondMi, // minus |
| 333 | kCondPl, // plus, positive or zero |
| 334 | kCondVs, // overflow |
| 335 | kCondVc, // no overflow |
| 336 | kCondHi, // unsigned greater than |
| 337 | kCondLs, // unsigned lower or same |
| 338 | kCondGe, // signed greater than or equal |
| 339 | kCondLt, // signed less than |
| 340 | kCondGt, // signed greater than |
| 341 | kCondLe, // signed less than or equal |
| 342 | kCondAl, // always |
| 343 | kCondNv, // never |
| 344 | }; |
| 345 | |
| 346 | std::ostream& operator<<(std::ostream& os, const ConditionCode& kind); |
| 347 | |
| 348 | // Target specific condition encodings |
| 349 | enum ArmConditionCode { |
| 350 | kArmCondEq = 0x0, // 0000 |
| 351 | kArmCondNe = 0x1, // 0001 |
| 352 | kArmCondCs = 0x2, // 0010 |
| 353 | kArmCondCc = 0x3, // 0011 |
| 354 | kArmCondMi = 0x4, // 0100 |
| 355 | kArmCondPl = 0x5, // 0101 |
| 356 | kArmCondVs = 0x6, // 0110 |
| 357 | kArmCondVc = 0x7, // 0111 |
| 358 | kArmCondHi = 0x8, // 1000 |
| 359 | kArmCondLs = 0x9, // 1001 |
| 360 | kArmCondGe = 0xa, // 1010 |
| 361 | kArmCondLt = 0xb, // 1011 |
| 362 | kArmCondGt = 0xc, // 1100 |
| 363 | kArmCondLe = 0xd, // 1101 |
| 364 | kArmCondAl = 0xe, // 1110 |
| 365 | kArmCondNv = 0xf, // 1111 |
| 366 | }; |
| 367 | |
| 368 | std::ostream& operator<<(std::ostream& os, const ArmConditionCode& kind); |
| 369 | |
| 370 | enum X86ConditionCode { |
| 371 | kX86CondO = 0x0, // overflow |
| 372 | kX86CondNo = 0x1, // not overflow |
| 373 | |
| 374 | kX86CondB = 0x2, // below |
| 375 | kX86CondNae = kX86CondB, // not-above-equal |
| 376 | kX86CondC = kX86CondB, // carry |
| 377 | |
| 378 | kX86CondNb = 0x3, // not-below |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 379 | kX86CondAe = kX86CondNb, // above-equal |
| 380 | kX86CondNc = kX86CondNb, // not-carry |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 381 | |
| 382 | kX86CondZ = 0x4, // zero |
| 383 | kX86CondEq = kX86CondZ, // equal |
| 384 | |
| 385 | kX86CondNz = 0x5, // not-zero |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 386 | kX86CondNe = kX86CondNz, // not-equal |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 387 | |
| 388 | kX86CondBe = 0x6, // below-equal |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 389 | kX86CondNa = kX86CondBe, // not-above |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 390 | |
| 391 | kX86CondNbe = 0x7, // not-below-equal |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 392 | kX86CondA = kX86CondNbe, // above |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 393 | |
| 394 | kX86CondS = 0x8, // sign |
| 395 | kX86CondNs = 0x9, // not-sign |
| 396 | |
| 397 | kX86CondP = 0xa, // 8-bit parity even |
| 398 | kX86CondPE = kX86CondP, |
| 399 | |
| 400 | kX86CondNp = 0xb, // 8-bit parity odd |
| 401 | kX86CondPo = kX86CondNp, |
| 402 | |
| 403 | kX86CondL = 0xc, // less-than |
| 404 | kX86CondNge = kX86CondL, // not-greater-equal |
| 405 | |
| 406 | kX86CondNl = 0xd, // not-less-than |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 407 | kX86CondGe = kX86CondNl, // not-greater-equal |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 408 | |
| 409 | kX86CondLe = 0xe, // less-than-equal |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 410 | kX86CondNg = kX86CondLe, // not-greater |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 411 | |
| 412 | kX86CondNle = 0xf, // not-less-than |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 413 | kX86CondG = kX86CondNle, // greater |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | std::ostream& operator<<(std::ostream& os, const X86ConditionCode& kind); |
| 417 | |
| 418 | enum ThrowKind { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 419 | kThrowNoSuchMethod, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 420 | }; |
| 421 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 422 | enum DividePattern { |
| 423 | DivideNone, |
| 424 | Divide3, |
| 425 | Divide5, |
| 426 | Divide7, |
| 427 | }; |
| 428 | |
| 429 | std::ostream& operator<<(std::ostream& os, const DividePattern& pattern); |
| 430 | |
Razvan A Lupusoru | 99ad723 | 2014-02-25 17:41:08 -0800 | [diff] [blame] | 431 | /** |
| 432 | * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers"). |
| 433 | * @details Without context sensitive analysis, the most conservative set of barriers |
| 434 | * must be issued to ensure the Java Memory Model. Thus the recipe is as follows: |
| 435 | * -# Use StoreStore barrier before volatile store. |
| 436 | * -# Use StoreLoad barrier after volatile store. |
| 437 | * -# Use LoadLoad and LoadStore barrier after each volatile load. |
| 438 | * -# Use StoreStore barrier after all stores but before return from any constructor whose |
| 439 | * class has final fields. |
| 440 | */ |
buzbee | 1bc37c6 | 2012-11-20 13:35:41 -0800 | [diff] [blame] | 441 | enum MemBarrierKind { |
| 442 | kLoadStore, |
| 443 | kLoadLoad, |
| 444 | kStoreStore, |
| 445 | kStoreLoad |
| 446 | }; |
| 447 | |
| 448 | std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind); |
| 449 | |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 450 | enum OpFeatureFlags { |
| 451 | kIsBranch = 0, |
| 452 | kNoOperand, |
| 453 | kIsUnaryOp, |
| 454 | kIsBinaryOp, |
| 455 | kIsTertiaryOp, |
| 456 | kIsQuadOp, |
| 457 | kIsQuinOp, |
| 458 | kIsSextupleOp, |
| 459 | kIsIT, |
| 460 | kMemLoad, |
| 461 | kMemStore, |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 462 | kPCRelFixup, // x86 FIXME: add NEEDS_FIXUP to instruction attributes. |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 463 | kRegDef0, |
| 464 | kRegDef1, |
Razvan A Lupusoru | 99ad723 | 2014-02-25 17:41:08 -0800 | [diff] [blame] | 465 | kRegDef2, |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 466 | kRegDefA, |
| 467 | kRegDefD, |
| 468 | kRegDefFPCSList0, |
| 469 | kRegDefFPCSList2, |
| 470 | kRegDefList0, |
| 471 | kRegDefList1, |
| 472 | kRegDefList2, |
| 473 | kRegDefLR, |
| 474 | kRegDefSP, |
| 475 | kRegUse0, |
| 476 | kRegUse1, |
| 477 | kRegUse2, |
| 478 | kRegUse3, |
| 479 | kRegUse4, |
| 480 | kRegUseA, |
| 481 | kRegUseC, |
| 482 | kRegUseD, |
Vladimir Marko | 70b797d | 2013-12-03 15:25:24 +0000 | [diff] [blame] | 483 | kRegUseB, |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 484 | kRegUseFPCSList0, |
| 485 | kRegUseFPCSList2, |
| 486 | kRegUseList0, |
| 487 | kRegUseList1, |
| 488 | kRegUseLR, |
| 489 | kRegUsePC, |
| 490 | kRegUseSP, |
| 491 | kSetsCCodes, |
Serguei Katkov | e90501d | 2014-03-12 15:56:54 +0700 | [diff] [blame] | 492 | kUsesCCodes, |
buzbee | 9da5c10 | 2014-03-28 12:59:18 -0700 | [diff] [blame] | 493 | kUseFpStack, |
| 494 | kUseHi, |
| 495 | kUseLo, |
| 496 | kDefHi, |
| 497 | kDefLo |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 498 | }; |
| 499 | |
buzbee | f662a7c | 2013-02-12 16:19:43 -0800 | [diff] [blame] | 500 | enum SelectInstructionKind { |
| 501 | kSelectNone, |
| 502 | kSelectConst, |
| 503 | kSelectMove, |
| 504 | kSelectGoto |
| 505 | }; |
| 506 | |
buzbee | a5abf70 | 2013-04-12 14:39:29 -0700 | [diff] [blame] | 507 | std::ostream& operator<<(std::ostream& os, const SelectInstructionKind& kind); |
| 508 | |
buzbee | b48819d | 2013-09-14 16:15:25 -0700 | [diff] [blame] | 509 | // LIR fixup kinds for Arm |
| 510 | enum FixupKind { |
| 511 | kFixupNone, |
| 512 | kFixupLabel, // For labels we just adjust the offset. |
Vladimir Marko | 306f017 | 2014-01-07 18:21:20 +0000 | [diff] [blame] | 513 | kFixupLoad, // Mostly for immediates. |
buzbee | b48819d | 2013-09-14 16:15:25 -0700 | [diff] [blame] | 514 | kFixupVLoad, // FP load which *may* be pc-relative. |
| 515 | kFixupCBxZ, // Cbz, Cbnz. |
| 516 | kFixupPushPop, // Not really pc relative, but changes size based on args. |
| 517 | kFixupCondBranch, // Conditional branch |
| 518 | kFixupT1Branch, // Thumb1 Unconditional branch |
| 519 | kFixupT2Branch, // Thumb2 Unconditional branch |
| 520 | kFixupBlx1, // Blx1 (start of Blx1/Blx2 pair). |
| 521 | kFixupBl1, // Bl1 (start of Bl1/Bl2 pair). |
| 522 | kFixupAdr, // Adr. |
| 523 | kFixupMovImmLST, // kThumb2MovImm16LST. |
| 524 | kFixupMovImmHST, // kThumb2MovImm16HST. |
| 525 | kFixupAlign4, // Align to 4-byte boundary. |
| 526 | }; |
| 527 | |
| 528 | std::ostream& operator<<(std::ostream& os, const FixupKind& kind); |
| 529 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame] | 530 | } // namespace art |
| 531 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 532 | #endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_ |