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