Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "Dalvik.h" |
| 18 | #include "vm/compiler/CompilerInternals.h" |
Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 19 | #include "ArmLIR.h" |
Ben Cheng | 5d90c20 | 2009-11-22 23:31:11 -0800 | [diff] [blame^] | 20 | #include "Codegen.h" |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 21 | |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 22 | #define DEBUG_OPT(X) |
| 23 | |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 24 | ArmLIR* dvmCompilerGenCopy(CompilationUnit *cUnit, int rDest, int rSrc); |
| 25 | |
| 26 | /* Is this a Dalvik register access? */ |
| 27 | static inline bool isDalvikLoad(ArmLIR *lir) |
| 28 | { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 29 | return (lir->useMask != ~0ULL) && (lir->useMask & ENCODE_DALVIK_REG); |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | static inline bool isDalvikStore(ArmLIR *lir) |
| 33 | { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 34 | return (lir->defMask != ~0ULL) && (lir->defMask & ENCODE_DALVIK_REG); |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Ben Cheng | a4aaf68 | 2009-09-30 22:53:44 -0700 | [diff] [blame] | 37 | static inline bool isDalvikRegisterClobbered(ArmLIR *lir1, ArmLIR *lir2) |
Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 38 | { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 39 | int reg1Lo = DECODE_ALIAS_INFO_REG(lir1->aliasInfo); |
| 40 | int reg1Hi = reg1Lo + DECODE_ALIAS_INFO_WIDE(lir1->aliasInfo); |
| 41 | int reg2Lo = DECODE_ALIAS_INFO_REG(lir2->aliasInfo); |
| 42 | int reg2Hi = reg2Lo + DECODE_ALIAS_INFO_WIDE(lir2->aliasInfo); |
| 43 | |
Ben Cheng | a4aaf68 | 2009-09-30 22:53:44 -0700 | [diff] [blame] | 44 | return (reg1Lo == reg2Lo) || (reg1Lo == reg2Hi) || (reg1Hi == reg2Lo); |
Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 45 | } |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 46 | |
| 47 | static void dumpDependentInsnPair(ArmLIR *thisLIR, ArmLIR *checkLIR, |
| 48 | const char *optimization) |
| 49 | { |
| 50 | LOGD("************ %s ************", optimization); |
| 51 | dvmDumpLIRInsn((LIR *) thisLIR, 0); |
| 52 | dvmDumpLIRInsn((LIR *) checkLIR, 0); |
| 53 | } |
| 54 | |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 55 | /* |
| 56 | * Perform a pass of top-down walk to |
| 57 | * 1) Eliminate redundant loads and stores |
| 58 | * 2) Sink stores to latest possible slot |
| 59 | */ |
| 60 | static void applyLoadStoreElimination(CompilationUnit *cUnit, |
Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 61 | ArmLIR *headLIR, |
| 62 | ArmLIR *tailLIR) |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 63 | { |
Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 64 | ArmLIR *thisLIR; |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 65 | |
| 66 | cUnit->optRound++; |
| 67 | for (thisLIR = headLIR; |
| 68 | thisLIR != tailLIR; |
| 69 | thisLIR = NEXT_LIR(thisLIR)) { |
| 70 | /* Skip newly added instructions */ |
| 71 | if (thisLIR->age >= cUnit->optRound) { |
| 72 | continue; |
| 73 | } |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 74 | if (isDalvikStore(thisLIR)) { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 75 | int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo); |
| 76 | int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo); |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 77 | int nativeRegId = thisLIR->operands[0]; |
Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 78 | ArmLIR *checkLIR; |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 79 | int sinkDistance = 0; |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 80 | /* |
| 81 | * Add r15 (pc) to the mask to prevent this instruction |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 82 | * from sinking past branch instructions. Unset the Dalvik register |
| 83 | * bit when checking with native resource constraints. |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 84 | */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 85 | u8 stopMask = (ENCODE_REG_PC | thisLIR->useMask) & |
| 86 | ~ENCODE_DALVIK_REG; |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 87 | |
| 88 | for (checkLIR = NEXT_LIR(thisLIR); |
| 89 | checkLIR != tailLIR; |
| 90 | checkLIR = NEXT_LIR(checkLIR)) { |
| 91 | |
| 92 | /* Check if a Dalvik register load is redundant */ |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 93 | if (isDalvikLoad(checkLIR) && |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 94 | (checkLIR->aliasInfo == thisLIR->aliasInfo) && |
| 95 | (REGTYPE(checkLIR->operands[0]) == REGTYPE(nativeRegId))) { |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 96 | /* Insert a move to replace the load */ |
| 97 | if (checkLIR->operands[0] != nativeRegId) { |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 98 | ArmLIR *moveLIR; |
Ben Cheng | 5d90c20 | 2009-11-22 23:31:11 -0800 | [diff] [blame^] | 99 | moveLIR = dvmCompilerRegCopyNoInsert( |
| 100 | cUnit, checkLIR->operands[0], nativeRegId); |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 101 | /* |
| 102 | * Insertion is guaranteed to succeed since checkLIR |
| 103 | * is never the first LIR on the list |
| 104 | */ |
| 105 | dvmCompilerInsertLIRBefore((LIR *) checkLIR, |
| 106 | (LIR *) moveLIR); |
| 107 | } |
| 108 | checkLIR->isNop = true; |
| 109 | continue; |
| 110 | |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 111 | /* |
| 112 | * Found a true output dependency - nuke the previous store. |
| 113 | * The register type doesn't matter here. |
| 114 | */ |
Bill Buzbee | 7ea0f64 | 2009-08-10 17:06:51 -0700 | [diff] [blame] | 115 | } else if (isDalvikStore(checkLIR) && |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 116 | (checkLIR->aliasInfo == thisLIR->aliasInfo)) { |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 117 | thisLIR->isNop = true; |
| 118 | break; |
| 119 | /* Find out the latest slot that the store can be sunk into */ |
| 120 | } else { |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 121 | /* Last instruction reached */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 122 | bool stopHere = (NEXT_LIR(checkLIR) == tailLIR); |
Bill Buzbee | a4a7f07 | 2009-08-27 13:58:09 -0700 | [diff] [blame] | 123 | |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 124 | /* Store data is clobbered */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 125 | stopHere |= ((stopMask & checkLIR->defMask) != 0); |
| 126 | |
| 127 | /* Store data partially clobbers the Dalvik register */ |
| 128 | if (stopHere == false && |
| 129 | ((checkLIR->useMask | checkLIR->defMask) & |
| 130 | ENCODE_DALVIK_REG)) { |
Ben Cheng | a4aaf68 | 2009-09-30 22:53:44 -0700 | [diff] [blame] | 131 | stopHere = isDalvikRegisterClobbered(thisLIR, checkLIR); |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 132 | } |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 133 | |
| 134 | /* Found a new place to put the store - move it here */ |
| 135 | if (stopHere == true) { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 136 | DEBUG_OPT(dumpDependentInsnPair(thisLIR, checkLIR, |
| 137 | "SINK STORE")); |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 138 | /* The store can be sunk for at least one cycle */ |
| 139 | if (sinkDistance != 0) { |
Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 140 | ArmLIR *newStoreLIR = |
| 141 | dvmCompilerNew(sizeof(ArmLIR), true); |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 142 | *newStoreLIR = *thisLIR; |
| 143 | newStoreLIR->age = cUnit->optRound; |
| 144 | /* |
| 145 | * Insertion is guaranteed to succeed since checkLIR |
| 146 | * is never the first LIR on the list |
| 147 | */ |
| 148 | dvmCompilerInsertLIRBefore((LIR *) checkLIR, |
| 149 | (LIR *) newStoreLIR); |
| 150 | thisLIR->isNop = true; |
| 151 | } |
| 152 | break; |
| 153 | } |
| 154 | |
| 155 | /* |
| 156 | * Saw a real instruction that the store can be sunk after |
| 157 | */ |
| 158 | if (!isPseudoOpCode(checkLIR->opCode)) { |
| 159 | sinkDistance++; |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 167 | static void applyLoadHoisting(CompilationUnit *cUnit, |
| 168 | ArmLIR *headLIR, |
| 169 | ArmLIR *tailLIR) |
| 170 | { |
| 171 | ArmLIR *thisLIR; |
| 172 | |
| 173 | cUnit->optRound++; |
| 174 | for (thisLIR = headLIR; |
| 175 | thisLIR != tailLIR; |
| 176 | thisLIR = NEXT_LIR(thisLIR)) { |
| 177 | /* Skip newly added instructions */ |
| 178 | if (thisLIR->age >= cUnit->optRound || |
| 179 | thisLIR->isNop == true) { |
| 180 | continue; |
| 181 | } |
| 182 | if (isDalvikLoad(thisLIR)) { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 183 | int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo); |
| 184 | int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo); |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 185 | int nativeRegId = thisLIR->operands[0]; |
| 186 | ArmLIR *checkLIR; |
| 187 | int hoistDistance = 0; |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 188 | u8 stopUseMask = (ENCODE_REG_PC | thisLIR->useMask) & |
| 189 | ~ENCODE_DALVIK_REG; |
| 190 | u8 stopDefMask = thisLIR->defMask & ~ENCODE_DALVIK_REG; |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 191 | |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 192 | /* First check if the load can be completely elinimated */ |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 193 | for (checkLIR = PREV_LIR(thisLIR); |
| 194 | checkLIR != headLIR; |
| 195 | checkLIR = PREV_LIR(checkLIR)) { |
| 196 | |
| 197 | if (checkLIR->isNop) continue; |
| 198 | |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 199 | /* |
| 200 | * Check if the Dalvik register is previously accessed |
| 201 | * with exactly the same type. |
| 202 | */ |
| 203 | if ((isDalvikLoad(checkLIR) || isDalvikStore(checkLIR)) && |
| 204 | (checkLIR->aliasInfo == thisLIR->aliasInfo) && |
| 205 | (checkLIR->operands[0] == nativeRegId)) { |
| 206 | /* |
| 207 | * If it is previously accessed but with a different type, |
| 208 | * the search will terminate later at the point checking |
| 209 | * for partially overlapping stores. |
| 210 | */ |
| 211 | thisLIR->isNop = true; |
| 212 | break; |
| 213 | } |
| 214 | |
| 215 | /* |
| 216 | * No earlier use/def can reach this load if: |
| 217 | * 1) Head instruction is reached |
| 218 | * 2) load target register is clobbered |
| 219 | * 3) A branch is seen (stopUseMask has the PC bit set). |
| 220 | */ |
| 221 | if ((checkLIR == headLIR) || |
| 222 | (stopUseMask | stopDefMask) & checkLIR->defMask) { |
| 223 | break; |
| 224 | } |
| 225 | |
| 226 | /* Store data partially clobbers the Dalvik register */ |
| 227 | if (isDalvikStore(checkLIR) && |
Ben Cheng | a4aaf68 | 2009-09-30 22:53:44 -0700 | [diff] [blame] | 228 | isDalvikRegisterClobbered(thisLIR, checkLIR)) { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 229 | break; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /* The load has been eliminated */ |
| 234 | if (thisLIR->isNop) continue; |
| 235 | |
| 236 | /* |
| 237 | * The load cannot be eliminated. See if it can be hoisted to an |
| 238 | * earlier spot. |
| 239 | */ |
| 240 | for (checkLIR = PREV_LIR(thisLIR); |
| 241 | /* empty by intention */; |
| 242 | checkLIR = PREV_LIR(checkLIR)) { |
| 243 | |
| 244 | if (checkLIR->isNop) continue; |
| 245 | |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 246 | /* Check if the current load is redundant */ |
| 247 | if ((isDalvikLoad(checkLIR) || isDalvikStore(checkLIR)) && |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 248 | (checkLIR->aliasInfo == thisLIR->aliasInfo) && |
| 249 | (REGTYPE(checkLIR->operands[0]) == REGTYPE(nativeRegId))) { |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 250 | /* Insert a move to replace the load */ |
| 251 | if (checkLIR->operands[0] != nativeRegId) { |
| 252 | ArmLIR *moveLIR; |
Ben Cheng | 5d90c20 | 2009-11-22 23:31:11 -0800 | [diff] [blame^] | 253 | moveLIR = dvmCompilerRegCopyNoInsert( |
| 254 | cUnit, nativeRegId, checkLIR->operands[0]); |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 255 | /* |
| 256 | * Convert *thisLIR* load into a move |
| 257 | */ |
| 258 | dvmCompilerInsertLIRAfter((LIR *) checkLIR, |
| 259 | (LIR *) moveLIR); |
| 260 | } |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 261 | thisLIR->isNop = true; |
| 262 | break; |
| 263 | |
| 264 | /* Find out if the load can be yanked past the checkLIR */ |
| 265 | } else { |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 266 | /* Last instruction reached */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 267 | bool stopHere = (checkLIR == headLIR); |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 268 | |
| 269 | /* Base address is clobbered by checkLIR */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 270 | stopHere |= ((stopUseMask & checkLIR->defMask) != 0); |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 271 | |
| 272 | /* Load target clobbers use/def in checkLIR */ |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 273 | stopHere |= ((stopDefMask & |
| 274 | (checkLIR->useMask | checkLIR->defMask)) != 0); |
| 275 | |
| 276 | /* Store data partially clobbers the Dalvik register */ |
| 277 | if (stopHere == false && |
| 278 | (checkLIR->defMask & ENCODE_DALVIK_REG)) { |
Ben Cheng | a4aaf68 | 2009-09-30 22:53:44 -0700 | [diff] [blame] | 279 | stopHere = isDalvikRegisterClobbered(thisLIR, checkLIR); |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | /* |
| 283 | * Stop at an earlier Dalvik load if the offset of checkLIR |
| 284 | * is not less than thisLIR |
| 285 | * |
| 286 | * Experiments show that doing |
| 287 | * |
| 288 | * ldr r1, [r5, #16] |
| 289 | * ldr r0, [r5, #20] |
| 290 | * |
| 291 | * is much faster than |
| 292 | * |
| 293 | * ldr r0, [r5, #20] |
| 294 | * ldr r1, [r5, #16] |
| 295 | */ |
| 296 | if (isDalvikLoad(checkLIR)) { |
| 297 | int dRegId2 = |
| 298 | DECODE_ALIAS_INFO_REG(checkLIR->aliasInfo); |
| 299 | if (dRegId2 <= dRegId) { |
| 300 | stopHere = true; |
| 301 | } |
| 302 | } |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 303 | |
| 304 | /* Found a new place to put the load - move it here */ |
| 305 | if (stopHere == true) { |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 306 | DEBUG_OPT(dumpDependentInsnPair(thisLIR, checkLIR, |
| 307 | "HOIST LOAD")); |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 308 | /* The store can be hoisted for at least one cycle */ |
| 309 | if (hoistDistance != 0) { |
| 310 | ArmLIR *newLoadLIR = |
| 311 | dvmCompilerNew(sizeof(ArmLIR), true); |
| 312 | *newLoadLIR = *thisLIR; |
| 313 | newLoadLIR->age = cUnit->optRound; |
| 314 | /* |
| 315 | * Insertion is guaranteed to succeed since checkLIR |
| 316 | * is never the first LIR on the list |
| 317 | */ |
| 318 | dvmCompilerInsertLIRAfter((LIR *) checkLIR, |
| 319 | (LIR *) newLoadLIR); |
| 320 | thisLIR->isNop = true; |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 321 | } |
| 322 | break; |
| 323 | } |
| 324 | |
| 325 | /* |
Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 326 | * Saw a real instruction that hosting the load is |
| 327 | * beneficial |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 328 | */ |
| 329 | if (!isPseudoOpCode(checkLIR->opCode)) { |
| 330 | hoistDistance++; |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 338 | void dvmCompilerApplyLocalOptimizations(CompilationUnit *cUnit, LIR *headLIR, |
| 339 | LIR *tailLIR) |
| 340 | { |
Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 341 | if (!(gDvmJit.disableOpt & (1 << kLoadStoreElimination))) { |
| 342 | applyLoadStoreElimination(cUnit, (ArmLIR *) headLIR, |
| 343 | (ArmLIR *) tailLIR); |
| 344 | } |
| 345 | if (!(gDvmJit.disableOpt & (1 << kLoadHoisting))) { |
| 346 | applyLoadHoisting(cUnit, (ArmLIR *) headLIR, (ArmLIR *) tailLIR); |
| 347 | } |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 348 | } |