ArchUtility.cpp revision a8b91c52fd8a90b784835dfe1f8898035266c4dd
10dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer/*
20dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * Copyright (C) 2009 The Android Open Source Project
30dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer *
40dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * Licensed under the Apache License, Version 2.0 (the "License");
50dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * you may not use this file except in compliance with the License.
60dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * You may obtain a copy of the License at
70dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer *
80dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer *      http://www.apache.org/licenses/LICENSE-2.0
90dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer *
100dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * Unless required by applicable law or agreed to in writing, software
110dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * distributed under the License is distributed on an "AS IS" BASIS,
120dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * See the License for the specific language governing permissions and
140dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer * limitations under the License.
150dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer */
160dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer
170dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer#include "../../CompilerInternals.h"
180dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer#include "libdex/DexOpcodes.h"
190dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer#include "MipsLIR.h"
200dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer
210dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer/* For dumping instructions */
220dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer#define MIPS_REG_COUNT 32
230dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischerstatic const char *mipsRegName[MIPS_REG_COUNT] = {
240dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer    "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
259cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer    "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
260dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer    "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
270dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer    "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
289cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer};
292ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer
3080bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer/*
3180bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer * Interpret a format string and build a string no longer than size
3280bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer * See format key in Assemble.c.
330dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer */
340dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischerstatic void buildInsnString(const char *fmt, MipsLIR *lir, char* buf,
350dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                            unsigned char *baseAddr, int size)
362ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer{
372ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer    int i;
382ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer    char *bufEnd = &buf[size-1];
392ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer    const char *fmtEnd = &fmt[strlen(fmt)];
402ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer    char tbuf[256];
4180bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer    char nc;
429cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer    while (fmt < fmtEnd) {
439cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer        int operand;
449cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer        if (*fmt == '!') {
459cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer            fmt++;
462ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer            assert(fmt < fmtEnd);
472ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer            nc = *fmt++;
482ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer            if (nc=='!') {
492ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                strcpy(tbuf, "!");
502ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer            } else {
5180bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer               assert(fmt < fmtEnd);
529cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer               assert((unsigned)(nc-'0') < 4);
5380bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer               operand = lir->operands[nc-'0'];
5480bcf30dd6dabb56076c7dc246eaa54fd43d783cEric Fischer               switch(*fmt++) {
550dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                   case 'b':
560dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       strcpy(tbuf,"0000");
570dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       for (i=3; i>= 0; i--) {
580dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           tbuf[i] += operand & 1;
590dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           operand >>= 1;
602ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       }
619cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       break;
629cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                   case 's':
639cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       sprintf(tbuf,"$f%d",operand & FP_REG_MASK);
649eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       break;
659eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                   case 'S':
669eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer		       assert(((operand & FP_REG_MASK) & 1) == 0);
679eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       sprintf(tbuf,"$f%d",operand & FP_REG_MASK);
689eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       break;
699eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                   case 'h':
709eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       sprintf(tbuf,"%04x", operand);
719eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       break;
729eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                   case 'M':
739eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                   case 'd':
749eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       sprintf(tbuf,"%d", operand);
759eb7e2c37f7d14daea64b6cc3183a9a8382a2209Eric Fischer                       break;
760dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                   case 'D':
770dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       sprintf(tbuf,"%d", operand+1);
782ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       break;
792ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                   case 'E':
802ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       sprintf(tbuf,"%d", operand*4);
810dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       break;
820dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                   case 'F':
830dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       sprintf(tbuf,"%d", operand*2);
840dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       break;
850dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                   case 'c':
860dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                       switch (operand) {
870dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           case kMipsCondEq:
880dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               strcpy(tbuf, "eq");
890dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               break;
900dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           case kMipsCondNe:
910dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               strcpy(tbuf, "ne");
920dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               break;
930dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           case kMipsCondLt:
940dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               strcpy(tbuf, "lt");
950dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               break;
960dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           case kMipsCondGe:
972ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               strcpy(tbuf, "ge");
982ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               break;
992ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                           case kMipsCondGt:
1002ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               strcpy(tbuf, "gt");
1012ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               break;
1022ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                           case kMipsCondLe:
1039cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               strcpy(tbuf, "le");
1040dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               break;
1050dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                           case kMipsCondCs:
1069cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               strcpy(tbuf, "cs");
1070dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer                               break;
1089cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                           case kMipsCondMi:
1099cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               strcpy(tbuf, "mi");
1109cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               break;
1112ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                           default:
1129cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               strcpy(tbuf, "");
1139cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               break;
11485427b3d8e25b36f8c0575d292348c861de40ed9Eric Fischer                       }
1159cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       break;
1162ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                   case 't':
1172ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       sprintf(tbuf,"0x%08x (L%p)",
1182ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               (int) baseAddr + lir->generic.offset + 4 +
1199cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                               (operand << 2),
1202ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                               lir->generic.target);
1219cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       break;
1222ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                   case 'T':
1232ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       sprintf(tbuf,"0x%08x",
12485427b3d8e25b36f8c0575d292348c861de40ed9Eric Fischer                               (int) (operand << 2));
1252ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       break;
1269cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                   case 'u': {
1279cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       int offset_1 = lir->operands[0];
1289cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       int offset_2 = NEXT_LIR(lir)->operands[0];
1299cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       intptr_t target =
1309cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                           ((((intptr_t) baseAddr + lir->generic.offset + 4) &
1312ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                            ~3) + (offset_1 << 21 >> 9) + (offset_2 << 1)) &
1322ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                           0xfffffffc;
1332ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       sprintf(tbuf, "%p", (void *) target);
1342ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       break;
1359cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                    }
1369cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer
1372ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                   /* Nothing to print for BLX_2 */
1389cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                   case 'v':
1399cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       strcpy(tbuf, "see above");
1402ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       break;
1419cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                   case 'r':
1429cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       assert(operand >= 0 && operand < MIPS_REG_COUNT);
1439cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       strcpy(tbuf, mipsRegName[operand]);
1449cfb874f7f7a5e109dd3f40df5f4778f13124851Eric Fischer                       break;
1452ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                   default:
1462ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       strcpy(tbuf,"DecodeError");
1472ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer                       break;
1482ca4e9ae8aaae5f30147f1b96fa27ae690cb4637Eric Fischer               }
1490dec431f187915c3e42f1c2afd2771e0bc91b14cEric Fischer               if (buf+strlen(tbuf) <= bufEnd) {
150                   strcpy(buf, tbuf);
151                   buf += strlen(tbuf);
152               } else {
153                   break;
154               }
155            }
156        } else {
157           *buf++ = *fmt++;
158        }
159        if (buf == bufEnd)
160            break;
161    }
162    *buf = 0;
163}
164
165void dvmDumpResourceMask(LIR *lir, u8 mask, const char *prefix)
166{
167    char buf[256];
168    buf[0] = 0;
169    MipsLIR *mipsLIR = (MipsLIR *) lir;
170
171    if (mask == ENCODE_ALL) {
172        strcpy(buf, "all");
173    } else {
174        char num[8];
175        int i;
176
177        for (i = 0; i < kRegEnd; i++) {
178            if (mask & (1ULL << i)) {
179                sprintf(num, "%d ", i);
180                strcat(buf, num);
181            }
182        }
183
184        if (mask & ENCODE_CCODE) {
185            strcat(buf, "cc ");
186        }
187        if (mask & ENCODE_FP_STATUS) {
188            strcat(buf, "fpcc ");
189        }
190        /* Memory bits */
191        if (mipsLIR && (mask & ENCODE_DALVIK_REG)) {
192            sprintf(buf + strlen(buf), "dr%d%s", mipsLIR->aliasInfo & 0xffff,
193                    (mipsLIR->aliasInfo & 0x80000000) ? "(+1)" : "");
194        }
195        if (mask & ENCODE_LITERAL) {
196            strcat(buf, "lit ");
197        }
198
199        if (mask & ENCODE_HEAP_REF) {
200            strcat(buf, "heap ");
201        }
202        if (mask & ENCODE_MUST_NOT_ALIAS) {
203            strcat(buf, "noalias ");
204        }
205    }
206    if (buf[0]) {
207        LOGD("%s: %s", prefix, buf);
208    }
209}
210
211/*
212 * Debugging macros
213 */
214#define DUMP_RESOURCE_MASK(X)
215#define DUMP_SSA_REP(X)
216
217/* Pretty-print a LIR instruction */
218void dvmDumpLIRInsn(LIR *arg, unsigned char *baseAddr)
219{
220    MipsLIR *lir = (MipsLIR *) arg;
221    char buf[256];
222    char opName[256];
223    int offset = lir->generic.offset;
224    int dest = lir->operands[0];
225    const bool dumpNop = false;
226
227    /* Handle pseudo-ops individually, and all regular insns as a group */
228    switch(lir->opcode) {
229        case kMipsChainingCellBottom:
230            LOGD("-------- end of chaining cells (0x%04x)", offset);
231            break;
232        case kMipsPseudoBarrier:
233            LOGD("-------- BARRIER");
234            break;
235        case kMipsPseudoExtended:
236            /* intentional fallthrough */
237        case kMipsPseudoSSARep:
238            DUMP_SSA_REP(LOGD("-------- %s", (char *) dest));
239            break;
240        case kMipsPseudoChainingCellBackwardBranch:
241            LOGD("L%p:", lir);
242            LOGD("-------- chaining cell (backward branch): 0x%04x", dest);
243            break;
244        case kMipsPseudoChainingCellNormal:
245            LOGD("L%p:", lir);
246            LOGD("-------- chaining cell (normal): 0x%04x", dest);
247            break;
248        case kMipsPseudoChainingCellHot:
249            LOGD("L%p:", lir);
250            LOGD("-------- chaining cell (hot): 0x%04x", dest);
251            break;
252        case kMipsPseudoChainingCellInvokePredicted:
253            LOGD("L%p:", lir);
254            LOGD("-------- chaining cell (predicted): %s%s",
255                 dest ? ((Method *) dest)->clazz->descriptor : "",
256                 dest ? ((Method *) dest)->name : "N/A");
257            break;
258        case kMipsPseudoChainingCellInvokeSingleton:
259            LOGD("L%p:", lir);
260            LOGD("-------- chaining cell (invoke singleton): %s%s/%p",
261                 ((Method *)dest)->clazz->descriptor,
262                 ((Method *)dest)->name,
263                 ((Method *)dest)->insns);
264            break;
265        case kMipsPseudoEntryBlock:
266            LOGD("-------- entry offset: 0x%04x", dest);
267            break;
268        case kMipsPseudoDalvikByteCodeBoundary:
269            LOGD("-------- dalvik offset: 0x%04x @ %s", dest,
270                 (char *) lir->operands[1]);
271            break;
272        case kMipsPseudoExitBlock:
273            LOGD("-------- exit offset: 0x%04x", dest);
274            break;
275        case kMipsPseudoPseudoAlign4:
276            LOGD("%p (%04x): .align4", baseAddr + offset, offset);
277            break;
278        case kMipsPseudoPCReconstructionCell:
279            LOGD("L%p:", lir);
280            LOGD("-------- reconstruct dalvik PC : 0x%04x @ +0x%04x", dest,
281                 lir->operands[1]);
282            break;
283        case kMipsPseudoPCReconstructionBlockLabel:
284            /* Do nothing */
285            break;
286        case kMipsPseudoEHBlockLabel:
287            LOGD("Exception_Handling:");
288            break;
289        case kMipsPseudoTargetLabel:
290        case kMipsPseudoNormalBlockLabel:
291            LOGD("L%p:", lir);
292            break;
293        default:
294            if (lir->flags.isNop && !dumpNop) {
295                break;
296            }
297            buildInsnString(EncodingMap[lir->opcode].name, lir, opName,
298                            baseAddr, 256);
299            buildInsnString(EncodingMap[lir->opcode].fmt, lir, buf, baseAddr,
300                            256);
301            LOGD("%p (%04x): %08x %-9s%s%s",
302                 baseAddr + offset, offset, *(u4 *)(baseAddr + offset), opName, buf,
303                 lir->flags.isNop ? "(nop)" : "");
304            break;
305    }
306
307    if (lir->useMask && (!lir->flags.isNop || dumpNop)) {
308        DUMP_RESOURCE_MASK(dvmDumpResourceMask((LIR *) lir,
309                                               lir->useMask, "use"));
310    }
311    if (lir->defMask && (!lir->flags.isNop || dumpNop)) {
312        DUMP_RESOURCE_MASK(dvmDumpResourceMask((LIR *) lir,
313                                               lir->defMask, "def"));
314    }
315}
316
317/* Dump instructions and constant pool contents */
318void dvmCompilerCodegenDump(CompilationUnit *cUnit)
319{
320    LOGD("Dumping LIR insns");
321    LIR *lirInsn;
322    MipsLIR *mipsLIR;
323
324    LOGD("installed code is at %p", cUnit->baseAddr);
325    LOGD("total size is %d bytes", cUnit->totalSize);
326    for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) {
327        dvmDumpLIRInsn(lirInsn, (unsigned char *) cUnit->baseAddr);
328    }
329    for (lirInsn = cUnit->classPointerList; lirInsn; lirInsn = lirInsn->next) {
330        mipsLIR = (MipsLIR *) lirInsn;
331        LOGD("%p (%04x): .class (%s)",
332             (char*)cUnit->baseAddr + mipsLIR->generic.offset,
333             mipsLIR->generic.offset,
334             ((CallsiteInfo *) mipsLIR->operands[0])->classDescriptor);
335    }
336    for (lirInsn = cUnit->literalList; lirInsn; lirInsn = lirInsn->next) {
337        mipsLIR = (MipsLIR *) lirInsn;
338        LOGD("%p (%04x): .word (%#x)",
339             (char*)cUnit->baseAddr + mipsLIR->generic.offset,
340             mipsLIR->generic.offset,
341             mipsLIR->operands[0]);
342    }
343}
344
345/* Target-specific cache flushing */
346int dvmCompilerCacheFlush(long start, long end, long flags)
347{
348    return cacheflush(start, end, flags);
349}
350
351/* Target-specific cache clearing */
352void dvmCompilerCacheClear(char *start, size_t size)
353{
354    /* 0x66 is an invalid opcode for mips. */
355    memset(start, 0x66, size);
356}
357