| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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 | |
| 17 | #include "Dalvik.h" |
| 18 | #include "libdex/OpCode.h" |
| 19 | #include "dexdump/OpCodeNames.h" |
| 20 | |
| 21 | #include "../../CompilerInternals.h" |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 22 | #include "ArmLIR.h" |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 23 | #include <unistd.h> /* for cacheflush */ |
| 24 | |
| 25 | /* |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 26 | * opcode: ArmOpCode enum |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 27 | * skeleton: pre-designated bit-pattern for this opcode |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 28 | * k0: key to applying ds/de |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 29 | * ds: dest start bit position |
| 30 | * de: dest end bit position |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 31 | * k1: key to applying s1s/s1e |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 32 | * s1s: src1 start bit position |
| 33 | * s1e: src1 end bit position |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 34 | * k2: key to applying s2s/s2e |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 35 | * s2s: src2 start bit position |
| 36 | * s2e: src2 end bit position |
| 37 | * operands: number of operands (for sanity check purposes) |
| 38 | * name: mnemonic name |
| 39 | * fmt: for pretty-prining |
| 40 | */ |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 41 | #define ENCODING_MAP(opcode, skeleton, k0, ds, de, k1, s1s, s1e, k2, s2s, s2e, \ |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 42 | k3, k3s, k3e, flags, name, fmt, size) \ |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 43 | {skeleton, {{k0, ds, de}, {k1, s1s, s1e}, {k2, s2s, s2e}, \ |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 44 | {k3, k3s, k3e}}, opcode, flags, name, fmt, size} |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 45 | |
| 46 | /* Instruction dump string format keys: !pf, where "!" is the start |
| 47 | * of the key, "p" is which numeric operand to use and "f" is the |
| 48 | * print format. |
| 49 | * |
| 50 | * [p]ositions: |
| 51 | * 0 -> operands[0] (dest) |
| 52 | * 1 -> operands[1] (src1) |
| 53 | * 2 -> operands[2] (src2) |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 54 | * 3 -> operands[3] (extra) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 55 | * |
| 56 | * [f]ormats: |
| 57 | * h -> 4-digit hex |
| 58 | * d -> decimal |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 59 | * E -> decimal*4 |
| 60 | * F -> decimal*2 |
| 61 | * c -> branch condition (beq, bne, etc.) |
| 62 | * t -> pc-relative target |
| 63 | * u -> 1st half of bl[x] target |
| 64 | * v -> 2nd half ob bl[x] target |
| 65 | * R -> register list |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 66 | * s -> single precision floating point register |
| 67 | * S -> double precision floating point register |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 68 | * m -> Thumb2 modified immediate |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 69 | * n -> complimented Thumb2 modified immediate |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 70 | * M -> Thumb2 16-bit zero-extended immediate |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 71 | * b -> 4-digit binary |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 72 | * |
| 73 | * [!] escape. To insert "!", use "!!" |
| 74 | */ |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 75 | /* NOTE: must be kept in sync with enum ArmOpcode from ArmLIR.h */ |
| 76 | ArmEncodingMap EncodingMap[ARM_LAST] = { |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 77 | ENCODING_MAP(ARM_16BIT_DATA, 0x0000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 78 | BITBLT, 15, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 79 | IS_UNARY_OP, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 80 | "data", "0x!0h(!0d)", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 81 | ENCODING_MAP(THUMB_ADC_RR, 0x4140, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 82 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 83 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES | USES_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 84 | "adcs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 85 | ENCODING_MAP(THUMB_ADD_RRI3, 0x1c00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 86 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 87 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 88 | "adds", "r!0d, r!1d, #!2d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 89 | ENCODING_MAP(THUMB_ADD_RI8, 0x3000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 90 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 91 | IS_BINARY_OP | REG_DEF0_USE0 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 92 | "adds", "r!0d, r!0d, #!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 93 | ENCODING_MAP(THUMB_ADD_RRR, 0x1800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 94 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 95 | IS_TERTIARY_OP | REG_DEF0_USE12 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 96 | "adds", "r!0d, r!1d, r!2d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 97 | ENCODING_MAP(THUMB_ADD_RR_LH, 0x4440, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 98 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 99 | IS_BINARY_OP | REG_DEF0_USE01, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 100 | "add", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 101 | ENCODING_MAP(THUMB_ADD_RR_HL, 0x4480, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 102 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 103 | IS_BINARY_OP | REG_DEF0_USE01, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 104 | "add", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 105 | ENCODING_MAP(THUMB_ADD_RR_HH, 0x44c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 106 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 107 | IS_BINARY_OP | REG_DEF0_USE01, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 108 | "add", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 109 | ENCODING_MAP(THUMB_ADD_PC_REL, 0xa000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 110 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 111 | IS_TERTIARY_OP | IS_BRANCH, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 112 | "add", "r!0d, pc, #!1E", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 113 | ENCODING_MAP(THUMB_ADD_SP_REL, 0xa800, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 114 | BITBLT, 10, 8, UNUSED, -1, -1, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 115 | IS_TERTIARY_OP | REG_DEF_SP | REG_USE_SP, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 116 | "add", "r!0d, sp, #!2E", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 117 | ENCODING_MAP(THUMB_ADD_SPI7, 0xb000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 118 | BITBLT, 6, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 119 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 120 | "add", "sp, #!0d*4", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 121 | ENCODING_MAP(THUMB_AND_RR, 0x4000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 122 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 123 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 124 | "ands", "r!0d, r!1d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 125 | ENCODING_MAP(THUMB_ASR_RRI5, 0x1000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 126 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 127 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 128 | "asrs", "r!0d, r!1d, #!2d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 129 | ENCODING_MAP(THUMB_ASR_RR, 0x4100, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 130 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 131 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 132 | "asrs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 133 | ENCODING_MAP(THUMB_B_COND, 0xd000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 134 | BITBLT, 7, 0, BITBLT, 11, 8, UNUSED, -1, -1, UNUSED, -1, -1, |
| 135 | IS_BINARY_OP | IS_BRANCH | USES_CCODES, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 136 | "b!1c", "!0t", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 137 | ENCODING_MAP(THUMB_B_UNCOND, 0xe000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 138 | BITBLT, 10, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 139 | NO_OPERAND | IS_BRANCH, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 140 | "b", "!0t", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 141 | ENCODING_MAP(THUMB_BIC_RR, 0x4380, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 142 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 143 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 144 | "bics", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 145 | ENCODING_MAP(THUMB_BKPT, 0xbe00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 146 | BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 147 | IS_UNARY_OP | IS_BRANCH, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 148 | "bkpt", "!0d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 149 | ENCODING_MAP(THUMB_BLX_1, 0xf000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 150 | BITBLT, 10, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 151 | IS_BINARY_OP | IS_BRANCH | REG_DEF_LR, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 152 | "blx_1", "!0u", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 153 | ENCODING_MAP(THUMB_BLX_2, 0xe800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 154 | BITBLT, 10, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 155 | IS_BINARY_OP | IS_BRANCH | REG_DEF_LR, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 156 | "blx_2", "!0v", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 157 | ENCODING_MAP(THUMB_BL_1, 0xf000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 158 | BITBLT, 10, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 159 | IS_UNARY_OP | IS_BRANCH | REG_DEF_LR, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 160 | "bl_1", "!0u", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 161 | ENCODING_MAP(THUMB_BL_2, 0xf800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 162 | BITBLT, 10, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 163 | IS_UNARY_OP | IS_BRANCH | REG_DEF_LR, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 164 | "bl_2", "!0v", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 165 | ENCODING_MAP(THUMB_BLX_R, 0x4780, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 166 | BITBLT, 6, 3, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 167 | IS_UNARY_OP | REG_USE0 | IS_BRANCH | REG_DEF_LR, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 168 | "blx", "r!0d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 169 | ENCODING_MAP(THUMB_BX, 0x4700, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 170 | BITBLT, 6, 3, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 171 | IS_UNARY_OP | IS_BRANCH, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 172 | "bx", "r!0d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 173 | ENCODING_MAP(THUMB_CMN_RR, 0x42c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 174 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 175 | IS_BINARY_OP | REG_USE01 | SETS_CCODES, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 176 | "cmn", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 177 | ENCODING_MAP(THUMB_CMP_RI8, 0x2800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 178 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 179 | IS_BINARY_OP | REG_USE0 | SETS_CCODES, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 180 | "cmp", "r!0d, #!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 181 | ENCODING_MAP(THUMB_CMP_RR, 0x4280, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 182 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 183 | IS_BINARY_OP | REG_USE01 | SETS_CCODES, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 184 | "cmp", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 185 | ENCODING_MAP(THUMB_CMP_LH, 0x4540, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 186 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 187 | IS_BINARY_OP | REG_USE01 | SETS_CCODES, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 188 | "cmp", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 189 | ENCODING_MAP(THUMB_CMP_HL, 0x4580, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 190 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 191 | IS_BINARY_OP | REG_USE01 | SETS_CCODES, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 192 | "cmp", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 193 | ENCODING_MAP(THUMB_CMP_HH, 0x45c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 194 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 195 | IS_BINARY_OP | REG_USE01 | SETS_CCODES, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 196 | "cmp", "r!0d, r!1d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 197 | ENCODING_MAP(THUMB_EOR_RR, 0x4040, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 198 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 199 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 200 | "eors", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 201 | ENCODING_MAP(THUMB_LDMIA, 0xc800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 202 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 203 | IS_BINARY_OP | REG_DEF0_USE0 | REG_DEF_LIST1, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 204 | "ldmia", "r!0d!!, <!1R>", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 205 | ENCODING_MAP(THUMB_LDR_RRI5, 0x6800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 206 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 207 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 208 | "ldr", "r!0d, [r!1d, #!2E]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 209 | ENCODING_MAP(THUMB_LDR_RRR, 0x5800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 210 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 211 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 212 | "ldr", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 213 | ENCODING_MAP(THUMB_LDR_PC_REL, 0x4800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 214 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 215 | IS_TERTIARY_OP | REG_DEF0 | REG_USE_PC, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 216 | "ldr", "r!0d, [pc, #!1E]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 217 | ENCODING_MAP(THUMB_LDR_SP_REL, 0x9800, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 218 | BITBLT, 10, 8, UNUSED, -1, -1, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 219 | IS_TERTIARY_OP | REG_DEF0 | REG_USE_SP, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 220 | "ldr", "r!0d, [sp, #!2E]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 221 | ENCODING_MAP(THUMB_LDRB_RRI5, 0x7800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 222 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 223 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 224 | "ldrb", "r!0d, [r!1d, #2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 225 | ENCODING_MAP(THUMB_LDRB_RRR, 0x5c00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 226 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 227 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 228 | "ldrb", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 229 | ENCODING_MAP(THUMB_LDRH_RRI5, 0x8800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 230 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 231 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 232 | "ldrh", "r!0d, [r!1d, #!2F]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 233 | ENCODING_MAP(THUMB_LDRH_RRR, 0x5a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 234 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 235 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 236 | "ldrh", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 237 | ENCODING_MAP(THUMB_LDRSB_RRR, 0x5600, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 238 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 239 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 240 | "ldrsb", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 241 | ENCODING_MAP(THUMB_LDRSH_RRR, 0x5e00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 242 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 243 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 244 | "ldrsh", "r!0d, [r!1d, r!2d]", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 245 | ENCODING_MAP(THUMB_LSL_RRI5, 0x0000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 246 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 247 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 248 | "lsls", "r!0d, r!1d, #!2d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 249 | ENCODING_MAP(THUMB_LSL_RR, 0x4080, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 250 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 251 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 252 | "lsls", "r!0d, r!1d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 253 | ENCODING_MAP(THUMB_LSR_RRI5, 0x0800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 254 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 255 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 256 | "lsrs", "r!0d, r!1d, #!2d", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 257 | ENCODING_MAP(THUMB_LSR_RR, 0x40c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 258 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 259 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 260 | "lsrs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 261 | ENCODING_MAP(THUMB_MOV_IMM, 0x2000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 262 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 263 | IS_BINARY_OP | REG_DEF0 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 264 | "movs", "r!0d, #!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 265 | ENCODING_MAP(THUMB_MOV_RR, 0x1c00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 266 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 267 | IS_BINARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 268 | "movs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 269 | ENCODING_MAP(THUMB_MOV_RR_H2H, 0x46c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 270 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 271 | IS_BINARY_OP | REG_DEF0_USE1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 272 | "mov", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 273 | ENCODING_MAP(THUMB_MOV_RR_H2L, 0x4640, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 274 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 275 | IS_BINARY_OP | REG_DEF0_USE1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 276 | "mov", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 277 | ENCODING_MAP(THUMB_MOV_RR_L2H, 0x4680, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 278 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 279 | IS_BINARY_OP | REG_DEF0_USE1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 280 | "mov", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 281 | ENCODING_MAP(THUMB_MUL, 0x4340, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 282 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 283 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 284 | "muls", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 285 | ENCODING_MAP(THUMB_MVN, 0x43c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 286 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 287 | IS_BINARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 288 | "mvns", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 289 | ENCODING_MAP(THUMB_NEG, 0x4240, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 290 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 291 | IS_BINARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 292 | "negs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 293 | ENCODING_MAP(THUMB_ORR, 0x4300, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 294 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 295 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 296 | "orrs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 297 | ENCODING_MAP(THUMB_POP, 0xbc00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 298 | BITBLT, 8, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 299 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP | REG_DEF_LIST0, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 300 | "pop", "<!0R>", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 301 | ENCODING_MAP(THUMB_PUSH, 0xb400, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 302 | BITBLT, 8, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 303 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP | REG_USE_LIST0, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 304 | "push", "<!0R>", 1), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 305 | ENCODING_MAP(THUMB_ROR_RR, 0x41c0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 306 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 307 | IS_BINARY_OP | REG_DEF0_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 308 | "rors", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 309 | ENCODING_MAP(THUMB_SBC, 0x4180, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 310 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 311 | IS_BINARY_OP | REG_DEF0_USE01 | USES_CCODES | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 312 | "sbcs", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 313 | ENCODING_MAP(THUMB_STMIA, 0xc000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 314 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 315 | IS_BINARY_OP | REG_DEF0 | REG_USE0 | REG_USE_LIST1, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 316 | "stmia", "r!0d!!, <!1R>", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 317 | ENCODING_MAP(THUMB_STR_RRI5, 0x6000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 318 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 319 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 320 | "str", "r!0d, [r!1d, #!2E]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 321 | ENCODING_MAP(THUMB_STR_RRR, 0x5000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 322 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 323 | IS_TERTIARY_OP | REG_USE012, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 324 | "str", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 325 | ENCODING_MAP(THUMB_STR_SP_REL, 0x9000, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 326 | BITBLT, 10, 8, UNUSED, -1, -1, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 327 | IS_TERTIARY_OP | REG_USE0 | REG_USE_SP, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 328 | "str", "r!0d, [sp, #!2E]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 329 | ENCODING_MAP(THUMB_STRB_RRI5, 0x7000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 330 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 331 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 332 | "strb", "r!0d, [r!1d, #!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 333 | ENCODING_MAP(THUMB_STRB_RRR, 0x5400, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 334 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 335 | IS_TERTIARY_OP | REG_USE012, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 336 | "strb", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 337 | ENCODING_MAP(THUMB_STRH_RRI5, 0x8000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 338 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 10, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 339 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 340 | "strh", "r!0d, [r!1d, #!2F]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 341 | ENCODING_MAP(THUMB_STRH_RRR, 0x5200, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 342 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 343 | IS_TERTIARY_OP | REG_USE012, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 344 | "strh", "r!0d, [r!1d, r!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 345 | ENCODING_MAP(THUMB_SUB_RRI3, 0x1e00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 346 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 347 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 348 | "subs", "r!0d, r!1d, #!2d]", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 349 | ENCODING_MAP(THUMB_SUB_RI8, 0x3800, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 350 | BITBLT, 10, 8, BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 351 | IS_BINARY_OP | REG_DEF0_USE0 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 352 | "subs", "r!0d, #!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 353 | ENCODING_MAP(THUMB_SUB_RRR, 0x1a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 354 | BITBLT, 2, 0, BITBLT, 5, 3, BITBLT, 8, 6, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 355 | IS_TERTIARY_OP | REG_DEF0_USE12 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 356 | "subs", "r!0d, r!1d, r!2d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 357 | ENCODING_MAP(THUMB_SUB_SPI7, 0xb080, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 358 | BITBLT, 6, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 359 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 360 | "sub", "sp, #!0d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 361 | ENCODING_MAP(THUMB_SWI, 0xdf00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 362 | BITBLT, 7, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 363 | IS_UNARY_OP | IS_BRANCH, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 364 | "swi", "!0d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 365 | ENCODING_MAP(THUMB_TST, 0x4200, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 366 | BITBLT, 2, 0, BITBLT, 5, 3, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 367 | IS_UNARY_OP | REG_USE01 | SETS_CCODES, |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 368 | "tst", "r!0d, r!1d", 1), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 369 | ENCODING_MAP(THUMB2_VLDRS, 0xed900a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 370 | SFP, 22, 12, BITBLT, 19, 16, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 371 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 372 | "vldr", "!0s, [r!1d, #!2E]", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 373 | ENCODING_MAP(THUMB2_VLDRD, 0xed900b00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 374 | DFP, 22, 12, BITBLT, 19, 16, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 375 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 376 | "vldr", "!0S, [r!1d, #!2E]", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 377 | ENCODING_MAP(THUMB2_VMULS, 0xee200a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 378 | SFP, 22, 12, SFP, 7, 16, SFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 379 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 380 | "vmuls", "!0s, !1s, !2s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 381 | ENCODING_MAP(THUMB2_VMULD, 0xee200b00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 382 | DFP, 22, 12, DFP, 7, 16, DFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 383 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 384 | "vmuld", "!0S, !1S, !2S", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 385 | ENCODING_MAP(THUMB2_VSTRS, 0xed800a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 386 | SFP, 22, 12, BITBLT, 19, 16, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 387 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 388 | "vstr", "!0s, [r!1d, #!2E]", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 389 | ENCODING_MAP(THUMB2_VSTRD, 0xed800b00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 390 | DFP, 22, 12, BITBLT, 19, 16, BITBLT, 7, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 391 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 392 | "vstr", "!0S, [r!1d, #!2E]", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 393 | ENCODING_MAP(THUMB2_VSUBS, 0xee300a40, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 394 | SFP, 22, 12, SFP, 7, 16, SFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 395 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 396 | "vsub", "!0s, !1s, !2s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 397 | ENCODING_MAP(THUMB2_VSUBD, 0xee300b40, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 398 | DFP, 22, 12, DFP, 7, 16, DFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 399 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 400 | "vsub", "!0S, !1S, !2S", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 401 | ENCODING_MAP(THUMB2_VADDS, 0xee300a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 402 | SFP, 22, 12, SFP, 7, 16, SFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 403 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 404 | "vadd", "!0s, !1s, !2s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 405 | ENCODING_MAP(THUMB2_VADDD, 0xee300b00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 406 | DFP, 22, 12, DFP, 7, 16, DFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 407 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 408 | "vadd", "!0S, !1S, !2S", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 409 | ENCODING_MAP(THUMB2_VDIVS, 0xee800a00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 410 | SFP, 22, 12, SFP, 7, 16, SFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 411 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 412 | "vdivs", "!0s, !1s, !2s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 413 | ENCODING_MAP(THUMB2_VDIVD, 0xee800b00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 414 | DFP, 22, 12, DFP, 7, 16, DFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 415 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 416 | "vdivd", "!0S, !1S, !2S", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 417 | ENCODING_MAP(THUMB2_VCVTIF, 0xeeb80ac0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 418 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 419 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 420 | "vcvt.f32", "!0s, !1s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 421 | ENCODING_MAP(THUMB2_VCVTID, 0xeeb80bc0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 422 | DFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 423 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 424 | "vcvt.f64", "!0S, !1s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 425 | ENCODING_MAP(THUMB2_VCVTFI, 0xeebd0ac0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 426 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 427 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 428 | "vcvt.s32.f32 ", "!0s, !1s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 429 | ENCODING_MAP(THUMB2_VCVTDI, 0xeebd0bc0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 430 | SFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 431 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 432 | "vcvt.s32.f64 ", "!0s, !1S", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 433 | ENCODING_MAP(THUMB2_VCVTFD, 0xeeb70ac0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 434 | DFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 435 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 436 | "vcvt.f64.f32 ", "!0S, !1s", 2), |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 437 | ENCODING_MAP(THUMB2_VCVTDF, 0xeeb70bc0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 438 | SFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 439 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 440 | "vcvt.f32.f64 ", "!0s, !1S", 2), |
| 441 | ENCODING_MAP(THUMB2_VSQRTS, 0xeeb10ac0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 442 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 443 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 444 | "vsqrt.f32 ", "!0s, !1s", 2), |
| 445 | ENCODING_MAP(THUMB2_VSQRTD, 0xeeb10bc0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 446 | DFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 447 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 9727c3d | 2009-08-01 11:32:36 -0700 | [diff] [blame] | 448 | "vsqrt.f64 ", "!0S, !1S", 2), |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 449 | ENCODING_MAP(THUMB2_MOV_IMM_SHIFT, 0xf04f0000, /* no setflags encoding */ |
| 450 | BITBLT, 11, 8, MODIMM, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 451 | IS_BINARY_OP | REG_DEF0, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 452 | "mov", "r!0d, #!1m", 2), |
| 453 | ENCODING_MAP(THUMB2_MOV_IMM16, 0xf2400000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 454 | BITBLT, 11, 8, IMM16, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 455 | IS_BINARY_OP | REG_DEF0, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 456 | "mov", "r!0d, #!1M", 2), |
| 457 | ENCODING_MAP(THUMB2_STR_RRI12, 0xf8c00000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 458 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 459 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 460 | "str", "r!0d,[r!1d, #!2d", 2), |
| 461 | ENCODING_MAP(THUMB2_LDR_RRI12, 0xf8d00000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 462 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 463 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 464 | "ldr", "r!0d,[r!1d, #!2d", 2), |
| 465 | ENCODING_MAP(THUMB2_STR_RRI8_PREDEC, 0xf8400c00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 466 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 8, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 467 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 468 | "str", "r!0d,[r!1d, #-!2d]", 2), |
| 469 | ENCODING_MAP(THUMB2_LDR_RRI8_PREDEC, 0xf8500c00, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 470 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 8, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 471 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 472 | "ldr", "r!0d,[r!1d, #-!2d]", 2), |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 473 | ENCODING_MAP(THUMB2_CBNZ, 0xb900, /* Note: does not affect flags */ |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 474 | BITBLT, 2, 0, IMM6, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 475 | IS_BINARY_OP | REG_USE0 | IS_BRANCH, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 476 | "cbnz", "r!0d,!1t", 1), |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 477 | ENCODING_MAP(THUMB2_CBZ, 0xb100, /* Note: does not affect flags */ |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 478 | BITBLT, 2, 0, IMM6, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 479 | IS_BINARY_OP | REG_USE0 | IS_BRANCH, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 480 | "cbz", "r!0d,!1t", 1), |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 481 | ENCODING_MAP(THUMB2_ADD_RRI12, 0xf2000000, |
| 482 | BITBLT, 11, 8, BITBLT, 19, 16, IMM12, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 483 | IS_TERTIARY_OP | REG_DEF0_USE1,/* Note: doesn't affect flags */ |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 484 | "add", "r!0d,r!1d,#!2d", 2), |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 485 | ENCODING_MAP(THUMB2_MOV_RR, 0xea4f0000, /* no setflags encoding */ |
| 486 | BITBLT, 11, 8, BITBLT, 3, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 487 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 488 | "mov", "r!0d, r!1d", 2), |
| 489 | ENCODING_MAP(THUMB2_VMOVS, 0xeeb00a40, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 490 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 491 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 492 | "vmov.f32 ", " !0s, !1s", 2), |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 493 | ENCODING_MAP(THUMB2_VMOVD, 0xeeb00b40, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 494 | DFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 495 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 496 | "vmov.f64 ", " !0S, !1S", 2), |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 497 | ENCODING_MAP(THUMB2_LDMIA, 0xe8900000, |
| 498 | BITBLT, 19, 16, BITBLT, 15, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 499 | IS_BINARY_OP | REG_DEF0_USE0 | REG_DEF_LIST1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 500 | "ldmia", "r!0d!!, <!1R>", 2), |
| 501 | ENCODING_MAP(THUMB2_STMIA, 0xe8800000, |
| 502 | BITBLT, 19, 16, BITBLT, 15, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 503 | IS_BINARY_OP | REG_DEF0_USE0 | REG_USE_LIST1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 504 | "stmia", "r!0d!!, <!1R>", 2), |
| 505 | ENCODING_MAP(THUMB2_ADD_RRR, 0xeb100000, /* setflags encoding */ |
| 506 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 507 | IS_QUAD_OP | REG_DEF0_USE12 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 508 | "adds", "r!0d, r!1d, r!2d", 2), |
| 509 | ENCODING_MAP(THUMB2_SUB_RRR, 0xebb00000, /* setflags enconding */ |
| 510 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 511 | IS_QUAD_OP | REG_DEF0_USE12 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 512 | "subs", "r!0d, r!1d, r!2d", 2), |
| 513 | ENCODING_MAP(THUMB2_SBC_RRR, 0xeb700000, /* setflags encoding */ |
| 514 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 515 | IS_QUAD_OP | REG_DEF0_USE12 | USES_CCODES | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 516 | "sbcs", "r!0d, r!1d, r!2d", 2), |
| 517 | ENCODING_MAP(THUMB2_CMP_RR, 0xebb00f00, |
| 518 | BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 519 | IS_TERTIARY_OP | REG_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 520 | "cmp", "r!0d, r!1d", 2), |
| 521 | ENCODING_MAP(THUMB2_SUB_RRI12, 0xf2a00000, |
| 522 | BITBLT, 11, 8, BITBLT, 19, 16, IMM12, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 523 | IS_TERTIARY_OP | REG_DEF0_USE1,/* Note: doesn't affect flags */ |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 524 | "sub", "r!0d,r!1d,#!2d", 2), |
| 525 | ENCODING_MAP(THUMB2_MVN_IMM_SHIFT, 0xf06f0000, /* no setflags encoding */ |
| 526 | BITBLT, 11, 8, MODIMM, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 527 | IS_BINARY_OP | REG_DEF0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 528 | "mvn", "r!0d, #!1n", 2), |
| 529 | ENCODING_MAP(THUMB2_SEL, 0xfaa0f080, |
| 530 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 531 | IS_TERTIARY_OP | REG_DEF0_USE12 | USES_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 532 | "sel", "r!0d, r!1d, r!2d", 2), |
| 533 | ENCODING_MAP(THUMB2_UBFX, 0xf3c00000, |
| 534 | BITBLT, 11, 8, BITBLT, 19, 16, LSB, -1, -1, BWIDTH, 4, 0, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 535 | IS_QUAD_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 536 | "ubfx", "r!0d, r!1d, #!2d, #!3d", 2), |
| 537 | ENCODING_MAP(THUMB2_SBFX, 0xf3400000, |
| 538 | BITBLT, 11, 8, BITBLT, 19, 16, LSB, -1, -1, BWIDTH, 4, 0, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 539 | IS_QUAD_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 540 | "sbfx", "r!0d, r!1d, #!2d, #!3d", 2), |
| 541 | ENCODING_MAP(THUMB2_LDR_RRR, 0xf8500000, |
| 542 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 543 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 544 | "ldr", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 545 | ENCODING_MAP(THUMB2_LDRH_RRR, 0xf8300000, |
| 546 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 547 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 548 | "ldrh", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 549 | ENCODING_MAP(THUMB2_LDRSH_RRR, 0xf9300000, |
| 550 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 551 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 552 | "ldrsh", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 553 | ENCODING_MAP(THUMB2_LDRB_RRR, 0xf8100000, |
| 554 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 555 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 556 | "ldrb", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 557 | ENCODING_MAP(THUMB2_LDRSB_RRR, 0xf9100000, |
| 558 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 559 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 560 | "ldrsb", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 561 | ENCODING_MAP(THUMB2_STR_RRR, 0xf8400000, |
| 562 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 563 | IS_QUAD_OP | REG_USE012, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 564 | "str", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 565 | ENCODING_MAP(THUMB2_STRH_RRR, 0xf8200000, |
| 566 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 567 | IS_QUAD_OP | REG_USE012, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 568 | "strh", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 569 | ENCODING_MAP(THUMB2_STRB_RRR, 0xf8000000, |
| 570 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 3, 0, BITBLT, 5, 4, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 571 | IS_QUAD_OP | REG_USE012, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 572 | "strb", "r!0d,[r!1d, r!2d, LSL #!3d]", 2), |
| 573 | ENCODING_MAP(THUMB2_LDRH_RRI12, 0xf8b00000, |
| 574 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 575 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 576 | "ldrh", "r!0d,[r!1d, #!2d", 2), |
| 577 | ENCODING_MAP(THUMB2_LDRSH_RRI12, 0xf9b00000, |
| 578 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 579 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 580 | "ldrsh", "r!0d,[r!1d, #!2d", 2), |
| 581 | ENCODING_MAP(THUMB2_LDRB_RRI12, 0xf8900000, |
| 582 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 583 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 584 | "ldrb", "r!0d,[r!1d, #!2d", 2), |
| 585 | ENCODING_MAP(THUMB2_LDRSB_RRI12, 0xf9900000, |
| 586 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 587 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 588 | "ldrsb", "r!0d,[r!1d, #!2d", 2), |
| 589 | ENCODING_MAP(THUMB2_STRH_RRI12, 0xf8a00000, |
| 590 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 591 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 592 | "strh", "r!0d,[r!1d, #!2d", 2), |
| 593 | ENCODING_MAP(THUMB2_STRB_RRI12, 0xf8800000, |
| 594 | BITBLT, 15, 12, BITBLT, 19, 16, BITBLT, 11, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 595 | IS_TERTIARY_OP | REG_USE01, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 596 | "strb", "r!0d,[r!1d, #!2d", 2), |
| 597 | ENCODING_MAP(THUMB2_POP, 0xe8bd0000, |
| 598 | BITBLT, 15, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 599 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP | REG_DEF_LIST0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 600 | "pop", "<!0R>", 2), |
| 601 | ENCODING_MAP(THUMB2_PUSH, 0xe8ad0000, |
| 602 | BITBLT, 15, 0, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 603 | IS_UNARY_OP | REG_DEF_SP | REG_USE_SP | REG_USE_LIST0, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 604 | "push", "<!0R>", 2), |
| 605 | ENCODING_MAP(THUMB2_CMP_RI8, 0xf1b00f00, |
| 606 | BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 607 | IS_BINARY_OP | REG_USE0 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 608 | "cmp", "r!0d, #!1m", 2), |
| 609 | ENCODING_MAP(THUMB2_ADC_RRR, 0xeb500000, /* setflags encoding */ |
| 610 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 611 | IS_QUAD_OP | REG_DEF0_USE12 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 612 | "acds", "r!0d, r!1d, r!2d, shift !3d", 2), |
| 613 | ENCODING_MAP(THUMB2_AND_RRR, 0xea000000, |
| 614 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 615 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 616 | "and", "r!0d, r!1d, r!2d, shift !3d", 2), |
| 617 | ENCODING_MAP(THUMB2_BIC_RRR, 0xea200000, |
| 618 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 619 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 620 | "bic", "r!0d, r!1d, r!2d, shift !3d", 2), |
| 621 | ENCODING_MAP(THUMB2_CMN_RR, 0xeb000000, |
| 622 | BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 623 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 624 | "cmn", "r!0d, r!1d, shift !2d", 2), |
| 625 | ENCODING_MAP(THUMB2_EOR_RRR, 0xea800000, |
| 626 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 627 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 628 | "eor", "r!0d, r!1d, r!2d, shift !3d", 2), |
| 629 | ENCODING_MAP(THUMB2_MUL_RRR, 0xfb00f000, |
| 630 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 631 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 632 | "mul", "r!0d, r!1d, r!2d", 2), |
| 633 | ENCODING_MAP(THUMB2_MVN_RR, 0xea6f0000, |
| 634 | BITBLT, 11, 8, BITBLT, 3, 0, SHIFT, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 635 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 636 | "mvn", "r!0d, r!1d, shift !2d", 2), |
| 637 | ENCODING_MAP(THUMB2_RSUB_RRI8, 0xf1d00000, |
| 638 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 639 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 640 | "rsb", "r!0d,r!1d,#!2m", 2), |
| 641 | ENCODING_MAP(THUMB2_NEG_RR, 0xf1d00000, /* instance of rsub */ |
| 642 | BITBLT, 11, 8, BITBLT, 19, 16, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 643 | IS_BINARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 644 | "neg", "r!0d,r!1d", 2), |
| 645 | ENCODING_MAP(THUMB2_ORR_RRR, 0xea400000, |
| 646 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 647 | IS_QUAD_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 648 | "orr", "r!0d, r!1d, r!2d, shift !3d", 2), |
| 649 | ENCODING_MAP(THUMB2_TST_RR, 0xea100f00, |
| 650 | BITBLT, 19, 16, BITBLT, 3, 0, SHIFT, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 651 | IS_TERTIARY_OP | REG_USE01 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 652 | "tst", "r!0d, r!1d, shift !2d", 2), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 653 | ENCODING_MAP(THUMB2_LSL_RRR, 0xfa00f000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 654 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 655 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 656 | "lsl", "r!0d, r!1d, r!2d", 2), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 657 | ENCODING_MAP(THUMB2_LSR_RRR, 0xfa20f000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 658 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 659 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 660 | "lsr", "r!0d, r!1d, r!2d", 2), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 661 | ENCODING_MAP(THUMB2_ASR_RRR, 0xfa40f000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 662 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 663 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 664 | "asr", "r!0d, r!1d, r!2d", 2), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 665 | ENCODING_MAP(THUMB2_ROR_RRR, 0xfa60f000, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 666 | BITBLT, 11, 8, BITBLT, 19, 16, BITBLT, 3, 0, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 667 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 668 | "ror", "r!0d, r!1d, r!2d", 2), |
| 669 | ENCODING_MAP(THUMB2_LSL_RRI5, 0xea4f0000, |
| 670 | BITBLT, 11, 8, BITBLT, 3, 0, SHIFT5, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 671 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 672 | "lsl", "r!0d, r!1d, #!2d", 2), |
| 673 | ENCODING_MAP(THUMB2_LSR_RRI5, 0xea4f0010, |
| 674 | BITBLT, 11, 8, BITBLT, 3, 0, SHIFT5, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 675 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 676 | "lsr", "r!0d, r!1d, #!2d", 2), |
| 677 | ENCODING_MAP(THUMB2_ASR_RRI5, 0xea4f0020, |
| 678 | BITBLT, 11, 8, BITBLT, 3, 0, SHIFT5, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 679 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 680 | "asr", "r!0d, r!1d, #!2d", 2), |
| 681 | ENCODING_MAP(THUMB2_ROR_RRI5, 0xea4f0030, |
| 682 | BITBLT, 11, 8, BITBLT, 3, 0, SHIFT5, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 683 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 684 | "ror", "r!0d, r!1d, #!2d", 2), |
| 685 | ENCODING_MAP(THUMB2_BIC_RRI8, 0xf0200000, |
| 686 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 687 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 688 | "bic", "r!0d, r!1d, #!2m", 2), |
| 689 | ENCODING_MAP(THUMB2_AND_RRI8, 0xf0000000, |
| 690 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 691 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 692 | "and", "r!0d, r!1d, #!2m", 2), |
| 693 | ENCODING_MAP(THUMB2_ORR_RRI8, 0xf0400000, |
| 694 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 695 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 696 | "orr", "r!0d, r!1d, #!2m", 2), |
| 697 | ENCODING_MAP(THUMB2_EOR_RRI8, 0xf0800000, |
| 698 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 699 | IS_TERTIARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 700 | "eor", "r!0d, r!1d, #!2m", 2), |
| 701 | ENCODING_MAP(THUMB2_ADD_RRI8, 0xf1100000, |
| 702 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 703 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 704 | "adds", "r!0d, r!1d, #!2m", 2), |
| 705 | ENCODING_MAP(THUMB2_ADC_RRI8, 0xf1500000, |
| 706 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 707 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES | USES_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 708 | "adcs", "r!0d, r!1d, #!2m", 2), |
| 709 | ENCODING_MAP(THUMB2_SUB_RRI8, 0xf1b00000, |
| 710 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 711 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 712 | "subs", "r!0d, r!1d, #!2m", 2), |
| 713 | ENCODING_MAP(THUMB2_SBC_RRI8, 0xf1700000, |
| 714 | BITBLT, 11, 8, BITBLT, 19, 16, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 715 | IS_TERTIARY_OP | REG_DEF0_USE1 | SETS_CCODES | USES_CCODES, |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 716 | "sbcs", "r!0d, r!1d, #!2m", 2), |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 717 | ENCODING_MAP(THUMB2_IT, 0xbf00, |
| 718 | BITBLT, 7, 4, BITBLT, 3, 0, MODIMM, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 719 | IS_BINARY_OP | IS_IT | USES_CCODES, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 720 | "it:!1b", "!0c", 1), |
| 721 | ENCODING_MAP(THUMB2_FMSTAT, 0xeef1fa10, |
| 722 | UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, UNUSED, -1, -1, |
| 723 | NO_OPERAND | SETS_CCODES, |
| 724 | "fmstat", "", 2), |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 725 | ENCODING_MAP(THUMB2_VCMPD, 0xeeb40b40, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 726 | DFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 727 | IS_BINARY_OP | REG_USE01, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 728 | "vcmp.f64", "!0S, !1S", 2), |
| 729 | ENCODING_MAP(THUMB2_VCMPS, 0xeeb40a40, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 730 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 731 | IS_BINARY_OP | REG_USE01, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 732 | "vcmp.f32", "!0s, !1s", 2), |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 733 | ENCODING_MAP(THUMB2_LDR_PC_REL12, 0xf8df0000, |
| 734 | BITBLT, 15, 12, BITBLT, 11, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 735 | IS_TERTIARY_OP | REG_DEF0 | REG_USE_PC, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 736 | "ldr", "r!0d,[rpc, #!1d", 2), |
| 737 | ENCODING_MAP(THUMB2_B_COND, 0xf0008000, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 738 | BROFFSET, -1, -1, BITBLT, 25, 22, UNUSED, -1, -1, |
| 739 | UNUSED, -1, -1, |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 740 | IS_BINARY_OP | IS_BRANCH | USES_CCODES, |
| 741 | "b!1c", "!0t", 2), |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 742 | ENCODING_MAP(THUMB2_VMOVD_RR, 0xeeb00b40, |
| 743 | DFP, 22, 12, DFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 744 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 745 | "vmov.f64", "!0S, !1S", 2), |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 746 | ENCODING_MAP(THUMB2_VMOVS_RR, 0xeeb00a40, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 747 | SFP, 22, 12, SFP, 5, 0, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 748 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 749 | "vmov.f32", "!0S, !1S", 2), |
| 750 | ENCODING_MAP(THUMB2_FMRS, 0xee100a10, |
| 751 | BITBLT, 15, 12, SFP, 8, 16, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 752 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 753 | "fmrs", "r!0d, !1s", 2), |
| 754 | ENCODING_MAP(THUMB2_FMSR, 0xee000a10, |
| 755 | SFP, 8, 16, BITBLT, 15, 12, UNUSED, -1, -1, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 756 | IS_BINARY_OP | REG_DEF0_USE1, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 757 | "fmsr", "!0s, r!1d", 2), |
| 758 | ENCODING_MAP(THUMB2_FMRRD, 0xec500b10, |
| 759 | BITBLT, 15, 12, BITBLT, 19, 16, DFP, 5, 0, UNUSED, -1, -1, |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 760 | IS_TERTIARY_OP | REG_DEF01_USE2, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 761 | "fmrrd", "r!0d, r!1d, !2S", 2), |
| 762 | ENCODING_MAP(THUMB2_FMDRR, 0xec400b10, |
| 763 | DFP, 5, 0, BITBLT, 15, 12, BITBLT, 19, 16, UNUSED, -1, -1, |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 764 | IS_TERTIARY_OP | REG_DEF0_USE12, |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 765 | "fmdrr", "!0S, r!1d, r!2d", 2), |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 766 | }; |
| 767 | |
| Ben Cheng | 6d57609 | 2009-09-01 17:01:58 -0700 | [diff] [blame] | 768 | /* |
| 769 | * The fake NOP of moving r0 to r0 actually will incur data stalls if r0 is |
| 770 | * not ready. Since r5 (rFP) is not updated often, it is less likely to |
| 771 | * generate unnecessary stall cycles. |
| 772 | */ |
| 773 | #define PADDING_MOV_R5_R5 0x1C2D |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 774 | |
| 775 | /* Write the numbers in the literal pool to the codegen stream */ |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 776 | static void installDataContent(CompilationUnit *cUnit) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 777 | { |
| Ben Cheng | e80cd94 | 2009-07-17 15:54:23 -0700 | [diff] [blame] | 778 | int *dataPtr = (int *) ((char *) cUnit->baseAddr + cUnit->dataOffset); |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 779 | ArmLIR *dataLIR = (ArmLIR *) cUnit->wordList; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 780 | while (dataLIR) { |
| 781 | *dataPtr++ = dataLIR->operands[0]; |
| 782 | dataLIR = NEXT_LIR(dataLIR); |
| 783 | } |
| 784 | } |
| 785 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 786 | /* Returns the size of a Jit trace description */ |
| 787 | static int jitTraceDescriptionSize(const JitTraceDescription *desc) |
| 788 | { |
| 789 | int runCount; |
| 790 | for (runCount = 0; ; runCount++) { |
| 791 | if (desc->trace[runCount].frag.runEnd) |
| 792 | break; |
| 793 | } |
| 794 | return sizeof(JitCodeDesc) + ((runCount+1) * sizeof(JitTraceRun)); |
| 795 | } |
| 796 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 797 | /* Return TRUE if error happens */ |
| 798 | static bool assembleInstructions(CompilationUnit *cUnit, intptr_t startAddr) |
| 799 | { |
| 800 | short *bufferAddr = (short *) cUnit->codeBuffer; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 801 | ArmLIR *lir; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 802 | |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 803 | for (lir = (ArmLIR *) cUnit->firstLIRInsn; lir; lir = NEXT_LIR(lir)) { |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 804 | if (lir->opCode < 0) { |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 805 | if ((lir->opCode == ARM_PSEUDO_ALIGN4) && |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 806 | /* 1 means padding is needed */ |
| 807 | (lir->operands[0] == 1)) { |
| Ben Cheng | 6d57609 | 2009-09-01 17:01:58 -0700 | [diff] [blame] | 808 | *bufferAddr++ = PADDING_MOV_R5_R5; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 809 | } |
| 810 | continue; |
| 811 | } |
| 812 | |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 813 | if (lir->isNop) { |
| 814 | continue; |
| 815 | } |
| 816 | |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 817 | if (lir->opCode == THUMB_LDR_PC_REL || |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 818 | lir->opCode == THUMB2_LDR_PC_REL12 || |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 819 | lir->opCode == THUMB_ADD_PC_REL) { |
| 820 | ArmLIR *lirTarget = (ArmLIR *) lir->generic.target; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 821 | intptr_t pc = (lir->generic.offset + 4) & ~3; |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 822 | /* |
| 823 | * Allow an offset (stored in operands[2] to be added to the |
| 824 | * PC-relative target. Useful to get to a fixed field inside a |
| 825 | * chaining cell. |
| 826 | */ |
| 827 | intptr_t target = lirTarget->generic.offset + lir->operands[2]; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 828 | int delta = target - pc; |
| 829 | if (delta & 0x3) { |
| 830 | LOGE("PC-rel distance is not multiples of 4: %d\n", delta); |
| 831 | dvmAbort(); |
| 832 | } |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 833 | if ((lir->opCode == THUMB2_LDR_PC_REL12) && (delta > 4091)) { |
| 834 | return true; |
| 835 | } else if (delta > 1020) { |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 836 | return true; |
| 837 | } |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 838 | lir->operands[1] = (lir->opCode == THUMB2_LDR_PC_REL12) ? |
| 839 | delta : delta >> 2; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 840 | } else if (lir->opCode == THUMB2_CBNZ || lir->opCode == THUMB2_CBZ) { |
| 841 | ArmLIR *targetLIR = (ArmLIR *) lir->generic.target; |
| 842 | intptr_t pc = lir->generic.offset + 4; |
| 843 | intptr_t target = targetLIR->generic.offset; |
| 844 | int delta = target - pc; |
| 845 | if (delta > 126 || delta < 0) { |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 846 | /* |
| Bill Buzbee | 7fb2edd | 2009-08-31 10:25:55 -0700 | [diff] [blame] | 847 | * TODO: allow multiple kinds of assembler failure to allow |
| 848 | * change of code patterns when things don't fit. |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 849 | */ |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 850 | return true; |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 851 | } else { |
| 852 | lir->operands[1] = delta >> 1; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 853 | } |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 854 | } else if (lir->opCode == THUMB_B_COND || |
| 855 | lir->opCode == THUMB2_B_COND) { |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 856 | ArmLIR *targetLIR = (ArmLIR *) lir->generic.target; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 857 | intptr_t pc = lir->generic.offset + 4; |
| 858 | intptr_t target = targetLIR->generic.offset; |
| 859 | int delta = target - pc; |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 860 | if ((lir->opCode == THUMB_B_COND) && (delta > 254 || delta < -256)) { |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 861 | return true; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 862 | } |
| 863 | lir->operands[0] = delta >> 1; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 864 | } else if (lir->opCode == THUMB_B_UNCOND) { |
| 865 | ArmLIR *targetLIR = (ArmLIR *) lir->generic.target; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 866 | intptr_t pc = lir->generic.offset + 4; |
| 867 | intptr_t target = targetLIR->generic.offset; |
| 868 | int delta = target - pc; |
| 869 | if (delta > 2046 || delta < -2048) { |
| 870 | LOGE("Unconditional branch distance out of range: %d\n", delta); |
| 871 | dvmAbort(); |
| 872 | } |
| 873 | lir->operands[0] = delta >> 1; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 874 | } else if (lir->opCode == THUMB_BLX_1) { |
| 875 | assert(NEXT_LIR(lir)->opCode == THUMB_BLX_2); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 876 | /* curPC is Thumb */ |
| 877 | intptr_t curPC = (startAddr + lir->generic.offset + 4) & ~3; |
| 878 | intptr_t target = lir->operands[1]; |
| 879 | |
| 880 | /* Match bit[1] in target with base */ |
| 881 | if (curPC & 0x2) { |
| 882 | target |= 0x2; |
| 883 | } |
| 884 | int delta = target - curPC; |
| 885 | assert((delta >= -(1<<22)) && (delta <= ((1<<22)-2))); |
| 886 | |
| 887 | lir->operands[0] = (delta >> 12) & 0x7ff; |
| 888 | NEXT_LIR(lir)->operands[0] = (delta>> 1) & 0x7ff; |
| 889 | } |
| 890 | |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 891 | ArmEncodingMap *encoder = &EncodingMap[lir->opCode]; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 892 | u4 bits = encoder->skeleton; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 893 | int i; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 894 | for (i = 0; i < 4; i++) { |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 895 | u4 operand; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 896 | u4 value; |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 897 | operand = lir->operands[i]; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 898 | switch(encoder->fieldLoc[i].kind) { |
| 899 | case UNUSED: |
| 900 | break; |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 901 | case BROFFSET: |
| 902 | value = ((operand & 0x80000) >> 19) << 26; |
| 903 | value |= ((operand & 0x40000) >> 18) << 11; |
| 904 | value |= ((operand & 0x20000) >> 17) << 13; |
| 905 | value |= ((operand & 0x1f800) >> 11) << 16; |
| 906 | value |= (operand & 0x007ff); |
| 907 | break; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 908 | case SHIFT5: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 909 | value = ((operand & 0x1c) >> 2) << 12; |
| 910 | value |= (operand & 0x03) << 6; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 911 | bits |= value; |
| 912 | break; |
| 913 | case SHIFT: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 914 | value = ((operand & 0x70) >> 4) << 12; |
| 915 | value |= (operand & 0x0f) << 4; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 916 | bits |= value; |
| 917 | break; |
| 918 | case BWIDTH: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 919 | value = operand - 1; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 920 | bits |= value; |
| 921 | break; |
| 922 | case LSB: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 923 | value = ((operand & 0x1c) >> 2) << 12; |
| 924 | value |= (operand & 0x03) << 6; |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 925 | bits |= value; |
| 926 | break; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 927 | case IMM6: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 928 | value = ((operand & 0x20) >> 5) << 9; |
| 929 | value |= (operand & 0x1f) << 3; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 930 | bits |= value; |
| 931 | break; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 932 | case BITBLT: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 933 | value = (operand << encoder->fieldLoc[i].start) & |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 934 | ((1 << (encoder->fieldLoc[i].end + 1)) - 1); |
| 935 | bits |= value; |
| 936 | break; |
| Ben Cheng | 30f1f46 | 2009-10-12 13:46:55 -0700 | [diff] [blame^] | 937 | case DFP: { |
| 938 | int regName = (operand & FP_REG_MASK) >> 1; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 939 | /* Snag the 1-bit slice and position it */ |
| Ben Cheng | 30f1f46 | 2009-10-12 13:46:55 -0700 | [diff] [blame^] | 940 | value = ((regName & 0x10) >> 4) << |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 941 | encoder->fieldLoc[i].end; |
| 942 | /* Extract and position the 4-bit slice */ |
| Ben Cheng | 30f1f46 | 2009-10-12 13:46:55 -0700 | [diff] [blame^] | 943 | value |= (regName & 0x0f) << |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 944 | encoder->fieldLoc[i].start; |
| 945 | bits |= value; |
| 946 | break; |
| Ben Cheng | 30f1f46 | 2009-10-12 13:46:55 -0700 | [diff] [blame^] | 947 | } |
| 948 | case SFP: |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 949 | /* Snag the 1-bit slice and position it */ |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 950 | value = (operand & 0x1) << |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 951 | encoder->fieldLoc[i].end; |
| 952 | /* Extract and position the 4-bit slice */ |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 953 | value |= ((operand & 0x1e) >> 1) << |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 954 | encoder->fieldLoc[i].start; |
| 955 | bits |= value; |
| 956 | break; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 957 | case IMM12: |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 958 | case MODIMM: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 959 | value = ((operand & 0x800) >> 11) << 26; |
| 960 | value |= ((operand & 0x700) >> 8) << 12; |
| 961 | value |= operand & 0x0ff; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 962 | bits |= value; |
| 963 | break; |
| 964 | case IMM16: |
| Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 965 | value = ((operand & 0x0800) >> 11) << 26; |
| 966 | value |= ((operand & 0xf000) >> 12) << 16; |
| 967 | value |= ((operand & 0x0700) >> 8) << 12; |
| 968 | value |= operand & 0x0ff; |
| Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 969 | bits |= value; |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 970 | break; |
| 971 | default: |
| 972 | assert(0); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 973 | } |
| 974 | } |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 975 | if (encoder->size == 2) { |
| 976 | *bufferAddr++ = (bits >> 16) & 0xffff; |
| 977 | } |
| 978 | *bufferAddr++ = bits & 0xffff; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 979 | } |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 980 | return false; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 981 | } |
| 982 | |
| 983 | /* |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 984 | * Translation layout in the code cache. Note that the codeAddress pointer |
| 985 | * in JitTable will point directly to the code body (field codeAddress). The |
| 986 | * chain cell offset codeAddress - 2, and (if present) executionCount is at |
| 987 | * codeAddress - 6. |
| 988 | * |
| 989 | * +----------------------------+ |
| 990 | * | Execution count | -> [Optional] 4 bytes |
| 991 | * +----------------------------+ |
| 992 | * +--| Offset to chain cell counts| -> 2 bytes |
| 993 | * | +----------------------------+ |
| 994 | * | | Code body | -> Start address for translation |
| 995 | * | | | variable in 2-byte chunks |
| 996 | * | . . (JitTable's codeAddress points here) |
| 997 | * | . . |
| 998 | * | | | |
| 999 | * | +----------------------------+ |
| 1000 | * | | Chaining Cells | -> 8 bytes each, must be 4 byte aligned |
| 1001 | * | . . |
| 1002 | * | . . |
| 1003 | * | | | |
| 1004 | * | +----------------------------+ |
| 1005 | * +->| Chaining cell counts | -> 4 bytes, chain cell counts by type |
| 1006 | * +----------------------------+ |
| 1007 | * | Trace description | -> variable sized |
| 1008 | * . . |
| 1009 | * | | |
| 1010 | * +----------------------------+ |
| 1011 | * | Literal pool | -> 4-byte aligned, variable size |
| 1012 | * . . |
| 1013 | * . . |
| 1014 | * | | |
| 1015 | * +----------------------------+ |
| 1016 | * |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1017 | * Go over each instruction in the list and calculate the offset from the top |
| 1018 | * before sending them off to the assembler. If out-of-range branch distance is |
| 1019 | * seen rearrange the instructions a bit to correct it. |
| 1020 | */ |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 1021 | void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1022 | { |
| 1023 | LIR *lir; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 1024 | ArmLIR *armLIR; |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1025 | int offset = 0; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1026 | int i; |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1027 | ChainCellCounts chainCellCounts; |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1028 | int descSize = jitTraceDescriptionSize(cUnit->traceDesc); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1029 | |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 1030 | info->codeAddress = NULL; |
| 1031 | info->instructionSet = cUnit->instructionSet; |
| 1032 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1033 | /* Beginning offset needs to allow space for chain cell offset */ |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 1034 | for (armLIR = (ArmLIR *) cUnit->firstLIRInsn; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1035 | armLIR; |
| 1036 | armLIR = NEXT_LIR(armLIR)) { |
| 1037 | armLIR->generic.offset = offset; |
| Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 1038 | if (armLIR->opCode >= 0 && !armLIR->isNop) { |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 1039 | armLIR->size = EncodingMap[armLIR->opCode].size * 2; |
| 1040 | offset += armLIR->size; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 1041 | } else if (armLIR->opCode == ARM_PSEUDO_ALIGN4) { |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1042 | if (offset & 0x2) { |
| 1043 | offset += 2; |
| 1044 | armLIR->operands[0] = 1; |
| 1045 | } else { |
| 1046 | armLIR->operands[0] = 0; |
| 1047 | } |
| 1048 | } |
| 1049 | /* Pseudo opcodes don't consume space */ |
| 1050 | } |
| 1051 | |
| 1052 | /* Const values have to be word aligned */ |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1053 | offset = (offset + 3) & ~3; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1054 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1055 | /* Add space for chain cell counts & trace description */ |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1056 | u4 chainCellOffset = offset; |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 1057 | ArmLIR *chainCellOffsetLIR = (ArmLIR *) cUnit->chainCellOffsetLIR; |
| Bill Buzbee | 6e963e1 | 2009-06-17 16:56:19 -0700 | [diff] [blame] | 1058 | assert(chainCellOffsetLIR); |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1059 | assert(chainCellOffset < 0x10000); |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 1060 | assert(chainCellOffsetLIR->opCode == ARM_16BIT_DATA && |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1061 | chainCellOffsetLIR->operands[0] == CHAIN_CELL_OFFSET_TAG); |
| 1062 | |
| Ben Cheng | e80cd94 | 2009-07-17 15:54:23 -0700 | [diff] [blame] | 1063 | /* |
| 1064 | * Replace the CHAIN_CELL_OFFSET_TAG with the real value. If trace |
| 1065 | * profiling is enabled, subtract 4 (occupied by the counter word) from |
| 1066 | * the absolute offset as the value stored in chainCellOffsetLIR is the |
| 1067 | * delta from &chainCellOffsetLIR to &ChainCellCounts. |
| 1068 | */ |
| 1069 | chainCellOffsetLIR->operands[0] = |
| 1070 | gDvmJit.profile ? (chainCellOffset - 4) : chainCellOffset; |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1071 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1072 | offset += sizeof(chainCellCounts) + descSize; |
| 1073 | |
| 1074 | assert((offset & 0x3) == 0); /* Should still be word aligned */ |
| 1075 | |
| 1076 | /* Set up offsets for literals */ |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1077 | cUnit->dataOffset = offset; |
| 1078 | |
| 1079 | for (lir = cUnit->wordList; lir; lir = lir->next) { |
| 1080 | lir->offset = offset; |
| 1081 | offset += 4; |
| 1082 | } |
| 1083 | |
| 1084 | cUnit->totalSize = offset; |
| 1085 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1086 | if (gDvmJit.codeCacheByteUsed + cUnit->totalSize > CODE_CACHE_SIZE) { |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1087 | gDvmJit.codeCacheFull = true; |
| 1088 | cUnit->baseAddr = NULL; |
| 1089 | return; |
| 1090 | } |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1091 | |
| 1092 | /* Allocate enough space for the code block */ |
| 1093 | cUnit->codeBuffer = dvmCompilerNew(chainCellOffset, true); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1094 | if (cUnit->codeBuffer == NULL) { |
| 1095 | LOGE("Code buffer allocation failure\n"); |
| 1096 | cUnit->baseAddr = NULL; |
| 1097 | return; |
| 1098 | } |
| 1099 | |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1100 | bool assemblerFailure = assembleInstructions( |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1101 | cUnit, (intptr_t) gDvmJit.codeCache + gDvmJit.codeCacheByteUsed); |
| 1102 | |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1103 | /* |
| 1104 | * Currently the only reason that can cause the assembler to fail is due to |
| 1105 | * trace length - cut it in half and retry. |
| 1106 | */ |
| 1107 | if (assemblerFailure) { |
| 1108 | cUnit->halveInstCount = true; |
| 1109 | return; |
| 1110 | } |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1111 | |
| Bill Buzbee | 6e963e1 | 2009-06-17 16:56:19 -0700 | [diff] [blame] | 1112 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1113 | cUnit->baseAddr = (char *) gDvmJit.codeCache + gDvmJit.codeCacheByteUsed; |
| 1114 | gDvmJit.codeCacheByteUsed += offset; |
| 1115 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1116 | /* Install the code block */ |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1117 | memcpy((char*)cUnit->baseAddr, cUnit->codeBuffer, chainCellOffset); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1118 | gDvmJit.numCompilations++; |
| 1119 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1120 | /* Install the chaining cell counts */ |
| 1121 | for (i=0; i< CHAINING_CELL_LAST; i++) { |
| 1122 | chainCellCounts.u.count[i] = cUnit->numChainingCells[i]; |
| 1123 | } |
| 1124 | memcpy((char*)cUnit->baseAddr + chainCellOffset, &chainCellCounts, |
| 1125 | sizeof(chainCellCounts)); |
| 1126 | |
| 1127 | /* Install the trace description */ |
| 1128 | memcpy((char*)cUnit->baseAddr + chainCellOffset + sizeof(chainCellCounts), |
| 1129 | cUnit->traceDesc, descSize); |
| 1130 | |
| 1131 | /* Write the literals directly into the code cache */ |
| 1132 | installDataContent(cUnit); |
| 1133 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1134 | /* Flush dcache and invalidate the icache to maintain coherence */ |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1135 | cacheflush((long)cUnit->baseAddr, |
| Ben Cheng | e80cd94 | 2009-07-17 15:54:23 -0700 | [diff] [blame] | 1136 | (long)((char *) cUnit->baseAddr + offset), 0); |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 1137 | |
| 1138 | /* Record code entry point and instruction set */ |
| 1139 | info->codeAddress = (char*)cUnit->baseAddr + cUnit->headerSize; |
| 1140 | info->instructionSet = cUnit->instructionSet; |
| 1141 | /* If applicable, mark low bit to denote thumb */ |
| 1142 | if (info->instructionSet != DALVIK_JIT_ARM) |
| 1143 | info->codeAddress = (char*)info->codeAddress + 1; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1144 | } |
| 1145 | |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1146 | static u4 assembleBXPair(int branchOffset) |
| 1147 | { |
| 1148 | u4 thumb1, thumb2; |
| 1149 | |
| 1150 | if ((branchOffset < -2048) | (branchOffset > 2046)) { |
| 1151 | thumb1 = (0xf000 | ((branchOffset>>12) & 0x7ff)); |
| 1152 | thumb2 = (0xf800 | ((branchOffset>> 1) & 0x7ff)); |
| 1153 | } else { |
| 1154 | thumb1 = (0xe000 | ((branchOffset>> 1) & 0x7ff)); |
| 1155 | thumb2 = 0x4300; /* nop -> or r0, r0 */ |
| 1156 | } |
| 1157 | |
| 1158 | return thumb2<<16 | thumb1; |
| 1159 | } |
| 1160 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1161 | /* |
| 1162 | * Perform translation chain operation. |
| 1163 | * For ARM, we'll use a pair of thumb instructions to generate |
| 1164 | * an unconditional chaining branch of up to 4MB in distance. |
| 1165 | * Use a BL, though we don't really need the link. The format is |
| 1166 | * 111HHooooooooooo |
| 1167 | * Where HH is 10 for the 1st inst, and 11 for the second and |
| 1168 | * the "o" field is each instruction's 11-bit contribution to the |
| 1169 | * 22-bit branch offset. |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1170 | * If the target is nearby, use a single-instruction bl. |
| 1171 | * If one or more threads is suspended, don't chain. |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1172 | */ |
| 1173 | void* dvmJitChain(void* tgtAddr, u4* branchAddr) |
| 1174 | { |
| 1175 | int baseAddr = (u4) branchAddr + 4; |
| 1176 | int branchOffset = (int) tgtAddr - baseAddr; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1177 | u4 newInst; |
| 1178 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1179 | if (gDvm.sumThreadSuspendCount == 0) { |
| 1180 | assert((branchOffset >= -(1<<22)) && (branchOffset <= ((1<<22)-2))); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1181 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1182 | gDvmJit.translationChains++; |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1183 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1184 | COMPILER_TRACE_CHAINING( |
| 1185 | LOGD("Jit Runtime: chaining 0x%x to 0x%x\n", |
| 1186 | (int) branchAddr, (int) tgtAddr & -2)); |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1187 | |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1188 | newInst = assembleBXPair(branchOffset); |
| 1189 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1190 | *branchAddr = newInst; |
| 1191 | cacheflush((long)branchAddr, (long)branchAddr + 4, 0); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1192 | } |
| 1193 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1194 | return tgtAddr; |
| 1195 | } |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1196 | |
| 1197 | /* |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1198 | * This method is called from the invoke templates for virtual and interface |
| 1199 | * methods to speculatively setup a chain to the callee. The templates are |
| 1200 | * written in assembly and have setup method, cell, and clazz at r0, r2, and |
| 1201 | * r3 respectively, so there is a unused argument in the list. Upon return one |
| 1202 | * of the following three results may happen: |
| 1203 | * 1) Chain is not setup because the callee is native. Reset the rechain |
| 1204 | * count to a big number so that it will take a long time before the next |
| 1205 | * rechain attempt to happen. |
| 1206 | * 2) Chain is not setup because the callee has not been created yet. Reset |
| 1207 | * the rechain count to a small number and retry in the near future. |
| 1208 | * 3) Ask all other threads to stop before patching this chaining cell. |
| 1209 | * This is required because another thread may have passed the class check |
| 1210 | * but hasn't reached the chaining cell yet to follow the chain. If we |
| 1211 | * patch the content before halting the other thread, there could be a |
| 1212 | * small window for race conditions to happen that it may follow the new |
| 1213 | * but wrong chain to invoke a different method. |
| 1214 | */ |
| 1215 | const Method *dvmJitToPatchPredictedChain(const Method *method, |
| 1216 | void *unused, |
| 1217 | PredictedChainingCell *cell, |
| 1218 | const ClassObject *clazz) |
| 1219 | { |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 1220 | #if defined(WITH_SELF_VERIFICATION) |
| 1221 | /* Disable chaining and prevent this from triggering again for a while */ |
| 1222 | cell->counter = PREDICTED_CHAIN_COUNTER_AVOID; |
| 1223 | cacheflush((long) cell, (long) (cell+1), 0); |
| 1224 | goto done; |
| 1225 | #else |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1226 | /* Don't come back here for a long time if the method is native */ |
| 1227 | if (dvmIsNativeMethod(method)) { |
| 1228 | cell->counter = PREDICTED_CHAIN_COUNTER_AVOID; |
| 1229 | cacheflush((long) cell, (long) (cell+1), 0); |
| 1230 | COMPILER_TRACE_CHAINING( |
| 1231 | LOGD("Jit Runtime: predicted chain %p to native method %s ignored", |
| 1232 | cell, method->name)); |
| 1233 | goto done; |
| 1234 | } |
| 1235 | int tgtAddr = (int) dvmJitGetCodeAddr(method->insns); |
| 1236 | |
| 1237 | /* |
| 1238 | * Compilation not made yet for the callee. Reset the counter to a small |
| 1239 | * value and come back to check soon. |
| 1240 | */ |
| 1241 | if (tgtAddr == 0) { |
| 1242 | /* |
| 1243 | * Wait for a few invocations (currently set to be 16) before trying |
| 1244 | * to setup the chain again. |
| 1245 | */ |
| 1246 | cell->counter = PREDICTED_CHAIN_COUNTER_DELAY; |
| 1247 | cacheflush((long) cell, (long) (cell+1), 0); |
| 1248 | COMPILER_TRACE_CHAINING( |
| 1249 | LOGD("Jit Runtime: predicted chain %p to method %s delayed", |
| 1250 | cell, method->name)); |
| 1251 | goto done; |
| 1252 | } |
| 1253 | |
| 1254 | /* Stop the world */ |
| 1255 | dvmSuspendAllThreads(SUSPEND_FOR_JIT); |
| 1256 | |
| 1257 | int baseAddr = (int) cell + 4; // PC is cur_addr + 4 |
| 1258 | int branchOffset = tgtAddr - baseAddr; |
| 1259 | |
| 1260 | COMPILER_TRACE_CHAINING( |
| 1261 | LOGD("Jit Runtime: predicted chain %p from %s to %s (%s) patched", |
| 1262 | cell, cell->clazz ? cell->clazz->descriptor : "NULL", |
| 1263 | clazz->descriptor, |
| 1264 | method->name)); |
| 1265 | |
| 1266 | cell->branch = assembleBXPair(branchOffset); |
| 1267 | cell->clazz = clazz; |
| 1268 | cell->method = method; |
| 1269 | cell->counter = PREDICTED_CHAIN_COUNTER_RECHAIN; |
| 1270 | |
| 1271 | cacheflush((long) cell, (long) (cell+1), 0); |
| 1272 | |
| 1273 | /* All done - resume all other threads */ |
| 1274 | dvmResumeAllThreads(SUSPEND_FOR_JIT); |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 1275 | #endif |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1276 | |
| 1277 | done: |
| 1278 | return method; |
| 1279 | } |
| 1280 | |
| 1281 | /* |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1282 | * Unchain a trace given the starting address of the translation |
| 1283 | * in the code cache. Refer to the diagram in dvmCompilerAssembleLIR. |
| 1284 | * Returns the address following the last cell unchained. Note that |
| 1285 | * the incoming codeAddr is a thumb code address, and therefore has |
| 1286 | * the low bit set. |
| 1287 | */ |
| 1288 | u4* dvmJitUnchain(void* codeAddr) |
| 1289 | { |
| 1290 | u2* pChainCellOffset = (u2*)((char*)codeAddr - 3); |
| 1291 | u2 chainCellOffset = *pChainCellOffset; |
| 1292 | ChainCellCounts *pChainCellCounts = |
| Ben Cheng | e80cd94 | 2009-07-17 15:54:23 -0700 | [diff] [blame] | 1293 | (ChainCellCounts*)((char*)codeAddr + chainCellOffset - 3); |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1294 | int cellSize; |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1295 | u4* pChainCells; |
| 1296 | u4* pStart; |
| 1297 | u4 thumb1; |
| 1298 | u4 thumb2; |
| 1299 | u4 newInst; |
| 1300 | int i,j; |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1301 | PredictedChainingCell *predChainCell; |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1302 | |
| 1303 | /* Get total count of chain cells */ |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1304 | for (i = 0, cellSize = 0; i < CHAINING_CELL_LAST; i++) { |
| 1305 | if (i != CHAINING_CELL_INVOKE_PREDICTED) { |
| 1306 | cellSize += pChainCellCounts->u.count[i] * 2; |
| 1307 | } else { |
| 1308 | cellSize += pChainCellCounts->u.count[i] * 4; |
| 1309 | } |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1310 | } |
| 1311 | |
| 1312 | /* Locate the beginning of the chain cell region */ |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1313 | pStart = pChainCells = ((u4 *) pChainCellCounts) - cellSize; |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1314 | |
| 1315 | /* The cells are sorted in order - walk through them and reset */ |
| 1316 | for (i = 0; i < CHAINING_CELL_LAST; i++) { |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1317 | int elemSize = 2; /* Most chaining cell has two words */ |
| 1318 | if (i == CHAINING_CELL_INVOKE_PREDICTED) { |
| 1319 | elemSize = 4; |
| 1320 | } |
| 1321 | |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1322 | for (j = 0; j < pChainCellCounts->u.count[i]; j++) { |
| 1323 | int targetOffset; |
| 1324 | switch(i) { |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1325 | case CHAINING_CELL_NORMAL: |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1326 | targetOffset = offsetof(InterpState, |
| 1327 | jitToInterpEntries.dvmJitToInterpNormal); |
| 1328 | break; |
| Ben Cheng | 1efc9c5 | 2009-06-08 18:25:27 -0700 | [diff] [blame] | 1329 | case CHAINING_CELL_HOT: |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1330 | case CHAINING_CELL_INVOKE_SINGLETON: |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1331 | targetOffset = offsetof(InterpState, |
| 1332 | jitToInterpEntries.dvmJitToTraceSelect); |
| 1333 | break; |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1334 | case CHAINING_CELL_INVOKE_PREDICTED: |
| 1335 | targetOffset = 0; |
| 1336 | predChainCell = (PredictedChainingCell *) pChainCells; |
| 1337 | /* Reset the cell to the init state */ |
| 1338 | predChainCell->branch = PREDICTED_CHAIN_BX_PAIR_INIT; |
| 1339 | predChainCell->clazz = PREDICTED_CHAIN_CLAZZ_INIT; |
| 1340 | predChainCell->method = PREDICTED_CHAIN_METHOD_INIT; |
| 1341 | predChainCell->counter = PREDICTED_CHAIN_COUNTER_INIT; |
| 1342 | break; |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 1343 | #if defined(WITH_SELF_VERIFICATION) |
| 1344 | case CHAINING_CELL_BACKWARD_BRANCH: |
| 1345 | targetOffset = offsetof(InterpState, |
| 1346 | jitToInterpEntries.dvmJitToBackwardBranch); |
| 1347 | break; |
| Bill Buzbee | 9c4b7c8 | 2009-09-10 10:10:38 -0700 | [diff] [blame] | 1348 | #elif defined(WITH_JIT_TUNING) |
| 1349 | case CHAINING_CELL_BACKWARD_BRANCH: |
| 1350 | targetOffset = offsetof(InterpState, |
| 1351 | jitToInterpEntries.dvmJitToInterpNormal); |
| 1352 | break; |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 1353 | #endif |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1354 | default: |
| 1355 | dvmAbort(); |
| 1356 | } |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1357 | COMPILER_TRACE_CHAINING( |
| 1358 | LOGD("Jit Runtime: unchaining 0x%x", (int)pChainCells)); |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1359 | /* |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1360 | * Thumb code sequence for a chaining cell is: |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1361 | * ldr r0, rGLUE, #<word offset> |
| 1362 | * blx r0 |
| 1363 | */ |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 1364 | if (i != CHAINING_CELL_INVOKE_PREDICTED) { |
| 1365 | targetOffset = targetOffset >> 2; /* convert to word offset */ |
| 1366 | thumb1 = 0x6800 | (targetOffset << 6) | |
| 1367 | (rGLUE << 3) | (r0 << 0); |
| 1368 | thumb2 = 0x4780 | (r0 << 3); |
| 1369 | newInst = thumb2<<16 | thumb1; |
| 1370 | *pChainCells = newInst; |
| 1371 | } |
| 1372 | pChainCells += elemSize; /* Advance by a fixed number of words */ |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1373 | } |
| 1374 | } |
| 1375 | return pChainCells; |
| 1376 | } |
| 1377 | |
| 1378 | /* Unchain all translation in the cache. */ |
| 1379 | void dvmJitUnchainAll() |
| 1380 | { |
| 1381 | u4* lowAddress = NULL; |
| 1382 | u4* highAddress = NULL; |
| 1383 | unsigned int i; |
| 1384 | if (gDvmJit.pJitEntryTable != NULL) { |
| 1385 | COMPILER_TRACE_CHAINING(LOGD("Jit Runtime: unchaining all")); |
| 1386 | dvmLockMutex(&gDvmJit.tableLock); |
| Bill Buzbee | 2717622 | 2009-06-09 09:20:16 -0700 | [diff] [blame] | 1387 | for (i = 0; i < gDvmJit.jitTableSize; i++) { |
| Bill Buzbee | 46cd5b6 | 2009-06-05 15:36:06 -0700 | [diff] [blame] | 1388 | if (gDvmJit.pJitEntryTable[i].dPC && |
| 1389 | gDvmJit.pJitEntryTable[i].codeAddress) { |
| 1390 | u4* lastAddress; |
| 1391 | lastAddress = |
| 1392 | dvmJitUnchain(gDvmJit.pJitEntryTable[i].codeAddress); |
| 1393 | if (lowAddress == NULL || |
| 1394 | (u4*)gDvmJit.pJitEntryTable[i].codeAddress < lowAddress) |
| 1395 | lowAddress = lastAddress; |
| 1396 | if (lastAddress > highAddress) |
| 1397 | highAddress = lastAddress; |
| 1398 | } |
| 1399 | } |
| 1400 | cacheflush((long)lowAddress, (long)highAddress, 0); |
| 1401 | dvmUnlockMutex(&gDvmJit.tableLock); |
| 1402 | } |
| 1403 | } |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 1404 | |
| 1405 | typedef struct jitProfileAddrToLine { |
| 1406 | u4 lineNum; |
| 1407 | u4 bytecodeOffset; |
| 1408 | } jitProfileAddrToLine; |
| 1409 | |
| 1410 | |
| 1411 | /* Callback function to track the bytecode offset/line number relationiship */ |
| 1412 | static int addrToLineCb (void *cnxt, u4 bytecodeOffset, u4 lineNum) |
| 1413 | { |
| 1414 | jitProfileAddrToLine *addrToLine = (jitProfileAddrToLine *) cnxt; |
| 1415 | |
| 1416 | /* Best match so far for this offset */ |
| 1417 | if (addrToLine->bytecodeOffset >= bytecodeOffset) { |
| 1418 | addrToLine->lineNum = lineNum; |
| 1419 | } |
| 1420 | return 0; |
| 1421 | } |
| 1422 | |
| 1423 | char *getTraceBase(const JitEntry *p) |
| 1424 | { |
| 1425 | return (char*)p->codeAddress - |
| 1426 | (6 + (p->u.info.instructionSet == DALVIK_JIT_ARM ? 0 : 1)); |
| 1427 | } |
| 1428 | |
| 1429 | /* Dumps profile info for a single trace */ |
| 1430 | static int dumpTraceProfile(JitEntry *p) |
| 1431 | { |
| 1432 | ChainCellCounts* pCellCounts; |
| 1433 | char* traceBase; |
| 1434 | u4* pExecutionCount; |
| 1435 | u2* pCellOffset; |
| 1436 | JitTraceDescription *desc; |
| 1437 | const Method* method; |
| 1438 | |
| 1439 | traceBase = getTraceBase(p); |
| 1440 | |
| 1441 | if (p->codeAddress == NULL) { |
| 1442 | LOGD("TRACEPROFILE 0x%08x 0 NULL 0 0", (int)traceBase); |
| 1443 | return 0; |
| 1444 | } |
| 1445 | |
| 1446 | pExecutionCount = (u4*) (traceBase); |
| 1447 | pCellOffset = (u2*) (traceBase + 4); |
| 1448 | pCellCounts = (ChainCellCounts*) ((char *)pCellOffset + *pCellOffset); |
| 1449 | desc = (JitTraceDescription*) ((char*)pCellCounts + sizeof(*pCellCounts)); |
| 1450 | method = desc->method; |
| 1451 | char *methodDesc = dexProtoCopyMethodDescriptor(&method->prototype); |
| 1452 | jitProfileAddrToLine addrToLine = {0, desc->trace[0].frag.startOffset}; |
| 1453 | |
| 1454 | /* |
| 1455 | * We may end up decoding the debug information for the same method |
| 1456 | * multiple times, but the tradeoff is we don't need to allocate extra |
| 1457 | * space to store the addr/line mapping. Since this is a debugging feature |
| 1458 | * and done infrequently so the slower but simpler mechanism should work |
| 1459 | * just fine. |
| 1460 | */ |
| 1461 | dexDecodeDebugInfo(method->clazz->pDvmDex->pDexFile, |
| 1462 | dvmGetMethodCode(method), |
| 1463 | method->clazz->descriptor, |
| 1464 | method->prototype.protoIdx, |
| 1465 | method->accessFlags, |
| 1466 | addrToLineCb, NULL, &addrToLine); |
| 1467 | |
| 1468 | LOGD("TRACEPROFILE 0x%08x % 10d [%#x(+%d), %d] %s%s;%s", |
| 1469 | (int)traceBase, |
| 1470 | *pExecutionCount, |
| 1471 | desc->trace[0].frag.startOffset, |
| 1472 | desc->trace[0].frag.numInsts, |
| 1473 | addrToLine.lineNum, |
| 1474 | method->clazz->descriptor, method->name, methodDesc); |
| 1475 | free(methodDesc); |
| 1476 | |
| 1477 | return *pExecutionCount; |
| 1478 | } |
| 1479 | |
| 1480 | /* Handy function to retrieve the profile count */ |
| 1481 | static inline int getProfileCount(const JitEntry *entry) |
| 1482 | { |
| 1483 | if (entry->dPC == 0 || entry->codeAddress == 0) |
| 1484 | return 0; |
| 1485 | u4 *pExecutionCount = (u4 *) getTraceBase(entry); |
| 1486 | |
| 1487 | return *pExecutionCount; |
| 1488 | } |
| 1489 | |
| 1490 | |
| 1491 | /* qsort callback function */ |
| 1492 | static int sortTraceProfileCount(const void *entry1, const void *entry2) |
| 1493 | { |
| 1494 | const JitEntry *jitEntry1 = entry1; |
| 1495 | const JitEntry *jitEntry2 = entry2; |
| 1496 | |
| 1497 | int count1 = getProfileCount(jitEntry1); |
| 1498 | int count2 = getProfileCount(jitEntry2); |
| 1499 | return (count1 == count2) ? 0 : ((count1 > count2) ? -1 : 1); |
| 1500 | } |
| 1501 | |
| 1502 | /* Sort the trace profile counts and dump them */ |
| 1503 | void dvmCompilerSortAndPrintTraceProfiles() |
| 1504 | { |
| 1505 | JitEntry *sortedEntries; |
| 1506 | int numTraces = 0; |
| 1507 | unsigned long counts = 0; |
| 1508 | unsigned int i; |
| 1509 | |
| 1510 | /* Make sure that the table is not changing */ |
| 1511 | dvmLockMutex(&gDvmJit.tableLock); |
| 1512 | |
| 1513 | /* Sort the entries by descending order */ |
| 1514 | sortedEntries = malloc(sizeof(JitEntry) * gDvmJit.jitTableSize); |
| 1515 | if (sortedEntries == NULL) |
| 1516 | goto done; |
| 1517 | memcpy(sortedEntries, gDvmJit.pJitEntryTable, |
| 1518 | sizeof(JitEntry) * gDvmJit.jitTableSize); |
| 1519 | qsort(sortedEntries, gDvmJit.jitTableSize, sizeof(JitEntry), |
| 1520 | sortTraceProfileCount); |
| 1521 | |
| 1522 | /* Dump the sorted entries */ |
| 1523 | for (i=0; i < gDvmJit.jitTableSize; i++) { |
| 1524 | if (sortedEntries[i].dPC != 0) { |
| 1525 | counts += dumpTraceProfile(&sortedEntries[i]); |
| 1526 | numTraces++; |
| 1527 | } |
| 1528 | } |
| 1529 | if (numTraces == 0) |
| 1530 | numTraces = 1; |
| 1531 | LOGD("JIT: Average execution count -> %d",(int)(counts / numTraces)); |
| 1532 | |
| 1533 | free(sortedEntries); |
| 1534 | done: |
| 1535 | dvmUnlockMutex(&gDvmJit.tableLock); |
| 1536 | return; |
| 1537 | } |