buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 "Dataflow.h" |
| 19 | //#include "libdex/DexOpcodes.h" |
| 20 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 21 | namespace art { |
| 22 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 23 | /* |
| 24 | * Main table containing data flow attributes for each bytecode. The |
| 25 | * first kNumPackedOpcodes entries are for Dalvik bytecode |
| 26 | * instructions, where extended opcode at the MIR level are appended |
| 27 | * afterwards. |
| 28 | * |
| 29 | * TODO - many optimization flags are incomplete - they will only limit the |
| 30 | * scope of optimizations but will not cause mis-optimizations. |
| 31 | */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 32 | const int oatDataFlowAttributes[kMirOpLast] = { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 33 | // 00 OP_NOP |
| 34 | DF_NOP, |
| 35 | |
| 36 | // 01 OP_MOVE vA, vB |
| 37 | DF_DA | DF_UB | DF_IS_MOVE, |
| 38 | |
| 39 | // 02 OP_MOVE_FROM16 vAA, vBBBB |
| 40 | DF_DA | DF_UB | DF_IS_MOVE, |
| 41 | |
| 42 | // 03 OP_MOVE_16 vAAAA, vBBBB |
| 43 | DF_DA | DF_UB | DF_IS_MOVE, |
| 44 | |
| 45 | // 04 OP_MOVE_WIDE vA, vB |
| 46 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 47 | |
| 48 | // 05 OP_MOVE_WIDE_FROM16 vAA, vBBBB |
| 49 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 50 | |
| 51 | // 06 OP_MOVE_WIDE_16 vAAAA, vBBBB |
| 52 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 53 | |
| 54 | // 07 OP_MOVE_OBJECT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 55 | DF_DA | DF_UB | DF_NULL_TRANSFER_0 | DF_IS_MOVE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 56 | |
| 57 | // 08 OP_MOVE_OBJECT_FROM16 vAA, vBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 58 | DF_DA | DF_UB | DF_NULL_TRANSFER_0 | DF_IS_MOVE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 59 | |
| 60 | // 09 OP_MOVE_OBJECT_16 vAAAA, vBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 61 | DF_DA | DF_UB | DF_NULL_TRANSFER_0 | DF_IS_MOVE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 62 | |
| 63 | // 0A OP_MOVE_RESULT vAA |
| 64 | DF_DA, |
| 65 | |
| 66 | // 0B OP_MOVE_RESULT_WIDE vAA |
| 67 | DF_DA_WIDE, |
| 68 | |
| 69 | // 0C OP_MOVE_RESULT_OBJECT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 70 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 71 | |
| 72 | // 0D OP_MOVE_EXCEPTION vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 73 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 74 | |
| 75 | // 0E OP_RETURN_VOID |
| 76 | DF_NOP, |
| 77 | |
| 78 | // 0F OP_RETURN vAA |
| 79 | DF_UA, |
| 80 | |
| 81 | // 10 OP_RETURN_WIDE vAA |
| 82 | DF_UA_WIDE, |
| 83 | |
| 84 | // 11 OP_RETURN_OBJECT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 85 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 86 | |
| 87 | // 12 OP_CONST_4 vA, #+B |
| 88 | DF_DA | DF_SETS_CONST, |
| 89 | |
| 90 | // 13 OP_CONST_16 vAA, #+BBBB |
| 91 | DF_DA | DF_SETS_CONST, |
| 92 | |
| 93 | // 14 OP_CONST vAA, #+BBBBBBBB |
| 94 | DF_DA | DF_SETS_CONST, |
| 95 | |
| 96 | // 15 OP_CONST_HIGH16 VAA, #+BBBB0000 |
| 97 | DF_DA | DF_SETS_CONST, |
| 98 | |
| 99 | // 16 OP_CONST_WIDE_16 vAA, #+BBBB |
| 100 | DF_DA_WIDE | DF_SETS_CONST, |
| 101 | |
| 102 | // 17 OP_CONST_WIDE_32 vAA, #+BBBBBBBB |
| 103 | DF_DA_WIDE | DF_SETS_CONST, |
| 104 | |
| 105 | // 18 OP_CONST_WIDE vAA, #+BBBBBBBBBBBBBBBB |
| 106 | DF_DA_WIDE | DF_SETS_CONST, |
| 107 | |
| 108 | // 19 OP_CONST_WIDE_HIGH16 vAA, #+BBBB000000000000 |
| 109 | DF_DA_WIDE | DF_SETS_CONST, |
| 110 | |
| 111 | // 1A OP_CONST_STRING vAA, string@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 112 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 113 | |
| 114 | // 1B OP_CONST_STRING_JUMBO vAA, string@BBBBBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 115 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 116 | |
| 117 | // 1C OP_CONST_CLASS vAA, type@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 118 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 119 | |
| 120 | // 1D OP_MONITOR_ENTER vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 121 | DF_UA | DF_NULL_CHK_0 | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 122 | |
| 123 | // 1E OP_MONITOR_EXIT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 124 | DF_UA | DF_NULL_CHK_0 | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 125 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 126 | // 1F OP_CHK_CAST vAA, type@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 127 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 128 | |
| 129 | // 20 OP_INSTANCE_OF vA, vB, type@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 130 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 131 | |
| 132 | // 21 OP_ARRAY_LENGTH vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 133 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 134 | |
| 135 | // 22 OP_NEW_INSTANCE vAA, type@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 136 | DF_DA | DF_NON_NULL_DST | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 137 | |
| 138 | // 23 OP_NEW_ARRAY vA, vB, type@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 139 | DF_DA | DF_UB | DF_NON_NULL_DST | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 140 | |
| 141 | // 24 OP_FILLED_NEW_ARRAY {vD, vE, vF, vG, vA} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 142 | DF_FORMAT_35C | DF_NON_NULL_RET, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 143 | |
| 144 | // 25 OP_FILLED_NEW_ARRAY_RANGE {vCCCC .. vNNNN}, type@BBBB |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 145 | DF_FORMAT_3RC | DF_NON_NULL_RET, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 146 | |
| 147 | // 26 OP_FILL_ARRAY_DATA vAA, +BBBBBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 148 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 149 | |
| 150 | // 27 OP_THROW vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 151 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 152 | |
| 153 | // 28 OP_GOTO |
| 154 | DF_NOP, |
| 155 | |
| 156 | // 29 OP_GOTO_16 |
| 157 | DF_NOP, |
| 158 | |
| 159 | // 2A OP_GOTO_32 |
| 160 | DF_NOP, |
| 161 | |
| 162 | // 2B OP_PACKED_SWITCH vAA, +BBBBBBBB |
| 163 | DF_UA, |
| 164 | |
| 165 | // 2C OP_SPARSE_SWITCH vAA, +BBBBBBBB |
| 166 | DF_UA, |
| 167 | |
| 168 | // 2D OP_CMPL_FLOAT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 169 | DF_DA | DF_UB | DF_UC | DF_FP_B | DF_FP_C | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 170 | |
| 171 | // 2E OP_CMPG_FLOAT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 172 | DF_DA | DF_UB | DF_UC | DF_FP_B | DF_FP_C | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 173 | |
| 174 | // 2F OP_CMPL_DOUBLE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 175 | DF_DA | DF_UB_WIDE | DF_UC_WIDE | DF_FP_B | DF_FP_C | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 176 | |
| 177 | // 30 OP_CMPG_DOUBLE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 178 | DF_DA | DF_UB_WIDE | DF_UC_WIDE | DF_FP_B | DF_FP_C | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 179 | |
| 180 | // 31 OP_CMP_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 181 | DF_DA | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 182 | |
| 183 | // 32 OP_IF_EQ vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 184 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 185 | |
| 186 | // 33 OP_IF_NE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 187 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 188 | |
| 189 | // 34 OP_IF_LT vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 190 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 191 | |
| 192 | // 35 OP_IF_GE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 193 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 194 | |
| 195 | // 36 OP_IF_GT vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 196 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 197 | |
| 198 | // 37 OP_IF_LE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 199 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 200 | |
| 201 | |
| 202 | // 38 OP_IF_EQZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 203 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 204 | |
| 205 | // 39 OP_IF_NEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 206 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 207 | |
| 208 | // 3A OP_IF_LTZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 209 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 210 | |
| 211 | // 3B OP_IF_GEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 212 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 213 | |
| 214 | // 3C OP_IF_GTZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 215 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 216 | |
| 217 | // 3D OP_IF_LEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 218 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 219 | |
| 220 | // 3E OP_UNUSED_3E |
| 221 | DF_NOP, |
| 222 | |
| 223 | // 3F OP_UNUSED_3F |
| 224 | DF_NOP, |
| 225 | |
| 226 | // 40 OP_UNUSED_40 |
| 227 | DF_NOP, |
| 228 | |
| 229 | // 41 OP_UNUSED_41 |
| 230 | DF_NOP, |
| 231 | |
| 232 | // 42 OP_UNUSED_42 |
| 233 | DF_NOP, |
| 234 | |
| 235 | // 43 OP_UNUSED_43 |
| 236 | DF_NOP, |
| 237 | |
| 238 | // 44 OP_AGET vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 239 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 240 | |
| 241 | // 45 OP_AGET_WIDE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 242 | DF_DA_WIDE | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 243 | |
| 244 | // 46 OP_AGET_OBJECT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 245 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 246 | |
| 247 | // 47 OP_AGET_BOOLEAN vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 248 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 249 | |
| 250 | // 48 OP_AGET_BYTE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 251 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 252 | |
| 253 | // 49 OP_AGET_CHAR vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 254 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 255 | |
| 256 | // 4A OP_AGET_SHORT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 257 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_IS_GETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 258 | |
| 259 | // 4B OP_APUT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 260 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 261 | |
| 262 | // 4C OP_APUT_WIDE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 263 | DF_UA_WIDE | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 264 | |
| 265 | // 4D OP_APUT_OBJECT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 266 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 267 | |
| 268 | // 4E OP_APUT_BOOLEAN vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 269 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 270 | |
| 271 | // 4F OP_APUT_BYTE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 272 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 273 | |
| 274 | // 50 OP_APUT_CHAR vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 275 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 276 | |
| 277 | // 51 OP_APUT_SHORT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 278 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_IS_SETTER | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 279 | |
| 280 | // 52 OP_IGET vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 281 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 282 | |
| 283 | // 53 OP_IGET_WIDE vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 284 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 285 | |
| 286 | // 54 OP_IGET_OBJECT vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 287 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 288 | |
| 289 | // 55 OP_IGET_BOOLEAN vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 290 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 291 | |
| 292 | // 56 OP_IGET_BYTE vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 293 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 294 | |
| 295 | // 57 OP_IGET_CHAR vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 296 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 297 | |
| 298 | // 58 OP_IGET_SHORT vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 299 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 300 | |
| 301 | // 59 OP_IPUT vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 302 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 303 | |
| 304 | // 5A OP_IPUT_WIDE vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 305 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 306 | |
| 307 | // 5B OP_IPUT_OBJECT vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 308 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 309 | |
| 310 | // 5C OP_IPUT_BOOLEAN vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 311 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 312 | |
| 313 | // 5D OP_IPUT_BYTE vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 314 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 315 | |
| 316 | // 5E OP_IPUT_CHAR vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 317 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 318 | |
| 319 | // 5F OP_IPUT_SHORT vA, vB, field@CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 320 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 321 | |
| 322 | // 60 OP_SGET vAA, field@BBBB |
| 323 | DF_DA | DF_IS_GETTER, |
| 324 | |
| 325 | // 61 OP_SGET_WIDE vAA, field@BBBB |
| 326 | DF_DA_WIDE | DF_IS_GETTER, |
| 327 | |
| 328 | // 62 OP_SGET_OBJECT vAA, field@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 329 | DF_DA | DF_IS_GETTER | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 330 | |
| 331 | // 63 OP_SGET_BOOLEAN vAA, field@BBBB |
| 332 | DF_DA | DF_IS_GETTER, |
| 333 | |
| 334 | // 64 OP_SGET_BYTE vAA, field@BBBB |
| 335 | DF_DA | DF_IS_GETTER, |
| 336 | |
| 337 | // 65 OP_SGET_CHAR vAA, field@BBBB |
| 338 | DF_DA | DF_IS_GETTER, |
| 339 | |
| 340 | // 66 OP_SGET_SHORT vAA, field@BBBB |
| 341 | DF_DA | DF_IS_GETTER, |
| 342 | |
| 343 | // 67 OP_SPUT vAA, field@BBBB |
| 344 | DF_UA | DF_IS_SETTER, |
| 345 | |
| 346 | // 68 OP_SPUT_WIDE vAA, field@BBBB |
| 347 | DF_UA_WIDE | DF_IS_SETTER, |
| 348 | |
| 349 | // 69 OP_SPUT_OBJECT vAA, field@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 350 | DF_UA | DF_IS_SETTER | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 351 | |
| 352 | // 6A OP_SPUT_BOOLEAN vAA, field@BBBB |
| 353 | DF_UA | DF_IS_SETTER, |
| 354 | |
| 355 | // 6B OP_SPUT_BYTE vAA, field@BBBB |
| 356 | DF_UA | DF_IS_SETTER, |
| 357 | |
| 358 | // 6C OP_SPUT_CHAR vAA, field@BBBB |
| 359 | DF_UA | DF_IS_SETTER, |
| 360 | |
| 361 | // 6D OP_SPUT_SHORT vAA, field@BBBB |
| 362 | DF_UA | DF_IS_SETTER, |
| 363 | |
| 364 | // 6E OP_INVOKE_VIRTUAL {vD, vE, vF, vG, vA} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 365 | DF_FORMAT_35C | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 366 | |
| 367 | // 6F OP_INVOKE_SUPER {vD, vE, vF, vG, vA} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 368 | DF_FORMAT_35C | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 369 | |
| 370 | // 70 OP_INVOKE_DIRECT {vD, vE, vF, vG, vA} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 371 | DF_FORMAT_35C | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 372 | |
| 373 | // 71 OP_INVOKE_STATIC {vD, vE, vF, vG, vA} |
| 374 | DF_FORMAT_35C, |
| 375 | |
| 376 | // 72 OP_INVOKE_INTERFACE {vD, vE, vF, vG, vA} |
| 377 | DF_FORMAT_35C, |
| 378 | |
| 379 | // 73 OP_UNUSED_73 |
| 380 | DF_NOP, |
| 381 | |
| 382 | // 74 OP_INVOKE_VIRTUAL_RANGE {vCCCC .. vNNNN} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 383 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 384 | |
| 385 | // 75 OP_INVOKE_SUPER_RANGE {vCCCC .. vNNNN} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 386 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 387 | |
| 388 | // 76 OP_INVOKE_DIRECT_RANGE {vCCCC .. vNNNN} |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 389 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 390 | |
| 391 | // 77 OP_INVOKE_STATIC_RANGE {vCCCC .. vNNNN} |
| 392 | DF_FORMAT_3RC, |
| 393 | |
| 394 | // 78 OP_INVOKE_INTERFACE_RANGE {vCCCC .. vNNNN} |
| 395 | DF_FORMAT_3RC, |
| 396 | |
| 397 | // 79 OP_UNUSED_79 |
| 398 | DF_NOP, |
| 399 | |
| 400 | // 7A OP_UNUSED_7A |
| 401 | DF_NOP, |
| 402 | |
| 403 | // 7B OP_NEG_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 404 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 405 | |
| 406 | // 7C OP_NOT_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 407 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 408 | |
| 409 | // 7D OP_NEG_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 410 | DF_DA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 411 | |
| 412 | // 7E OP_NOT_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 413 | DF_DA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 414 | |
| 415 | // 7F OP_NEG_FLOAT vA, vB |
| 416 | DF_DA | DF_UB | DF_FP_A | DF_FP_B, |
| 417 | |
| 418 | // 80 OP_NEG_DOUBLE vA, vB |
| 419 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 420 | |
| 421 | // 81 OP_INT_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 422 | DF_DA_WIDE | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 423 | |
| 424 | // 82 OP_INT_TO_FLOAT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 425 | DF_DA | DF_UB | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 426 | |
| 427 | // 83 OP_INT_TO_DOUBLE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 428 | DF_DA_WIDE | DF_UB | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 429 | |
| 430 | // 84 OP_LONG_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 431 | DF_DA | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 432 | |
| 433 | // 85 OP_LONG_TO_FLOAT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 434 | DF_DA | DF_UB_WIDE | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 435 | |
| 436 | // 86 OP_LONG_TO_DOUBLE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 437 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 438 | |
| 439 | // 87 OP_FLOAT_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 440 | DF_DA | DF_UB | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 441 | |
| 442 | // 88 OP_FLOAT_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 443 | DF_DA_WIDE | DF_UB | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 444 | |
| 445 | // 89 OP_FLOAT_TO_DOUBLE vA, vB |
| 446 | DF_DA_WIDE | DF_UB | DF_FP_A | DF_FP_B, |
| 447 | |
| 448 | // 8A OP_DOUBLE_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 449 | DF_DA | DF_UB_WIDE | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 450 | |
| 451 | // 8B OP_DOUBLE_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 452 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 453 | |
| 454 | // 8C OP_DOUBLE_TO_FLOAT vA, vB |
| 455 | DF_DA | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 456 | |
| 457 | // 8D OP_INT_TO_BYTE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 458 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 459 | |
| 460 | // 8E OP_INT_TO_CHAR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 461 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 462 | |
| 463 | // 8F OP_INT_TO_SHORT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 464 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 465 | |
| 466 | // 90 OP_ADD_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 467 | DF_DA | DF_UB | DF_UC | DF_IS_LINEAR | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 468 | |
| 469 | // 91 OP_SUB_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 470 | DF_DA | DF_UB | DF_UC | DF_IS_LINEAR | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 471 | |
| 472 | // 92 OP_MUL_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 473 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 474 | |
| 475 | // 93 OP_DIV_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 476 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 477 | |
| 478 | // 94 OP_REM_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 479 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 480 | |
| 481 | // 95 OP_AND_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 482 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 483 | |
| 484 | // 96 OP_OR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 485 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 486 | |
| 487 | // 97 OP_XOR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 488 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 489 | |
| 490 | // 98 OP_SHL_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 491 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 492 | |
| 493 | // 99 OP_SHR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 494 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 495 | |
| 496 | // 9A OP_USHR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 497 | DF_DA | DF_UB | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 498 | |
| 499 | // 9B OP_ADD_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 500 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 501 | |
| 502 | // 9C OP_SUB_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 503 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 504 | |
| 505 | // 9D OP_MUL_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 506 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 507 | |
| 508 | // 9E OP_DIV_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 509 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 510 | |
| 511 | // 9F OP_REM_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 512 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 513 | |
| 514 | // A0 OP_AND_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 515 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 516 | |
| 517 | // A1 OP_OR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 518 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 519 | |
| 520 | // A2 OP_XOR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 521 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 522 | |
| 523 | // A3 OP_SHL_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 524 | DF_DA_WIDE | DF_UB_WIDE | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 525 | |
| 526 | // A4 OP_SHR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 527 | DF_DA_WIDE | DF_UB_WIDE | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 528 | |
| 529 | // A5 OP_USHR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 530 | DF_DA_WIDE | DF_UB_WIDE | DF_UC | DF_CORE_A | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 531 | |
| 532 | // A6 OP_ADD_FLOAT vAA, vBB, vCC |
| 533 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 534 | |
| 535 | // A7 OP_SUB_FLOAT vAA, vBB, vCC |
| 536 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 537 | |
| 538 | // A8 OP_MUL_FLOAT vAA, vBB, vCC |
| 539 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 540 | |
| 541 | // A9 OP_DIV_FLOAT vAA, vBB, vCC |
| 542 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 543 | |
| 544 | // AA OP_REM_FLOAT vAA, vBB, vCC |
| 545 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 546 | |
| 547 | // AB OP_ADD_DOUBLE vAA, vBB, vCC |
| 548 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 549 | |
| 550 | // AC OP_SUB_DOUBLE vAA, vBB, vCC |
| 551 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 552 | |
| 553 | // AD OP_MUL_DOUBLE vAA, vBB, vCC |
| 554 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 555 | |
| 556 | // AE OP_DIV_DOUBLE vAA, vBB, vCC |
| 557 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 558 | |
| 559 | // AF OP_REM_DOUBLE vAA, vBB, vCC |
| 560 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 561 | |
| 562 | // B0 OP_ADD_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 563 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 564 | |
| 565 | // B1 OP_SUB_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 566 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 567 | |
| 568 | // B2 OP_MUL_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 569 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 570 | |
| 571 | // B3 OP_DIV_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 572 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 573 | |
| 574 | // B4 OP_REM_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 575 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 576 | |
| 577 | // B5 OP_AND_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 578 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 579 | |
| 580 | // B6 OP_OR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 581 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 582 | |
| 583 | // B7 OP_XOR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 584 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 585 | |
| 586 | // B8 OP_SHL_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 587 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 588 | |
| 589 | // B9 OP_SHR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 590 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 591 | |
| 592 | // BA OP_USHR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 593 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 594 | |
| 595 | // BB OP_ADD_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 596 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 597 | |
| 598 | // BC OP_SUB_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 599 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 600 | |
| 601 | // BD OP_MUL_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 602 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 603 | |
| 604 | // BE OP_DIV_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 605 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 606 | |
| 607 | // BF OP_REM_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 608 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 609 | |
| 610 | // C0 OP_AND_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 611 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 612 | |
| 613 | // C1 OP_OR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 614 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 615 | |
| 616 | // C2 OP_XOR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 617 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 618 | |
| 619 | // C3 OP_SHL_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 620 | DF_DA_WIDE | DF_UA_WIDE | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 621 | |
| 622 | // C4 OP_SHR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 623 | DF_DA_WIDE | DF_UA_WIDE | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 624 | |
| 625 | // C5 OP_USHR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 626 | DF_DA_WIDE | DF_UA_WIDE | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 627 | |
| 628 | // C6 OP_ADD_FLOAT_2ADDR vA, vB |
| 629 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 630 | |
| 631 | // C7 OP_SUB_FLOAT_2ADDR vA, vB |
| 632 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 633 | |
| 634 | // C8 OP_MUL_FLOAT_2ADDR vA, vB |
| 635 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 636 | |
| 637 | // C9 OP_DIV_FLOAT_2ADDR vA, vB |
| 638 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 639 | |
| 640 | // CA OP_REM_FLOAT_2ADDR vA, vB |
| 641 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 642 | |
| 643 | // CB OP_ADD_DOUBLE_2ADDR vA, vB |
| 644 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 645 | |
| 646 | // CC OP_SUB_DOUBLE_2ADDR vA, vB |
| 647 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 648 | |
| 649 | // CD OP_MUL_DOUBLE_2ADDR vA, vB |
| 650 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 651 | |
| 652 | // CE OP_DIV_DOUBLE_2ADDR vA, vB |
| 653 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 654 | |
| 655 | // CF OP_REM_DOUBLE_2ADDR vA, vB |
| 656 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 657 | |
| 658 | // D0 OP_ADD_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 659 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 660 | |
| 661 | // D1 OP_RSUB_INT vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 662 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 663 | |
| 664 | // D2 OP_MUL_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 665 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 666 | |
| 667 | // D3 OP_DIV_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 668 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 669 | |
| 670 | // D4 OP_REM_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 671 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 672 | |
| 673 | // D5 OP_AND_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 674 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 675 | |
| 676 | // D6 OP_OR_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 677 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 678 | |
| 679 | // D7 OP_XOR_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 680 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 681 | |
| 682 | // D8 OP_ADD_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 683 | DF_DA | DF_UB | DF_IS_LINEAR | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 684 | |
| 685 | // D9 OP_RSUB_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 686 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 687 | |
| 688 | // DA OP_MUL_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 689 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 690 | |
| 691 | // DB OP_DIV_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 692 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 693 | |
| 694 | // DC OP_REM_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 695 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 696 | |
| 697 | // DD OP_AND_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 698 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 699 | |
| 700 | // DE OP_OR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 701 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 702 | |
| 703 | // DF OP_XOR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 704 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 705 | |
| 706 | // E0 OP_SHL_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 707 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 708 | |
| 709 | // E1 OP_SHR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 710 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 711 | |
| 712 | // E2 OP_USHR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 713 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 714 | |
| 715 | // E3 OP_IGET_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 716 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 717 | |
| 718 | // E4 OP_IPUT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 719 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 720 | |
| 721 | // E5 OP_SGET_VOLATILE |
| 722 | DF_DA, |
| 723 | |
| 724 | // E6 OP_SPUT_VOLATILE |
| 725 | DF_UA, |
| 726 | |
| 727 | // E7 OP_IGET_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 728 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 729 | |
| 730 | // E8 OP_IGET_WIDE_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 731 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 732 | |
| 733 | // E9 OP_IPUT_WIDE_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 734 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 735 | |
| 736 | // EA OP_SGET_WIDE_VOLATILE |
| 737 | DF_DA_WIDE, |
| 738 | |
| 739 | // EB OP_SPUT_WIDE_VOLATILE |
| 740 | DF_UA_WIDE, |
| 741 | |
| 742 | // EC OP_BREAKPOINT |
| 743 | DF_NOP, |
| 744 | |
| 745 | // ED OP_THROW_VERIFICATION_ERROR |
| 746 | DF_NOP, |
| 747 | |
| 748 | // EE OP_EXECUTE_INLINE |
| 749 | DF_FORMAT_35C, |
| 750 | |
| 751 | // EF OP_EXECUTE_INLINE_RANGE |
| 752 | DF_FORMAT_3RC, |
| 753 | |
| 754 | // F0 OP_INVOKE_OBJECT_INIT_RANGE |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 755 | DF_NOP | DF_NULL_CHK_0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 756 | |
| 757 | // F1 OP_RETURN_VOID_BARRIER |
| 758 | DF_NOP, |
| 759 | |
| 760 | // F2 OP_IGET_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 761 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 762 | |
| 763 | // F3 OP_IGET_WIDE_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 764 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 765 | |
| 766 | // F4 OP_IGET_OBJECT_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 767 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_IS_GETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 768 | |
| 769 | // F5 OP_IPUT_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 770 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 771 | |
| 772 | // F6 OP_IPUT_WIDE_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 773 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_1 |DF_IS_SETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 774 | |
| 775 | // F7 OP_IPUT_OBJECT_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 776 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_IS_SETTER, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 777 | |
| 778 | // F8 OP_INVOKE_VIRTUAL_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 779 | DF_FORMAT_35C | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 780 | |
| 781 | // F9 OP_INVOKE_VIRTUAL_QUICK_RANGE |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 782 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 783 | |
| 784 | // FA OP_INVOKE_SUPER_QUICK |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 785 | DF_FORMAT_35C | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 786 | |
| 787 | // FB OP_INVOKE_SUPER_QUICK_RANGE |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 788 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 789 | |
| 790 | // FC OP_IPUT_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 791 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 792 | |
| 793 | // FD OP_SGET_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 794 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 795 | |
| 796 | // FE OP_SPUT_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 797 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 798 | |
Elliott Hughes | 8e5944b | 2012-01-05 13:44:44 -0800 | [diff] [blame] | 799 | // FF OP_UNUSED_FF |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 800 | DF_NOP, |
| 801 | |
| 802 | // Beginning of extended MIR opcodes |
Elliott Hughes | 8e5944b | 2012-01-05 13:44:44 -0800 | [diff] [blame] | 803 | // 100 OP_MIR_PHI |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 804 | DF_PHI | DF_DA | DF_NULL_TRANSFER_N, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 805 | /* |
| 806 | * For extended MIR inserted at the MIR2LIR stage, it is okay to have |
| 807 | * undefined values here. |
| 808 | */ |
| 809 | }; |
| 810 | |
| 811 | /* Return the Dalvik register/subscript pair of a given SSA register */ |
| 812 | int oatConvertSSARegToDalvik(const CompilationUnit* cUnit, int ssaReg) |
| 813 | { |
| 814 | return GET_ELEM_N(cUnit->ssaToDalvikMap, int, ssaReg); |
| 815 | } |
| 816 | |
| 817 | /* |
| 818 | * Utility function to convert encoded SSA register value into Dalvik register |
| 819 | * and subscript pair. Each SSA register can be used to index the |
| 820 | * ssaToDalvikMap list to get the subscript[31..16]/dalvik_reg[15..0] mapping. |
| 821 | */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 822 | char* oatGetDalvikDisassembly(CompilationUnit* cUnit, |
| 823 | const DecodedInstruction* insn, const char* note) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 824 | { |
| 825 | char buffer[256]; |
| 826 | Opcode opcode = insn->opcode; |
| 827 | int dfAttributes = oatDataFlowAttributes[opcode]; |
| 828 | int flags; |
| 829 | char* ret; |
| 830 | |
| 831 | buffer[0] = 0; |
| 832 | if ((int)opcode >= (int)kMirOpFirst) { |
| 833 | if ((int)opcode == (int)kMirOpPhi) { |
| 834 | strcpy(buffer, "PHI"); |
| 835 | } |
| 836 | else { |
| 837 | sprintf(buffer, "Opcode %#x", opcode); |
| 838 | } |
| 839 | flags = 0; |
| 840 | } else { |
| 841 | strcpy(buffer, dexGetOpcodeName(opcode)); |
| 842 | flags = dexGetFlagsFromOpcode(insn->opcode); |
| 843 | } |
| 844 | |
| 845 | if (note) |
| 846 | strcat(buffer, note); |
| 847 | |
| 848 | /* For branches, decode the instructions to print out the branch targets */ |
| 849 | if (flags & kInstrCanBranch) { |
| 850 | InstructionFormat dalvikFormat = dexGetFormatFromOpcode(insn->opcode); |
| 851 | int offset = 0; |
| 852 | switch (dalvikFormat) { |
| 853 | case kFmt21t: |
| 854 | snprintf(buffer + strlen(buffer), 256, " v%d,", insn->vA); |
| 855 | offset = (int) insn->vB; |
| 856 | break; |
| 857 | case kFmt22t: |
| 858 | snprintf(buffer + strlen(buffer), 256, " v%d, v%d,", |
| 859 | insn->vA, insn->vB); |
| 860 | offset = (int) insn->vC; |
| 861 | break; |
| 862 | case kFmt10t: |
| 863 | case kFmt20t: |
| 864 | case kFmt30t: |
| 865 | offset = (int) insn->vA; |
| 866 | break; |
| 867 | default: |
| 868 | LOG(FATAL) << "Unexpected branch format " << (int)dalvikFormat |
| 869 | << " / opcode " << (int)opcode; |
| 870 | } |
| 871 | snprintf(buffer + strlen(buffer), 256, " (%c%x)", |
| 872 | offset > 0 ? '+' : '-', |
| 873 | offset > 0 ? offset : -offset); |
| 874 | } else if (dfAttributes & DF_FORMAT_35C) { |
| 875 | unsigned int i; |
| 876 | for (i = 0; i < insn->vA; i++) { |
| 877 | if (i != 0) strcat(buffer, ","); |
| 878 | snprintf(buffer + strlen(buffer), 256, " v%d", insn->arg[i]); |
| 879 | } |
| 880 | } |
| 881 | else if (dfAttributes & DF_FORMAT_3RC) { |
| 882 | snprintf(buffer + strlen(buffer), 256, |
| 883 | " v%d..v%d", insn->vC, insn->vC + insn->vA - 1); |
| 884 | } |
| 885 | else { |
| 886 | if (dfAttributes & DF_A_IS_REG) { |
| 887 | snprintf(buffer + strlen(buffer), 256, " v%d", insn->vA); |
| 888 | } |
| 889 | if (dfAttributes & DF_B_IS_REG) { |
| 890 | snprintf(buffer + strlen(buffer), 256, ", v%d", insn->vB); |
| 891 | } |
| 892 | else if ((int)opcode < (int)kMirOpFirst) { |
| 893 | snprintf(buffer + strlen(buffer), 256, ", (#%d)", insn->vB); |
| 894 | } |
| 895 | if (dfAttributes & DF_C_IS_REG) { |
| 896 | snprintf(buffer + strlen(buffer), 256, ", v%d", insn->vC); |
| 897 | } |
| 898 | else if ((int)opcode < (int)kMirOpFirst) { |
| 899 | snprintf(buffer + strlen(buffer), 256, ", (#%d)", insn->vC); |
| 900 | } |
| 901 | } |
| 902 | int length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 903 | ret = (char*)oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 904 | memcpy(ret, buffer, length); |
| 905 | return ret; |
| 906 | } |
| 907 | |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 908 | char* getSSAName(const CompilationUnit* cUnit, int ssaReg, char* name) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 909 | { |
| 910 | int ssa2DalvikValue = oatConvertSSARegToDalvik(cUnit, ssaReg); |
| 911 | |
| 912 | sprintf(name, "v%d_%d", |
| 913 | DECODE_REG(ssa2DalvikValue), DECODE_SUB(ssa2DalvikValue)); |
| 914 | return name; |
| 915 | } |
| 916 | |
| 917 | /* |
| 918 | * Dalvik instruction disassembler with optional SSA printing. |
| 919 | */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 920 | char* oatFullDisassembler(CompilationUnit* cUnit, |
| 921 | const MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 922 | { |
| 923 | char buffer[256]; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 924 | char operand0[32], operand1[32]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 925 | const DecodedInstruction *insn = &mir->dalvikInsn; |
| 926 | int opcode = insn->opcode; |
| 927 | int dfAttributes = oatDataFlowAttributes[opcode]; |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 928 | char* ret; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 929 | int length; |
| 930 | OpcodeFlags flags; |
| 931 | |
| 932 | buffer[0] = 0; |
| 933 | if (opcode >= kMirOpFirst) { |
| 934 | if (opcode == kMirOpPhi) { |
| 935 | snprintf(buffer, 256, "PHI %s = (%s", |
| 936 | getSSAName(cUnit, mir->ssaRep->defs[0], operand0), |
| 937 | getSSAName(cUnit, mir->ssaRep->uses[0], operand1)); |
| 938 | int i; |
| 939 | for (i = 1; i < mir->ssaRep->numUses; i++) { |
| 940 | snprintf(buffer + strlen(buffer), 256, ", %s", |
| 941 | getSSAName(cUnit, mir->ssaRep->uses[i], operand0)); |
| 942 | } |
| 943 | snprintf(buffer + strlen(buffer), 256, ")"); |
| 944 | } |
| 945 | else { |
| 946 | sprintf(buffer, "Opcode %#x", opcode); |
| 947 | } |
| 948 | goto done; |
| 949 | } else { |
| 950 | strcpy(buffer, dexGetOpcodeName((Opcode)opcode)); |
| 951 | } |
| 952 | |
| 953 | flags = dexGetFlagsFromOpcode((Opcode)opcode); |
| 954 | /* For branches, decode the instructions to print out the branch targets */ |
| 955 | if (flags & kInstrCanBranch) { |
| 956 | InstructionFormat dalvikFormat = dexGetFormatFromOpcode(insn->opcode); |
| 957 | int delta = 0; |
| 958 | switch (dalvikFormat) { |
| 959 | case kFmt21t: |
| 960 | snprintf(buffer + strlen(buffer), 256, " %s, ", |
| 961 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0)); |
| 962 | delta = (int) insn->vB; |
| 963 | break; |
| 964 | case kFmt22t: |
| 965 | snprintf(buffer + strlen(buffer), 256, " %s, %s, ", |
| 966 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0), |
| 967 | getSSAName(cUnit, mir->ssaRep->uses[1], operand1)); |
| 968 | delta = (int) insn->vC; |
| 969 | break; |
| 970 | case kFmt10t: |
| 971 | case kFmt20t: |
| 972 | case kFmt30t: |
| 973 | delta = (int) insn->vA; |
| 974 | break; |
| 975 | default: |
| 976 | LOG(FATAL) << "Unexpected branch format: " << |
| 977 | (int)dalvikFormat; |
| 978 | } |
| 979 | snprintf(buffer + strlen(buffer), 256, " %04x", |
| 980 | mir->offset + delta); |
| 981 | } else if (dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) { |
| 982 | unsigned int i; |
| 983 | for (i = 0; i < insn->vA; i++) { |
| 984 | if (i != 0) strcat(buffer, ","); |
| 985 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 986 | getSSAName(cUnit, mir->ssaRep->uses[i], operand0)); |
| 987 | } |
| 988 | } else { |
| 989 | int udIdx; |
| 990 | if (mir->ssaRep->numDefs) { |
| 991 | |
| 992 | for (udIdx = 0; udIdx < mir->ssaRep->numDefs; udIdx++) { |
| 993 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 994 | getSSAName(cUnit, mir->ssaRep->defs[udIdx], operand0)); |
| 995 | } |
| 996 | strcat(buffer, ","); |
| 997 | } |
| 998 | if (mir->ssaRep->numUses) { |
| 999 | /* No leading ',' for the first use */ |
| 1000 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 1001 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0)); |
| 1002 | for (udIdx = 1; udIdx < mir->ssaRep->numUses; udIdx++) { |
| 1003 | snprintf(buffer + strlen(buffer), 256, ", %s", |
| 1004 | getSSAName(cUnit, mir->ssaRep->uses[udIdx], operand0)); |
| 1005 | } |
| 1006 | } |
| 1007 | if (opcode < kMirOpFirst) { |
| 1008 | InstructionFormat dalvikFormat = |
| 1009 | dexGetFormatFromOpcode((Opcode)opcode); |
| 1010 | switch (dalvikFormat) { |
| 1011 | case kFmt11n: // op vA, #+B |
| 1012 | case kFmt21s: // op vAA, #+BBBB |
| 1013 | case kFmt21h: // op vAA, #+BBBB00000[00000000] |
| 1014 | case kFmt31i: // op vAA, #+BBBBBBBB |
| 1015 | case kFmt51l: // op vAA, #+BBBBBBBBBBBBBBBB |
| 1016 | snprintf(buffer + strlen(buffer), 256, " #%#x", insn->vB); |
| 1017 | break; |
| 1018 | case kFmt21c: // op vAA, thing@BBBB |
| 1019 | case kFmt31c: // op vAA, thing@BBBBBBBB |
| 1020 | snprintf(buffer + strlen(buffer), 256, " @%#x", insn->vB); |
| 1021 | break; |
| 1022 | case kFmt22b: // op vAA, vBB, #+CC |
| 1023 | case kFmt22s: // op vA, vB, #+CCCC |
| 1024 | snprintf(buffer + strlen(buffer), 256, " #%#x", insn->vC); |
| 1025 | break; |
| 1026 | case kFmt22c: // op vA, vB, thing@CCCC |
| 1027 | case kFmt22cs: // [opt] op vA, vB, field offset CCCC |
| 1028 | snprintf(buffer + strlen(buffer), 256, " @%#x", insn->vC); |
| 1029 | break; |
| 1030 | /* No need for special printing */ |
| 1031 | default: |
| 1032 | break; |
| 1033 | } |
| 1034 | } |
| 1035 | } |
| 1036 | |
| 1037 | done: |
| 1038 | length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1039 | ret = (char*) oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1040 | memcpy(ret, buffer, length); |
| 1041 | return ret; |
| 1042 | } |
| 1043 | |
| 1044 | /* |
| 1045 | * Utility function to convert encoded SSA register value into Dalvik register |
| 1046 | * and subscript pair. Each SSA register can be used to index the |
| 1047 | * ssaToDalvikMap list to get the subscript[31..16]/dalvik_reg[15..0] mapping. |
| 1048 | */ |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 1049 | char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1050 | { |
| 1051 | char buffer[256]; |
| 1052 | char* ret; |
| 1053 | int i; |
| 1054 | |
| 1055 | buffer[0] = 0; |
| 1056 | for (i = 0; i < ssaRep->numDefs; i++) { |
| 1057 | int ssa2DalvikValue = oatConvertSSARegToDalvik(cUnit, ssaRep->defs[i]); |
| 1058 | |
| 1059 | sprintf(buffer + strlen(buffer), "s%d(v%d_%d) ", |
| 1060 | ssaRep->defs[i], DECODE_REG(ssa2DalvikValue), |
| 1061 | DECODE_SUB(ssa2DalvikValue)); |
| 1062 | } |
| 1063 | |
| 1064 | if (ssaRep->numDefs) { |
| 1065 | strcat(buffer, "<- "); |
| 1066 | } |
| 1067 | |
| 1068 | for (i = 0; i < ssaRep->numUses; i++) { |
| 1069 | int ssa2DalvikValue = oatConvertSSARegToDalvik(cUnit, ssaRep->uses[i]); |
| 1070 | int len = strlen(buffer); |
| 1071 | |
| 1072 | if (snprintf(buffer + len, 250 - len, "s%d(v%d_%d) ", |
| 1073 | ssaRep->uses[i], DECODE_REG(ssa2DalvikValue), |
| 1074 | DECODE_SUB(ssa2DalvikValue)) >= (250 - len)) { |
| 1075 | strcat(buffer, "..."); |
| 1076 | break; |
| 1077 | } |
| 1078 | } |
| 1079 | |
| 1080 | int length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1081 | ret = (char*)oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1082 | memcpy(ret, buffer, length); |
| 1083 | return ret; |
| 1084 | } |
| 1085 | |
| 1086 | /* Any register that is used before being defined is considered live-in */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1087 | STATIC inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV, |
| 1088 | ArenaBitVector* defV, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1089 | ArenaBitVector* liveInV, int dalvikRegId) |
| 1090 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1091 | oatSetBit(cUnit, useV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1092 | if (!oatIsBitSet(defV, dalvikRegId)) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1093 | oatSetBit(cUnit, liveInV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1094 | } |
| 1095 | } |
| 1096 | |
| 1097 | /* Mark a reg as being defined */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1098 | STATIC inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV, |
| 1099 | int dalvikRegId) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1100 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1101 | oatSetBit(cUnit, defV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1102 | } |
| 1103 | |
| 1104 | /* |
| 1105 | * Find out live-in variables for natural loops. Variables that are live-in in |
| 1106 | * the main loop body are considered to be defined in the entry block. |
| 1107 | */ |
| 1108 | bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb) |
| 1109 | { |
| 1110 | MIR* mir; |
| 1111 | ArenaBitVector *useV, *defV, *liveInV; |
| 1112 | |
| 1113 | if (bb->dataFlowInfo == NULL) return false; |
| 1114 | |
| 1115 | useV = bb->dataFlowInfo->useV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1116 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapUse); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1117 | defV = bb->dataFlowInfo->defV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1118 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapDef); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1119 | liveInV = bb->dataFlowInfo->liveInV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1120 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, |
| 1121 | kBitMapLiveIn); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1122 | |
| 1123 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1124 | int dfAttributes = |
| 1125 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1126 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1127 | |
| 1128 | if (dfAttributes & DF_HAS_USES) { |
| 1129 | if (dfAttributes & DF_UA) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1130 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1131 | } else if (dfAttributes & DF_UA_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1132 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA); |
| 1133 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1134 | } |
| 1135 | if (dfAttributes & DF_UB) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1136 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1137 | } else if (dfAttributes & DF_UB_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1138 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB); |
| 1139 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1140 | } |
| 1141 | if (dfAttributes & DF_UC) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1142 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1143 | } else if (dfAttributes & DF_UC_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1144 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC); |
| 1145 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1146 | } |
| 1147 | } |
| 1148 | if (dfAttributes & DF_HAS_DEFS) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1149 | handleDef(cUnit, defV, dInsn->vA); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1150 | if (dfAttributes & DF_DA_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1151 | handleDef(cUnit, defV, dInsn->vA+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1152 | } |
| 1153 | } |
| 1154 | } |
| 1155 | return true; |
| 1156 | } |
| 1157 | |
| 1158 | /* Find out the latest SSA register for a given Dalvik register */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1159 | STATIC void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1160 | int regIndex) |
| 1161 | { |
| 1162 | int encodedValue = cUnit->dalvikToSSAMap[dalvikReg]; |
| 1163 | int ssaReg = DECODE_REG(encodedValue); |
| 1164 | uses[regIndex] = ssaReg; |
| 1165 | } |
| 1166 | |
| 1167 | /* Setup a new SSA register for a given Dalvik register */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1168 | STATIC void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1169 | int regIndex) |
| 1170 | { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1171 | int ssaReg = cUnit->numSSARegs++; |
| 1172 | /* Bump up the subscript */ |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1173 | int dalvikSub = ++cUnit->SSALastDefs[dalvikReg]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1174 | int newD2SMapping = ENCODE_REG_SUB(ssaReg, dalvikSub); |
| 1175 | |
| 1176 | cUnit->dalvikToSSAMap[dalvikReg] = newD2SMapping; |
| 1177 | |
| 1178 | int newS2DMapping = ENCODE_REG_SUB(dalvikReg, dalvikSub); |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1179 | oatInsertGrowableList(cUnit, cUnit->ssaToDalvikMap, newS2DMapping); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1180 | |
| 1181 | defs[regIndex] = ssaReg; |
| 1182 | } |
| 1183 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1184 | /* Look up new SSA names for format_35c instructions */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1185 | STATIC void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1186 | { |
| 1187 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1188 | int numUses = dInsn->vA; |
| 1189 | int i; |
| 1190 | |
| 1191 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1192 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1193 | kAllocDFInfo); |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1194 | // NOTE: will be filled in during type & size inference pass |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1195 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1196 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1197 | |
| 1198 | for (i = 0; i < numUses; i++) { |
| 1199 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->arg[i], i); |
| 1200 | } |
| 1201 | } |
| 1202 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1203 | /* Look up new SSA names for format_3rc instructions */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1204 | STATIC void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1205 | { |
| 1206 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1207 | int numUses = dInsn->vA; |
| 1208 | int i; |
| 1209 | |
| 1210 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1211 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1212 | kAllocDFInfo); |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1213 | // NOTE: will be filled in during type & size inference pass |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1214 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1215 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1216 | |
| 1217 | for (i = 0; i < numUses; i++) { |
| 1218 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+i, i); |
| 1219 | } |
| 1220 | } |
| 1221 | |
| 1222 | /* Entry function to convert a block into SSA representation */ |
| 1223 | bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb) |
| 1224 | { |
| 1225 | MIR* mir; |
| 1226 | |
| 1227 | if (bb->dataFlowInfo == NULL) return false; |
| 1228 | |
| 1229 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1230 | mir->ssaRep = (struct SSARepresentation *) |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1231 | oatNew(cUnit, sizeof(SSARepresentation), true, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1232 | |
| 1233 | int dfAttributes = |
| 1234 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1235 | |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1236 | // If not a pseudo-op, note non-leaf or can throw |
| 1237 | if (mir->dalvikInsn.opcode < kNumPackedOpcodes) { |
| 1238 | int flags = dexGetFlagsFromOpcode(mir->dalvikInsn.opcode); |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1239 | |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1240 | if (flags & kInstrCanThrow) { |
| 1241 | cUnit->attrs &= ~METHOD_IS_THROW_FREE; |
| 1242 | } |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1243 | |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1244 | if (flags & kInstrInvoke) { |
| 1245 | cUnit->attrs &= ~METHOD_IS_LEAF; |
| 1246 | } |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1247 | } |
| 1248 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1249 | int numUses = 0; |
| 1250 | |
| 1251 | if (dfAttributes & DF_FORMAT_35C) { |
| 1252 | dataFlowSSAFormat35C(cUnit, mir); |
| 1253 | continue; |
| 1254 | } |
| 1255 | |
| 1256 | if (dfAttributes & DF_FORMAT_3RC) { |
| 1257 | dataFlowSSAFormat3RC(cUnit, mir); |
| 1258 | continue; |
| 1259 | } |
| 1260 | |
| 1261 | if (dfAttributes & DF_HAS_USES) { |
| 1262 | if (dfAttributes & DF_UA) { |
| 1263 | numUses++; |
| 1264 | } else if (dfAttributes & DF_UA_WIDE) { |
| 1265 | numUses += 2; |
| 1266 | } |
| 1267 | if (dfAttributes & DF_UB) { |
| 1268 | numUses++; |
| 1269 | } else if (dfAttributes & DF_UB_WIDE) { |
| 1270 | numUses += 2; |
| 1271 | } |
| 1272 | if (dfAttributes & DF_UC) { |
| 1273 | numUses++; |
| 1274 | } else if (dfAttributes & DF_UC_WIDE) { |
| 1275 | numUses += 2; |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | if (numUses) { |
| 1280 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1281 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1282 | false, kAllocDFInfo); |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1283 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1284 | false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1285 | } |
| 1286 | |
| 1287 | int numDefs = 0; |
| 1288 | |
| 1289 | if (dfAttributes & DF_HAS_DEFS) { |
| 1290 | numDefs++; |
| 1291 | if (dfAttributes & DF_DA_WIDE) { |
| 1292 | numDefs++; |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | if (numDefs) { |
| 1297 | mir->ssaRep->numDefs = numDefs; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1298 | mir->ssaRep->defs = (int *)oatNew(cUnit, sizeof(int) * numDefs, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1299 | false, kAllocDFInfo); |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1300 | mir->ssaRep->fpDef = (bool *)oatNew(cUnit, sizeof(bool) * numDefs, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1301 | false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1302 | } |
| 1303 | |
| 1304 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1305 | |
| 1306 | if (dfAttributes & DF_HAS_USES) { |
| 1307 | numUses = 0; |
| 1308 | if (dfAttributes & DF_UA) { |
| 1309 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1310 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++); |
| 1311 | } else if (dfAttributes & DF_UA_WIDE) { |
| 1312 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1313 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++); |
| 1314 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1315 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA+1, numUses++); |
| 1316 | } |
| 1317 | if (dfAttributes & DF_UB) { |
| 1318 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1319 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++); |
| 1320 | } else if (dfAttributes & DF_UB_WIDE) { |
| 1321 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1322 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++); |
| 1323 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1324 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB+1, numUses++); |
| 1325 | } |
| 1326 | if (dfAttributes & DF_UC) { |
| 1327 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1328 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++); |
| 1329 | } else if (dfAttributes & DF_UC_WIDE) { |
| 1330 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1331 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++); |
| 1332 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1333 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+1, numUses++); |
| 1334 | } |
| 1335 | } |
| 1336 | if (dfAttributes & DF_HAS_DEFS) { |
| 1337 | mir->ssaRep->fpDef[0] = dfAttributes & DF_FP_A; |
| 1338 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA, 0); |
| 1339 | if (dfAttributes & DF_DA_WIDE) { |
| 1340 | mir->ssaRep->fpDef[1] = dfAttributes & DF_FP_A; |
| 1341 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA+1, 1); |
| 1342 | } |
| 1343 | } |
| 1344 | } |
| 1345 | |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1346 | if (!cUnit->disableDataflow) { |
| 1347 | /* |
| 1348 | * Take a snapshot of Dalvik->SSA mapping at the end of each block. The |
| 1349 | * input to PHI nodes can be derived from the snapshot of all |
| 1350 | * predecessor blocks. |
| 1351 | */ |
| 1352 | bb->dataFlowInfo->dalvikToSSAMap = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1353 | (int *)oatNew(cUnit, sizeof(int) * cUnit->numDalvikRegisters, false, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1354 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1355 | |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1356 | memcpy(bb->dataFlowInfo->dalvikToSSAMap, cUnit->dalvikToSSAMap, |
| 1357 | sizeof(int) * cUnit->numDalvikRegisters); |
| 1358 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1359 | return true; |
| 1360 | } |
| 1361 | |
| 1362 | /* Setup a constant value for opcodes thare have the DF_SETS_CONST attribute */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1363 | STATIC void setConstant(CompilationUnit* cUnit, int ssaReg, int value) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1364 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1365 | oatSetBit(cUnit, cUnit->isConstantV, ssaReg); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1366 | cUnit->constantValues[ssaReg] = value; |
| 1367 | } |
| 1368 | |
| 1369 | bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb) |
| 1370 | { |
| 1371 | MIR* mir; |
| 1372 | ArenaBitVector *isConstantV = cUnit->isConstantV; |
| 1373 | |
| 1374 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1375 | int dfAttributes = |
| 1376 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1377 | |
| 1378 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1379 | |
| 1380 | if (!(dfAttributes & DF_HAS_DEFS)) continue; |
| 1381 | |
| 1382 | /* Handle instructions that set up constants directly */ |
| 1383 | if (dfAttributes & DF_SETS_CONST) { |
| 1384 | if (dfAttributes & DF_DA) { |
| 1385 | switch (dInsn->opcode) { |
| 1386 | case OP_CONST_4: |
| 1387 | case OP_CONST_16: |
| 1388 | case OP_CONST: |
| 1389 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1390 | break; |
| 1391 | case OP_CONST_HIGH16: |
| 1392 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1393 | dInsn->vB << 16); |
| 1394 | break; |
| 1395 | default: |
| 1396 | break; |
| 1397 | } |
| 1398 | } else if (dfAttributes & DF_DA_WIDE) { |
| 1399 | switch (dInsn->opcode) { |
| 1400 | case OP_CONST_WIDE_16: |
| 1401 | case OP_CONST_WIDE_32: |
| 1402 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1403 | setConstant(cUnit, mir->ssaRep->defs[1], 0); |
| 1404 | break; |
| 1405 | case OP_CONST_WIDE: |
| 1406 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1407 | (int) dInsn->vB_wide); |
| 1408 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1409 | (int) (dInsn->vB_wide >> 32)); |
| 1410 | break; |
| 1411 | case OP_CONST_WIDE_HIGH16: |
| 1412 | setConstant(cUnit, mir->ssaRep->defs[0], 0); |
| 1413 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1414 | dInsn->vB << 16); |
| 1415 | break; |
| 1416 | default: |
| 1417 | break; |
| 1418 | } |
| 1419 | } |
| 1420 | /* Handle instructions that set up constants directly */ |
| 1421 | } else if (dfAttributes & DF_IS_MOVE) { |
| 1422 | int i; |
| 1423 | |
| 1424 | for (i = 0; i < mir->ssaRep->numUses; i++) { |
| 1425 | if (!oatIsBitSet(isConstantV, mir->ssaRep->uses[i])) break; |
| 1426 | } |
| 1427 | /* Move a register holding a constant to another register */ |
| 1428 | if (i == mir->ssaRep->numUses) { |
| 1429 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1430 | cUnit->constantValues[mir->ssaRep->uses[0]]); |
| 1431 | if (dfAttributes & DF_DA_WIDE) { |
| 1432 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1433 | cUnit->constantValues[mir->ssaRep->uses[1]]); |
| 1434 | } |
| 1435 | } |
| 1436 | } |
| 1437 | } |
| 1438 | /* TODO: implement code to handle arithmetic operations */ |
| 1439 | return true; |
| 1440 | } |
| 1441 | |
| 1442 | /* Setup the basic data structures for SSA conversion */ |
| 1443 | void oatInitializeSSAConversion(CompilationUnit* cUnit) |
| 1444 | { |
| 1445 | int i; |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 1446 | int numDalvikReg = cUnit->numDalvikRegisters; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1447 | |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1448 | cUnit->ssaToDalvikMap = (GrowableList *)oatNew(cUnit, sizeof(GrowableList), |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1449 | false, kAllocDFInfo); |
| 1450 | // Create the SSAtoDalvikMap, estimating the max size |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1451 | oatInitGrowableList(cUnit, cUnit->ssaToDalvikMap, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1452 | numDalvikReg + cUnit->defCount + 128, |
| 1453 | kListSSAtoDalvikMap); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1454 | /* |
| 1455 | * Initial number of SSA registers is equal to the number of Dalvik |
| 1456 | * registers. |
| 1457 | */ |
| 1458 | cUnit->numSSARegs = numDalvikReg; |
| 1459 | |
| 1460 | /* |
| 1461 | * Initialize the SSA2Dalvik map list. For the first numDalvikReg elements, |
| 1462 | * the subscript is 0 so we use the ENCODE_REG_SUB macro to encode the value |
| 1463 | * into "(0 << 16) | i" |
| 1464 | */ |
| 1465 | for (i = 0; i < numDalvikReg; i++) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1466 | oatInsertGrowableList(cUnit, cUnit->ssaToDalvikMap, |
| 1467 | ENCODE_REG_SUB(i, 0)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1468 | } |
| 1469 | |
| 1470 | /* |
| 1471 | * Initialize the DalvikToSSAMap map. The low 16 bit is the SSA register id, |
| 1472 | * while the high 16 bit is the current subscript. The original Dalvik |
| 1473 | * register N is mapped to SSA register N with subscript 0. |
| 1474 | */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1475 | cUnit->dalvikToSSAMap = (int *)oatNew(cUnit, sizeof(int) * numDalvikReg, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1476 | false, kAllocDFInfo); |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1477 | /* Keep track of the higest def for each dalvik reg */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1478 | cUnit->SSALastDefs = (int *)oatNew(cUnit, sizeof(int) * numDalvikReg, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1479 | false, kAllocDFInfo); |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1480 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1481 | for (i = 0; i < numDalvikReg; i++) { |
| 1482 | cUnit->dalvikToSSAMap[i] = i; |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1483 | cUnit->SSALastDefs[i] = 0; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1484 | } |
| 1485 | |
| 1486 | /* |
| 1487 | * Allocate the BasicBlockDataFlow structure for the entry and code blocks |
| 1488 | */ |
| 1489 | GrowableListIterator iterator; |
| 1490 | |
| 1491 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
| 1492 | |
| 1493 | while (true) { |
| 1494 | BasicBlock* bb = (BasicBlock *) oatGrowableListIteratorNext(&iterator); |
| 1495 | if (bb == NULL) break; |
| 1496 | if (bb->hidden == true) continue; |
| 1497 | if (bb->blockType == kDalvikByteCode || |
| 1498 | bb->blockType == kEntryBlock || |
| 1499 | bb->blockType == kExitBlock) { |
| 1500 | bb->dataFlowInfo = (BasicBlockDataFlow *) |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1501 | oatNew(cUnit, sizeof(BasicBlockDataFlow), |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1502 | true, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1503 | } |
| 1504 | } |
| 1505 | } |
| 1506 | |
| 1507 | /* Clear the visited flag for each BB */ |
| 1508 | bool oatClearVisitedFlag(struct CompilationUnit* cUnit, |
| 1509 | struct BasicBlock* bb) |
| 1510 | { |
| 1511 | bb->visited = false; |
| 1512 | return true; |
| 1513 | } |
| 1514 | |
| 1515 | void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit, |
| 1516 | bool (*func)(CompilationUnit*, BasicBlock*), |
| 1517 | DataFlowAnalysisMode dfaMode, |
| 1518 | bool isIterative) |
| 1519 | { |
| 1520 | bool change = true; |
| 1521 | |
| 1522 | while (change) { |
| 1523 | change = false; |
| 1524 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1525 | switch (dfaMode) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1526 | /* Scan all blocks and perform the operations specified in func */ |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1527 | case kAllNodes: |
| 1528 | { |
| 1529 | GrowableListIterator iterator; |
| 1530 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
| 1531 | while (true) { |
| 1532 | BasicBlock* bb = |
| 1533 | (BasicBlock *) oatGrowableListIteratorNext(&iterator); |
| 1534 | if (bb == NULL) break; |
| 1535 | if (bb->hidden == true) continue; |
| 1536 | change |= (*func)(cUnit, bb); |
| 1537 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1538 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1539 | break; |
| 1540 | /* Scan reachable blocks and perform the ops specified in func. */ |
| 1541 | case kReachableNodes: |
| 1542 | { |
| 1543 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1544 | int idx; |
| 1545 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1546 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1547 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1548 | int blockIdx = cUnit->dfsOrder.elemList[idx]; |
| 1549 | BasicBlock* bb = |
| 1550 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1551 | blockIdx); |
| 1552 | change |= (*func)(cUnit, bb); |
| 1553 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1554 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1555 | break; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1556 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1557 | /* Scan reachable blocks by pre-order dfs and invoke func on each. */ |
| 1558 | case kPreOrderDFSTraversal: |
| 1559 | { |
| 1560 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1561 | int idx; |
| 1562 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1563 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1564 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1565 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
| 1566 | BasicBlock* bb = |
| 1567 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1568 | dfsIdx); |
| 1569 | change |= (*func)(cUnit, bb); |
| 1570 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1571 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1572 | break; |
| 1573 | /* Scan reachable blocks post-order dfs and invoke func on each. */ |
| 1574 | case kPostOrderDFSTraversal: |
| 1575 | { |
| 1576 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1577 | int idx; |
| 1578 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1579 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1580 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1581 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
| 1582 | BasicBlock* bb = |
| 1583 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1584 | dfsIdx); |
| 1585 | change |= (*func)(cUnit, bb); |
| 1586 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1587 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1588 | break; |
| 1589 | /* Scan reachable post-order dom tree and invoke func on each. */ |
| 1590 | case kPostOrderDOMTraversal: |
| 1591 | { |
| 1592 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1593 | int idx; |
| 1594 | const GrowableList *blockList = &cUnit->blockList; |
| 1595 | |
| 1596 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1597 | int domIdx = cUnit->domPostOrderTraversal.elemList[idx]; |
| 1598 | BasicBlock* bb = |
| 1599 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1600 | domIdx); |
| 1601 | change |= (*func)(cUnit, bb); |
| 1602 | } |
| 1603 | } |
| 1604 | break; |
| 1605 | /* Scan reachable blocks reverse post-order dfs, invoke func on each */ |
| 1606 | case kReversePostOrderTraversal: |
| 1607 | { |
| 1608 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1609 | int idx; |
| 1610 | const GrowableList *blockList = &cUnit->blockList; |
| 1611 | |
| 1612 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1613 | int revIdx = cUnit->dfsPostOrder.elemList[idx]; |
| 1614 | BasicBlock* bb = |
| 1615 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1616 | revIdx); |
| 1617 | change |= (*func)(cUnit, bb); |
| 1618 | } |
| 1619 | } |
| 1620 | break; |
| 1621 | default: |
| 1622 | LOG(FATAL) << "Unknown traversal mode " << (int)dfaMode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1623 | } |
| 1624 | /* If isIterative is false, exit the loop after the first iteration */ |
| 1625 | change &= isIterative; |
| 1626 | } |
| 1627 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1628 | |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1629 | STATIC bool nullCheckEliminationInit(struct CompilationUnit* cUnit, |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1630 | struct BasicBlock* bb) |
| 1631 | { |
| 1632 | if (bb->dataFlowInfo == NULL) return false; |
| 1633 | bb->dataFlowInfo->endingNullCheckV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1634 | oatAllocBitVector(cUnit, cUnit->numSSARegs, false, kBitMapNullCheck); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1635 | oatClearAllBits(bb->dataFlowInfo->endingNullCheckV); |
| 1636 | return true; |
| 1637 | } |
| 1638 | |
| 1639 | /* Eliminate unnecessary null checks for a basic block. */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1640 | STATIC bool eliminateNullChecks( struct CompilationUnit* cUnit, |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1641 | struct BasicBlock* bb) |
| 1642 | { |
| 1643 | if (bb->dataFlowInfo == NULL) return false; |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1644 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1645 | /* |
| 1646 | * Set initial state. Be conservative with catch |
| 1647 | * blocks and start with no assumptions about null check |
| 1648 | * status (except for "this"). |
| 1649 | */ |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1650 | if ((bb->blockType == kEntryBlock) | bb->catchEntry) { |
| 1651 | oatClearAllBits(cUnit->tempSSARegisterV); |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 1652 | if ((cUnit->access_flags & kAccStatic) == 0) { |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1653 | // If non-static method, mark "this" as non-null |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 1654 | int thisReg = cUnit->numDalvikRegisters - cUnit->numIns; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1655 | oatSetBit(cUnit, cUnit->tempSSARegisterV, thisReg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1656 | } |
| 1657 | } else { |
| 1658 | // Starting state is intesection of all incoming arcs |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1659 | GrowableListIterator iter; |
| 1660 | oatGrowableListIteratorInit(bb->predecessors, &iter); |
| 1661 | BasicBlock* predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); |
| 1662 | DCHECK(predBB != NULL); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1663 | oatCopyBitVector(cUnit->tempSSARegisterV, |
| 1664 | predBB->dataFlowInfo->endingNullCheckV); |
| 1665 | while (true) { |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1666 | predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); |
| 1667 | if (!predBB) break; |
buzbee | aad7201 | 2011-09-21 21:52:09 -0700 | [diff] [blame] | 1668 | if ((predBB->dataFlowInfo == NULL) || |
| 1669 | (predBB->dataFlowInfo->endingNullCheckV == NULL)) { |
| 1670 | continue; |
| 1671 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1672 | oatIntersectBitVectors(cUnit->tempSSARegisterV, |
| 1673 | cUnit->tempSSARegisterV, |
| 1674 | predBB->dataFlowInfo->endingNullCheckV); |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | // Walk through the instruction in the block, updating as necessary |
| 1679 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1680 | if (mir->ssaRep == NULL) { |
| 1681 | continue; |
| 1682 | } |
| 1683 | int dfAttributes = |
| 1684 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1685 | |
| 1686 | // Mark target of NEW* as non-null |
| 1687 | if (dfAttributes & DF_NON_NULL_DST) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1688 | oatSetBit(cUnit, cUnit->tempSSARegisterV, mir->ssaRep->defs[0]); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1689 | } |
| 1690 | |
| 1691 | // Mark non-null returns from invoke-style NEW* |
| 1692 | if (dfAttributes & DF_NON_NULL_RET) { |
| 1693 | MIR* nextMir = mir->next; |
| 1694 | // Next should be an OP_MOVE_RESULT_OBJECT |
| 1695 | if (nextMir && nextMir->dalvikInsn.opcode == OP_MOVE_RESULT_OBJECT) { |
| 1696 | // Mark as null checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1697 | oatSetBit(cUnit, cUnit->tempSSARegisterV, |
| 1698 | nextMir->ssaRep->defs[0]); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1699 | } else { |
| 1700 | if (nextMir) { |
| 1701 | LOG(WARNING) << "Unexpected opcode following new: " << |
| 1702 | (int)nextMir->dalvikInsn.opcode; |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1703 | } else if (bb->fallThrough) { |
| 1704 | // Look in next basic block |
| 1705 | struct BasicBlock* nextBB = bb->fallThrough; |
| 1706 | for (MIR* tmir = nextBB->firstMIRInsn; tmir; |
| 1707 | tmir =tmir->next){ |
| 1708 | if ((int)tmir->dalvikInsn.opcode >= (int)kMirOpFirst) { |
| 1709 | continue; |
| 1710 | } |
| 1711 | // First non-pseudo should be OP_MOVE_RESULT_OBJECT |
| 1712 | if (tmir->dalvikInsn.opcode == OP_MOVE_RESULT_OBJECT) { |
| 1713 | // Mark as null checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1714 | oatSetBit(cUnit, cUnit->tempSSARegisterV, |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1715 | tmir->ssaRep->defs[0]); |
| 1716 | } else { |
| 1717 | LOG(WARNING) << "Unexpected op after new: " << |
| 1718 | (int)tmir->dalvikInsn.opcode; |
| 1719 | } |
| 1720 | break; |
| 1721 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1722 | } |
| 1723 | } |
| 1724 | } |
| 1725 | |
| 1726 | /* |
| 1727 | * Propagate nullcheck state on register copies (including |
| 1728 | * Phi pseudo copies. For the latter, nullcheck state is |
| 1729 | * the "and" of all the Phi's operands. |
| 1730 | */ |
| 1731 | if (dfAttributes & (DF_NULL_TRANSFER_0 | DF_NULL_TRANSFER_N)) { |
| 1732 | int tgtSreg = mir->ssaRep->defs[0]; |
| 1733 | int operands = (dfAttributes & DF_NULL_TRANSFER_0) ? 1 : |
| 1734 | mir->ssaRep->numUses; |
| 1735 | bool nullChecked = true; |
| 1736 | for (int i = 0; i < operands; i++) { |
| 1737 | nullChecked &= oatIsBitSet(cUnit->tempSSARegisterV, |
| 1738 | mir->ssaRep->uses[i]); |
| 1739 | } |
| 1740 | if (nullChecked) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1741 | oatSetBit(cUnit, cUnit->tempSSARegisterV, tgtSreg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | // Already nullchecked? |
| 1746 | if (dfAttributes & DF_HAS_NULL_CHKS) { |
| 1747 | int srcSreg = (dfAttributes & DF_NULL_CHK_1) ? |
| 1748 | mir->ssaRep->uses[1] : mir->ssaRep->uses[0]; |
| 1749 | if (oatIsBitSet(cUnit->tempSSARegisterV, srcSreg)) { |
| 1750 | // Eliminate the null check |
| 1751 | mir->optimizationFlags |= MIR_IGNORE_NULL_CHECK; |
| 1752 | } else { |
| 1753 | // Mark sReg as null-checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame^] | 1754 | oatSetBit(cUnit, cUnit->tempSSARegisterV, srcSreg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1755 | } |
| 1756 | } |
| 1757 | } |
| 1758 | |
| 1759 | // Did anything change? |
| 1760 | bool res = oatCompareBitVectors(bb->dataFlowInfo->endingNullCheckV, |
| 1761 | cUnit->tempSSARegisterV); |
| 1762 | if (res) { |
| 1763 | oatCopyBitVector(bb->dataFlowInfo->endingNullCheckV, |
| 1764 | cUnit->tempSSARegisterV); |
| 1765 | } |
| 1766 | return res; |
| 1767 | } |
| 1768 | |
| 1769 | void oatMethodNullCheckElimination(CompilationUnit *cUnit) |
| 1770 | { |
| 1771 | if (!(cUnit->disableOpt & (1 << kNullCheckElimination))) { |
| 1772 | DCHECK(cUnit->tempSSARegisterV != NULL); |
| 1773 | oatDataFlowAnalysisDispatcher(cUnit, nullCheckEliminationInit, |
| 1774 | kAllNodes, |
| 1775 | false /* isIterative */); |
| 1776 | oatDataFlowAnalysisDispatcher(cUnit, eliminateNullChecks, |
| 1777 | kPreOrderDFSTraversal, |
| 1778 | true /* isIterative */); |
| 1779 | } |
| 1780 | } |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 1781 | |
| 1782 | } // namespace art |