buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * This file contains x86-specific codegen factory support. |
| 19 | * It is included by |
| 20 | * |
| 21 | * Codegen-$(TARGET_ARCH_VARIANT).c |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | namespace art { |
| 26 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 27 | bool genAddLong(CompilationUnit* cUnit, RegLocation rlDest, |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 28 | RegLocation rlSrc1, RegLocation rlSrc2) |
| 29 | { |
| 30 | oatFlushAllRegs(cUnit); |
| 31 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 32 | loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); |
Ian Rogers | fc700ed | 2012-04-04 11:21:26 -0700 | [diff] [blame] | 33 | loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 34 | // Compute (r1:r0) = (r1:r0) + (r2:r3) |
| 35 | opRegReg(cUnit, kOpAdd, r0, r2); // r0 = r0 + r2 |
| 36 | opRegReg(cUnit, kOpAdc, r1, r3); // r1 = r1 + r3 + CF |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 37 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 38 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 39 | storeValueWide(cUnit, rlDest, rlResult); |
| 40 | return false; |
| 41 | } |
| 42 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 43 | bool genSubLong(CompilationUnit* cUnit, RegLocation rlDest, |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 44 | RegLocation rlSrc1, RegLocation rlSrc2) |
| 45 | { |
| 46 | oatFlushAllRegs(cUnit); |
| 47 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 48 | loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); |
Ian Rogers | fc700ed | 2012-04-04 11:21:26 -0700 | [diff] [blame] | 49 | loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 50 | // Compute (r1:r0) = (r1:r0) + (r2:r3) |
| 51 | opRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2 |
| 52 | opRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 53 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 54 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 55 | storeValueWide(cUnit, rlDest, rlResult); |
| 56 | return false; |
| 57 | } |
| 58 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 59 | bool genAndLong(CompilationUnit* cUnit, RegLocation rlDest, |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 60 | RegLocation rlSrc1, RegLocation rlSrc2) |
| 61 | { |
| 62 | oatFlushAllRegs(cUnit); |
| 63 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 64 | loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); |
Ian Rogers | fc700ed | 2012-04-04 11:21:26 -0700 | [diff] [blame] | 65 | loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 66 | // Compute (r1:r0) = (r1:r0) + (r2:r3) |
| 67 | opRegReg(cUnit, kOpAnd, r0, r2); // r0 = r0 - r2 |
| 68 | opRegReg(cUnit, kOpAnd, r1, r3); // r1 = r1 - r3 - CF |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 69 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 70 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 71 | storeValueWide(cUnit, rlDest, rlResult); |
| 72 | return false; |
| 73 | } |
| 74 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 75 | bool genOrLong(CompilationUnit* cUnit, RegLocation rlDest, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 76 | RegLocation rlSrc1, RegLocation rlSrc2) |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 77 | { |
| 78 | oatFlushAllRegs(cUnit); |
| 79 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 80 | loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); |
Ian Rogers | fc700ed | 2012-04-04 11:21:26 -0700 | [diff] [blame] | 81 | loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 82 | // Compute (r1:r0) = (r1:r0) + (r2:r3) |
| 83 | opRegReg(cUnit, kOpOr, r0, r2); // r0 = r0 - r2 |
| 84 | opRegReg(cUnit, kOpOr, r1, r3); // r1 = r1 - r3 - CF |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 85 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 86 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 87 | storeValueWide(cUnit, rlDest, rlResult); |
| 88 | return false; |
| 89 | } |
| 90 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 91 | bool genXorLong(CompilationUnit* cUnit, RegLocation rlDest, |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 92 | RegLocation rlSrc1, RegLocation rlSrc2) |
| 93 | { |
| 94 | oatFlushAllRegs(cUnit); |
| 95 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 96 | loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); |
Ian Rogers | fc700ed | 2012-04-04 11:21:26 -0700 | [diff] [blame] | 97 | loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 98 | // Compute (r1:r0) = (r1:r0) + (r2:r3) |
| 99 | opRegReg(cUnit, kOpXor, r0, r2); // r0 = r0 - r2 |
| 100 | opRegReg(cUnit, kOpXor, r1, r3); // r1 = r1 - r3 - CF |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 101 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 102 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 103 | storeValueWide(cUnit, rlDest, rlResult); |
| 104 | return false; |
| 105 | } |
| 106 | |
buzbee | 408ad16 | 2012-06-06 16:45:18 -0700 | [diff] [blame] | 107 | bool genNegLong(CompilationUnit* cUnit, RegLocation rlDest, |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 108 | RegLocation rlSrc) |
| 109 | { |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 110 | oatFlushAllRegs(cUnit); |
| 111 | oatLockCallTemps(cUnit); // Prepare for explicit register usage |
| 112 | loadValueDirectWideFixed(cUnit, rlSrc, r0, r1); |
| 113 | // Compute (r1:r0) = -(r1:r0) |
| 114 | opRegReg(cUnit, kOpNeg, r0, r0); // r0 = -r0 |
| 115 | opRegImm(cUnit, kOpAdc, r1, 0); // r1 = r1 + CF |
| 116 | opRegReg(cUnit, kOpNeg, r1, r1); // r1 = -r1 |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 117 | RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1, |
| 118 | INVALID_SREG, INVALID_SREG}; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 119 | storeValueWide(cUnit, rlDest, rlResult); |
| 120 | return false; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void genDebuggerUpdate(CompilationUnit* cUnit, int32_t offset); |
| 124 | |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 125 | void spillCoreRegs(CompilationUnit* cUnit) { |
| 126 | if (cUnit->numCoreSpills == 0) { |
| 127 | return; |
| 128 | } |
| 129 | // Spill mask not including fake return address register |
| 130 | uint32_t mask = cUnit->coreSpillMask & ~(1 << rRET); |
jeffhao | 703f2cd | 2012-07-13 17:25:52 -0700 | [diff] [blame] | 131 | int offset = cUnit->frameSize - (4 * cUnit->numCoreSpills); |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 132 | for (int reg = 0; mask; mask >>= 1, reg++) { |
| 133 | if (mask & 0x1) { |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 134 | storeWordDisp(cUnit, rSP, offset, reg); |
jeffhao | 703f2cd | 2012-07-13 17:25:52 -0700 | [diff] [blame] | 135 | offset += 4; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 136 | } |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 137 | } |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 138 | } |
| 139 | |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 140 | void unSpillCoreRegs(CompilationUnit* cUnit) { |
| 141 | if (cUnit->numCoreSpills == 0) { |
| 142 | return; |
| 143 | } |
| 144 | // Spill mask not including fake return address register |
| 145 | uint32_t mask = cUnit->coreSpillMask & ~(1 << rRET); |
jeffhao | 703f2cd | 2012-07-13 17:25:52 -0700 | [diff] [blame] | 146 | int offset = cUnit->frameSize - (4 * cUnit->numCoreSpills); |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 147 | for (int reg = 0; mask; mask >>= 1, reg++) { |
| 148 | if (mask & 0x1) { |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 149 | loadWordDisp(cUnit, rSP, offset, reg); |
jeffhao | 703f2cd | 2012-07-13 17:25:52 -0700 | [diff] [blame] | 150 | offset += 4; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 151 | } |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 152 | } |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | void opRegThreadMem(CompilationUnit* cUnit, OpKind op, int rDest, int threadOffset) { |
| 156 | X86OpCode opcode = kX86Bkpt; |
| 157 | switch (op) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 158 | case kOpCmp: opcode = kX86Cmp32RT; break; |
| 159 | default: |
| 160 | LOG(FATAL) << "Bad opcode: " << op; |
| 161 | break; |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 162 | } |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 163 | newLIR2(cUnit, opcode, rDest, threadOffset); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 164 | } |
| 165 | |
buzbee | ad8f15e | 2012-06-18 14:49:45 -0700 | [diff] [blame] | 166 | void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs, |
| 167 | RegLocation rlMethod) |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 168 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 169 | /* |
| 170 | * On entry, rARG0, rARG1, rARG2 are live. Let the register |
| 171 | * allocation mechanism know so it doesn't try to use any of them when |
| 172 | * expanding the frame or flushing. This leaves the utility |
| 173 | * code with no spare temps. |
| 174 | */ |
| 175 | oatLockTemp(cUnit, rARG0); |
| 176 | oatLockTemp(cUnit, rARG1); |
| 177 | oatLockTemp(cUnit, rARG2); |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 178 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 179 | /* Build frame, return address already on stack */ |
| 180 | opRegImm(cUnit, kOpSub, rSP, cUnit->frameSize - 4); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 181 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 182 | /* |
| 183 | * We can safely skip the stack overflow check if we're |
| 184 | * a leaf *and* our frame size < fudge factor. |
| 185 | */ |
| 186 | bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) && |
| 187 | ((size_t)cUnit->frameSize < |
| 188 | Thread::kStackOverflowReservedBytes)); |
| 189 | newLIR0(cUnit, kPseudoMethodEntry); |
| 190 | /* Spill core callee saves */ |
| 191 | spillCoreRegs(cUnit); |
| 192 | /* NOTE: promotion of FP regs currently unsupported, thus no FP spill */ |
| 193 | DCHECK_EQ(cUnit->numFPSpills, 0); |
| 194 | if (!skipOverflowCheck) { |
| 195 | // cmp rSP, fs:[stack_end_]; jcc throw_launchpad |
| 196 | LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kThrowStackOverflow, 0, 0, 0, 0); |
| 197 | opRegThreadMem(cUnit, kOpCmp, rSP, Thread::StackEndOffset().Int32Value()); |
| 198 | opCondBranch(cUnit, kCondUlt, tgt); |
| 199 | // Remember branch target - will process later |
| 200 | oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, (intptr_t)tgt); |
| 201 | } |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 202 | |
buzbee | ad8f15e | 2012-06-18 14:49:45 -0700 | [diff] [blame] | 203 | flushIns(cUnit, argLocs, rlMethod); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 204 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 205 | if (cUnit->genDebugger) { |
| 206 | // Refresh update debugger callout |
| 207 | UNIMPLEMENTED(WARNING) << "genDebugger"; |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 208 | #if 0 |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 209 | loadWordDisp(cUnit, rSELF, |
| 210 | OFFSETOF_MEMBER(Thread, pUpdateDebuggerFromCode), rSUSPEND); |
| 211 | genDebuggerUpdate(cUnit, DEBUGGER_METHOD_ENTRY); |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 212 | #endif |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 213 | } |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 214 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 215 | oatFreeTemp(cUnit, rARG0); |
| 216 | oatFreeTemp(cUnit, rARG1); |
| 217 | oatFreeTemp(cUnit, rARG2); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 218 | } |
| 219 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 220 | void genExitSequence(CompilationUnit* cUnit) { |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 221 | /* |
| 222 | * In the exit path, rRET0/rRET1 are live - make sure they aren't |
| 223 | * allocated by the register utilities as temps. |
| 224 | */ |
| 225 | oatLockTemp(cUnit, rRET0); |
| 226 | oatLockTemp(cUnit, rRET1); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 227 | |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 228 | newLIR0(cUnit, kPseudoMethodExit); |
| 229 | /* If we're compiling for the debugger, generate an update callout */ |
| 230 | if (cUnit->genDebugger) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 231 | genDebuggerUpdate(cUnit, DEBUGGER_METHOD_EXIT); |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 232 | } |
| 233 | unSpillCoreRegs(cUnit); |
| 234 | /* Remove frame except for return address */ |
| 235 | opRegImm(cUnit, kOpAdd, rSP, cUnit->frameSize - 4); |
| 236 | newLIR0(cUnit, kX86Ret); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /* |
| 240 | * Nop any unconditional branches that go to the next instruction. |
| 241 | * Note: new redundant branches may be inserted later, and we'll |
| 242 | * use a check in final instruction assembly to nop those out. |
| 243 | */ |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 244 | void removeRedundantBranches(CompilationUnit* cUnit) { |
| 245 | LIR* thisLIR; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 246 | |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 247 | for (thisLIR = (LIR*) cUnit->firstLIRInsn; |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 248 | thisLIR != (LIR*) cUnit->lastLIRInsn; |
| 249 | thisLIR = NEXT_LIR(thisLIR)) { |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 250 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 251 | /* Branch to the next instruction */ |
| 252 | if (thisLIR->opcode == kX86Jmp8 || thisLIR->opcode == kX86Jmp32) { |
| 253 | LIR* nextLIR = thisLIR; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 254 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 255 | while (true) { |
| 256 | nextLIR = NEXT_LIR(nextLIR); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 257 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 258 | /* |
| 259 | * Is the branch target the next instruction? |
| 260 | */ |
| 261 | if (nextLIR == (LIR*) thisLIR->target) { |
| 262 | thisLIR->flags.isNop = true; |
| 263 | break; |
| 264 | } |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 265 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 266 | /* |
| 267 | * Found real useful stuff between the branch and the target. |
| 268 | * Need to explicitly check the lastLIRInsn here because it |
| 269 | * might be the last real instruction. |
| 270 | */ |
| 271 | if (!isPseudoOpcode(nextLIR->opcode) || |
| 272 | (nextLIR = (LIR*) cUnit->lastLIRInsn)) |
| 273 | break; |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 274 | } |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 275 | } |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 276 | } |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | |
| 280 | /* Common initialization routine for an architecture family */ |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 281 | bool oatArchInit() { |
| 282 | int i; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 283 | |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 284 | for (i = 0; i < kX86Last; i++) { |
| 285 | if (EncodingMap[i].opcode != i) { |
| 286 | LOG(FATAL) << "Encoding order for " << EncodingMap[i].name |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 287 | << " is wrong: expecting " << i << ", seeing " |
| 288 | << (int)EncodingMap[i].opcode; |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 289 | } |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 290 | } |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 291 | |
Ian Rogers | f7d9ad3 | 2012-03-13 18:45:39 -0700 | [diff] [blame] | 292 | return oatArchVariantInit(); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | } // namespace art |