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