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" |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 19 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 20 | namespace art { |
| 21 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 22 | /* |
| 23 | * Main table containing data flow attributes for each bytecode. The |
| 24 | * first kNumPackedOpcodes entries are for Dalvik bytecode |
| 25 | * instructions, where extended opcode at the MIR level are appended |
| 26 | * afterwards. |
| 27 | * |
| 28 | * TODO - many optimization flags are incomplete - they will only limit the |
| 29 | * scope of optimizations but will not cause mis-optimizations. |
| 30 | */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 31 | const int oatDataFlowAttributes[kMirOpLast] = { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 32 | // 00 NOP |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 33 | DF_NOP, |
| 34 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 35 | // 01 MOVE vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 36 | DF_DA | DF_UB | DF_IS_MOVE, |
| 37 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 38 | // 02 MOVE_FROM16 vAA, vBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 39 | DF_DA | DF_UB | DF_IS_MOVE, |
| 40 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 41 | // 03 MOVE_16 vAAAA, vBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 42 | DF_DA | DF_UB | DF_IS_MOVE, |
| 43 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 44 | // 04 MOVE_WIDE vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 45 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 46 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 47 | // 05 MOVE_WIDE_FROM16 vAA, vBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 48 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 49 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 50 | // 06 MOVE_WIDE_16 vAAAA, vBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 51 | DF_DA_WIDE | DF_UB_WIDE | DF_IS_MOVE, |
| 52 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 53 | // 07 MOVE_OBJECT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 54 | 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] | 55 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 56 | // 08 MOVE_OBJECT_FROM16 vAA, vBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 57 | 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] | 58 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 59 | // 09 MOVE_OBJECT_16 vAAAA, vBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 60 | 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] | 61 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 62 | // 0A MOVE_RESULT vAA |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 63 | DF_DA, |
| 64 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 65 | // 0B MOVE_RESULT_WIDE vAA |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 66 | DF_DA_WIDE, |
| 67 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 68 | // 0C MOVE_RESULT_OBJECT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 69 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 70 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 71 | // 0D MOVE_EXCEPTION vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 72 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 73 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 74 | // 0E RETURN_VOID |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 75 | DF_NOP, |
| 76 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 77 | // 0F RETURN vAA |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 78 | DF_UA, |
| 79 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 80 | // 10 RETURN_WIDE vAA |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 81 | DF_UA_WIDE, |
| 82 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 83 | // 11 RETURN_OBJECT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 84 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 85 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 86 | // 12 CONST_4 vA, #+B |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 87 | DF_DA | DF_SETS_CONST, |
| 88 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 89 | // 13 CONST_16 vAA, #+BBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 90 | DF_DA | DF_SETS_CONST, |
| 91 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 92 | // 14 CONST vAA, #+BBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 93 | DF_DA | DF_SETS_CONST, |
| 94 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 95 | // 15 CONST_HIGH16 VAA, #+BBBB0000 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 96 | DF_DA | DF_SETS_CONST, |
| 97 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 98 | // 16 CONST_WIDE_16 vAA, #+BBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 99 | DF_DA_WIDE | DF_SETS_CONST, |
| 100 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 101 | // 17 CONST_WIDE_32 vAA, #+BBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 102 | DF_DA_WIDE | DF_SETS_CONST, |
| 103 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 104 | // 18 CONST_WIDE vAA, #+BBBBBBBBBBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 105 | DF_DA_WIDE | DF_SETS_CONST, |
| 106 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 107 | // 19 CONST_WIDE_HIGH16 vAA, #+BBBB000000000000 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 108 | DF_DA_WIDE | DF_SETS_CONST, |
| 109 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 110 | // 1A CONST_STRING vAA, string@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 111 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 112 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 113 | // 1B CONST_STRING_JUMBO vAA, string@BBBBBBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 114 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 115 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 116 | // 1C CONST_CLASS vAA, type@BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 117 | DF_DA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 118 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 119 | // 1D MONITOR_ENTER vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 120 | DF_UA | DF_NULL_CHK_0 | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 121 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 122 | // 1E MONITOR_EXIT vAA |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 123 | DF_UA | DF_NULL_CHK_0 | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 124 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 125 | // 1F CHK_CAST vAA, type@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 126 | DF_UA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 127 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 128 | // 20 INSTANCE_OF vA, vB, type@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 129 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 130 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 131 | // 21 ARRAY_LENGTH vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 132 | 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] | 133 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 134 | // 22 NEW_INSTANCE vAA, type@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 135 | DF_DA | DF_NON_NULL_DST | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 136 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 137 | // 23 NEW_ARRAY vA, vB, type@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 138 | DF_DA | DF_UB | DF_NON_NULL_DST | DF_CORE_A | DF_CORE_B | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 139 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 140 | // 24 FILLED_NEW_ARRAY {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 141 | DF_FORMAT_35C | DF_NON_NULL_RET | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 142 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 143 | // 25 FILLED_NEW_ARRAY_RANGE {vCCCC .. vNNNN}, type@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 144 | DF_FORMAT_3RC | DF_NON_NULL_RET | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 145 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 146 | // 26 FILL_ARRAY_DATA vAA, +BBBBBBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 147 | DF_UA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 148 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 149 | // 27 THROW vAA |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 150 | DF_UA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 151 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 152 | // 28 GOTO |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 153 | DF_NOP, |
| 154 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 155 | // 29 GOTO_16 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 156 | DF_NOP, |
| 157 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 158 | // 2A GOTO_32 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 159 | DF_NOP, |
| 160 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 161 | // 2B PACKED_SWITCH vAA, +BBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 162 | DF_UA, |
| 163 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 164 | // 2C SPARSE_SWITCH vAA, +BBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 165 | DF_UA, |
| 166 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 167 | // 2D CMPL_FLOAT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 168 | 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] | 169 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 170 | // 2E CMPG_FLOAT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 171 | 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] | 172 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 173 | // 2F CMPL_DOUBLE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 174 | 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] | 175 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 176 | // 30 CMPG_DOUBLE vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 177 | 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] | 178 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 179 | // 31 CMP_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 180 | 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] | 181 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 182 | // 32 IF_EQ vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 183 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 184 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 185 | // 33 IF_NE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 186 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 187 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 188 | // 34 IF_LT vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 189 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 190 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 191 | // 35 IF_GE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 192 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 193 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 194 | // 36 IF_GT vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 195 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 196 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 197 | // 37 IF_LE vA, vB, +CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 198 | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 199 | |
| 200 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 201 | // 38 IF_EQZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 202 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 203 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 204 | // 39 IF_NEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 205 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 206 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 207 | // 3A IF_LTZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 208 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 209 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 210 | // 3B IF_GEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 211 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 212 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 213 | // 3C IF_GTZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 214 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 215 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 216 | // 3D IF_LEZ vAA, +BBBB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 217 | DF_UA | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 218 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 219 | // 3E UNUSED_3E |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 220 | DF_NOP, |
| 221 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 222 | // 3F UNUSED_3F |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 223 | DF_NOP, |
| 224 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 225 | // 40 UNUSED_40 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 226 | DF_NOP, |
| 227 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 228 | // 41 UNUSED_41 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 229 | DF_NOP, |
| 230 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 231 | // 42 UNUSED_42 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 232 | DF_NOP, |
| 233 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 234 | // 43 UNUSED_43 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 235 | DF_NOP, |
| 236 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 237 | // 44 AGET vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 238 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 239 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 240 | // 45 AGET_WIDE vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 241 | DF_DA_WIDE | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 242 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 243 | // 46 AGET_OBJECT vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 244 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 245 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 246 | // 47 AGET_BOOLEAN vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 247 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 248 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 249 | // 48 AGET_BYTE vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 250 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 251 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 252 | // 49 AGET_CHAR vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 253 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 254 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 255 | // 4A AGET_SHORT vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 256 | DF_DA | DF_UB | DF_UC | DF_NULL_CHK_0 | DF_RANGE_CHK_1 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 257 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 258 | // 4B APUT vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 259 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 260 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 261 | // 4C APUT_WIDE vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 262 | DF_UA_WIDE | DF_UB | DF_UC | DF_NULL_CHK_2 | DF_RANGE_CHK_3 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 263 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 264 | // 4D APUT_OBJECT vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 265 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 266 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 267 | // 4E APUT_BOOLEAN vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 268 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 269 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 270 | // 4F APUT_BYTE vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 271 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 272 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 273 | // 50 APUT_CHAR vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 274 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 275 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 276 | // 51 APUT_SHORT vAA, vBB, vCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 277 | DF_UA | DF_UB | DF_UC | DF_NULL_CHK_1 | DF_RANGE_CHK_2 | DF_CORE_B | DF_CORE_C, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 278 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 279 | // 52 IGET vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 280 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 281 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 282 | // 53 IGET_WIDE vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 283 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 284 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 285 | // 54 IGET_OBJECT vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 286 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 287 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 288 | // 55 IGET_BOOLEAN vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 289 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 290 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 291 | // 56 IGET_BYTE vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 292 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 293 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 294 | // 57 IGET_CHAR vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 295 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 296 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 297 | // 58 IGET_SHORT vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 298 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 299 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 300 | // 59 IPUT vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 301 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 302 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 303 | // 5A IPUT_WIDE vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 304 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_2 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 305 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 306 | // 5B IPUT_OBJECT vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 307 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 308 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 309 | // 5C IPUT_BOOLEAN vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 310 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 311 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 312 | // 5D IPUT_BYTE vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 313 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 314 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 315 | // 5E IPUT_CHAR vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 316 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 317 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 318 | // 5F IPUT_SHORT vA, vB, field@CCCC |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 319 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 320 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 321 | // 60 SGET vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 322 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 323 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 324 | // 61 SGET_WIDE vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 325 | DF_DA_WIDE | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 326 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 327 | // 62 SGET_OBJECT vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 328 | DF_DA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 329 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 330 | // 63 SGET_BOOLEAN vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 331 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 332 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 333 | // 64 SGET_BYTE vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 334 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 335 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 336 | // 65 SGET_CHAR vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 337 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 338 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 339 | // 66 SGET_SHORT vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 340 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 341 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 342 | // 67 SPUT vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 343 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 344 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 345 | // 68 SPUT_WIDE vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 346 | DF_UA_WIDE | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 347 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 348 | // 69 SPUT_OBJECT vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 349 | DF_UA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 350 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 351 | // 6A SPUT_BOOLEAN vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 352 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 353 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 354 | // 6B SPUT_BYTE vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 355 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 356 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 357 | // 6C SPUT_CHAR vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 358 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 359 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 360 | // 6D SPUT_SHORT vAA, field@BBBB |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 361 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 362 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 363 | // 6E INVOKE_VIRTUAL {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 364 | DF_FORMAT_35C | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 365 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 366 | // 6F INVOKE_SUPER {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 367 | DF_FORMAT_35C | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 368 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 369 | // 70 INVOKE_DIRECT {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 370 | DF_FORMAT_35C | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 371 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 372 | // 71 INVOKE_STATIC {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 373 | DF_FORMAT_35C | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 374 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 375 | // 72 INVOKE_INTERFACE {vD, vE, vF, vG, vA} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 376 | DF_FORMAT_35C | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 377 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 378 | // 73 UNUSED_73 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 379 | DF_NOP, |
| 380 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 381 | // 74 INVOKE_VIRTUAL_RANGE {vCCCC .. vNNNN} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 382 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 383 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 384 | // 75 INVOKE_SUPER_RANGE {vCCCC .. vNNNN} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 385 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 386 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 387 | // 76 INVOKE_DIRECT_RANGE {vCCCC .. vNNNN} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 388 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 389 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 390 | // 77 INVOKE_STATIC_RANGE {vCCCC .. vNNNN} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 391 | DF_FORMAT_3RC | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 392 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 393 | // 78 INVOKE_INTERFACE_RANGE {vCCCC .. vNNNN} |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 394 | DF_FORMAT_3RC | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 395 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 396 | // 79 UNUSED_79 |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 397 | DF_NOP, |
| 398 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 399 | // 7A UNUSED_7A |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 400 | DF_NOP, |
| 401 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 402 | // 7B NEG_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 403 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 404 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 405 | // 7C NOT_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 406 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 407 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 408 | // 7D NEG_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 409 | DF_DA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 410 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 411 | // 7E NOT_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 412 | DF_DA_WIDE | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 413 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 414 | // 7F NEG_FLOAT vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 415 | DF_DA | DF_UB | DF_FP_A | DF_FP_B, |
| 416 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 417 | // 80 NEG_DOUBLE vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 418 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 419 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 420 | // 81 INT_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 421 | DF_DA_WIDE | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 422 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 423 | // 82 INT_TO_FLOAT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 424 | DF_DA | DF_UB | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 425 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 426 | // 83 INT_TO_DOUBLE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 427 | DF_DA_WIDE | DF_UB | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 428 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 429 | // 84 LONG_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 430 | DF_DA | DF_UB_WIDE | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 431 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 432 | // 85 LONG_TO_FLOAT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 433 | DF_DA | DF_UB_WIDE | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 434 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 435 | // 86 LONG_TO_DOUBLE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 436 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 437 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 438 | // 87 FLOAT_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 439 | DF_DA | DF_UB | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 440 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 441 | // 88 FLOAT_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 442 | DF_DA_WIDE | DF_UB | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 443 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 444 | // 89 FLOAT_TO_DOUBLE vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 445 | DF_DA_WIDE | DF_UB | DF_FP_A | DF_FP_B, |
| 446 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 447 | // 8A DOUBLE_TO_INT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 448 | DF_DA | DF_UB_WIDE | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 449 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 450 | // 8B DOUBLE_TO_LONG vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 451 | DF_DA_WIDE | DF_UB_WIDE | DF_FP_B | DF_CORE_A, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 452 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 453 | // 8C DOUBLE_TO_FLOAT vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 454 | DF_DA | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 455 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 456 | // 8D INT_TO_BYTE vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 457 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 458 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 459 | // 8E INT_TO_CHAR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 460 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 461 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 462 | // 8F INT_TO_SHORT vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 463 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 464 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 465 | // 90 ADD_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 466 | 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] | 467 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 468 | // 91 SUB_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 469 | 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] | 470 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 471 | // 92 MUL_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 472 | 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] | 473 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 474 | // 93 DIV_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 475 | 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] | 476 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 477 | // 94 REM_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 478 | 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] | 479 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 480 | // 95 AND_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 481 | 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] | 482 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 483 | // 96 OR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 484 | 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] | 485 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 486 | // 97 XOR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 487 | 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] | 488 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 489 | // 98 SHL_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 490 | 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] | 491 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 492 | // 99 SHR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 493 | 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] | 494 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 495 | // 9A USHR_INT vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 496 | 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] | 497 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 498 | // 9B ADD_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 499 | 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] | 500 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 501 | // 9C SUB_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 502 | 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] | 503 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 504 | // 9D MUL_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 505 | 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] | 506 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 507 | // 9E DIV_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 508 | 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] | 509 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 510 | // 9F REM_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 511 | 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] | 512 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 513 | // A0 AND_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 514 | 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] | 515 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 516 | // A1 OR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 517 | 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] | 518 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 519 | // A2 XOR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 520 | 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] | 521 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 522 | // A3 SHL_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 523 | 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] | 524 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 525 | // A4 SHR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 526 | 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] | 527 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 528 | // A5 USHR_LONG vAA, vBB, vCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 529 | 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] | 530 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 531 | // A6 ADD_FLOAT vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 532 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 533 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 534 | // A7 SUB_FLOAT vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 535 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 536 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 537 | // A8 MUL_FLOAT vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 538 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 539 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 540 | // A9 DIV_FLOAT vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 541 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 542 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 543 | // AA REM_FLOAT vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 544 | DF_DA | DF_UB | DF_UC | DF_FP_A | DF_FP_B | DF_FP_C, |
| 545 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 546 | // AB ADD_DOUBLE vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 547 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 548 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 549 | // AC SUB_DOUBLE vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 550 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 551 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 552 | // AD MUL_DOUBLE vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 553 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 554 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 555 | // AE DIV_DOUBLE vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 556 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 557 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 558 | // AF REM_DOUBLE vAA, vBB, vCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 559 | DF_DA_WIDE | DF_UB_WIDE | DF_UC_WIDE | DF_FP_A | DF_FP_B | DF_FP_C, |
| 560 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 561 | // B0 ADD_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 562 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 563 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 564 | // B1 SUB_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 565 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 566 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 567 | // B2 MUL_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 568 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 569 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 570 | // B3 DIV_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 571 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 572 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 573 | // B4 REM_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 574 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 575 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 576 | // B5 AND_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 577 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 578 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 579 | // B6 OR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 580 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 581 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 582 | // B7 XOR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 583 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 584 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 585 | // B8 SHL_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 586 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 587 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 588 | // B9 SHR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 589 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 590 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 591 | // BA USHR_INT_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 592 | DF_DA | DF_UA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 593 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 594 | // BB ADD_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 595 | 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] | 596 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 597 | // BC SUB_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 598 | 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] | 599 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 600 | // BD MUL_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 601 | 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] | 602 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 603 | // BE DIV_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 604 | 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] | 605 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 606 | // BF REM_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 607 | 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] | 608 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 609 | // C0 AND_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 610 | 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] | 611 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 612 | // C1 OR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 613 | 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] | 614 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 615 | // C2 XOR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 616 | 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] | 617 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 618 | // C3 SHL_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 619 | 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] | 620 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 621 | // C4 SHR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 622 | 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] | 623 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 624 | // C5 USHR_LONG_2ADDR vA, vB |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 625 | 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] | 626 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 627 | // C6 ADD_FLOAT_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 628 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 629 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 630 | // C7 SUB_FLOAT_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 631 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 632 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 633 | // C8 MUL_FLOAT_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 634 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 635 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 636 | // C9 DIV_FLOAT_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 637 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 638 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 639 | // CA REM_FLOAT_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 640 | DF_DA | DF_UA | DF_UB | DF_FP_A | DF_FP_B, |
| 641 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 642 | // CB ADD_DOUBLE_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 643 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 644 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 645 | // CC SUB_DOUBLE_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 646 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 647 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 648 | // CD MUL_DOUBLE_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 649 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 650 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 651 | // CE DIV_DOUBLE_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 652 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 653 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 654 | // CF REM_DOUBLE_2ADDR vA, vB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 655 | DF_DA_WIDE | DF_UA_WIDE | DF_UB_WIDE | DF_FP_A | DF_FP_B, |
| 656 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 657 | // D0 ADD_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 658 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 659 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 660 | // D1 RSUB_INT vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 661 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 662 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 663 | // D2 MUL_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 664 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 665 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 666 | // D3 DIV_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 667 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 668 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 669 | // D4 REM_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 670 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 671 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 672 | // D5 AND_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 673 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 674 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 675 | // D6 OR_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 676 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 677 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 678 | // D7 XOR_INT_LIT16 vA, vB, #+CCCC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 679 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 680 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 681 | // D8 ADD_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 682 | DF_DA | DF_UB | DF_IS_LINEAR | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 683 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 684 | // D9 RSUB_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 685 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 686 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 687 | // DA MUL_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 688 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 689 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 690 | // DB DIV_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 691 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 692 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 693 | // DC REM_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 694 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 695 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 696 | // DD AND_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 697 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 698 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 699 | // DE OR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 700 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 701 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 702 | // DF XOR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 703 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 704 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 705 | // E0 SHL_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 706 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 707 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 708 | // E1 SHR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 709 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 710 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 711 | // E2 USHR_INT_LIT8 vAA, vBB, #+CC |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 712 | DF_DA | DF_UB | DF_CORE_A | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 713 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 714 | // E3 IGET_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 715 | DF_DA | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 716 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 717 | // E4 IPUT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 718 | DF_UA | DF_UB | DF_NULL_CHK_1 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 719 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 720 | // E5 SGET_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 721 | DF_DA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 722 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 723 | // E6 SPUT_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 724 | DF_UA | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 725 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 726 | // E7 IGET_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 727 | 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] | 728 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 729 | // E8 IGET_WIDE_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 730 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 731 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 732 | // E9 IPUT_WIDE_VOLATILE |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 733 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_2 | DF_CORE_B, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 734 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 735 | // EA SGET_WIDE_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 736 | DF_DA_WIDE | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 737 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 738 | // EB SPUT_WIDE_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 739 | DF_UA_WIDE | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 740 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 741 | // EC BREAKPOINT |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 742 | DF_NOP, |
| 743 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 744 | // ED THROW_VERIFICATION_ERROR |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 745 | DF_NOP | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 746 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 747 | // EE EXECUTE_INLINE |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 748 | DF_FORMAT_35C, |
| 749 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 750 | // EF EXECUTE_INLINE_RANGE |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 751 | DF_FORMAT_3RC, |
| 752 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 753 | // F0 INVOKE_OBJECT_INIT_RANGE |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 754 | DF_NOP | DF_NULL_CHK_0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 755 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 756 | // F1 RETURN_VOID_BARRIER |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 757 | DF_NOP, |
| 758 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 759 | // F2 IGET_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 760 | DF_DA | DF_UB | DF_NULL_CHK_0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 761 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 762 | // F3 IGET_WIDE_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 763 | DF_DA_WIDE | DF_UB | DF_NULL_CHK_0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 764 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 765 | // F4 IGET_OBJECT_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 766 | DF_DA | DF_UB | DF_NULL_CHK_0, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 767 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 768 | // F5 IPUT_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 769 | DF_UA | DF_UB | DF_NULL_CHK_1, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 770 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 771 | // F6 IPUT_WIDE_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 772 | DF_UA_WIDE | DF_UB | DF_NULL_CHK_2, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 773 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 774 | // F7 IPUT_OBJECT_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 775 | DF_UA | DF_UB | DF_NULL_CHK_1, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 776 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 777 | // F8 INVOKE_VIRTUAL_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 778 | DF_FORMAT_35C | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 779 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 780 | // F9 INVOKE_VIRTUAL_QUICK_RANGE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 781 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 782 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 783 | // FA INVOKE_SUPER_QUICK |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 784 | DF_FORMAT_35C | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 785 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 786 | // FB INVOKE_SUPER_QUICK_RANGE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 787 | DF_FORMAT_3RC | DF_NULL_CHK_OUT0 | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 788 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 789 | // FC IPUT_OBJECT_VOLATILE |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 790 | 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] | 791 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 792 | // FD SGET_OBJECT_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 793 | DF_DA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 794 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 795 | // FE SPUT_OBJECT_VOLATILE |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 796 | DF_UA | DF_CORE_A | DF_UMS, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 797 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 798 | // FF UNUSED_FF |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 799 | DF_NOP, |
| 800 | |
| 801 | // Beginning of extended MIR opcodes |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 802 | // 100 MIR_PHI |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 803 | DF_PHI | DF_DA | DF_NULL_TRANSFER_N, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 804 | /* |
| 805 | * For extended MIR inserted at the MIR2LIR stage, it is okay to have |
| 806 | * undefined values here. |
| 807 | */ |
| 808 | }; |
| 809 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 810 | /* Return the base virtual register for a SSA name */ |
| 811 | int SRegToVReg(const CompilationUnit* cUnit, int ssaReg) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 812 | { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 813 | DCHECK_LT(ssaReg, (int)cUnit->ssaBaseVRegs->numUsed); |
| 814 | return GET_ELEM_N(cUnit->ssaBaseVRegs, int, ssaReg); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 815 | } |
| 816 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 817 | int SRegToSubscript(const CompilationUnit* cUnit, int ssaReg) |
| 818 | { |
| 819 | DCHECK(ssaReg < (int)cUnit->ssaSubscripts->numUsed); |
| 820 | return GET_ELEM_N(cUnit->ssaSubscripts, int, ssaReg); |
| 821 | } |
| 822 | |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 823 | char* oatGetDalvikDisassembly(CompilationUnit* cUnit, |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 824 | const DecodedInstruction& insn, const char* note) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 825 | { |
| 826 | char buffer[256]; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 827 | Instruction::Code opcode = insn.opcode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 828 | int dfAttributes = oatDataFlowAttributes[opcode]; |
| 829 | int flags; |
| 830 | char* ret; |
| 831 | |
| 832 | buffer[0] = 0; |
| 833 | if ((int)opcode >= (int)kMirOpFirst) { |
| 834 | if ((int)opcode == (int)kMirOpPhi) { |
| 835 | strcpy(buffer, "PHI"); |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 836 | } else { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 837 | sprintf(buffer, "Opcode %#x", opcode); |
| 838 | } |
| 839 | flags = 0; |
| 840 | } else { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 841 | strcpy(buffer, Instruction::Name(opcode)); |
| 842 | flags = Instruction::Flags(opcode); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 843 | } |
| 844 | |
| 845 | if (note) |
| 846 | strcat(buffer, note); |
| 847 | |
| 848 | /* For branches, decode the instructions to print out the branch targets */ |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 849 | if (flags & Instruction::kBranch) { |
| 850 | Instruction::Format dalvikFormat = Instruction::FormatOf(insn.opcode); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 851 | int offset = 0; |
| 852 | switch (dalvikFormat) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 853 | case Instruction::k21t: |
| 854 | snprintf(buffer + strlen(buffer), 256, " v%d,", insn.vA); |
| 855 | offset = (int) insn.vB; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 856 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 857 | case Instruction::k22t: |
| 858 | snprintf(buffer + strlen(buffer), 256, " v%d, v%d,", insn.vA, insn.vB); |
| 859 | offset = (int) insn.vC; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 860 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 861 | case Instruction::k10t: |
| 862 | case Instruction::k20t: |
| 863 | case Instruction::k30t: |
| 864 | offset = (int) insn.vA; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 865 | break; |
| 866 | default: |
| 867 | LOG(FATAL) << "Unexpected branch format " << (int)dalvikFormat |
| 868 | << " / opcode " << (int)opcode; |
| 869 | } |
| 870 | snprintf(buffer + strlen(buffer), 256, " (%c%x)", |
| 871 | offset > 0 ? '+' : '-', |
| 872 | offset > 0 ? offset : -offset); |
| 873 | } else if (dfAttributes & DF_FORMAT_35C) { |
| 874 | unsigned int i; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 875 | for (i = 0; i < insn.vA; i++) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 876 | if (i != 0) strcat(buffer, ","); |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 877 | snprintf(buffer + strlen(buffer), 256, " v%d", insn.arg[i]); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 878 | } |
| 879 | } |
| 880 | else if (dfAttributes & DF_FORMAT_3RC) { |
| 881 | snprintf(buffer + strlen(buffer), 256, |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 882 | " v%d..v%d", insn.vC, insn.vC + insn.vA - 1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 883 | } |
| 884 | else { |
| 885 | if (dfAttributes & DF_A_IS_REG) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 886 | snprintf(buffer + strlen(buffer), 256, " v%d", insn.vA); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 887 | } |
| 888 | if (dfAttributes & DF_B_IS_REG) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 889 | snprintf(buffer + strlen(buffer), 256, ", v%d", insn.vB); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 890 | } |
| 891 | else if ((int)opcode < (int)kMirOpFirst) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 892 | snprintf(buffer + strlen(buffer), 256, ", (#%d)", insn.vB); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 893 | } |
| 894 | if (dfAttributes & DF_C_IS_REG) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 895 | snprintf(buffer + strlen(buffer), 256, ", v%d", insn.vC); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 896 | } |
| 897 | else if ((int)opcode < (int)kMirOpFirst) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 898 | snprintf(buffer + strlen(buffer), 256, ", (#%d)", insn.vC); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 899 | } |
| 900 | } |
| 901 | int length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 902 | ret = (char*)oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 903 | memcpy(ret, buffer, length); |
| 904 | return ret; |
| 905 | } |
| 906 | |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 907 | char* getSSAName(const CompilationUnit* cUnit, int ssaReg, char* name) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 908 | { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 909 | sprintf(name, "v%d_%d", SRegToVReg(cUnit, ssaReg), |
| 910 | SRegToSubscript(cUnit, ssaReg)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 911 | return name; |
| 912 | } |
| 913 | |
| 914 | /* |
| 915 | * Dalvik instruction disassembler with optional SSA printing. |
| 916 | */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 917 | char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 918 | { |
| 919 | char buffer[256]; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 920 | char operand0[32], operand1[32]; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 921 | const DecodedInstruction* insn = &mir->dalvikInsn; |
| 922 | Instruction::Code opcode = insn->opcode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 923 | int dfAttributes = oatDataFlowAttributes[opcode]; |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 924 | char* ret; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 925 | int length; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 926 | |
| 927 | buffer[0] = 0; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 928 | if (static_cast<int>(opcode) >= static_cast<int>(kMirOpFirst)) { |
| 929 | if (static_cast<int>(opcode) == static_cast<int>(kMirOpPhi)) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 930 | snprintf(buffer, 256, "PHI %s = (%s", |
| 931 | getSSAName(cUnit, mir->ssaRep->defs[0], operand0), |
| 932 | getSSAName(cUnit, mir->ssaRep->uses[0], operand1)); |
| 933 | int i; |
| 934 | for (i = 1; i < mir->ssaRep->numUses; i++) { |
| 935 | snprintf(buffer + strlen(buffer), 256, ", %s", |
| 936 | getSSAName(cUnit, mir->ssaRep->uses[i], operand0)); |
| 937 | } |
| 938 | snprintf(buffer + strlen(buffer), 256, ")"); |
| 939 | } |
| 940 | else { |
| 941 | sprintf(buffer, "Opcode %#x", opcode); |
| 942 | } |
| 943 | goto done; |
| 944 | } else { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 945 | strcpy(buffer, Instruction::Name(opcode)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 946 | } |
| 947 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 948 | /* For branches, decode the instructions to print out the branch targets */ |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 949 | if (Instruction::Flags(insn->opcode) & Instruction::kBranch) { |
| 950 | Instruction::Format dalvikFormat = Instruction::FormatOf(insn->opcode); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 951 | int delta = 0; |
| 952 | switch (dalvikFormat) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 953 | case Instruction::k21t: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 954 | snprintf(buffer + strlen(buffer), 256, " %s, ", |
| 955 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0)); |
| 956 | delta = (int) insn->vB; |
| 957 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 958 | case Instruction::k22t: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 959 | snprintf(buffer + strlen(buffer), 256, " %s, %s, ", |
| 960 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0), |
| 961 | getSSAName(cUnit, mir->ssaRep->uses[1], operand1)); |
| 962 | delta = (int) insn->vC; |
| 963 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 964 | case Instruction::k10t: |
| 965 | case Instruction::k20t: |
| 966 | case Instruction::k30t: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 967 | delta = (int) insn->vA; |
| 968 | break; |
| 969 | default: |
| 970 | LOG(FATAL) << "Unexpected branch format: " << |
| 971 | (int)dalvikFormat; |
| 972 | } |
| 973 | snprintf(buffer + strlen(buffer), 256, " %04x", |
| 974 | mir->offset + delta); |
| 975 | } else if (dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) { |
| 976 | unsigned int i; |
| 977 | for (i = 0; i < insn->vA; i++) { |
| 978 | if (i != 0) strcat(buffer, ","); |
| 979 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 980 | getSSAName(cUnit, mir->ssaRep->uses[i], operand0)); |
| 981 | } |
| 982 | } else { |
| 983 | int udIdx; |
| 984 | if (mir->ssaRep->numDefs) { |
| 985 | |
| 986 | for (udIdx = 0; udIdx < mir->ssaRep->numDefs; udIdx++) { |
| 987 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 988 | getSSAName(cUnit, mir->ssaRep->defs[udIdx], operand0)); |
| 989 | } |
| 990 | strcat(buffer, ","); |
| 991 | } |
| 992 | if (mir->ssaRep->numUses) { |
| 993 | /* No leading ',' for the first use */ |
| 994 | snprintf(buffer + strlen(buffer), 256, " %s", |
| 995 | getSSAName(cUnit, mir->ssaRep->uses[0], operand0)); |
| 996 | for (udIdx = 1; udIdx < mir->ssaRep->numUses; udIdx++) { |
| 997 | snprintf(buffer + strlen(buffer), 256, ", %s", |
| 998 | getSSAName(cUnit, mir->ssaRep->uses[udIdx], operand0)); |
| 999 | } |
| 1000 | } |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1001 | if (static_cast<int>(opcode) < static_cast<int>(kMirOpFirst)) { |
| 1002 | Instruction::Format dalvikFormat = Instruction::FormatOf(opcode); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1003 | switch (dalvikFormat) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1004 | case Instruction::k11n: // op vA, #+B |
| 1005 | case Instruction::k21s: // op vAA, #+BBBB |
| 1006 | case Instruction::k21h: // op vAA, #+BBBB00000[00000000] |
| 1007 | case Instruction::k31i: // op vAA, #+BBBBBBBB |
| 1008 | case Instruction::k51l: // op vAA, #+BBBBBBBBBBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1009 | snprintf(buffer + strlen(buffer), 256, " #%#x", insn->vB); |
| 1010 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1011 | case Instruction::k21c: // op vAA, thing@BBBB |
| 1012 | case Instruction::k31c: // op vAA, thing@BBBBBBBB |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1013 | snprintf(buffer + strlen(buffer), 256, " @%#x", insn->vB); |
| 1014 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1015 | case Instruction::k22b: // op vAA, vBB, #+CC |
| 1016 | case Instruction::k22s: // op vA, vB, #+CCCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1017 | snprintf(buffer + strlen(buffer), 256, " #%#x", insn->vC); |
| 1018 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1019 | case Instruction::k22c: // op vA, vB, thing@CCCC |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1020 | snprintf(buffer + strlen(buffer), 256, " @%#x", insn->vC); |
| 1021 | break; |
| 1022 | /* No need for special printing */ |
| 1023 | default: |
| 1024 | break; |
| 1025 | } |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | done: |
| 1030 | length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1031 | ret = (char*) oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1032 | memcpy(ret, buffer, length); |
| 1033 | return ret; |
| 1034 | } |
| 1035 | |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 1036 | char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1037 | { |
| 1038 | char buffer[256]; |
| 1039 | char* ret; |
| 1040 | int i; |
| 1041 | |
| 1042 | buffer[0] = 0; |
| 1043 | for (i = 0; i < ssaRep->numDefs; i++) { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1044 | int ssaReg = ssaRep->defs[i]; |
| 1045 | sprintf(buffer + strlen(buffer), "s%d(v%d_%d) ", ssaReg, |
| 1046 | SRegToVReg(cUnit, ssaReg), SRegToSubscript(cUnit, ssaReg)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1047 | } |
| 1048 | |
| 1049 | if (ssaRep->numDefs) { |
| 1050 | strcat(buffer, "<- "); |
| 1051 | } |
| 1052 | |
| 1053 | for (i = 0; i < ssaRep->numUses; i++) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1054 | int len = strlen(buffer); |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1055 | int ssaReg = ssaRep->uses[i]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1056 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1057 | if (snprintf(buffer + len, 250 - len, "s%d(v%d_%d) ", ssaReg, |
| 1058 | SRegToVReg(cUnit, ssaReg), |
| 1059 | SRegToSubscript(cUnit, ssaReg))) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1060 | strcat(buffer, "..."); |
| 1061 | break; |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | int length = strlen(buffer) + 1; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1066 | ret = (char*)oatNew(cUnit, length, false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1067 | memcpy(ret, buffer, length); |
| 1068 | return ret; |
| 1069 | } |
| 1070 | |
| 1071 | /* Any register that is used before being defined is considered live-in */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1072 | inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV, |
| 1073 | ArenaBitVector* defV, ArenaBitVector* liveInV, |
| 1074 | int dalvikRegId) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1075 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1076 | oatSetBit(cUnit, useV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1077 | if (!oatIsBitSet(defV, dalvikRegId)) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1078 | oatSetBit(cUnit, liveInV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | /* Mark a reg as being defined */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1083 | inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV, |
| 1084 | int dalvikRegId) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1085 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1086 | oatSetBit(cUnit, defV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1087 | } |
| 1088 | |
| 1089 | /* |
| 1090 | * Find out live-in variables for natural loops. Variables that are live-in in |
| 1091 | * the main loop body are considered to be defined in the entry block. |
| 1092 | */ |
| 1093 | bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb) |
| 1094 | { |
| 1095 | MIR* mir; |
| 1096 | ArenaBitVector *useV, *defV, *liveInV; |
| 1097 | |
| 1098 | if (bb->dataFlowInfo == NULL) return false; |
| 1099 | |
| 1100 | useV = bb->dataFlowInfo->useV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1101 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapUse); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1102 | defV = bb->dataFlowInfo->defV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1103 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapDef); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1104 | liveInV = bb->dataFlowInfo->liveInV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1105 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, |
| 1106 | kBitMapLiveIn); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1107 | |
| 1108 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1109 | int dfAttributes = |
| 1110 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1111 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1112 | |
| 1113 | if (dfAttributes & DF_HAS_USES) { |
| 1114 | if (dfAttributes & DF_UA) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1115 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1116 | } else if (dfAttributes & DF_UA_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1117 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA); |
| 1118 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1119 | } |
| 1120 | if (dfAttributes & DF_UB) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1121 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1122 | } else if (dfAttributes & DF_UB_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1123 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB); |
| 1124 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1125 | } |
| 1126 | if (dfAttributes & DF_UC) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1127 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1128 | } else if (dfAttributes & DF_UC_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1129 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC); |
| 1130 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1131 | } |
| 1132 | } |
buzbee | 07ce1d7 | 2012-02-10 17:22:02 -0800 | [diff] [blame] | 1133 | if (dfAttributes & DF_FORMAT_35C) { |
| 1134 | for (unsigned int i = 0; i < dInsn->vA; i++) { |
| 1135 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->arg[i]); |
| 1136 | } |
| 1137 | } |
| 1138 | if (dfAttributes & DF_FORMAT_3RC) { |
| 1139 | for (unsigned int i = 0; i < dInsn->vA; i++) { |
| 1140 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+i); |
| 1141 | } |
| 1142 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1143 | if (dfAttributes & DF_HAS_DEFS) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1144 | handleDef(cUnit, defV, dInsn->vA); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1145 | if (dfAttributes & DF_DA_WIDE) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1146 | handleDef(cUnit, defV, dInsn->vA+1); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1147 | } |
| 1148 | } |
| 1149 | } |
| 1150 | return true; |
| 1151 | } |
| 1152 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1153 | int addNewSReg(CompilationUnit* cUnit, int vReg) |
| 1154 | { |
| 1155 | // Compiler temps always have a subscript of 0 |
| 1156 | int subscript = (vReg < 0) ? 0 : ++cUnit->SSALastDefs[vReg]; |
| 1157 | int ssaReg = cUnit->numSSARegs++; |
| 1158 | oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, vReg); |
| 1159 | oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, subscript); |
| 1160 | DCHECK_EQ(cUnit->ssaBaseVRegs->numUsed, cUnit->ssaSubscripts->numUsed); |
| 1161 | return ssaReg; |
| 1162 | } |
| 1163 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1164 | /* Find out the latest SSA register for a given Dalvik register */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1165 | void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg, |
| 1166 | int regIndex) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1167 | { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1168 | DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters)); |
| 1169 | uses[regIndex] = cUnit->vRegToSSAMap[dalvikReg]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1170 | } |
| 1171 | |
| 1172 | /* Setup a new SSA register for a given Dalvik register */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1173 | void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg, |
| 1174 | int regIndex) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1175 | { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1176 | DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters)); |
| 1177 | int ssaReg = addNewSReg(cUnit, dalvikReg); |
| 1178 | cUnit->vRegToSSAMap[dalvikReg] = ssaReg; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1179 | defs[regIndex] = ssaReg; |
| 1180 | } |
| 1181 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1182 | /* Look up new SSA names for format_35c instructions */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1183 | void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1184 | { |
| 1185 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1186 | int numUses = dInsn->vA; |
| 1187 | int i; |
| 1188 | |
| 1189 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1190 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1191 | kAllocDFInfo); |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1192 | // NOTE: will be filled in during type & size inference pass |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1193 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1194 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1195 | |
| 1196 | for (i = 0; i < numUses; i++) { |
| 1197 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->arg[i], i); |
| 1198 | } |
| 1199 | } |
| 1200 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1201 | /* Look up new SSA names for format_3rc instructions */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1202 | void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1203 | { |
| 1204 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1205 | int numUses = dInsn->vA; |
| 1206 | int i; |
| 1207 | |
| 1208 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1209 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1210 | kAllocDFInfo); |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 1211 | // NOTE: will be filled in during type & size inference pass |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1212 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, true, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1213 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1214 | |
| 1215 | for (i = 0; i < numUses; i++) { |
| 1216 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+i, i); |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | /* Entry function to convert a block into SSA representation */ |
| 1221 | bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb) |
| 1222 | { |
| 1223 | MIR* mir; |
| 1224 | |
| 1225 | if (bb->dataFlowInfo == NULL) return false; |
| 1226 | |
| 1227 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1228 | mir->ssaRep = (struct SSARepresentation *) |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1229 | oatNew(cUnit, sizeof(SSARepresentation), true, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1230 | |
| 1231 | int dfAttributes = |
| 1232 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1233 | |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1234 | // If not a pseudo-op, note non-leaf or can throw |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1235 | if (static_cast<int>(mir->dalvikInsn.opcode) < static_cast<int>(kNumPackedOpcodes)) { |
| 1236 | int flags = Instruction::Flags(mir->dalvikInsn.opcode); |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1237 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1238 | if (flags & Instruction::kThrow) { |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1239 | cUnit->attrs &= ~METHOD_IS_THROW_FREE; |
| 1240 | } |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1241 | |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1242 | if (flags & Instruction::kInvoke) { |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1243 | cUnit->attrs &= ~METHOD_IS_LEAF; |
| 1244 | } |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1245 | } |
| 1246 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1247 | int numUses = 0; |
| 1248 | |
| 1249 | if (dfAttributes & DF_FORMAT_35C) { |
| 1250 | dataFlowSSAFormat35C(cUnit, mir); |
| 1251 | continue; |
| 1252 | } |
| 1253 | |
| 1254 | if (dfAttributes & DF_FORMAT_3RC) { |
| 1255 | dataFlowSSAFormat3RC(cUnit, mir); |
| 1256 | continue; |
| 1257 | } |
| 1258 | |
| 1259 | if (dfAttributes & DF_HAS_USES) { |
| 1260 | if (dfAttributes & DF_UA) { |
| 1261 | numUses++; |
| 1262 | } else if (dfAttributes & DF_UA_WIDE) { |
| 1263 | numUses += 2; |
| 1264 | } |
| 1265 | if (dfAttributes & DF_UB) { |
| 1266 | numUses++; |
| 1267 | } else if (dfAttributes & DF_UB_WIDE) { |
| 1268 | numUses += 2; |
| 1269 | } |
| 1270 | if (dfAttributes & DF_UC) { |
| 1271 | numUses++; |
| 1272 | } else if (dfAttributes & DF_UC_WIDE) { |
| 1273 | numUses += 2; |
| 1274 | } |
| 1275 | } |
| 1276 | |
| 1277 | if (numUses) { |
| 1278 | mir->ssaRep->numUses = numUses; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1279 | mir->ssaRep->uses = (int *)oatNew(cUnit, sizeof(int) * numUses, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1280 | false, kAllocDFInfo); |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1281 | mir->ssaRep->fpUse = (bool *)oatNew(cUnit, sizeof(bool) * numUses, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1282 | false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | int numDefs = 0; |
| 1286 | |
| 1287 | if (dfAttributes & DF_HAS_DEFS) { |
| 1288 | numDefs++; |
| 1289 | if (dfAttributes & DF_DA_WIDE) { |
| 1290 | numDefs++; |
| 1291 | } |
| 1292 | } |
| 1293 | |
| 1294 | if (numDefs) { |
| 1295 | mir->ssaRep->numDefs = numDefs; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1296 | mir->ssaRep->defs = (int *)oatNew(cUnit, sizeof(int) * numDefs, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1297 | false, kAllocDFInfo); |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1298 | mir->ssaRep->fpDef = (bool *)oatNew(cUnit, sizeof(bool) * numDefs, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1299 | false, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1300 | } |
| 1301 | |
| 1302 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1303 | |
| 1304 | if (dfAttributes & DF_HAS_USES) { |
| 1305 | numUses = 0; |
| 1306 | if (dfAttributes & DF_UA) { |
| 1307 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1308 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++); |
| 1309 | } else if (dfAttributes & DF_UA_WIDE) { |
| 1310 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1311 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++); |
| 1312 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1313 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA+1, numUses++); |
| 1314 | } |
| 1315 | if (dfAttributes & DF_UB) { |
| 1316 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1317 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++); |
| 1318 | } else if (dfAttributes & DF_UB_WIDE) { |
| 1319 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1320 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++); |
| 1321 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1322 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB+1, numUses++); |
| 1323 | } |
| 1324 | if (dfAttributes & DF_UC) { |
| 1325 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1326 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++); |
| 1327 | } else if (dfAttributes & DF_UC_WIDE) { |
| 1328 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1329 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++); |
| 1330 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1331 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+1, numUses++); |
| 1332 | } |
| 1333 | } |
| 1334 | if (dfAttributes & DF_HAS_DEFS) { |
| 1335 | mir->ssaRep->fpDef[0] = dfAttributes & DF_FP_A; |
| 1336 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA, 0); |
| 1337 | if (dfAttributes & DF_DA_WIDE) { |
| 1338 | mir->ssaRep->fpDef[1] = dfAttributes & DF_FP_A; |
| 1339 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA+1, 1); |
| 1340 | } |
| 1341 | } |
| 1342 | } |
| 1343 | |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1344 | if (!cUnit->disableDataflow) { |
| 1345 | /* |
| 1346 | * Take a snapshot of Dalvik->SSA mapping at the end of each block. The |
| 1347 | * input to PHI nodes can be derived from the snapshot of all |
| 1348 | * predecessor blocks. |
| 1349 | */ |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1350 | bb->dataFlowInfo->vRegToSSAMap = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1351 | (int *)oatNew(cUnit, sizeof(int) * cUnit->numDalvikRegisters, false, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1352 | kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1353 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1354 | memcpy(bb->dataFlowInfo->vRegToSSAMap, cUnit->vRegToSSAMap, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1355 | sizeof(int) * cUnit->numDalvikRegisters); |
| 1356 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1357 | return true; |
| 1358 | } |
| 1359 | |
| 1360 | /* Setup a constant value for opcodes thare have the DF_SETS_CONST attribute */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1361 | void setConstant(CompilationUnit* cUnit, int ssaReg, int value) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1362 | { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1363 | oatSetBit(cUnit, cUnit->isConstantV, ssaReg); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1364 | cUnit->constantValues[ssaReg] = value; |
| 1365 | } |
| 1366 | |
| 1367 | bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb) |
| 1368 | { |
| 1369 | MIR* mir; |
| 1370 | ArenaBitVector *isConstantV = cUnit->isConstantV; |
| 1371 | |
| 1372 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1373 | int dfAttributes = |
| 1374 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1375 | |
| 1376 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1377 | |
| 1378 | if (!(dfAttributes & DF_HAS_DEFS)) continue; |
| 1379 | |
| 1380 | /* Handle instructions that set up constants directly */ |
| 1381 | if (dfAttributes & DF_SETS_CONST) { |
| 1382 | if (dfAttributes & DF_DA) { |
| 1383 | switch (dInsn->opcode) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1384 | case Instruction::CONST_4: |
| 1385 | case Instruction::CONST_16: |
| 1386 | case Instruction::CONST: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1387 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1388 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1389 | case Instruction::CONST_HIGH16: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1390 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1391 | dInsn->vB << 16); |
| 1392 | break; |
| 1393 | default: |
| 1394 | break; |
| 1395 | } |
| 1396 | } else if (dfAttributes & DF_DA_WIDE) { |
| 1397 | switch (dInsn->opcode) { |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1398 | case Instruction::CONST_WIDE_16: |
| 1399 | case Instruction::CONST_WIDE_32: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1400 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1401 | setConstant(cUnit, mir->ssaRep->defs[1], 0); |
| 1402 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1403 | case Instruction::CONST_WIDE: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1404 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1405 | (int) dInsn->vB_wide); |
| 1406 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1407 | (int) (dInsn->vB_wide >> 32)); |
| 1408 | break; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1409 | case Instruction::CONST_WIDE_HIGH16: |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1410 | setConstant(cUnit, mir->ssaRep->defs[0], 0); |
| 1411 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1412 | dInsn->vB << 16); |
| 1413 | break; |
| 1414 | default: |
| 1415 | break; |
| 1416 | } |
| 1417 | } |
| 1418 | /* Handle instructions that set up constants directly */ |
| 1419 | } else if (dfAttributes & DF_IS_MOVE) { |
| 1420 | int i; |
| 1421 | |
| 1422 | for (i = 0; i < mir->ssaRep->numUses; i++) { |
| 1423 | if (!oatIsBitSet(isConstantV, mir->ssaRep->uses[i])) break; |
| 1424 | } |
| 1425 | /* Move a register holding a constant to another register */ |
| 1426 | if (i == mir->ssaRep->numUses) { |
| 1427 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1428 | cUnit->constantValues[mir->ssaRep->uses[0]]); |
| 1429 | if (dfAttributes & DF_DA_WIDE) { |
| 1430 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1431 | cUnit->constantValues[mir->ssaRep->uses[1]]); |
| 1432 | } |
| 1433 | } |
| 1434 | } |
| 1435 | } |
| 1436 | /* TODO: implement code to handle arithmetic operations */ |
| 1437 | return true; |
| 1438 | } |
| 1439 | |
| 1440 | /* Setup the basic data structures for SSA conversion */ |
| 1441 | void oatInitializeSSAConversion(CompilationUnit* cUnit) |
| 1442 | { |
| 1443 | int i; |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 1444 | int numDalvikReg = cUnit->numDalvikRegisters; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1445 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1446 | cUnit->ssaBaseVRegs = (GrowableList *)oatNew(cUnit, sizeof(GrowableList), |
| 1447 | false, kAllocDFInfo); |
| 1448 | cUnit->ssaSubscripts = (GrowableList *)oatNew(cUnit, sizeof(GrowableList), |
| 1449 | false, kAllocDFInfo); |
| 1450 | // Create the ssa mappings, estimating the max size |
| 1451 | oatInitGrowableList(cUnit, cUnit->ssaBaseVRegs, |
| 1452 | numDalvikReg + cUnit->defCount + 128, |
| 1453 | kListSSAtoDalvikMap); |
| 1454 | oatInitGrowableList(cUnit, cUnit->ssaSubscripts, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1455 | numDalvikReg + cUnit->defCount + 128, |
| 1456 | kListSSAtoDalvikMap); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1457 | /* |
| 1458 | * Initial number of SSA registers is equal to the number of Dalvik |
| 1459 | * registers. |
| 1460 | */ |
| 1461 | cUnit->numSSARegs = numDalvikReg; |
| 1462 | |
| 1463 | /* |
| 1464 | * Initialize the SSA2Dalvik map list. For the first numDalvikReg elements, |
| 1465 | * the subscript is 0 so we use the ENCODE_REG_SUB macro to encode the value |
| 1466 | * into "(0 << 16) | i" |
| 1467 | */ |
| 1468 | for (i = 0; i < numDalvikReg; i++) { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1469 | oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, i); |
| 1470 | oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, 0); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1471 | } |
| 1472 | |
| 1473 | /* |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1474 | * Initialize the DalvikToSSAMap map. There is one entry for each |
| 1475 | * Dalvik register, and the SSA names for those are the same. |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1476 | */ |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1477 | cUnit->vRegToSSAMap = (int *)oatNew(cUnit, sizeof(int) * numDalvikReg, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1478 | false, kAllocDFInfo); |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1479 | /* Keep track of the higest def for each dalvik reg */ |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1480 | cUnit->SSALastDefs = (int *)oatNew(cUnit, sizeof(int) * numDalvikReg, |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1481 | false, kAllocDFInfo); |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1482 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1483 | for (i = 0; i < numDalvikReg; i++) { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1484 | cUnit->vRegToSSAMap[i] = i; |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1485 | cUnit->SSALastDefs[i] = 0; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1486 | } |
| 1487 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1488 | /* Add ssa reg for Method* */ |
| 1489 | cUnit->methodSReg = addNewSReg(cUnit, SSA_METHOD_BASEREG); |
| 1490 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1491 | /* |
| 1492 | * Allocate the BasicBlockDataFlow structure for the entry and code blocks |
| 1493 | */ |
| 1494 | GrowableListIterator iterator; |
| 1495 | |
| 1496 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
| 1497 | |
| 1498 | while (true) { |
| 1499 | BasicBlock* bb = (BasicBlock *) oatGrowableListIteratorNext(&iterator); |
| 1500 | if (bb == NULL) break; |
| 1501 | if (bb->hidden == true) continue; |
| 1502 | if (bb->blockType == kDalvikByteCode || |
| 1503 | bb->blockType == kEntryBlock || |
| 1504 | bb->blockType == kExitBlock) { |
| 1505 | bb->dataFlowInfo = (BasicBlockDataFlow *) |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1506 | oatNew(cUnit, sizeof(BasicBlockDataFlow), |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1507 | true, kAllocDFInfo); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1508 | } |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | /* Clear the visited flag for each BB */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1513 | bool oatClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1514 | { |
| 1515 | bb->visited = false; |
| 1516 | return true; |
| 1517 | } |
| 1518 | |
| 1519 | void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit, |
| 1520 | bool (*func)(CompilationUnit*, BasicBlock*), |
| 1521 | DataFlowAnalysisMode dfaMode, |
| 1522 | bool isIterative) |
| 1523 | { |
| 1524 | bool change = true; |
| 1525 | |
| 1526 | while (change) { |
| 1527 | change = false; |
| 1528 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1529 | switch (dfaMode) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1530 | /* Scan all blocks and perform the operations specified in func */ |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1531 | case kAllNodes: |
| 1532 | { |
| 1533 | GrowableListIterator iterator; |
| 1534 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
| 1535 | while (true) { |
| 1536 | BasicBlock* bb = |
| 1537 | (BasicBlock *) oatGrowableListIteratorNext(&iterator); |
| 1538 | if (bb == NULL) break; |
| 1539 | if (bb->hidden == true) continue; |
| 1540 | change |= (*func)(cUnit, bb); |
| 1541 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1542 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1543 | break; |
| 1544 | /* Scan reachable blocks and perform the ops specified in func. */ |
| 1545 | case kReachableNodes: |
| 1546 | { |
| 1547 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1548 | int idx; |
| 1549 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1550 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1551 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1552 | int blockIdx = cUnit->dfsOrder.elemList[idx]; |
| 1553 | BasicBlock* bb = |
| 1554 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1555 | blockIdx); |
| 1556 | change |= (*func)(cUnit, bb); |
| 1557 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1558 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1559 | break; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1560 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1561 | /* Scan reachable blocks by pre-order dfs and invoke func on each. */ |
| 1562 | case kPreOrderDFSTraversal: |
| 1563 | { |
| 1564 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1565 | int idx; |
| 1566 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1567 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1568 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1569 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
| 1570 | BasicBlock* bb = |
| 1571 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1572 | dfsIdx); |
| 1573 | change |= (*func)(cUnit, bb); |
| 1574 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1575 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1576 | break; |
| 1577 | /* Scan reachable blocks post-order dfs and invoke func on each. */ |
| 1578 | case kPostOrderDFSTraversal: |
| 1579 | { |
| 1580 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1581 | int idx; |
| 1582 | const GrowableList *blockList = &cUnit->blockList; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1583 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1584 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1585 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
| 1586 | BasicBlock* bb = |
| 1587 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1588 | dfsIdx); |
| 1589 | change |= (*func)(cUnit, bb); |
| 1590 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1591 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 1592 | break; |
| 1593 | /* Scan reachable post-order dom tree and invoke func on each. */ |
| 1594 | case kPostOrderDOMTraversal: |
| 1595 | { |
| 1596 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1597 | int idx; |
| 1598 | const GrowableList *blockList = &cUnit->blockList; |
| 1599 | |
| 1600 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1601 | int domIdx = cUnit->domPostOrderTraversal.elemList[idx]; |
| 1602 | BasicBlock* bb = |
| 1603 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1604 | domIdx); |
| 1605 | change |= (*func)(cUnit, bb); |
| 1606 | } |
| 1607 | } |
| 1608 | break; |
| 1609 | /* Scan reachable blocks reverse post-order dfs, invoke func on each */ |
| 1610 | case kReversePostOrderTraversal: |
| 1611 | { |
| 1612 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1613 | int idx; |
| 1614 | const GrowableList *blockList = &cUnit->blockList; |
| 1615 | |
| 1616 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1617 | int revIdx = cUnit->dfsPostOrder.elemList[idx]; |
| 1618 | BasicBlock* bb = |
| 1619 | (BasicBlock *) oatGrowableListGetElement(blockList, |
| 1620 | revIdx); |
| 1621 | change |= (*func)(cUnit, bb); |
| 1622 | } |
| 1623 | } |
| 1624 | break; |
| 1625 | default: |
| 1626 | LOG(FATAL) << "Unknown traversal mode " << (int)dfaMode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1627 | } |
| 1628 | /* If isIterative is false, exit the loop after the first iteration */ |
| 1629 | change &= isIterative; |
| 1630 | } |
| 1631 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1632 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1633 | /* Advance to next strictly dominated MIR node in an extended basic block */ |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1634 | MIR* advanceMIR(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir, ArenaBitVector* bv, |
| 1635 | bool clearMark) { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1636 | BasicBlock* bb = *pBb; |
| 1637 | if (mir != NULL) { |
| 1638 | mir = mir->next; |
| 1639 | if (mir == NULL) { |
| 1640 | bb = bb->fallThrough; |
| 1641 | if ((bb == NULL) || bb->predecessors->numUsed != 1) { |
| 1642 | mir = NULL; |
| 1643 | } else { |
| 1644 | if (bv) { |
| 1645 | oatSetBit(cUnit, bv, bb->id); |
| 1646 | } |
| 1647 | *pBb = bb; |
| 1648 | mir = bb->firstMIRInsn; |
| 1649 | } |
| 1650 | } |
| 1651 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1652 | if (mir && clearMark) { |
| 1653 | mir->optimizationFlags &= ~MIR_MARK; |
| 1654 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1655 | return mir; |
| 1656 | } |
| 1657 | |
buzbee | fc9e6fa | 2012-03-23 15:14:29 -0700 | [diff] [blame] | 1658 | /* |
| 1659 | * To be used at an invoke mir. If the logically next mir node represents |
| 1660 | * a move-result, return it. Else, return NULL. If a move-result exists, |
| 1661 | * it is required to immediately follow the invoke with no intervening |
| 1662 | * opcodes or incoming arcs. However, if the result of the invoke is not |
| 1663 | * used, a move-result may not be present. |
| 1664 | */ |
| 1665 | MIR* oatFindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, |
| 1666 | bool wide) |
| 1667 | { |
| 1668 | BasicBlock* tbb = bb; |
| 1669 | mir = advanceMIR(cUnit, &tbb, mir, NULL, false); |
| 1670 | while (mir != NULL) { |
| 1671 | if (!wide && mir->dalvikInsn.opcode == Instruction::MOVE_RESULT) { |
| 1672 | break; |
| 1673 | } |
| 1674 | if (wide && mir->dalvikInsn.opcode == Instruction::MOVE_RESULT_WIDE) { |
| 1675 | break; |
| 1676 | } |
| 1677 | // Keep going if pseudo op, otherwise terminate |
| 1678 | if (mir->dalvikInsn.opcode < static_cast<Instruction::Code>(kNumPackedOpcodes)) { |
| 1679 | mir = NULL; |
| 1680 | } else { |
| 1681 | mir = advanceMIR(cUnit, &tbb, mir, NULL, false); |
| 1682 | } |
| 1683 | } |
| 1684 | return mir; |
| 1685 | } |
| 1686 | |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1687 | void squashDupRangeChecks(CompilationUnit* cUnit, BasicBlock** pBp, MIR* mir, |
| 1688 | int arraySreg, int indexSreg) |
| 1689 | { |
| 1690 | while (true) { |
| 1691 | mir = advanceMIR(cUnit, pBp, mir, NULL, false); |
| 1692 | if (!mir) { |
| 1693 | break; |
| 1694 | } |
| 1695 | if ((mir->ssaRep == NULL) || |
| 1696 | (mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1697 | continue; |
| 1698 | } |
| 1699 | int checkArray = INVALID_SREG; |
| 1700 | int checkIndex = INVALID_SREG; |
Elliott Hughes | b25c3f6 | 2012-03-26 16:35:06 -0700 | [diff] [blame] | 1701 | switch (mir->dalvikInsn.opcode) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1702 | case Instruction::AGET: |
| 1703 | case Instruction::AGET_OBJECT: |
| 1704 | case Instruction::AGET_BOOLEAN: |
| 1705 | case Instruction::AGET_BYTE: |
| 1706 | case Instruction::AGET_CHAR: |
| 1707 | case Instruction::AGET_SHORT: |
| 1708 | case Instruction::AGET_WIDE: |
| 1709 | checkArray = mir->ssaRep->uses[0]; |
| 1710 | checkIndex = mir->ssaRep->uses[1]; |
| 1711 | break; |
| 1712 | break; |
| 1713 | case Instruction::APUT: |
| 1714 | case Instruction::APUT_OBJECT: |
| 1715 | case Instruction::APUT_SHORT: |
| 1716 | case Instruction::APUT_CHAR: |
| 1717 | case Instruction::APUT_BYTE: |
| 1718 | case Instruction::APUT_BOOLEAN: |
| 1719 | checkArray = mir->ssaRep->uses[1]; |
| 1720 | checkIndex = mir->ssaRep->uses[2]; |
| 1721 | break; |
| 1722 | case Instruction::APUT_WIDE: |
| 1723 | checkArray = mir->ssaRep->uses[2]; |
| 1724 | checkIndex = mir->ssaRep->uses[3]; |
| 1725 | default: |
| 1726 | break; |
| 1727 | } |
| 1728 | if (checkArray == INVALID_SREG) { |
| 1729 | continue; |
| 1730 | } |
| 1731 | if ((arraySreg == checkArray) && (indexSreg == checkIndex)) { |
| 1732 | if (cUnit->printMe) { |
| 1733 | LOG(INFO) << "Squashing range check @ 0x" << std::hex |
| 1734 | << mir->offset; |
| 1735 | } |
| 1736 | mir->optimizationFlags |= MIR_IGNORE_RANGE_CHECK; |
| 1737 | } |
| 1738 | } |
| 1739 | } |
| 1740 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1741 | /* Allocate a compiler temp, return Sreg. Reuse existing if no conflict */ |
| 1742 | int allocCompilerTempSreg(CompilationUnit* cUnit, ArenaBitVector* bv) |
| 1743 | { |
| 1744 | for (int i = 0; i < cUnit->numCompilerTemps; i++) { |
| 1745 | CompilerTemp* ct = (CompilerTemp*)cUnit->compilerTemps.elemList[i]; |
| 1746 | ArenaBitVector* tBv = ct->bv; |
| 1747 | if (!oatTestBitVectors(bv, tBv)) { |
| 1748 | // Combine live maps and reuse existing temp |
| 1749 | oatUnifyBitVectors(tBv, tBv, bv); |
| 1750 | return ct->sReg; |
| 1751 | } |
| 1752 | } |
| 1753 | |
| 1754 | // Create a new compiler temp & associated live bitmap |
| 1755 | CompilerTemp* ct = (CompilerTemp*)oatNew(cUnit, sizeof(CompilerTemp), |
| 1756 | true, kAllocMisc); |
| 1757 | ArenaBitVector *nBv = oatAllocBitVector(cUnit, cUnit->numBlocks, true, |
| 1758 | kBitMapMisc); |
| 1759 | oatCopyBitVector(nBv, bv); |
| 1760 | ct->bv = nBv; |
| 1761 | ct->sReg = addNewSReg(cUnit, SSA_CTEMP_BASEREG - cUnit->numCompilerTemps); |
| 1762 | cUnit->numCompilerTemps++; |
| 1763 | oatInsertGrowableList(cUnit, &cUnit->compilerTemps, (intptr_t)ct); |
| 1764 | DCHECK_EQ(cUnit->numCompilerTemps, (int)cUnit->compilerTemps.numUsed); |
| 1765 | return ct->sReg; |
| 1766 | } |
| 1767 | |
| 1768 | /* Creata a new MIR node for a new pseudo op. */ |
| 1769 | MIR* rawMIR(CompilationUnit* cUnit, Instruction::Code opcode, int defs, int uses) |
| 1770 | { |
| 1771 | MIR* res = (MIR*)oatNew( cUnit, sizeof(MIR), true, kAllocMIR); |
| 1772 | res->ssaRep =(struct SSARepresentation *) |
| 1773 | oatNew(cUnit, sizeof(SSARepresentation), true, kAllocDFInfo); |
| 1774 | if (uses) { |
| 1775 | res->ssaRep->numUses = uses; |
| 1776 | res->ssaRep->uses = (int*)oatNew(cUnit, sizeof(int) * uses, false, kAllocDFInfo); |
| 1777 | } |
| 1778 | if (defs) { |
| 1779 | res->ssaRep->numDefs = defs; |
| 1780 | res->ssaRep->defs = (int*)oatNew(cUnit, sizeof(int) * defs, false, kAllocDFInfo); |
| 1781 | res->ssaRep->fpDef = (bool*)oatNew(cUnit, sizeof(bool) * defs, true, kAllocDFInfo); |
| 1782 | } |
| 1783 | res->dalvikInsn.opcode = opcode; |
| 1784 | return res; |
| 1785 | } |
| 1786 | |
| 1787 | /* Do some MIR-level basic block optimizations */ |
| 1788 | bool basicBlockOpt(CompilationUnit* cUnit, BasicBlock* bb) |
| 1789 | { |
| 1790 | int numTemps = 0; |
| 1791 | |
| 1792 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1793 | // Look for interesting opcodes, skip otherwise |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1794 | Instruction::Code opcode = mir->dalvikInsn.opcode; |
Elliott Hughes | b25c3f6 | 2012-03-26 16:35:06 -0700 | [diff] [blame] | 1795 | switch (opcode) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1796 | case Instruction::AGET: |
| 1797 | case Instruction::AGET_OBJECT: |
| 1798 | case Instruction::AGET_BOOLEAN: |
| 1799 | case Instruction::AGET_BYTE: |
| 1800 | case Instruction::AGET_CHAR: |
| 1801 | case Instruction::AGET_SHORT: |
| 1802 | case Instruction::AGET_WIDE: |
| 1803 | if (!(mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1804 | int arrSreg = mir->ssaRep->uses[0]; |
| 1805 | int idxSreg = mir->ssaRep->uses[1]; |
| 1806 | BasicBlock* tbb = bb; |
| 1807 | squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg); |
| 1808 | } |
| 1809 | break; |
| 1810 | case Instruction::APUT: |
| 1811 | case Instruction::APUT_OBJECT: |
| 1812 | case Instruction::APUT_SHORT: |
| 1813 | case Instruction::APUT_CHAR: |
| 1814 | case Instruction::APUT_BYTE: |
| 1815 | case Instruction::APUT_BOOLEAN: |
| 1816 | case Instruction::APUT_WIDE: |
| 1817 | if (!(mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1818 | int start = (opcode == Instruction::APUT_WIDE) ? 2 : 1; |
| 1819 | int arrSreg = mir->ssaRep->uses[start]; |
| 1820 | int idxSreg = mir->ssaRep->uses[start + 1]; |
| 1821 | BasicBlock* tbb = bb; |
| 1822 | squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg); |
| 1823 | } |
| 1824 | break; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1825 | case Instruction::CMPL_FLOAT: |
| 1826 | case Instruction::CMPL_DOUBLE: |
| 1827 | case Instruction::CMPG_FLOAT: |
| 1828 | case Instruction::CMPG_DOUBLE: |
| 1829 | case Instruction::CMP_LONG: |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1830 | // TODO: Check for and fuse preceeding comparison |
| 1831 | break; |
| 1832 | default: |
| 1833 | break; |
| 1834 | } |
| 1835 | } |
| 1836 | |
| 1837 | if (numTemps > cUnit->numCompilerTemps) { |
| 1838 | cUnit->numCompilerTemps = numTemps; |
| 1839 | } |
| 1840 | return true; |
| 1841 | } |
| 1842 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1843 | bool nullCheckEliminationInit(struct CompilationUnit* cUnit, |
| 1844 | struct BasicBlock* bb) |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1845 | { |
| 1846 | if (bb->dataFlowInfo == NULL) return false; |
| 1847 | bb->dataFlowInfo->endingNullCheckV = |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1848 | oatAllocBitVector(cUnit, cUnit->numSSARegs, false, kBitMapNullCheck); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1849 | oatClearAllBits(bb->dataFlowInfo->endingNullCheckV); |
| 1850 | return true; |
| 1851 | } |
| 1852 | |
| 1853 | /* Eliminate unnecessary null checks for a basic block. */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1854 | bool eliminateNullChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb) |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1855 | { |
| 1856 | if (bb->dataFlowInfo == NULL) return false; |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1857 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1858 | /* |
| 1859 | * Set initial state. Be conservative with catch |
| 1860 | * blocks and start with no assumptions about null check |
| 1861 | * status (except for "this"). |
| 1862 | */ |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1863 | if ((bb->blockType == kEntryBlock) | bb->catchEntry) { |
| 1864 | oatClearAllBits(cUnit->tempSSARegisterV); |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 1865 | if ((cUnit->access_flags & kAccStatic) == 0) { |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1866 | // If non-static method, mark "this" as non-null |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 1867 | int thisReg = cUnit->numDalvikRegisters - cUnit->numIns; |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1868 | oatSetBit(cUnit, cUnit->tempSSARegisterV, thisReg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1869 | } |
| 1870 | } else { |
| 1871 | // Starting state is intesection of all incoming arcs |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1872 | GrowableListIterator iter; |
| 1873 | oatGrowableListIteratorInit(bb->predecessors, &iter); |
| 1874 | BasicBlock* predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); |
| 1875 | DCHECK(predBB != NULL); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1876 | oatCopyBitVector(cUnit->tempSSARegisterV, |
| 1877 | predBB->dataFlowInfo->endingNullCheckV); |
| 1878 | while (true) { |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1879 | predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); |
| 1880 | if (!predBB) break; |
buzbee | aad7201 | 2011-09-21 21:52:09 -0700 | [diff] [blame] | 1881 | if ((predBB->dataFlowInfo == NULL) || |
| 1882 | (predBB->dataFlowInfo->endingNullCheckV == NULL)) { |
| 1883 | continue; |
| 1884 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1885 | oatIntersectBitVectors(cUnit->tempSSARegisterV, |
| 1886 | cUnit->tempSSARegisterV, |
| 1887 | predBB->dataFlowInfo->endingNullCheckV); |
| 1888 | } |
| 1889 | } |
| 1890 | |
| 1891 | // Walk through the instruction in the block, updating as necessary |
| 1892 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1893 | if (mir->ssaRep == NULL) { |
| 1894 | continue; |
| 1895 | } |
| 1896 | int dfAttributes = |
| 1897 | oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1898 | |
| 1899 | // Mark target of NEW* as non-null |
| 1900 | if (dfAttributes & DF_NON_NULL_DST) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1901 | oatSetBit(cUnit, cUnit->tempSSARegisterV, mir->ssaRep->defs[0]); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1902 | } |
| 1903 | |
| 1904 | // Mark non-null returns from invoke-style NEW* |
| 1905 | if (dfAttributes & DF_NON_NULL_RET) { |
| 1906 | MIR* nextMir = mir->next; |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1907 | // Next should be an MOVE_RESULT_OBJECT |
| 1908 | if (nextMir && nextMir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) { |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1909 | // Mark as null checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1910 | oatSetBit(cUnit, cUnit->tempSSARegisterV, |
| 1911 | nextMir->ssaRep->defs[0]); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1912 | } else { |
| 1913 | if (nextMir) { |
| 1914 | LOG(WARNING) << "Unexpected opcode following new: " << |
| 1915 | (int)nextMir->dalvikInsn.opcode; |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1916 | } else if (bb->fallThrough) { |
| 1917 | // Look in next basic block |
| 1918 | struct BasicBlock* nextBB = bb->fallThrough; |
| 1919 | for (MIR* tmir = nextBB->firstMIRInsn; tmir; |
Elliott Hughes | b25c3f6 | 2012-03-26 16:35:06 -0700 | [diff] [blame] | 1920 | tmir =tmir->next) { |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1921 | if ((int)tmir->dalvikInsn.opcode >= (int)kMirOpFirst) { |
| 1922 | continue; |
| 1923 | } |
Elliott Hughes | adb8c67 | 2012-03-06 16:49:32 -0800 | [diff] [blame] | 1924 | // First non-pseudo should be MOVE_RESULT_OBJECT |
| 1925 | if (tmir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) { |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1926 | // Mark as null checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1927 | oatSetBit(cUnit, cUnit->tempSSARegisterV, |
buzbee | 949f56e | 2011-10-06 11:05:45 -0700 | [diff] [blame] | 1928 | tmir->ssaRep->defs[0]); |
| 1929 | } else { |
| 1930 | LOG(WARNING) << "Unexpected op after new: " << |
| 1931 | (int)tmir->dalvikInsn.opcode; |
| 1932 | } |
| 1933 | break; |
| 1934 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1935 | } |
| 1936 | } |
| 1937 | } |
| 1938 | |
| 1939 | /* |
| 1940 | * Propagate nullcheck state on register copies (including |
| 1941 | * Phi pseudo copies. For the latter, nullcheck state is |
| 1942 | * the "and" of all the Phi's operands. |
| 1943 | */ |
| 1944 | if (dfAttributes & (DF_NULL_TRANSFER_0 | DF_NULL_TRANSFER_N)) { |
| 1945 | int tgtSreg = mir->ssaRep->defs[0]; |
| 1946 | int operands = (dfAttributes & DF_NULL_TRANSFER_0) ? 1 : |
| 1947 | mir->ssaRep->numUses; |
| 1948 | bool nullChecked = true; |
| 1949 | for (int i = 0; i < operands; i++) { |
| 1950 | nullChecked &= oatIsBitSet(cUnit->tempSSARegisterV, |
| 1951 | mir->ssaRep->uses[i]); |
| 1952 | } |
| 1953 | if (nullChecked) { |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1954 | oatSetBit(cUnit, cUnit->tempSSARegisterV, tgtSreg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1955 | } |
| 1956 | } |
| 1957 | |
| 1958 | // Already nullchecked? |
| 1959 | if (dfAttributes & DF_HAS_NULL_CHKS) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1960 | int srcIdx; |
| 1961 | if (dfAttributes & DF_NULL_CHK_1) { |
| 1962 | srcIdx = 1; |
| 1963 | } else if (dfAttributes & DF_NULL_CHK_2) { |
| 1964 | srcIdx = 2; |
| 1965 | } else { |
| 1966 | srcIdx = 0; |
| 1967 | } |
| 1968 | int srcSreg = mir->ssaRep->uses[srcIdx]; |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1969 | if (oatIsBitSet(cUnit->tempSSARegisterV, srcSreg)) { |
| 1970 | // Eliminate the null check |
| 1971 | mir->optimizationFlags |= MIR_IGNORE_NULL_CHECK; |
| 1972 | } else { |
| 1973 | // Mark sReg as null-checked |
buzbee | ba938cb | 2012-02-03 14:47:55 -0800 | [diff] [blame] | 1974 | oatSetBit(cUnit, cUnit->tempSSARegisterV, srcSreg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1975 | } |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | // Did anything change? |
| 1980 | bool res = oatCompareBitVectors(bb->dataFlowInfo->endingNullCheckV, |
| 1981 | cUnit->tempSSARegisterV); |
| 1982 | if (res) { |
| 1983 | oatCopyBitVector(bb->dataFlowInfo->endingNullCheckV, |
| 1984 | cUnit->tempSSARegisterV); |
| 1985 | } |
| 1986 | return res; |
| 1987 | } |
| 1988 | |
| 1989 | void oatMethodNullCheckElimination(CompilationUnit *cUnit) |
| 1990 | { |
| 1991 | if (!(cUnit->disableOpt & (1 << kNullCheckElimination))) { |
| 1992 | DCHECK(cUnit->tempSSARegisterV != NULL); |
| 1993 | oatDataFlowAnalysisDispatcher(cUnit, nullCheckEliminationInit, |
| 1994 | kAllNodes, |
| 1995 | false /* isIterative */); |
| 1996 | oatDataFlowAnalysisDispatcher(cUnit, eliminateNullChecks, |
| 1997 | kPreOrderDFSTraversal, |
| 1998 | true /* isIterative */); |
| 1999 | } |
| 2000 | } |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 2001 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 2002 | void oatMethodBasicBlockOptimization(CompilationUnit *cUnit) |
| 2003 | { |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 2004 | if (!(cUnit->disableOpt & (1 << kBBOpt))) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2005 | oatInitGrowableList(cUnit, &cUnit->compilerTemps, 6, kListMisc); |
| 2006 | DCHECK_EQ(cUnit->numCompilerTemps, 0); |
| 2007 | if (!(cUnit->disableOpt & (1 << kBBOpt))) { |
| 2008 | oatDataFlowAnalysisDispatcher(cUnit, basicBlockOpt, |
| 2009 | kAllNodes, false /* isIterative */); |
| 2010 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 2011 | } |
| 2012 | } |
| 2013 | |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2014 | void addLoopHeader(CompilationUnit* cUnit, BasicBlock* header, |
| 2015 | BasicBlock* backEdge) |
| 2016 | { |
| 2017 | GrowableListIterator iter; |
| 2018 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2019 | for (LoopInfo* loop = (LoopInfo*)oatGrowableListIteratorNext(&iter); |
| 2020 | (loop != NULL); loop = (LoopInfo*)oatGrowableListIteratorNext(&iter)) { |
| 2021 | if (loop->header == header) { |
| 2022 | oatInsertGrowableList(cUnit, &loop->incomingBackEdges, |
| 2023 | (intptr_t)backEdge); |
| 2024 | return; |
| 2025 | } |
| 2026 | } |
| 2027 | LoopInfo* info = (LoopInfo*)oatNew(cUnit, sizeof(LoopInfo), true, |
| 2028 | kAllocDFInfo); |
| 2029 | info->header = header; |
| 2030 | oatInitGrowableList(cUnit, &info->incomingBackEdges, 2, kListMisc); |
| 2031 | oatInsertGrowableList(cUnit, &info->incomingBackEdges, (intptr_t)backEdge); |
| 2032 | oatInsertGrowableList(cUnit, &cUnit->loopHeaders, (intptr_t)info); |
| 2033 | } |
| 2034 | |
| 2035 | bool findBackEdges(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 2036 | { |
| 2037 | if ((bb->dataFlowInfo == NULL) || (bb->lastMIRInsn == NULL)) { |
| 2038 | return false; |
| 2039 | } |
| 2040 | Instruction::Code opcode = bb->lastMIRInsn->dalvikInsn.opcode; |
| 2041 | if (Instruction::Flags(opcode) & Instruction::kBranch) { |
| 2042 | if (bb->taken && (bb->taken->startOffset <= bb->startOffset)) { |
| 2043 | DCHECK(bb->dominators != NULL); |
| 2044 | if (oatIsBitSet(bb->dominators, bb->taken->id)) { |
| 2045 | if (cUnit->printMe) { |
| 2046 | LOG(INFO) << "Loop backedge from 0x" |
| 2047 | << std::hex << bb->lastMIRInsn->offset |
| 2048 | << " to 0x" << std::hex << bb->taken->startOffset; |
| 2049 | } |
| 2050 | addLoopHeader(cUnit, bb->taken, bb); |
| 2051 | } |
| 2052 | } |
| 2053 | } |
| 2054 | return false; |
| 2055 | } |
| 2056 | |
| 2057 | void addBlocksToLoop(CompilationUnit* cUnit, ArenaBitVector* blocks, |
| 2058 | BasicBlock* bb, int headId) |
| 2059 | { |
| 2060 | if (!oatIsBitSet(bb->dominators, headId) || |
| 2061 | oatIsBitSet(blocks, bb->id)) { |
| 2062 | return; |
| 2063 | } |
| 2064 | oatSetBit(cUnit, blocks, bb->id); |
| 2065 | GrowableListIterator iter; |
| 2066 | oatGrowableListIteratorInit(bb->predecessors, &iter); |
| 2067 | BasicBlock* predBB; |
| 2068 | for (predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); predBB; |
| 2069 | predBB = (BasicBlock*)oatGrowableListIteratorNext(&iter)) { |
| 2070 | addBlocksToLoop(cUnit, blocks, predBB, headId); |
| 2071 | } |
| 2072 | } |
| 2073 | |
| 2074 | void oatDumpLoops(CompilationUnit *cUnit) |
| 2075 | { |
| 2076 | GrowableListIterator iter; |
| 2077 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2078 | for (LoopInfo* loop = (LoopInfo*)oatGrowableListIteratorNext(&iter); |
| 2079 | (loop != NULL); loop = (LoopInfo*)oatGrowableListIteratorNext(&iter)) { |
| 2080 | LOG(INFO) << "Loop head block id " << loop->header->id |
| 2081 | << ", offset 0x" << std::hex << loop->header->startOffset |
| 2082 | << ", Depth: " << loop->header->nestingDepth; |
| 2083 | GrowableListIterator iter; |
| 2084 | oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter); |
| 2085 | BasicBlock* edgeBB; |
| 2086 | for (edgeBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); edgeBB; |
| 2087 | edgeBB = (BasicBlock*)oatGrowableListIteratorNext(&iter)) { |
| 2088 | LOG(INFO) << " Backedge block id " << edgeBB->id |
| 2089 | << ", offset 0x" << std::hex << edgeBB->startOffset; |
| 2090 | ArenaBitVectorIterator bIter; |
| 2091 | oatBitVectorIteratorInit(loop->blocks, &bIter); |
| 2092 | for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1; |
| 2093 | bbId = oatBitVectorIteratorNext(&bIter)) { |
| 2094 | BasicBlock *bb; |
| 2095 | bb = (BasicBlock*) |
| 2096 | oatGrowableListGetElement(&cUnit->blockList, bbId); |
| 2097 | LOG(INFO) << " (" << bb->id << ", 0x" << std::hex |
| 2098 | << bb->startOffset << ")"; |
| 2099 | } |
| 2100 | } |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | void oatMethodLoopDetection(CompilationUnit *cUnit) |
| 2105 | { |
| 2106 | if (cUnit->disableOpt & (1 << kPromoteRegs)) { |
| 2107 | return; |
| 2108 | } |
| 2109 | oatInitGrowableList(cUnit, &cUnit->loopHeaders, 6, kListMisc); |
| 2110 | // Find the loop headers |
| 2111 | oatDataFlowAnalysisDispatcher(cUnit, findBackEdges, |
| 2112 | kAllNodes, false /* isIterative */); |
| 2113 | GrowableListIterator iter; |
| 2114 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2115 | // Add blocks to each header |
| 2116 | for (LoopInfo* loop = (LoopInfo*)oatGrowableListIteratorNext(&iter); |
| 2117 | loop; loop = (LoopInfo*)oatGrowableListIteratorNext(&iter)) { |
| 2118 | loop->blocks = oatAllocBitVector(cUnit, cUnit->numBlocks, true, |
| 2119 | kBitMapMisc); |
| 2120 | oatSetBit(cUnit, loop->blocks, loop->header->id); |
| 2121 | GrowableListIterator iter; |
| 2122 | oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter); |
| 2123 | BasicBlock* edgeBB; |
| 2124 | for (edgeBB = (BasicBlock*)oatGrowableListIteratorNext(&iter); edgeBB; |
| 2125 | edgeBB = (BasicBlock*)oatGrowableListIteratorNext(&iter)) { |
| 2126 | addBlocksToLoop(cUnit, loop->blocks, edgeBB, loop->header->id); |
| 2127 | } |
| 2128 | } |
| 2129 | // Compute the nesting depth of each header |
| 2130 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2131 | for (LoopInfo* loop = (LoopInfo*)oatGrowableListIteratorNext(&iter); |
| 2132 | loop; loop = (LoopInfo*)oatGrowableListIteratorNext(&iter)) { |
| 2133 | GrowableListIterator iter2; |
| 2134 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter2); |
| 2135 | LoopInfo* loop2; |
| 2136 | for (loop2 = (LoopInfo*)oatGrowableListIteratorNext(&iter2); |
| 2137 | loop2; loop2 = (LoopInfo*)oatGrowableListIteratorNext(&iter2)) { |
| 2138 | if (oatIsBitSet(loop2->blocks, loop->header->id)) { |
| 2139 | loop->header->nestingDepth++; |
| 2140 | } |
| 2141 | } |
| 2142 | } |
| 2143 | // Assign nesting depth to each block in all loops |
| 2144 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2145 | for (LoopInfo* loop = (LoopInfo*)oatGrowableListIteratorNext(&iter); |
| 2146 | (loop != NULL); loop = (LoopInfo*)oatGrowableListIteratorNext(&iter)) { |
| 2147 | ArenaBitVectorIterator bIter; |
| 2148 | oatBitVectorIteratorInit(loop->blocks, &bIter); |
| 2149 | for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1; |
| 2150 | bbId = oatBitVectorIteratorNext(&bIter)) { |
| 2151 | BasicBlock *bb; |
| 2152 | bb = (BasicBlock*) oatGrowableListGetElement(&cUnit->blockList, |
| 2153 | bbId); |
| 2154 | bb->nestingDepth = std::max(bb->nestingDepth, |
| 2155 | loop->header->nestingDepth); |
| 2156 | } |
| 2157 | } |
| 2158 | if (cUnit->printMe) { |
| 2159 | oatDumpLoops(cUnit); |
| 2160 | } |
| 2161 | } |
| 2162 | |
| 2163 | /* |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2164 | * This function will make a best guess at whether the invoke will |
| 2165 | * end up using Method*. It isn't critical to get it exactly right, |
| 2166 | * and attempting to do would involve more complexity than it's |
| 2167 | * worth. |
| 2168 | */ |
| 2169 | bool invokeUsesMethodStar(CompilationUnit* cUnit, MIR* mir) |
| 2170 | { |
| 2171 | InvokeType type; |
| 2172 | Instruction::Code opcode = mir->dalvikInsn.opcode; |
Elliott Hughes | b25c3f6 | 2012-03-26 16:35:06 -0700 | [diff] [blame] | 2173 | switch (opcode) { |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2174 | case Instruction::INVOKE_STATIC: |
| 2175 | case Instruction::INVOKE_STATIC_RANGE: |
| 2176 | type = kStatic; |
| 2177 | break; |
| 2178 | case Instruction::INVOKE_DIRECT: |
| 2179 | case Instruction::INVOKE_DIRECT_RANGE: |
| 2180 | type = kDirect; |
| 2181 | break; |
| 2182 | case Instruction::INVOKE_VIRTUAL: |
| 2183 | case Instruction::INVOKE_VIRTUAL_RANGE: |
| 2184 | type = kVirtual; |
| 2185 | break; |
| 2186 | case Instruction::INVOKE_INTERFACE: |
| 2187 | case Instruction::INVOKE_INTERFACE_RANGE: |
| 2188 | return false; |
| 2189 | case Instruction::INVOKE_SUPER_RANGE: |
| 2190 | case Instruction::INVOKE_SUPER: |
| 2191 | type = kSuper; |
| 2192 | break; |
| 2193 | default: |
| 2194 | LOG(WARNING) << "Unexpected invoke op: " << (int)opcode; |
| 2195 | return false; |
| 2196 | } |
| 2197 | OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, |
| 2198 | *cUnit->dex_file, *cUnit->dex_cache, |
| 2199 | cUnit->code_item, cUnit->method_idx, |
| 2200 | cUnit->access_flags); |
| 2201 | // TODO: add a flag so we don't counts the stats for this twice |
| 2202 | uint32_t dexMethodIdx = mir->dalvikInsn.vB; |
| 2203 | int vtableIdx; |
| 2204 | uintptr_t directCode; |
| 2205 | uintptr_t directMethod; |
| 2206 | bool fastPath = |
| 2207 | cUnit->compiler->ComputeInvokeInfo(dexMethodIdx, &mUnit, type, |
| 2208 | vtableIdx, directCode, |
| 2209 | directMethod) && |
| 2210 | !SLOW_INVOKE_PATH; |
| 2211 | return (((type == kDirect) || (type == kStatic)) && |
| 2212 | fastPath && ((directCode == 0) || (directMethod == 0))); |
| 2213 | } |
| 2214 | |
| 2215 | /* |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2216 | * Count uses, weighting by loop nesting depth. This code only |
| 2217 | * counts explicitly used sRegs. A later phase will add implicit |
| 2218 | * counts for things such as Method*, null-checked references, etc. |
| 2219 | */ |
| 2220 | bool countUses(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 2221 | { |
| 2222 | if (bb->blockType != kDalvikByteCode) { |
| 2223 | return false; |
| 2224 | } |
| 2225 | for (MIR* mir = bb->firstMIRInsn; (mir != NULL); mir = mir->next) { |
| 2226 | if (mir->ssaRep == NULL) { |
| 2227 | continue; |
| 2228 | } |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2229 | uint32_t weight = std::min(16U, (uint32_t)bb->nestingDepth); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2230 | for (int i = 0; i < mir->ssaRep->numUses; i++) { |
| 2231 | int sReg = mir->ssaRep->uses[i]; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2232 | DCHECK_LT(sReg, (int)cUnit->useCounts.numUsed); |
| 2233 | cUnit->useCounts.elemList[sReg] += (1 << weight); |
| 2234 | } |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2235 | if (!(cUnit->disableOpt & (1 << kPromoteCompilerTemps))) { |
| 2236 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 2237 | // Implicit use of Method* ? */ |
| 2238 | if (dfAttributes & DF_UMS) { |
| 2239 | /* |
| 2240 | * Some invokes will not use Method* - need to perform test similar |
| 2241 | * to that found in genInvoke() to decide whether to count refs |
| 2242 | * for Method* on invoke-class opcodes. |
| 2243 | * TODO: refactor for common test here, save results for genInvoke |
| 2244 | */ |
| 2245 | int usesMethodStar = true; |
| 2246 | if ((dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) && |
| 2247 | !(dfAttributes & DF_NON_NULL_RET)) { |
| 2248 | usesMethodStar &= invokeUsesMethodStar(cUnit, mir); |
| 2249 | } |
| 2250 | if (usesMethodStar) { |
| 2251 | cUnit->useCounts.elemList[cUnit->methodSReg] += (1 << weight); |
| 2252 | } |
| 2253 | } |
| 2254 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2255 | } |
| 2256 | return false; |
| 2257 | } |
| 2258 | |
| 2259 | void oatMethodUseCount(CompilationUnit *cUnit) |
| 2260 | { |
| 2261 | if (cUnit->disableOpt & (1 << kPromoteRegs)) { |
| 2262 | return; |
| 2263 | } |
| 2264 | oatInitGrowableList(cUnit, &cUnit->useCounts, cUnit->numSSARegs + 32, |
| 2265 | kListMisc); |
| 2266 | // Initialize list |
| 2267 | for (int i = 0; i < cUnit->numSSARegs; i++) { |
| 2268 | oatInsertGrowableList(cUnit, &cUnit->useCounts, 0); |
| 2269 | } |
| 2270 | oatDataFlowAnalysisDispatcher(cUnit, countUses, |
| 2271 | kAllNodes, false /* isIterative */); |
| 2272 | } |
| 2273 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 2274 | } // namespace art |