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 | |
buzbee | eaf09bc | 2012-11-15 14:51:41 -0800 | [diff] [blame] | 17 | #include "compiler_internals.h" |
buzbee | efc6369 | 2012-11-14 16:31:52 -0800 | [diff] [blame] | 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 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 841 | DCHECK_LT(ssaReg, static_cast<int>(cUnit->ssaBaseVRegs->numUsed)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 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 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 847 | DCHECK(ssaReg < static_cast<int>(cUnit->ssaSubscripts->numUsed)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 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 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 853 | DCHECK(sReg < static_cast<int>(cUnit->rawUseCounts.numUsed)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 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)); |
Ian Rogers | a75a013 | 2012-09-28 11:41:42 -0700 | [diff] [blame] | 878 | flags = Instruction::FlagsOf(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)); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 892 | offset = insn.vB; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 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)); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 896 | offset = insn.vC; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 897 | break; |
| 898 | case Instruction::k10t: |
| 899 | case Instruction::k20t: |
| 900 | case Instruction::k30t: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 901 | offset = insn.vA; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 902 | break; |
| 903 | default: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 904 | LOG(FATAL) << "Unexpected branch format " << dalvikFormat << " from " << insn.opcode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 905 | } |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 906 | str.append(StringPrintf(" (%c%x)", |
| 907 | offset > 0 ? '+' : '-', |
| 908 | offset > 0 ? offset : -offset)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 909 | } else if (dfAttributes & DF_FORMAT_35C) { |
| 910 | unsigned int i; |
| 911 | for (i = 0; i < insn.vA; i++) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 912 | if (i != 0) str.append(","); |
| 913 | str.append(StringPrintf(" v%d", insn.arg[i])); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 914 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 915 | } |
| 916 | else if (dfAttributes & DF_FORMAT_3RC) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 917 | 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] | 918 | } else { |
| 919 | if (dfAttributes & DF_A_IS_REG) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 920 | str.append(StringPrintf(" v%d", insn.vA)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 921 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 922 | if (dfAttributes & DF_B_IS_REG) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 923 | str.append(StringPrintf(", v%d", insn.vB)); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 924 | } else if (static_cast<int>(opcode) < static_cast<int>(kMirOpFirst)) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 925 | str.append(StringPrintf(", (#%d)", insn.vB)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 926 | } |
| 927 | if (dfAttributes & DF_C_IS_REG) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 928 | str.append(StringPrintf(", v%d", insn.vC)); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 929 | } else if (static_cast<int>(opcode) < static_cast<int>(kMirOpFirst)) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 930 | str.append(StringPrintf(", (#%d)", insn.vC)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 931 | } |
| 932 | } |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 933 | int length = str.length() + 1; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 934 | ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo)); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 935 | strncpy(ret, str.c_str(), length); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 936 | return ret; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 937 | } |
| 938 | |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 939 | std::string getSSAName(const CompilationUnit* cUnit, int ssaReg) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 940 | { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 941 | return StringPrintf("v%d_%d", SRegToVReg(cUnit, ssaReg), |
| 942 | SRegToSubscript(cUnit, ssaReg)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | /* |
| 946 | * Dalvik instruction disassembler with optional SSA printing. |
| 947 | */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 948 | char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 949 | { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 950 | std::string str; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 951 | const DecodedInstruction* insn = &mir->dalvikInsn; |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 952 | int opcode = insn->opcode; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 953 | int dfAttributes = oatDataFlowAttributes[opcode]; |
| 954 | char* ret; |
| 955 | int length; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 956 | |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 957 | if (opcode >= kMirOpFirst) { |
| 958 | if (opcode == kMirOpPhi) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 959 | int* incoming = reinterpret_cast<int*>(mir->dalvikInsn.vB); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 960 | str.append(StringPrintf("PHI %s = (%s", |
| 961 | getSSAName(cUnit, mir->ssaRep->defs[0]).c_str(), |
| 962 | getSSAName(cUnit, mir->ssaRep->uses[0]).c_str())); |
| 963 | str.append(StringPrintf(":%d",incoming[0])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 964 | int i; |
| 965 | for (i = 1; i < mir->ssaRep->numUses; i++) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 966 | str.append(StringPrintf(", %s:%d", |
| 967 | getSSAName(cUnit, mir->ssaRep->uses[i]).c_str(), |
| 968 | incoming[i])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 969 | } |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 970 | str.append(")"); |
| 971 | } else if (opcode == kMirOpCheck) { |
| 972 | str.append("Check "); |
| 973 | str.append(Instruction::Name(mir->meta.throwInsn->dalvikInsn.opcode)); |
| 974 | } else if (opcode == kMirOpNop) { |
| 975 | str.append("MirNop"); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 976 | } else { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 977 | str.append(StringPrintf("Opcode %#x", opcode)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 978 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 979 | goto done; |
| 980 | } else { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 981 | str.append(Instruction::Name(insn->opcode)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 982 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 983 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 984 | /* For branches, decode the instructions to print out the branch targets */ |
Ian Rogers | a75a013 | 2012-09-28 11:41:42 -0700 | [diff] [blame] | 985 | if (Instruction::FlagsOf(insn->opcode) & Instruction::kBranch) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 986 | Instruction::Format dalvikFormat = Instruction::FormatOf(insn->opcode); |
| 987 | int delta = 0; |
| 988 | switch (dalvikFormat) { |
| 989 | case Instruction::k21t: |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 990 | str.append(StringPrintf(" %s, ", |
| 991 | getSSAName(cUnit, mir->ssaRep->uses[0]).c_str())); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 992 | delta = insn->vB; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 993 | break; |
| 994 | case Instruction::k22t: |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 995 | str.append(StringPrintf(" %s, %s, ", |
| 996 | getSSAName(cUnit, mir->ssaRep->uses[0]).c_str(), |
| 997 | getSSAName(cUnit, mir->ssaRep->uses[1]).c_str())); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 998 | delta = insn->vC; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 999 | break; |
| 1000 | case Instruction::k10t: |
| 1001 | case Instruction::k20t: |
| 1002 | case Instruction::k30t: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1003 | delta = insn->vA; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1004 | break; |
| 1005 | default: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1006 | LOG(FATAL) << "Unexpected branch format: " << dalvikFormat; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1007 | } |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1008 | str.append(StringPrintf(" %04x", mir->offset + delta)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1009 | } else if (dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) { |
| 1010 | unsigned int i; |
| 1011 | for (i = 0; i < insn->vA; i++) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1012 | if (i != 0) str.append(","); |
| 1013 | str.append(" "); |
| 1014 | str.append(getSSAName(cUnit, mir->ssaRep->uses[i])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1015 | } |
| 1016 | } else { |
| 1017 | int udIdx; |
| 1018 | if (mir->ssaRep->numDefs) { |
| 1019 | |
| 1020 | for (udIdx = 0; udIdx < mir->ssaRep->numDefs; udIdx++) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1021 | str.append(" "); |
| 1022 | str.append(getSSAName(cUnit, mir->ssaRep->defs[udIdx])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1023 | } |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1024 | str.append(","); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1025 | } |
| 1026 | if (mir->ssaRep->numUses) { |
| 1027 | /* No leading ',' for the first use */ |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1028 | str.append(" "); |
| 1029 | str.append(getSSAName(cUnit, mir->ssaRep->uses[0])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1030 | for (udIdx = 1; udIdx < mir->ssaRep->numUses; udIdx++) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1031 | str.append(", "); |
| 1032 | str.append(getSSAName(cUnit, mir->ssaRep->uses[udIdx])); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1033 | } |
| 1034 | } |
| 1035 | if (static_cast<int>(opcode) < static_cast<int>(kMirOpFirst)) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1036 | Instruction::Format dalvikFormat = Instruction::FormatOf(insn->opcode); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1037 | switch (dalvikFormat) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1038 | case Instruction::k11n: // op vA, #+B |
| 1039 | case Instruction::k21s: // op vAA, #+BBBB |
| 1040 | case Instruction::k21h: // op vAA, #+BBBB00000[00000000] |
| 1041 | case Instruction::k31i: // op vAA, #+BBBBBBBB |
| 1042 | case Instruction::k51l: // op vAA, #+BBBBBBBBBBBBBBBB |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1043 | str.append(StringPrintf(" #%#x", insn->vB)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1044 | break; |
| 1045 | case Instruction::k21c: // op vAA, thing@BBBB |
| 1046 | case Instruction::k31c: // op vAA, thing@BBBBBBBB |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1047 | str.append(StringPrintf(" @%#x", insn->vB)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1048 | break; |
| 1049 | case Instruction::k22b: // op vAA, vBB, #+CC |
| 1050 | case Instruction::k22s: // op vA, vB, #+CCCC |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1051 | str.append(StringPrintf(" #%#x", insn->vC)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1052 | break; |
| 1053 | case Instruction::k22c: // op vA, vB, thing@CCCC |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1054 | str.append(StringPrintf(" @%#x", insn->vC)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1055 | break; |
| 1056 | /* No need for special printing */ |
| 1057 | default: |
| 1058 | break; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1059 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1060 | } |
| 1061 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1062 | |
| 1063 | done: |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1064 | length = str.length() + 1; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1065 | ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo)); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1066 | strncpy(ret, str.c_str(), length); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1067 | return ret; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1068 | } |
| 1069 | |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 1070 | char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1071 | { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1072 | std::string str; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1073 | char* ret; |
| 1074 | int i; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1075 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1076 | for (i = 0; i < ssaRep->numDefs; i++) { |
| 1077 | int ssaReg = ssaRep->defs[i]; |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1078 | str.append(StringPrintf("s%d(v%d_%d) ", ssaReg, |
| 1079 | SRegToVReg(cUnit, ssaReg), |
| 1080 | SRegToSubscript(cUnit, ssaReg))); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1081 | } |
| 1082 | |
| 1083 | if (ssaRep->numDefs) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1084 | str.append("<- "); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1085 | } |
| 1086 | |
| 1087 | for (i = 0; i < ssaRep->numUses; i++) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1088 | int ssaReg = ssaRep->uses[i]; |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1089 | str.append(StringPrintf("s%d(v%d_%d) ", ssaReg, SRegToVReg(cUnit, ssaReg), |
| 1090 | SRegToSubscript(cUnit, ssaReg))); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1091 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1092 | |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1093 | int length = str.length() + 1; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1094 | ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo)); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1095 | strncpy(ret, str.c_str(), length); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1096 | return ret; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1097 | } |
| 1098 | |
| 1099 | /* Any register that is used before being defined is considered live-in */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1100 | inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV, |
| 1101 | ArenaBitVector* defV, ArenaBitVector* liveInV, |
| 1102 | int dalvikRegId) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1103 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1104 | oatSetBit(cUnit, useV, dalvikRegId); |
| 1105 | if (!oatIsBitSet(defV, dalvikRegId)) { |
| 1106 | oatSetBit(cUnit, liveInV, dalvikRegId); |
| 1107 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1108 | } |
| 1109 | |
| 1110 | /* Mark a reg as being defined */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1111 | inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV, |
| 1112 | int dalvikRegId) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1113 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1114 | oatSetBit(cUnit, defV, dalvikRegId); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1115 | } |
| 1116 | |
| 1117 | /* |
| 1118 | * Find out live-in variables for natural loops. Variables that are live-in in |
| 1119 | * the main loop body are considered to be defined in the entry block. |
| 1120 | */ |
| 1121 | bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb) |
| 1122 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1123 | MIR* mir; |
| 1124 | ArenaBitVector *useV, *defV, *liveInV; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1125 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1126 | if (bb->dataFlowInfo == NULL) return false; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1127 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1128 | useV = bb->dataFlowInfo->useV = |
| 1129 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapUse); |
| 1130 | defV = bb->dataFlowInfo->defV = |
| 1131 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapDef); |
| 1132 | liveInV = bb->dataFlowInfo->liveInV = |
| 1133 | oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, |
| 1134 | kBitMapLiveIn); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1135 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1136 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1137 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1138 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1139 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1140 | if (dfAttributes & DF_HAS_USES) { |
| 1141 | if (dfAttributes & DF_UA) { |
| 1142 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1143 | if (dfAttributes & DF_A_WIDE) { |
| 1144 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA+1); |
| 1145 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1146 | } |
| 1147 | if (dfAttributes & DF_UB) { |
| 1148 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1149 | if (dfAttributes & DF_B_WIDE) { |
| 1150 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB+1); |
| 1151 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1152 | } |
| 1153 | if (dfAttributes & DF_UC) { |
| 1154 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1155 | if (dfAttributes & DF_C_WIDE) { |
| 1156 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+1); |
| 1157 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1158 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1159 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1160 | if (dfAttributes & DF_FORMAT_35C) { |
| 1161 | for (unsigned int i = 0; i < dInsn->vA; i++) { |
| 1162 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->arg[i]); |
| 1163 | } |
| 1164 | } |
| 1165 | if (dfAttributes & DF_FORMAT_3RC) { |
| 1166 | for (unsigned int i = 0; i < dInsn->vA; i++) { |
| 1167 | handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+i); |
| 1168 | } |
| 1169 | } |
| 1170 | if (dfAttributes & DF_HAS_DEFS) { |
| 1171 | handleDef(cUnit, defV, dInsn->vA); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1172 | if (dfAttributes & DF_A_WIDE) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1173 | handleDef(cUnit, defV, dInsn->vA+1); |
| 1174 | } |
| 1175 | } |
| 1176 | } |
| 1177 | return true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1178 | } |
| 1179 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1180 | int addNewSReg(CompilationUnit* cUnit, int vReg) |
| 1181 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1182 | // Compiler temps always have a subscript of 0 |
| 1183 | int subscript = (vReg < 0) ? 0 : ++cUnit->SSALastDefs[vReg]; |
| 1184 | int ssaReg = cUnit->numSSARegs++; |
| 1185 | oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, vReg); |
| 1186 | oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, subscript); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1187 | std::string ssaName = getSSAName(cUnit, ssaReg); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1188 | char* name = static_cast<char*>(oatNew(cUnit, ssaName.length() + 1, false, kAllocDFInfo)); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1189 | strncpy(name, ssaName.c_str(), ssaName.length() + 1); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1190 | oatInsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1191 | DCHECK_EQ(cUnit->ssaBaseVRegs->numUsed, cUnit->ssaSubscripts->numUsed); |
| 1192 | return ssaReg; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1193 | } |
| 1194 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1195 | /* Find out the latest SSA register for a given Dalvik register */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1196 | void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg, |
| 1197 | int regIndex) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1198 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1199 | DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters)); |
| 1200 | uses[regIndex] = cUnit->vRegToSSAMap[dalvikReg]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1201 | } |
| 1202 | |
| 1203 | /* Setup a new SSA register for a given Dalvik register */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1204 | void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg, |
| 1205 | int regIndex) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1206 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1207 | DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters)); |
| 1208 | int ssaReg = addNewSReg(cUnit, dalvikReg); |
| 1209 | cUnit->vRegToSSAMap[dalvikReg] = ssaReg; |
| 1210 | defs[regIndex] = ssaReg; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1211 | } |
| 1212 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1213 | /* Look up new SSA names for format_35c instructions */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1214 | void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1215 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1216 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1217 | int numUses = dInsn->vA; |
| 1218 | int i; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1219 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1220 | mir->ssaRep->numUses = numUses; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1221 | mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1222 | // NOTE: will be filled in during type & size inference pass |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1223 | mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, true, |
| 1224 | kAllocDFInfo)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1225 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1226 | for (i = 0; i < numUses; i++) { |
| 1227 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->arg[i], i); |
| 1228 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1229 | } |
| 1230 | |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 1231 | /* Look up new SSA names for format_3rc instructions */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1232 | void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1233 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1234 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1235 | int numUses = dInsn->vA; |
| 1236 | int i; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1237 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1238 | mir->ssaRep->numUses = numUses; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1239 | mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1240 | // NOTE: will be filled in during type & size inference pass |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1241 | mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, true, |
| 1242 | kAllocDFInfo)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1243 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1244 | for (i = 0; i < numUses; i++) { |
| 1245 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+i, i); |
| 1246 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1247 | } |
| 1248 | |
| 1249 | /* Entry function to convert a block into SSA representation */ |
| 1250 | bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb) |
| 1251 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1252 | MIR* mir; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1253 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1254 | if (bb->dataFlowInfo == NULL) return false; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1255 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1256 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1257 | mir->ssaRep = static_cast<struct SSARepresentation *>(oatNew(cUnit, sizeof(SSARepresentation), |
| 1258 | true, kAllocDFInfo)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1259 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1260 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1261 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1262 | // If not a pseudo-op, note non-leaf or can throw |
| 1263 | if (static_cast<int>(mir->dalvikInsn.opcode) < |
| 1264 | static_cast<int>(kNumPackedOpcodes)) { |
Ian Rogers | a75a013 | 2012-09-28 11:41:42 -0700 | [diff] [blame] | 1265 | int flags = Instruction::FlagsOf(mir->dalvikInsn.opcode); |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1266 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1267 | if (flags & Instruction::kThrow) { |
| 1268 | cUnit->attrs &= ~METHOD_IS_THROW_FREE; |
| 1269 | } |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 1270 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1271 | if (flags & Instruction::kInvoke) { |
| 1272 | cUnit->attrs &= ~METHOD_IS_LEAF; |
| 1273 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1274 | } |
| 1275 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1276 | int numUses = 0; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1277 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1278 | if (dfAttributes & DF_FORMAT_35C) { |
| 1279 | dataFlowSSAFormat35C(cUnit, mir); |
| 1280 | continue; |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 1281 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1282 | |
| 1283 | if (dfAttributes & DF_FORMAT_3RC) { |
| 1284 | dataFlowSSAFormat3RC(cUnit, mir); |
| 1285 | continue; |
| 1286 | } |
| 1287 | |
| 1288 | if (dfAttributes & DF_HAS_USES) { |
| 1289 | if (dfAttributes & DF_UA) { |
| 1290 | numUses++; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1291 | if (dfAttributes & DF_A_WIDE) { |
| 1292 | numUses ++; |
| 1293 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1294 | } |
| 1295 | if (dfAttributes & DF_UB) { |
| 1296 | numUses++; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1297 | if (dfAttributes & DF_B_WIDE) { |
| 1298 | numUses ++; |
| 1299 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1300 | } |
| 1301 | if (dfAttributes & DF_UC) { |
| 1302 | numUses++; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1303 | if (dfAttributes & DF_C_WIDE) { |
| 1304 | numUses ++; |
| 1305 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | if (numUses) { |
| 1310 | mir->ssaRep->numUses = numUses; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1311 | mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, false, |
| 1312 | kAllocDFInfo)); |
| 1313 | mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, false, |
| 1314 | kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1315 | } |
| 1316 | |
| 1317 | int numDefs = 0; |
| 1318 | |
| 1319 | if (dfAttributes & DF_HAS_DEFS) { |
| 1320 | numDefs++; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1321 | if (dfAttributes & DF_A_WIDE) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1322 | numDefs++; |
| 1323 | } |
| 1324 | } |
| 1325 | |
| 1326 | if (numDefs) { |
| 1327 | mir->ssaRep->numDefs = numDefs; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1328 | mir->ssaRep->defs = static_cast<int*>(oatNew(cUnit, sizeof(int) * numDefs, false, |
| 1329 | kAllocDFInfo)); |
| 1330 | mir->ssaRep->fpDef = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numDefs, false, |
| 1331 | kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1332 | } |
| 1333 | |
| 1334 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
| 1335 | |
| 1336 | if (dfAttributes & DF_HAS_USES) { |
| 1337 | numUses = 0; |
| 1338 | if (dfAttributes & DF_UA) { |
| 1339 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1340 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1341 | if (dfAttributes & DF_A_WIDE) { |
| 1342 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A; |
| 1343 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA+1, numUses++); |
| 1344 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1345 | } |
| 1346 | if (dfAttributes & DF_UB) { |
| 1347 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1348 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1349 | if (dfAttributes & DF_B_WIDE) { |
| 1350 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B; |
| 1351 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB+1, numUses++); |
| 1352 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1353 | } |
| 1354 | if (dfAttributes & DF_UC) { |
| 1355 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1356 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1357 | if (dfAttributes & DF_C_WIDE) { |
| 1358 | mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C; |
| 1359 | handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+1, numUses++); |
| 1360 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1361 | } |
| 1362 | } |
| 1363 | if (dfAttributes & DF_HAS_DEFS) { |
| 1364 | mir->ssaRep->fpDef[0] = dfAttributes & DF_FP_A; |
| 1365 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA, 0); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1366 | if (dfAttributes & DF_A_WIDE) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1367 | mir->ssaRep->fpDef[1] = dfAttributes & DF_FP_A; |
| 1368 | handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA+1, 1); |
| 1369 | } |
| 1370 | } |
| 1371 | } |
| 1372 | |
| 1373 | if (!cUnit->disableDataflow) { |
| 1374 | /* |
| 1375 | * Take a snapshot of Dalvik->SSA mapping at the end of each block. The |
| 1376 | * input to PHI nodes can be derived from the snapshot of all |
| 1377 | * predecessor blocks. |
| 1378 | */ |
| 1379 | bb->dataFlowInfo->vRegToSSAMap = |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1380 | static_cast<int*>(oatNew(cUnit, sizeof(int) * cUnit->numDalvikRegisters, false, |
| 1381 | kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1382 | |
| 1383 | memcpy(bb->dataFlowInfo->vRegToSSAMap, cUnit->vRegToSSAMap, |
| 1384 | sizeof(int) * cUnit->numDalvikRegisters); |
| 1385 | } |
| 1386 | return true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | /* Setup a constant value for opcodes thare have the DF_SETS_CONST attribute */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1390 | void setConstant(CompilationUnit* cUnit, int ssaReg, int value) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1391 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1392 | oatSetBit(cUnit, cUnit->isConstantV, ssaReg); |
| 1393 | cUnit->constantValues[ssaReg] = value; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1394 | } |
| 1395 | |
| 1396 | bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb) |
| 1397 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1398 | MIR* mir; |
| 1399 | ArenaBitVector *isConstantV = cUnit->isConstantV; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1400 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1401 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1402 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
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 | DecodedInstruction *dInsn = &mir->dalvikInsn; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1405 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1406 | if (!(dfAttributes & DF_HAS_DEFS)) continue; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1407 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1408 | /* Handle instructions that set up constants directly */ |
| 1409 | if (dfAttributes & DF_SETS_CONST) { |
| 1410 | if (dfAttributes & DF_DA) { |
| 1411 | switch (dInsn->opcode) { |
| 1412 | case Instruction::CONST_4: |
| 1413 | case Instruction::CONST_16: |
| 1414 | case Instruction::CONST: |
| 1415 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1416 | break; |
| 1417 | case Instruction::CONST_HIGH16: |
| 1418 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB << 16); |
| 1419 | break; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1420 | case Instruction::CONST_WIDE_16: |
| 1421 | case Instruction::CONST_WIDE_32: |
| 1422 | setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB); |
| 1423 | setConstant(cUnit, mir->ssaRep->defs[1], 0); |
| 1424 | break; |
| 1425 | case Instruction::CONST_WIDE: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1426 | setConstant(cUnit, mir->ssaRep->defs[0], static_cast<int>(dInsn->vB_wide)); |
| 1427 | setConstant(cUnit, mir->ssaRep->defs[1], static_cast<int>(dInsn->vB_wide >> 32)); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1428 | break; |
| 1429 | case Instruction::CONST_WIDE_HIGH16: |
| 1430 | setConstant(cUnit, mir->ssaRep->defs[0], 0); |
| 1431 | setConstant(cUnit, mir->ssaRep->defs[1], dInsn->vB << 16); |
| 1432 | break; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1433 | default: |
| 1434 | break; |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1435 | } |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 1436 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1437 | /* Handle instructions that set up constants directly */ |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 1438 | } else if (dfAttributes & DF_IS_MOVE) { |
| 1439 | int i; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1440 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 1441 | for (i = 0; i < mir->ssaRep->numUses; i++) { |
| 1442 | if (!oatIsBitSet(isConstantV, mir->ssaRep->uses[i])) break; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1443 | } |
| 1444 | /* Move a register holding a constant to another register */ |
| 1445 | if (i == mir->ssaRep->numUses) { |
| 1446 | setConstant(cUnit, mir->ssaRep->defs[0], |
| 1447 | cUnit->constantValues[mir->ssaRep->uses[0]]); |
buzbee | bff2465 | 2012-05-06 16:22:05 -0700 | [diff] [blame] | 1448 | if (dfAttributes & DF_A_WIDE) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1449 | setConstant(cUnit, mir->ssaRep->defs[1], |
| 1450 | cUnit->constantValues[mir->ssaRep->uses[1]]); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1451 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1452 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1453 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1454 | } |
| 1455 | /* TODO: implement code to handle arithmetic operations */ |
| 1456 | return true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1457 | } |
| 1458 | |
| 1459 | /* Setup the basic data structures for SSA conversion */ |
| 1460 | void oatInitializeSSAConversion(CompilationUnit* cUnit) |
| 1461 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1462 | int i; |
| 1463 | int numDalvikReg = cUnit->numDalvikRegisters; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1464 | |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1465 | cUnit->ssaBaseVRegs = |
| 1466 | static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo)); |
| 1467 | cUnit->ssaSubscripts = |
| 1468 | static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo)); |
| 1469 | cUnit->ssaStrings = |
| 1470 | static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1471 | // Create the ssa mappings, estimating the max size |
| 1472 | oatInitGrowableList(cUnit, cUnit->ssaBaseVRegs, |
| 1473 | numDalvikReg + cUnit->defCount + 128, |
| 1474 | kListSSAtoDalvikMap); |
| 1475 | oatInitGrowableList(cUnit, cUnit->ssaSubscripts, |
| 1476 | numDalvikReg + cUnit->defCount + 128, |
| 1477 | kListSSAtoDalvikMap); |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 1478 | oatInitGrowableList(cUnit, cUnit->ssaStrings, |
| 1479 | numDalvikReg + cUnit->defCount + 128, |
| 1480 | kListSSAtoDalvikMap); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1481 | /* |
| 1482 | * Initial number of SSA registers is equal to the number of Dalvik |
| 1483 | * registers. |
| 1484 | */ |
| 1485 | cUnit->numSSARegs = numDalvikReg; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1486 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1487 | /* |
| 1488 | * Initialize the SSA2Dalvik map list. For the first numDalvikReg elements, |
| 1489 | * the subscript is 0 so we use the ENCODE_REG_SUB macro to encode the value |
| 1490 | * into "(0 << 16) | i" |
| 1491 | */ |
| 1492 | for (i = 0; i < numDalvikReg; i++) { |
| 1493 | oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, i); |
| 1494 | oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, 0); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1495 | std::string ssaName = getSSAName(cUnit, i); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1496 | char* name = static_cast<char*>(oatNew(cUnit, ssaName.length() + 1, true, kAllocDFInfo)); |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1497 | strncpy(name, ssaName.c_str(), ssaName.length() + 1); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1498 | oatInsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1499 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1500 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1501 | /* |
| 1502 | * Initialize the DalvikToSSAMap map. There is one entry for each |
| 1503 | * Dalvik register, and the SSA names for those are the same. |
| 1504 | */ |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1505 | cUnit->vRegToSSAMap = |
| 1506 | static_cast<int*>(oatNew(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1507 | /* Keep track of the higest def for each dalvik reg */ |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1508 | cUnit->SSALastDefs = |
| 1509 | static_cast<int*>(oatNew(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo)); |
buzbee | f0cde54 | 2011-09-13 14:55:02 -0700 | [diff] [blame] | 1510 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1511 | for (i = 0; i < numDalvikReg; i++) { |
| 1512 | cUnit->vRegToSSAMap[i] = i; |
| 1513 | cUnit->SSALastDefs[i] = 0; |
| 1514 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1515 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1516 | /* Add ssa reg for Method* */ |
| 1517 | cUnit->methodSReg = addNewSReg(cUnit, SSA_METHOD_BASEREG); |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1518 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1519 | /* |
| 1520 | * Allocate the BasicBlockDataFlow structure for the entry and code blocks |
| 1521 | */ |
| 1522 | GrowableListIterator iterator; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1523 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1524 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1525 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1526 | while (true) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1527 | BasicBlock* bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1528 | if (bb == NULL) break; |
| 1529 | if (bb->hidden == true) continue; |
| 1530 | if (bb->blockType == kDalvikByteCode || |
| 1531 | bb->blockType == kEntryBlock || |
| 1532 | bb->blockType == kExitBlock) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1533 | bb->dataFlowInfo = static_cast<BasicBlockDataFlow*>(oatNew(cUnit, sizeof(BasicBlockDataFlow), |
| 1534 | true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1535 | } |
| 1536 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1537 | } |
| 1538 | |
| 1539 | /* Clear the visited flag for each BB */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1540 | bool oatClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1541 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1542 | bb->visited = false; |
| 1543 | return true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1547 | bool (*func)(CompilationUnit*, BasicBlock*), |
| 1548 | DataFlowAnalysisMode dfaMode, |
| 1549 | bool isIterative) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1550 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1551 | bool change = true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1552 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1553 | while (change) { |
| 1554 | change = false; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1555 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1556 | switch (dfaMode) { |
| 1557 | /* Scan all blocks and perform the operations specified in func */ |
| 1558 | case kAllNodes: |
| 1559 | { |
| 1560 | GrowableListIterator iterator; |
| 1561 | oatGrowableListIteratorInit(&cUnit->blockList, &iterator); |
| 1562 | while (true) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1563 | BasicBlock* bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1564 | if (bb == NULL) break; |
| 1565 | if (bb->hidden == true) continue; |
| 1566 | change |= (*func)(cUnit, bb); |
| 1567 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1568 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1569 | break; |
| 1570 | /* Scan reachable blocks and perform the ops specified in func. */ |
| 1571 | case kReachableNodes: |
| 1572 | { |
| 1573 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1574 | int idx; |
| 1575 | const GrowableList *blockList = &cUnit->blockList; |
| 1576 | |
| 1577 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1578 | int blockIdx = cUnit->dfsOrder.elemList[idx]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1579 | BasicBlock* bb = |
| 1580 | reinterpret_cast<BasicBlock*>( oatGrowableListGetElement(blockList, blockIdx)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1581 | change |= (*func)(cUnit, bb); |
| 1582 | } |
| 1583 | } |
| 1584 | break; |
| 1585 | |
| 1586 | /* Scan reachable blocks by pre-order dfs and invoke func on each. */ |
| 1587 | case kPreOrderDFSTraversal: |
| 1588 | { |
| 1589 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1590 | int idx; |
| 1591 | const GrowableList *blockList = &cUnit->blockList; |
| 1592 | |
| 1593 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1594 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1595 | BasicBlock* bb = |
| 1596 | reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, dfsIdx)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1597 | change |= (*func)(cUnit, bb); |
| 1598 | } |
| 1599 | } |
| 1600 | break; |
| 1601 | /* Scan reachable blocks post-order dfs and invoke func on each. */ |
| 1602 | case kPostOrderDFSTraversal: |
| 1603 | { |
| 1604 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1605 | int idx; |
| 1606 | const GrowableList *blockList = &cUnit->blockList; |
| 1607 | |
| 1608 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1609 | int dfsIdx = cUnit->dfsOrder.elemList[idx]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1610 | BasicBlock* bb = |
| 1611 | reinterpret_cast<BasicBlock *>( oatGrowableListGetElement(blockList, dfsIdx)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1612 | change |= (*func)(cUnit, bb); |
| 1613 | } |
| 1614 | } |
| 1615 | break; |
| 1616 | /* Scan reachable post-order dom tree and invoke func on each. */ |
| 1617 | case kPostOrderDOMTraversal: |
| 1618 | { |
| 1619 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1620 | int idx; |
| 1621 | const GrowableList *blockList = &cUnit->blockList; |
| 1622 | |
| 1623 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 1624 | int domIdx = cUnit->domPostOrderTraversal.elemList[idx]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1625 | BasicBlock* bb = |
| 1626 | reinterpret_cast<BasicBlock*>( oatGrowableListGetElement(blockList, domIdx)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1627 | change |= (*func)(cUnit, bb); |
| 1628 | } |
| 1629 | } |
| 1630 | break; |
| 1631 | /* Scan reachable blocks reverse post-order dfs, invoke func on each */ |
| 1632 | case kReversePostOrderTraversal: |
| 1633 | { |
| 1634 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 1635 | int idx; |
| 1636 | const GrowableList *blockList = &cUnit->blockList; |
| 1637 | |
| 1638 | for (idx = numReachableBlocks - 1; idx >= 0; idx--) { |
| 1639 | int revIdx = cUnit->dfsPostOrder.elemList[idx]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1640 | BasicBlock* bb = |
| 1641 | reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, revIdx)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1642 | change |= (*func)(cUnit, bb); |
| 1643 | } |
| 1644 | } |
| 1645 | break; |
| 1646 | default: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1647 | LOG(FATAL) << "Unknown traversal mode: " << dfaMode; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1648 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1649 | /* If isIterative is false, exit the loop after the first iteration */ |
| 1650 | change &= isIterative; |
| 1651 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1652 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1653 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1654 | /* Advance to next strictly dominated MIR node in an extended basic block */ |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1655 | MIR* advanceMIR(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir, |
| 1656 | ArenaBitVector* bv, bool clearMark) { |
| 1657 | BasicBlock* bb = *pBb; |
| 1658 | if (mir != NULL) { |
| 1659 | mir = mir->next; |
| 1660 | if (mir == NULL) { |
| 1661 | bb = bb->fallThrough; |
| 1662 | if ((bb == NULL) || bb->predecessors->numUsed != 1) { |
| 1663 | mir = NULL; |
| 1664 | } else { |
| 1665 | if (bv) { |
| 1666 | oatSetBit(cUnit, bv, bb->id); |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1667 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1668 | *pBb = bb; |
| 1669 | mir = bb->firstMIRInsn; |
| 1670 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1671 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1672 | } |
| 1673 | if (mir && clearMark) { |
| 1674 | mir->optimizationFlags &= ~MIR_MARK; |
| 1675 | } |
| 1676 | return mir; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1677 | } |
| 1678 | |
buzbee | fc9e6fa | 2012-03-23 15:14:29 -0700 | [diff] [blame] | 1679 | /* |
| 1680 | * To be used at an invoke mir. If the logically next mir node represents |
| 1681 | * a move-result, return it. Else, return NULL. If a move-result exists, |
| 1682 | * it is required to immediately follow the invoke with no intervening |
| 1683 | * opcodes or incoming arcs. However, if the result of the invoke is not |
| 1684 | * used, a move-result may not be present. |
| 1685 | */ |
buzbee | 15bf980 | 2012-06-12 17:49:27 -0700 | [diff] [blame] | 1686 | MIR* oatFindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir) |
buzbee | fc9e6fa | 2012-03-23 15:14:29 -0700 | [diff] [blame] | 1687 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1688 | BasicBlock* tbb = bb; |
| 1689 | mir = advanceMIR(cUnit, &tbb, mir, NULL, false); |
| 1690 | while (mir != NULL) { |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1691 | int opcode = mir->dalvikInsn.opcode; |
buzbee | 15bf980 | 2012-06-12 17:49:27 -0700 | [diff] [blame] | 1692 | if ((mir->dalvikInsn.opcode == Instruction::MOVE_RESULT) || |
buzbee | 52ed776 | 2012-06-13 23:43:14 -0700 | [diff] [blame] | 1693 | (mir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) || |
buzbee | 15bf980 | 2012-06-12 17:49:27 -0700 | [diff] [blame] | 1694 | (mir->dalvikInsn.opcode == Instruction::MOVE_RESULT_WIDE)) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1695 | break; |
| 1696 | } |
| 1697 | // Keep going if pseudo op, otherwise terminate |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 1698 | if (opcode < kNumPackedOpcodes) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1699 | mir = NULL; |
| 1700 | } else { |
| 1701 | mir = advanceMIR(cUnit, &tbb, mir, NULL, false); |
| 1702 | } |
| 1703 | } |
| 1704 | return mir; |
buzbee | fc9e6fa | 2012-03-23 15:14:29 -0700 | [diff] [blame] | 1705 | } |
| 1706 | |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1707 | void squashDupRangeChecks(CompilationUnit* cUnit, BasicBlock** pBp, MIR* mir, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1708 | int arraySreg, int indexSreg) |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1709 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1710 | while (true) { |
| 1711 | mir = advanceMIR(cUnit, pBp, mir, NULL, false); |
| 1712 | if (!mir) { |
| 1713 | break; |
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 | if ((mir->ssaRep == NULL) || |
| 1716 | (mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1717 | continue; |
| 1718 | } |
| 1719 | int checkArray = INVALID_SREG; |
| 1720 | int checkIndex = INVALID_SREG; |
| 1721 | switch (mir->dalvikInsn.opcode) { |
| 1722 | case Instruction::AGET: |
| 1723 | case Instruction::AGET_OBJECT: |
| 1724 | case Instruction::AGET_BOOLEAN: |
| 1725 | case Instruction::AGET_BYTE: |
| 1726 | case Instruction::AGET_CHAR: |
| 1727 | case Instruction::AGET_SHORT: |
| 1728 | case Instruction::AGET_WIDE: |
| 1729 | checkArray = mir->ssaRep->uses[0]; |
| 1730 | checkIndex = mir->ssaRep->uses[1]; |
| 1731 | break; |
| 1732 | case Instruction::APUT: |
| 1733 | case Instruction::APUT_OBJECT: |
| 1734 | case Instruction::APUT_SHORT: |
| 1735 | case Instruction::APUT_CHAR: |
| 1736 | case Instruction::APUT_BYTE: |
| 1737 | case Instruction::APUT_BOOLEAN: |
| 1738 | checkArray = mir->ssaRep->uses[1]; |
| 1739 | checkIndex = mir->ssaRep->uses[2]; |
| 1740 | break; |
| 1741 | case Instruction::APUT_WIDE: |
| 1742 | checkArray = mir->ssaRep->uses[2]; |
| 1743 | checkIndex = mir->ssaRep->uses[3]; |
| 1744 | default: |
| 1745 | break; |
| 1746 | } |
| 1747 | if (checkArray == INVALID_SREG) { |
| 1748 | continue; |
| 1749 | } |
| 1750 | if ((arraySreg == checkArray) && (indexSreg == checkIndex)) { |
| 1751 | if (cUnit->printMe) { |
| 1752 | LOG(INFO) << "Squashing range check @ 0x" << std::hex << mir->offset; |
| 1753 | } |
| 1754 | mir->optimizationFlags |= MIR_IGNORE_RANGE_CHECK; |
| 1755 | } |
| 1756 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 1757 | } |
| 1758 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1759 | /* Allocate a compiler temp, return Sreg. Reuse existing if no conflict */ |
| 1760 | int allocCompilerTempSreg(CompilationUnit* cUnit, ArenaBitVector* bv) |
| 1761 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1762 | for (int i = 0; i < cUnit->numCompilerTemps; i++) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1763 | CompilerTemp* ct = reinterpret_cast<CompilerTemp*>(cUnit->compilerTemps.elemList[i]); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1764 | ArenaBitVector* tBv = ct->bv; |
| 1765 | if (!oatTestBitVectors(bv, tBv)) { |
| 1766 | // Combine live maps and reuse existing temp |
| 1767 | oatUnifyBitVectors(tBv, tBv, bv); |
| 1768 | return ct->sReg; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1769 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1770 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1771 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1772 | // Create a new compiler temp & associated live bitmap |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1773 | CompilerTemp* ct = |
| 1774 | static_cast<CompilerTemp*>(oatNew(cUnit, sizeof(CompilerTemp), true, kAllocMisc)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1775 | ArenaBitVector *nBv = oatAllocBitVector(cUnit, cUnit->numBlocks, true, |
| 1776 | kBitMapMisc); |
| 1777 | oatCopyBitVector(nBv, bv); |
| 1778 | ct->bv = nBv; |
| 1779 | ct->sReg = addNewSReg(cUnit, SSA_CTEMP_BASEREG - cUnit->numCompilerTemps); |
| 1780 | cUnit->numCompilerTemps++; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1781 | oatInsertGrowableList(cUnit, &cUnit->compilerTemps, reinterpret_cast<uintptr_t>(ct)); |
| 1782 | DCHECK_EQ(cUnit->numCompilerTemps, static_cast<int>(cUnit->compilerTemps.numUsed)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1783 | return ct->sReg; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1784 | } |
| 1785 | |
| 1786 | /* Creata a new MIR node for a new pseudo op. */ |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1787 | MIR* rawMIR(CompilationUnit* cUnit, Instruction::Code opcode, int defs, |
| 1788 | int uses) |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1789 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1790 | MIR* res = static_cast<MIR*>(oatNew(cUnit, sizeof(MIR), true, kAllocMIR)); |
| 1791 | res->ssaRep = static_cast<struct SSARepresentation*> |
| 1792 | (oatNew(cUnit, sizeof(SSARepresentation), true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1793 | if (uses) { |
| 1794 | res->ssaRep->numUses = uses; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1795 | res->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * uses, false, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1796 | } |
| 1797 | if (defs) { |
| 1798 | res->ssaRep->numDefs = defs; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1799 | res->ssaRep->defs = static_cast<int*>(oatNew(cUnit, sizeof(int) * defs, false, kAllocDFInfo)); |
| 1800 | res->ssaRep->fpDef = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * defs, true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1801 | } |
| 1802 | res->dalvikInsn.opcode = opcode; |
| 1803 | return res; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1804 | } |
| 1805 | |
| 1806 | /* Do some MIR-level basic block optimizations */ |
| 1807 | bool basicBlockOpt(CompilationUnit* cUnit, BasicBlock* bb) |
| 1808 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1809 | int numTemps = 0; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1810 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1811 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1812 | // Look for interesting opcodes, skip otherwise |
| 1813 | Instruction::Code opcode = mir->dalvikInsn.opcode; |
| 1814 | switch (opcode) { |
| 1815 | case Instruction::AGET: |
| 1816 | case Instruction::AGET_OBJECT: |
| 1817 | case Instruction::AGET_BOOLEAN: |
| 1818 | case Instruction::AGET_BYTE: |
| 1819 | case Instruction::AGET_CHAR: |
| 1820 | case Instruction::AGET_SHORT: |
| 1821 | case Instruction::AGET_WIDE: |
| 1822 | if (!(mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1823 | int arrSreg = mir->ssaRep->uses[0]; |
| 1824 | int idxSreg = mir->ssaRep->uses[1]; |
| 1825 | BasicBlock* tbb = bb; |
| 1826 | squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg); |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1827 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1828 | break; |
| 1829 | case Instruction::APUT: |
| 1830 | case Instruction::APUT_OBJECT: |
| 1831 | case Instruction::APUT_SHORT: |
| 1832 | case Instruction::APUT_CHAR: |
| 1833 | case Instruction::APUT_BYTE: |
| 1834 | case Instruction::APUT_BOOLEAN: |
| 1835 | case Instruction::APUT_WIDE: |
| 1836 | if (!(mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK)) { |
| 1837 | int start = (opcode == Instruction::APUT_WIDE) ? 2 : 1; |
| 1838 | int arrSreg = mir->ssaRep->uses[start]; |
| 1839 | int idxSreg = mir->ssaRep->uses[start + 1]; |
| 1840 | BasicBlock* tbb = bb; |
| 1841 | squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg); |
| 1842 | } |
| 1843 | break; |
| 1844 | case Instruction::CMPL_FLOAT: |
| 1845 | case Instruction::CMPL_DOUBLE: |
| 1846 | case Instruction::CMPG_FLOAT: |
| 1847 | case Instruction::CMPG_DOUBLE: |
| 1848 | case Instruction::CMP_LONG: |
buzbee | ca7a5e4 | 2012-08-20 11:12:18 -0700 | [diff] [blame] | 1849 | if (cUnit->genBitcode) { |
| 1850 | // Bitcode doesn't allow this optimization. |
| 1851 | break; |
| 1852 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1853 | if (mir->next != NULL) { |
| 1854 | MIR* mirNext = mir->next; |
| 1855 | Instruction::Code brOpcode = mirNext->dalvikInsn.opcode; |
| 1856 | ConditionCode ccode = kCondNv; |
| 1857 | switch(brOpcode) { |
| 1858 | case Instruction::IF_EQZ: |
| 1859 | ccode = kCondEq; |
| 1860 | break; |
| 1861 | case Instruction::IF_NEZ: |
| 1862 | ccode = kCondNe; |
| 1863 | break; |
| 1864 | case Instruction::IF_LTZ: |
| 1865 | ccode = kCondLt; |
| 1866 | break; |
| 1867 | case Instruction::IF_GEZ: |
| 1868 | ccode = kCondGe; |
| 1869 | break; |
| 1870 | case Instruction::IF_GTZ: |
| 1871 | ccode = kCondGt; |
| 1872 | break; |
| 1873 | case Instruction::IF_LEZ: |
| 1874 | ccode = kCondLe; |
| 1875 | break; |
| 1876 | default: |
| 1877 | break; |
| 1878 | } |
| 1879 | // Make sure result of cmp is used by next insn and nowhere else |
| 1880 | if ((ccode != kCondNv) && |
| 1881 | (mir->ssaRep->defs[0] == mirNext->ssaRep->uses[0]) && |
| 1882 | (getSSAUseCount(cUnit, mir->ssaRep->defs[0]) == 1)) { |
| 1883 | mirNext->dalvikInsn.arg[0] = ccode; |
| 1884 | switch(opcode) { |
| 1885 | case Instruction::CMPL_FLOAT: |
| 1886 | mirNext->dalvikInsn.opcode = |
| 1887 | static_cast<Instruction::Code>(kMirOpFusedCmplFloat); |
| 1888 | break; |
| 1889 | case Instruction::CMPL_DOUBLE: |
| 1890 | mirNext->dalvikInsn.opcode = |
| 1891 | static_cast<Instruction::Code>(kMirOpFusedCmplDouble); |
| 1892 | break; |
| 1893 | case Instruction::CMPG_FLOAT: |
| 1894 | mirNext->dalvikInsn.opcode = |
| 1895 | static_cast<Instruction::Code>(kMirOpFusedCmpgFloat); |
| 1896 | break; |
| 1897 | case Instruction::CMPG_DOUBLE: |
| 1898 | mirNext->dalvikInsn.opcode = |
| 1899 | static_cast<Instruction::Code>(kMirOpFusedCmpgDouble); |
| 1900 | break; |
| 1901 | case Instruction::CMP_LONG: |
| 1902 | mirNext->dalvikInsn.opcode = |
| 1903 | static_cast<Instruction::Code>(kMirOpFusedCmpLong); |
| 1904 | break; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1905 | default: LOG(ERROR) << "Unexpected opcode: " << opcode; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1906 | } |
| 1907 | mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop); |
| 1908 | mirNext->ssaRep->numUses = mir->ssaRep->numUses; |
| 1909 | mirNext->ssaRep->uses = mir->ssaRep->uses; |
| 1910 | mirNext->ssaRep->fpUse = mir->ssaRep->fpUse; |
| 1911 | mirNext->ssaRep->numDefs = 0; |
| 1912 | mir->ssaRep->numUses = 0; |
| 1913 | mir->ssaRep->numDefs = 0; |
| 1914 | } |
| 1915 | } |
| 1916 | break; |
| 1917 | default: |
| 1918 | break; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1919 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1920 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1921 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1922 | if (numTemps > cUnit->numCompilerTemps) { |
| 1923 | cUnit->numCompilerTemps = numTemps; |
| 1924 | } |
| 1925 | return true; |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 1926 | } |
| 1927 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1928 | bool nullCheckEliminationInit(struct CompilationUnit* cUnit, |
| 1929 | struct BasicBlock* bb) |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1930 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 1931 | if (bb->dataFlowInfo == NULL) return false; |
| 1932 | bb->dataFlowInfo->endingNullCheckV = |
| 1933 | oatAllocBitVector(cUnit, cUnit->numSSARegs, false, kBitMapNullCheck); |
| 1934 | oatClearAllBits(bb->dataFlowInfo->endingNullCheckV); |
| 1935 | return true; |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 1936 | } |
| 1937 | |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 1938 | /* Collect stats on number of checks removed */ |
| 1939 | bool countChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 1940 | { |
| 1941 | if (bb->dataFlowInfo == NULL) return false; |
| 1942 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 1943 | if (mir->ssaRep == NULL) { |
| 1944 | continue; |
| 1945 | } |
| 1946 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 1947 | if (dfAttributes & DF_HAS_NULL_CHKS) { |
| 1948 | cUnit->checkstats->nullChecks++; |
| 1949 | if (mir->optimizationFlags & MIR_IGNORE_NULL_CHECK) { |
| 1950 | cUnit->checkstats->nullChecksEliminated++; |
| 1951 | } |
| 1952 | } |
| 1953 | if (dfAttributes & DF_HAS_RANGE_CHKS) { |
| 1954 | cUnit->checkstats->rangeChecks++; |
| 1955 | if (mir->optimizationFlags & MIR_IGNORE_RANGE_CHECK) { |
| 1956 | cUnit->checkstats->rangeChecksEliminated++; |
| 1957 | } |
| 1958 | } |
| 1959 | } |
| 1960 | return false; |
| 1961 | } |
| 1962 | |
buzbee | 0967a25 | 2012-09-14 10:43:54 -0700 | [diff] [blame] | 1963 | /* Try to make common case the fallthrough path */ |
| 1964 | bool layoutBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 1965 | { |
| 1966 | // TODO: For now, just looking for direct throws. Consider generalizing for profile feedback |
| 1967 | if (!bb->explicitThrow) { |
| 1968 | return false; |
| 1969 | } |
| 1970 | BasicBlock* walker = bb; |
| 1971 | while (true) { |
| 1972 | // Check termination conditions |
| 1973 | if ((walker->blockType == kEntryBlock) || (walker->predecessors->numUsed != 1)) { |
| 1974 | break; |
| 1975 | } |
| 1976 | BasicBlock* prev = GET_ELEM_N(walker->predecessors, BasicBlock*, 0); |
| 1977 | if (prev->conditionalBranch) { |
| 1978 | if (prev->fallThrough == walker) { |
| 1979 | // Already done - return |
| 1980 | break; |
| 1981 | } |
| 1982 | DCHECK_EQ(walker, prev->taken); |
| 1983 | // Got one. Flip it and exit |
| 1984 | Instruction::Code opcode = prev->lastMIRInsn->dalvikInsn.opcode; |
| 1985 | switch (opcode) { |
| 1986 | case Instruction::IF_EQ: opcode = Instruction::IF_NE; break; |
| 1987 | case Instruction::IF_NE: opcode = Instruction::IF_EQ; break; |
| 1988 | case Instruction::IF_LT: opcode = Instruction::IF_GE; break; |
| 1989 | case Instruction::IF_GE: opcode = Instruction::IF_LT; break; |
| 1990 | case Instruction::IF_GT: opcode = Instruction::IF_LE; break; |
| 1991 | case Instruction::IF_LE: opcode = Instruction::IF_GT; break; |
| 1992 | case Instruction::IF_EQZ: opcode = Instruction::IF_NEZ; break; |
| 1993 | case Instruction::IF_NEZ: opcode = Instruction::IF_EQZ; break; |
| 1994 | case Instruction::IF_LTZ: opcode = Instruction::IF_GEZ; break; |
| 1995 | case Instruction::IF_GEZ: opcode = Instruction::IF_LTZ; break; |
| 1996 | case Instruction::IF_GTZ: opcode = Instruction::IF_LEZ; break; |
| 1997 | case Instruction::IF_LEZ: opcode = Instruction::IF_GTZ; break; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 1998 | default: LOG(FATAL) << "Unexpected opcode " << opcode; |
buzbee | 0967a25 | 2012-09-14 10:43:54 -0700 | [diff] [blame] | 1999 | } |
| 2000 | prev->lastMIRInsn->dalvikInsn.opcode = opcode; |
| 2001 | BasicBlock* tBB = prev->taken; |
| 2002 | prev->taken = prev->fallThrough; |
| 2003 | prev->fallThrough = tBB; |
| 2004 | break; |
| 2005 | } |
| 2006 | walker = prev; |
| 2007 | } |
| 2008 | return false; |
| 2009 | } |
| 2010 | |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2011 | /* Combine any basic blocks terminated by instructions that we now know can't throw */ |
| 2012 | bool combineBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 2013 | { |
| 2014 | // Loop here to allow combining a sequence of blocks |
| 2015 | while (true) { |
| 2016 | // Check termination conditions |
| 2017 | if ((bb->firstMIRInsn == NULL) |
| 2018 | || (bb->dataFlowInfo == NULL) |
| 2019 | || (bb->blockType == kExceptionHandling) |
| 2020 | || (bb->blockType == kExitBlock) |
| 2021 | || (bb->blockType == kDead) |
| 2022 | || ((bb->taken == NULL) || (bb->taken->blockType != kExceptionHandling)) |
| 2023 | || (bb->successorBlockList.blockListType != kNotUsed) |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2024 | || (static_cast<int>(bb->lastMIRInsn->dalvikInsn.opcode) != kMirOpCheck)) { |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2025 | break; |
| 2026 | } |
| 2027 | |
| 2028 | // Test the kMirOpCheck instruction |
| 2029 | MIR* mir = bb->lastMIRInsn; |
| 2030 | // Grab the attributes from the paired opcode |
| 2031 | MIR* throwInsn = mir->meta.throwInsn; |
| 2032 | int dfAttributes = oatDataFlowAttributes[throwInsn->dalvikInsn.opcode]; |
buzbee | 0967a25 | 2012-09-14 10:43:54 -0700 | [diff] [blame] | 2033 | bool canCombine = true; |
| 2034 | if (dfAttributes & DF_HAS_NULL_CHKS) { |
| 2035 | canCombine &= ((throwInsn->optimizationFlags & MIR_IGNORE_NULL_CHECK) != 0); |
| 2036 | } |
| 2037 | if (dfAttributes & DF_HAS_RANGE_CHKS) { |
| 2038 | canCombine &= ((throwInsn->optimizationFlags & MIR_IGNORE_RANGE_CHECK) != 0); |
| 2039 | } |
| 2040 | if (!canCombine) { |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2041 | break; |
| 2042 | } |
| 2043 | // OK - got one. Combine |
| 2044 | BasicBlock* bbNext = bb->fallThrough; |
| 2045 | DCHECK(!bbNext->catchEntry); |
| 2046 | DCHECK_EQ(bbNext->predecessors->numUsed, 1U); |
| 2047 | MIR* tMir = bb->lastMIRInsn->prev; |
| 2048 | // Overwrite the kOpCheck insn with the paired opcode |
| 2049 | DCHECK_EQ(bbNext->firstMIRInsn, throwInsn); |
| 2050 | *bb->lastMIRInsn = *throwInsn; |
| 2051 | bb->lastMIRInsn->prev = tMir; |
| 2052 | // Use the successor info from the next block |
| 2053 | bb->successorBlockList = bbNext->successorBlockList; |
| 2054 | // Use the ending block linkage from the next block |
| 2055 | bb->fallThrough = bbNext->fallThrough; |
| 2056 | bb->taken->blockType = kDead; // Kill the unused exception block |
| 2057 | bb->taken = bbNext->taken; |
| 2058 | // Include the rest of the instructions |
| 2059 | bb->lastMIRInsn = bbNext->lastMIRInsn; |
| 2060 | |
| 2061 | /* |
| 2062 | * NOTE: we aren't updating all dataflow info here. Should either make sure this pass |
| 2063 | * happens after uses of iDominated, domFrontier or update the dataflow info here. |
| 2064 | */ |
| 2065 | |
| 2066 | // Kill bbNext and remap now-dead id to parent |
| 2067 | bbNext->blockType = kDead; |
| 2068 | cUnit->blockIdMap.Overwrite(bbNext->id, bb->id); |
| 2069 | |
| 2070 | // Now, loop back and see if we can keep going |
| 2071 | } |
| 2072 | return false; |
| 2073 | } |
| 2074 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2075 | /* Eliminate unnecessary null checks for a basic block. */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 2076 | bool eliminateNullChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb) |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2077 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2078 | if (bb->dataFlowInfo == NULL) return false; |
| 2079 | |
| 2080 | /* |
| 2081 | * Set initial state. Be conservative with catch |
| 2082 | * blocks and start with no assumptions about null check |
| 2083 | * status (except for "this"). |
| 2084 | */ |
| 2085 | if ((bb->blockType == kEntryBlock) | bb->catchEntry) { |
| 2086 | oatClearAllBits(cUnit->tempSSARegisterV); |
| 2087 | if ((cUnit->access_flags & kAccStatic) == 0) { |
| 2088 | // If non-static method, mark "this" as non-null |
| 2089 | int thisReg = cUnit->numDalvikRegisters - cUnit->numIns; |
| 2090 | oatSetBit(cUnit, cUnit->tempSSARegisterV, thisReg); |
| 2091 | } |
| 2092 | } else { |
| 2093 | // Starting state is intesection of all incoming arcs |
| 2094 | GrowableListIterator iter; |
| 2095 | oatGrowableListIteratorInit(bb->predecessors, &iter); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2096 | BasicBlock* predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2097 | DCHECK(predBB != NULL); |
| 2098 | oatCopyBitVector(cUnit->tempSSARegisterV, |
| 2099 | predBB->dataFlowInfo->endingNullCheckV); |
| 2100 | while (true) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2101 | predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2102 | if (!predBB) break; |
| 2103 | if ((predBB->dataFlowInfo == NULL) || |
| 2104 | (predBB->dataFlowInfo->endingNullCheckV == NULL)) { |
| 2105 | continue; |
| 2106 | } |
| 2107 | oatIntersectBitVectors(cUnit->tempSSARegisterV, |
| 2108 | cUnit->tempSSARegisterV, |
| 2109 | predBB->dataFlowInfo->endingNullCheckV); |
| 2110 | } |
| 2111 | } |
| 2112 | |
| 2113 | // Walk through the instruction in the block, updating as necessary |
| 2114 | for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 2115 | if (mir->ssaRep == NULL) { |
| 2116 | continue; |
| 2117 | } |
| 2118 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 2119 | |
| 2120 | // Mark target of NEW* as non-null |
| 2121 | if (dfAttributes & DF_NON_NULL_DST) { |
| 2122 | oatSetBit(cUnit, cUnit->tempSSARegisterV, mir->ssaRep->defs[0]); |
| 2123 | } |
| 2124 | |
| 2125 | // Mark non-null returns from invoke-style NEW* |
| 2126 | if (dfAttributes & DF_NON_NULL_RET) { |
| 2127 | MIR* nextMir = mir->next; |
| 2128 | // Next should be an MOVE_RESULT_OBJECT |
| 2129 | if (nextMir && |
| 2130 | nextMir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) { |
| 2131 | // Mark as null checked |
| 2132 | oatSetBit(cUnit, cUnit->tempSSARegisterV, nextMir->ssaRep->defs[0]); |
| 2133 | } else { |
| 2134 | if (nextMir) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2135 | LOG(WARNING) << "Unexpected opcode following new: " << nextMir->dalvikInsn.opcode; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2136 | } else if (bb->fallThrough) { |
| 2137 | // Look in next basic block |
| 2138 | struct BasicBlock* nextBB = bb->fallThrough; |
| 2139 | for (MIR* tmir = nextBB->firstMIRInsn; tmir; |
| 2140 | tmir =tmir->next) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2141 | if (static_cast<int>(tmir->dalvikInsn.opcode) >= static_cast<int>(kMirOpFirst)) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2142 | continue; |
| 2143 | } |
| 2144 | // First non-pseudo should be MOVE_RESULT_OBJECT |
| 2145 | if (tmir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) { |
| 2146 | // Mark as null checked |
| 2147 | oatSetBit(cUnit, cUnit->tempSSARegisterV, tmir->ssaRep->defs[0]); |
| 2148 | } else { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2149 | LOG(WARNING) << "Unexpected op after new: " << tmir->dalvikInsn.opcode; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2150 | } |
| 2151 | break; |
| 2152 | } |
| 2153 | } |
| 2154 | } |
| 2155 | } |
buzbee | 5abfa3e | 2012-01-31 17:01:43 -0800 | [diff] [blame] | 2156 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2157 | /* |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2158 | * Propagate nullcheck state on register copies (including |
| 2159 | * Phi pseudo copies. For the latter, nullcheck state is |
| 2160 | * the "and" of all the Phi's operands. |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2161 | */ |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2162 | if (dfAttributes & (DF_NULL_TRANSFER_0 | DF_NULL_TRANSFER_N)) { |
| 2163 | int tgtSreg = mir->ssaRep->defs[0]; |
| 2164 | int operands = (dfAttributes & DF_NULL_TRANSFER_0) ? 1 : |
| 2165 | mir->ssaRep->numUses; |
| 2166 | bool nullChecked = true; |
| 2167 | for (int i = 0; i < operands; i++) { |
| 2168 | nullChecked &= oatIsBitSet(cUnit->tempSSARegisterV, |
| 2169 | mir->ssaRep->uses[i]); |
| 2170 | } |
| 2171 | if (nullChecked) { |
| 2172 | oatSetBit(cUnit, cUnit->tempSSARegisterV, tgtSreg); |
| 2173 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2174 | } |
| 2175 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2176 | // Already nullchecked? |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2177 | if ((dfAttributes & DF_HAS_NULL_CHKS) && !(mir->optimizationFlags & MIR_IGNORE_NULL_CHECK)) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2178 | int srcIdx; |
| 2179 | if (dfAttributes & DF_NULL_CHK_1) { |
| 2180 | srcIdx = 1; |
| 2181 | } else if (dfAttributes & DF_NULL_CHK_2) { |
| 2182 | srcIdx = 2; |
| 2183 | } else { |
| 2184 | srcIdx = 0; |
| 2185 | } |
| 2186 | int srcSreg = mir->ssaRep->uses[srcIdx]; |
| 2187 | if (oatIsBitSet(cUnit->tempSSARegisterV, srcSreg)) { |
| 2188 | // Eliminate the null check |
| 2189 | mir->optimizationFlags |= MIR_IGNORE_NULL_CHECK; |
| 2190 | } else { |
| 2191 | // Mark sReg as null-checked |
| 2192 | oatSetBit(cUnit, cUnit->tempSSARegisterV, srcSreg); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2193 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2194 | } |
| 2195 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2196 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2197 | // Did anything change? |
| 2198 | bool res = oatCompareBitVectors(bb->dataFlowInfo->endingNullCheckV, |
| 2199 | cUnit->tempSSARegisterV); |
| 2200 | if (res) { |
| 2201 | oatCopyBitVector(bb->dataFlowInfo->endingNullCheckV, |
| 2202 | cUnit->tempSSARegisterV); |
| 2203 | } |
| 2204 | return res; |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2205 | } |
| 2206 | |
| 2207 | void oatMethodNullCheckElimination(CompilationUnit *cUnit) |
| 2208 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2209 | if (!(cUnit->disableOpt & (1 << kNullCheckElimination))) { |
| 2210 | DCHECK(cUnit->tempSSARegisterV != NULL); |
| 2211 | oatDataFlowAnalysisDispatcher(cUnit, nullCheckEliminationInit, kAllNodes, |
| 2212 | false /* isIterative */); |
| 2213 | oatDataFlowAnalysisDispatcher(cUnit, eliminateNullChecks, |
| 2214 | kPreOrderDFSTraversal, |
| 2215 | true /* isIterative */); |
| 2216 | } |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 2217 | } |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 2218 | |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2219 | void oatMethodBasicBlockCombine(CompilationUnit* cUnit) |
| 2220 | { |
| 2221 | oatDataFlowAnalysisDispatcher(cUnit, combineBlocks, kPreOrderDFSTraversal, false); |
| 2222 | } |
| 2223 | |
buzbee | 0967a25 | 2012-09-14 10:43:54 -0700 | [diff] [blame] | 2224 | void oatMethodCodeLayout(CompilationUnit* cUnit) |
| 2225 | { |
| 2226 | oatDataFlowAnalysisDispatcher(cUnit, layoutBlocks, kAllNodes, false); |
| 2227 | } |
| 2228 | |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2229 | void oatDumpCheckStats(CompilationUnit *cUnit) |
| 2230 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2231 | Checkstats* stats = |
| 2232 | static_cast<Checkstats*>(oatNew(cUnit, sizeof(Checkstats), true, kAllocDFInfo)); |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2233 | cUnit->checkstats = stats; |
| 2234 | oatDataFlowAnalysisDispatcher(cUnit, countChecks, kAllNodes, false /* isIterative */); |
| 2235 | if (stats->nullChecks > 0) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2236 | float eliminated = static_cast<float>(stats->nullChecksEliminated); |
| 2237 | float checks = static_cast<float>(stats->nullChecks); |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2238 | LOG(INFO) << "Null Checks: " << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 2239 | << stats->nullChecksEliminated << " of " << stats->nullChecks << " -> " |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2240 | << (eliminated/checks) * 100.0 << "%"; |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2241 | } |
| 2242 | if (stats->rangeChecks > 0) { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2243 | float eliminated = static_cast<float>(stats->rangeChecksEliminated); |
| 2244 | float checks = static_cast<float>(stats->rangeChecks); |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2245 | LOG(INFO) << "Range Checks: " << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 2246 | << stats->rangeChecksEliminated << " of " << stats->rangeChecks << " -> " |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2247 | << (eliminated/checks) * 100.0 << "%"; |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 2248 | } |
| 2249 | } |
| 2250 | |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 2251 | void oatMethodBasicBlockOptimization(CompilationUnit *cUnit) |
| 2252 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2253 | if (!(cUnit->disableOpt & (1 << kBBOpt))) { |
| 2254 | oatInitGrowableList(cUnit, &cUnit->compilerTemps, 6, kListMisc); |
| 2255 | DCHECK_EQ(cUnit->numCompilerTemps, 0); |
buzbee | ca7a5e4 | 2012-08-20 11:12:18 -0700 | [diff] [blame] | 2256 | oatDataFlowAnalysisDispatcher(cUnit, basicBlockOpt, |
| 2257 | kAllNodes, false /* isIterative */); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2258 | } |
buzbee | e196567 | 2012-03-11 18:39:19 -0700 | [diff] [blame] | 2259 | } |
| 2260 | |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2261 | void addLoopHeader(CompilationUnit* cUnit, BasicBlock* header, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2262 | BasicBlock* backEdge) |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2263 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2264 | GrowableListIterator iter; |
| 2265 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2266 | for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter)); |
| 2267 | (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2268 | if (loop->header == header) { |
| 2269 | oatInsertGrowableList(cUnit, &loop->incomingBackEdges, |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2270 | reinterpret_cast<uintptr_t>(backEdge)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2271 | return; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2272 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2273 | } |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2274 | LoopInfo* info = static_cast<LoopInfo*>(oatNew(cUnit, sizeof(LoopInfo), true, kAllocDFInfo)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2275 | info->header = header; |
| 2276 | oatInitGrowableList(cUnit, &info->incomingBackEdges, 2, kListMisc); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2277 | oatInsertGrowableList(cUnit, &info->incomingBackEdges, reinterpret_cast<uintptr_t>(backEdge)); |
| 2278 | oatInsertGrowableList(cUnit, &cUnit->loopHeaders, reinterpret_cast<uintptr_t>(info)); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2279 | } |
| 2280 | |
| 2281 | bool findBackEdges(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 2282 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2283 | if ((bb->dataFlowInfo == NULL) || (bb->lastMIRInsn == NULL)) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2284 | return false; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2285 | } |
| 2286 | Instruction::Code opcode = bb->lastMIRInsn->dalvikInsn.opcode; |
Ian Rogers | a75a013 | 2012-09-28 11:41:42 -0700 | [diff] [blame] | 2287 | if (Instruction::FlagsOf(opcode) & Instruction::kBranch) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2288 | if (bb->taken && (bb->taken->startOffset <= bb->startOffset)) { |
| 2289 | DCHECK(bb->dominators != NULL); |
| 2290 | if (oatIsBitSet(bb->dominators, bb->taken->id)) { |
| 2291 | if (cUnit->printMe) { |
| 2292 | LOG(INFO) << "Loop backedge from 0x" |
| 2293 | << std::hex << bb->lastMIRInsn->offset |
| 2294 | << " to 0x" << std::hex << bb->taken->startOffset; |
| 2295 | } |
| 2296 | addLoopHeader(cUnit, bb->taken, bb); |
| 2297 | } |
| 2298 | } |
| 2299 | } |
| 2300 | return false; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2301 | } |
| 2302 | |
| 2303 | void addBlocksToLoop(CompilationUnit* cUnit, ArenaBitVector* blocks, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2304 | BasicBlock* bb, int headId) |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2305 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2306 | if (!oatIsBitSet(bb->dominators, headId) || |
| 2307 | oatIsBitSet(blocks, bb->id)) { |
| 2308 | return; |
| 2309 | } |
| 2310 | oatSetBit(cUnit, blocks, bb->id); |
| 2311 | GrowableListIterator iter; |
| 2312 | oatGrowableListIteratorInit(bb->predecessors, &iter); |
| 2313 | BasicBlock* predBB; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2314 | for (predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); predBB; |
| 2315 | predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2316 | addBlocksToLoop(cUnit, blocks, predBB, headId); |
| 2317 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2318 | } |
| 2319 | |
| 2320 | void oatDumpLoops(CompilationUnit *cUnit) |
| 2321 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2322 | GrowableListIterator iter; |
| 2323 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2324 | for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter)); |
| 2325 | (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2326 | LOG(INFO) << "Loop head block id " << loop->header->id |
| 2327 | << ", offset 0x" << std::hex << loop->header->startOffset |
| 2328 | << ", Depth: " << loop->header->nestingDepth; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2329 | GrowableListIterator iter; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2330 | oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter); |
| 2331 | BasicBlock* edgeBB; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2332 | for (edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); edgeBB; |
| 2333 | edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2334 | LOG(INFO) << " Backedge block id " << edgeBB->id |
| 2335 | << ", offset 0x" << std::hex << edgeBB->startOffset; |
| 2336 | ArenaBitVectorIterator bIter; |
| 2337 | oatBitVectorIteratorInit(loop->blocks, &bIter); |
| 2338 | for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1; |
| 2339 | bbId = oatBitVectorIteratorNext(&bIter)) { |
| 2340 | BasicBlock *bb; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2341 | bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(&cUnit->blockList, bbId)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2342 | LOG(INFO) << " (" << bb->id << ", 0x" << std::hex |
| 2343 | << bb->startOffset << ")"; |
| 2344 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2345 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2346 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2347 | } |
| 2348 | |
| 2349 | void oatMethodLoopDetection(CompilationUnit *cUnit) |
| 2350 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2351 | if (cUnit->disableOpt & (1 << kPromoteRegs)) { |
| 2352 | return; |
| 2353 | } |
| 2354 | oatInitGrowableList(cUnit, &cUnit->loopHeaders, 6, kListMisc); |
| 2355 | // Find the loop headers |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2356 | oatDataFlowAnalysisDispatcher(cUnit, findBackEdges, kAllNodes, false /* isIterative */); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2357 | GrowableListIterator iter; |
| 2358 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
| 2359 | // Add blocks to each header |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2360 | for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter)); |
| 2361 | loop; loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2362 | loop->blocks = oatAllocBitVector(cUnit, cUnit->numBlocks, true, |
| 2363 | kBitMapMisc); |
| 2364 | oatSetBit(cUnit, loop->blocks, loop->header->id); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2365 | GrowableListIterator iter; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2366 | oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter); |
| 2367 | BasicBlock* edgeBB; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2368 | for (edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); edgeBB; |
| 2369 | edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2370 | addBlocksToLoop(cUnit, loop->blocks, edgeBB, loop->header->id); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2371 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2372 | } |
| 2373 | // Compute the nesting depth of each header |
| 2374 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2375 | for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter)); |
| 2376 | loop; loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2377 | GrowableListIterator iter2; |
| 2378 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter2); |
| 2379 | LoopInfo* loop2; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2380 | for (loop2 = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter2)); |
| 2381 | loop2; loop2 = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter2))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2382 | if (oatIsBitSet(loop2->blocks, loop->header->id)) { |
| 2383 | loop->header->nestingDepth++; |
| 2384 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2385 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2386 | } |
| 2387 | // Assign nesting depth to each block in all loops |
| 2388 | oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter); |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2389 | for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter)); |
| 2390 | (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2391 | ArenaBitVectorIterator bIter; |
| 2392 | oatBitVectorIteratorInit(loop->blocks, &bIter); |
| 2393 | for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1; |
| 2394 | bbId = oatBitVectorIteratorNext(&bIter)) { |
| 2395 | BasicBlock *bb; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2396 | bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(&cUnit->blockList, bbId)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2397 | bb->nestingDepth = std::max(bb->nestingDepth, |
| 2398 | loop->header->nestingDepth); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2399 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2400 | } |
| 2401 | if (cUnit->printMe) { |
| 2402 | oatDumpLoops(cUnit); |
| 2403 | } |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2404 | } |
| 2405 | |
| 2406 | /* |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2407 | * This function will make a best guess at whether the invoke will |
| 2408 | * end up using Method*. It isn't critical to get it exactly right, |
| 2409 | * and attempting to do would involve more complexity than it's |
| 2410 | * worth. |
| 2411 | */ |
| 2412 | bool invokeUsesMethodStar(CompilationUnit* cUnit, MIR* mir) |
| 2413 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2414 | InvokeType type; |
| 2415 | Instruction::Code opcode = mir->dalvikInsn.opcode; |
| 2416 | switch (opcode) { |
| 2417 | case Instruction::INVOKE_STATIC: |
| 2418 | case Instruction::INVOKE_STATIC_RANGE: |
| 2419 | type = kStatic; |
| 2420 | break; |
| 2421 | case Instruction::INVOKE_DIRECT: |
| 2422 | case Instruction::INVOKE_DIRECT_RANGE: |
| 2423 | type = kDirect; |
| 2424 | break; |
| 2425 | case Instruction::INVOKE_VIRTUAL: |
| 2426 | case Instruction::INVOKE_VIRTUAL_RANGE: |
| 2427 | type = kVirtual; |
| 2428 | break; |
| 2429 | case Instruction::INVOKE_INTERFACE: |
| 2430 | case Instruction::INVOKE_INTERFACE_RANGE: |
| 2431 | return false; |
| 2432 | case Instruction::INVOKE_SUPER_RANGE: |
| 2433 | case Instruction::INVOKE_SUPER: |
| 2434 | type = kSuper; |
| 2435 | break; |
| 2436 | default: |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2437 | LOG(WARNING) << "Unexpected invoke op: " << opcode; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2438 | return false; |
| 2439 | } |
| 2440 | OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker, |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 2441 | *cUnit->dex_file, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2442 | cUnit->code_item, cUnit->method_idx, |
| 2443 | cUnit->access_flags); |
| 2444 | // TODO: add a flag so we don't counts the stats for this twice |
| 2445 | uint32_t dexMethodIdx = mir->dalvikInsn.vB; |
| 2446 | int vtableIdx; |
| 2447 | uintptr_t directCode; |
| 2448 | uintptr_t directMethod; |
| 2449 | bool fastPath = |
| 2450 | cUnit->compiler->ComputeInvokeInfo(dexMethodIdx, &mUnit, type, |
| 2451 | vtableIdx, directCode, |
| 2452 | directMethod) && |
| 2453 | !SLOW_INVOKE_PATH; |
| 2454 | return (((type == kDirect) || (type == kStatic)) && |
| 2455 | fastPath && ((directCode == 0) || (directMethod == 0))); |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 2456 | } |
| 2457 | |
| 2458 | /* |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2459 | * Count uses, weighting by loop nesting depth. This code only |
| 2460 | * counts explicitly used sRegs. A later phase will add implicit |
| 2461 | * counts for things such as Method*, null-checked references, etc. |
| 2462 | */ |
| 2463 | bool countUses(struct CompilationUnit* cUnit, struct BasicBlock* bb) |
| 2464 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2465 | if (bb->blockType != kDalvikByteCode) { |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2466 | return false; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2467 | } |
| 2468 | for (MIR* mir = bb->firstMIRInsn; (mir != NULL); mir = mir->next) { |
| 2469 | if (mir->ssaRep == NULL) { |
| 2470 | continue; |
| 2471 | } |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2472 | uint32_t weight = std::min(16U, static_cast<uint32_t>(bb->nestingDepth)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2473 | for (int i = 0; i < mir->ssaRep->numUses; i++) { |
| 2474 | int sReg = mir->ssaRep->uses[i]; |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2475 | DCHECK_LT(sReg, static_cast<int>(cUnit->useCounts.numUsed)); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2476 | cUnit->rawUseCounts.elemList[sReg]++; |
| 2477 | cUnit->useCounts.elemList[sReg] += (1 << weight); |
| 2478 | } |
| 2479 | if (!(cUnit->disableOpt & (1 << kPromoteCompilerTemps))) { |
| 2480 | int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode]; |
| 2481 | // Implicit use of Method* ? */ |
| 2482 | if (dfAttributes & DF_UMS) { |
| 2483 | /* |
| 2484 | * Some invokes will not use Method* - need to perform test similar |
| 2485 | * to that found in genInvoke() to decide whether to count refs |
| 2486 | * for Method* on invoke-class opcodes. |
| 2487 | * TODO: refactor for common test here, save results for genInvoke |
| 2488 | */ |
| 2489 | int usesMethodStar = true; |
| 2490 | if ((dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) && |
| 2491 | !(dfAttributes & DF_NON_NULL_RET)) { |
| 2492 | usesMethodStar &= invokeUsesMethodStar(cUnit, mir); |
| 2493 | } |
| 2494 | if (usesMethodStar) { |
| 2495 | cUnit->rawUseCounts.elemList[cUnit->methodSReg]++; |
| 2496 | cUnit->useCounts.elemList[cUnit->methodSReg] += (1 << weight); |
| 2497 | } |
| 2498 | } |
| 2499 | } |
| 2500 | } |
| 2501 | return false; |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | void oatMethodUseCount(CompilationUnit *cUnit) |
| 2505 | { |
buzbee | cbd6d44 | 2012-11-17 14:11:25 -0800 | [diff] [blame^] | 2506 | oatInitGrowableList(cUnit, &cUnit->useCounts, cUnit->numSSARegs + 32, kListMisc); |
| 2507 | oatInitGrowableList(cUnit, &cUnit->rawUseCounts, cUnit->numSSARegs + 32, kListMisc); |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 2508 | // Initialize list |
| 2509 | for (int i = 0; i < cUnit->numSSARegs; i++) { |
| 2510 | oatInsertGrowableList(cUnit, &cUnit->useCounts, 0); |
| 2511 | oatInsertGrowableList(cUnit, &cUnit->rawUseCounts, 0); |
| 2512 | } |
| 2513 | if (cUnit->disableOpt & (1 << kPromoteRegs)) { |
| 2514 | return; |
| 2515 | } |
| 2516 | oatDataFlowAnalysisDispatcher(cUnit, countUses, |
| 2517 | kAllNodes, false /* isIterative */); |
buzbee | 239c4e7 | 2012-03-16 08:42:29 -0700 | [diff] [blame] | 2518 | } |
| 2519 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 2520 | } // namespace art |