Another step towards a Mips target

Updating the MIPS target to use the now common codegen routines.
Still much to do, but the general structure is sufficient to allow
work to begin on the other target.

Change-Id: I0d288fdfb59c8e76fad73185fdd56b345e87b604
diff --git a/src/compiler/codegen/arm/ArchUtility.cc b/src/compiler/codegen/arm/ArchUtility.cc
index e1eba44..be6b44d 100644
--- a/src/compiler/codegen/arm/ArchUtility.cc
+++ b/src/compiler/codegen/arm/ArchUtility.cc
@@ -321,180 +321,5 @@
     }
 }
 
-/*
- * Debugging macros
- */
-#define DUMP_RESOURCE_MASK(X)
-#define DUMP_SSA_REP(X)
-
-/* Pretty-print a LIR instruction */
-void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr)
-{
-    LIR* lir = (LIR*) arg;
-    int offset = lir->offset;
-    int dest = lir->operands[0];
-    const bool dumpNop = false;
-
-    /* Handle pseudo-ops individually, and all regular insns as a group */
-    switch(lir->opcode) {
-        case kPseudoMethodEntry:
-            LOG(INFO) << "-------- method entry " <<
-                PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
-            break;
-        case kPseudoMethodExit:
-            LOG(INFO) << "-------- Method_Exit";
-            break;
-        case kPseudoBarrier:
-            LOG(INFO) << "-------- BARRIER";
-            break;
-        case kPseudoExtended:
-            LOG(INFO) << "-------- " << (char* ) dest;
-            break;
-        case kPseudoSSARep:
-            DUMP_SSA_REP(LOG(INFO) << "-------- kMirOpPhi: " <<  (char* ) dest);
-            break;
-        case kPseudoEntryBlock:
-            LOG(INFO) << "-------- entry offset: 0x" << std::hex << dest;
-            break;
-        case kPseudoDalvikByteCodeBoundary:
-            LOG(INFO) << "-------- dalvik offset: 0x" << std::hex <<
-                 lir->dalvikOffset << " @ " << (char* )lir->operands[0];
-            break;
-        case kPseudoExitBlock:
-            LOG(INFO) << "-------- exit offset: 0x" << std::hex << dest;
-            break;
-        case kPseudoPseudoAlign4:
-            LOG(INFO) << (intptr_t)baseAddr + offset << " (0x" << std::hex <<
-                offset << "): .align4";
-            break;
-        case kPseudoEHBlockLabel:
-            LOG(INFO) << "Exception_Handling:";
-            break;
-        case kPseudoTargetLabel:
-        case kPseudoNormalBlockLabel:
-            LOG(INFO) << "L" << (intptr_t)lir << ":";
-            break;
-        case kPseudoThrowTarget:
-            LOG(INFO) << "LT" << (intptr_t)lir << ":";
-            break;
-        case kPseudoSuspendTarget:
-            LOG(INFO) << "LS" << (intptr_t)lir << ":";
-            break;
-        case kPseudoCaseLabel:
-            LOG(INFO) << "LC" << (intptr_t)lir << ": Case target 0x" <<
-                std::hex << lir->operands[0] << "|" << std::dec <<
-                lir->operands[0];
-            break;
-        default:
-            if (lir->flags.isNop && !dumpNop) {
-                break;
-            } else {
-                std::string op_name(buildInsnString(EncodingMap[lir->opcode].name, lir, baseAddr));
-                std::string op_operands(buildInsnString(EncodingMap[lir->opcode].fmt, lir, baseAddr));
-                LOG(INFO) << StringPrintf("%p (%04x): %-9s%s%s", baseAddr + offset, offset,
-                    op_name.c_str(), op_operands.c_str(), lir->flags.isNop ? "(nop)" : "");
-            }
-            break;
-    }
-
-    if (lir->useMask && (!lir->flags.isNop || dumpNop)) {
-        DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir,
-                                               lir->useMask, "use"));
-    }
-    if (lir->defMask && (!lir->flags.isNop || dumpNop)) {
-        DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir,
-                                               lir->defMask, "def"));
-    }
-}
-
-void oatDumpPromotionMap(CompilationUnit *cUnit)
-{
-    for (int i = 0; i < cUnit->numDalvikRegisters; i++) {
-        PromotionMap vRegMap = cUnit->promotionMap[i];
-        char buf[100];
-        if (vRegMap.fpLocation == kLocPhysReg) {
-            snprintf(buf, 100, " : s%d", vRegMap.fpReg & FP_REG_MASK);
-        } else {
-            buf[0] = 0;
-        }
-        char buf2[100];
-        snprintf(buf2, 100, "V[%02d] -> %s%d%s", i,
-                 vRegMap.coreLocation == kLocPhysReg ?
-                 "r" : "SP+", vRegMap.coreLocation == kLocPhysReg ?
-                 vRegMap.coreReg : oatSRegOffset(cUnit, i), buf);
-        LOG(INFO) << buf2;
-    }
-}
-
-void oatDumpFullPromotionMap(CompilationUnit *cUnit)
-{
-    for (int i = 0; i < cUnit->numDalvikRegisters; i++) {
-        PromotionMap vRegMap = cUnit->promotionMap[i];
-        LOG(INFO) << i << " -> " << "CL:" << (int)vRegMap.coreLocation <<
-            ", CR:" << (int)vRegMap.coreReg << ", FL:" <<
-            (int)vRegMap.fpLocation << ", FR:" << (int)vRegMap.fpReg <<
-            ", - " << (int)vRegMap.firstInPair;
-    }
-}
-
-/* Dump instructions and constant pool contents */
-void oatCodegenDump(CompilationUnit* cUnit)
-{
-    LOG(INFO) << "/*";
-    LOG(INFO) << "Dumping LIR insns for "
-        << PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
-    LIR* lirInsn;
-    LIR* armLIR;
-    int insnsSize = cUnit->insnsSize;
-
-    LOG(INFO) << "Regs (excluding ins) : " << cUnit->numRegs;
-    LOG(INFO) << "Ins                  : " << cUnit->numIns;
-    LOG(INFO) << "Outs                 : " << cUnit->numOuts;
-    LOG(INFO) << "CoreSpills           : " << cUnit->numCoreSpills;
-    LOG(INFO) << "FPSpills             : " << cUnit->numFPSpills;
-    LOG(INFO) << "Padding              : " << cUnit->numPadding;
-    LOG(INFO) << "Frame size           : " << cUnit->frameSize;
-    LOG(INFO) << "Start of ins         : " << cUnit->insOffset;
-    LOG(INFO) << "Start of regs        : " << cUnit->regsOffset;
-    LOG(INFO) << "code size is " << cUnit->totalSize <<
-        " bytes, Dalvik size is " << insnsSize * 2;
-    LOG(INFO) << "expansion factor: " <<
-         (float)cUnit->totalSize / (float)(insnsSize * 2);
-    oatDumpPromotionMap(cUnit);
-    for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) {
-        oatDumpLIRInsn(cUnit, lirInsn, 0);
-    }
-    for (lirInsn = cUnit->classPointerList; lirInsn; lirInsn = lirInsn->next) {
-        armLIR = (LIR*) lirInsn;
-        LOG(INFO) << StringPrintf("%x (%04x): .class (%s)",
-            armLIR->offset, armLIR->offset,
-            ((CallsiteInfo *) armLIR->operands[0])->classDescriptor);
-    }
-    for (lirInsn = cUnit->literalList; lirInsn; lirInsn = lirInsn->next) {
-        armLIR = (LIR*) lirInsn;
-        LOG(INFO) << StringPrintf("%x (%04x): .word (%#x)",
-            armLIR->offset, armLIR->offset, armLIR->operands[0]);
-    }
-
-    const DexFile::MethodId& method_id =
-        cUnit->dex_file->GetMethodId(cUnit->method_idx);
-    std::string signature(cUnit->dex_file->GetMethodSignature(method_id));
-    std::string name(cUnit->dex_file->GetMethodName(method_id));
-    std::string descriptor(cUnit->dex_file->GetMethodDeclaringClassDescriptor(method_id));
-
-    // Dump mapping table
-    if (cUnit->mappingTable.size() > 0) {
-        std::string line(StringPrintf("\n    MappingTable %s%s_%s_mappingTable[%zu] = {",
-            descriptor.c_str(), name.c_str(), signature.c_str(), cUnit->mappingTable.size()));
-        std::replace(line.begin(), line.end(), ';', '_');
-        LOG(INFO) << line;
-        for (uint32_t i = 0; i < cUnit->mappingTable.size(); i+=2) {
-            line = StringPrintf("        {0x%08x, 0x%04x},",
-                cUnit->mappingTable[i], cUnit->mappingTable[i+1]);
-            LOG(INFO) << line;
-        }
-        LOG(INFO) <<"    };\n\n";
-    }
-}
 
 }  // namespace art
diff --git a/src/compiler/codegen/arm/ArmLIR.h b/src/compiler/codegen/arm/ArmLIR.h
index 196bddb..e4e9eb8 100644
--- a/src/compiler/codegen/arm/ArmLIR.h
+++ b/src/compiler/codegen/arm/ArmLIR.h
@@ -745,22 +745,6 @@
 
 extern const ArmEncodingMap EncodingMap[kArmLast];
 
-typedef struct SwitchTable {
-    int offset;
-    const u2* table;            // Original dex table
-    int vaddr;                  // Dalvik offset of switch opcode
-    LIR* bxInst;                // Switch indirect branch instruction
-    LIR** targets;              // Array of case targets
-} SwitchTable;
-
-typedef struct FillArrayData {
-    int offset;
-    const u2* table;           // Original dex table
-    int size;
-    int vaddr;                 // Dalvik offset of OP_FILL_ARRAY_DATA opcode
-} FillArrayData;
-
-
 }  // namespace art
 
 #endif  // ART_SRC_COMPILER_CODEGEN_ARM_ARMLIR_H_
diff --git a/src/compiler/codegen/arm/ArmRallocUtil.cc b/src/compiler/codegen/arm/ArmRallocUtil.cc
index a020687..d44d7cf 100644
--- a/src/compiler/codegen/arm/ArmRallocUtil.cc
+++ b/src/compiler/codegen/arm/ArmRallocUtil.cc
@@ -116,6 +116,22 @@
     oatClobber(cUnit, r3);
     oatClobber(cUnit, r12);
     oatClobber(cUnit, r14lr);
+    oatClobber(cUnit, fr0);
+    oatClobber(cUnit, fr1);
+    oatClobber(cUnit, fr2);
+    oatClobber(cUnit, fr3);
+    oatClobber(cUnit, fr4);
+    oatClobber(cUnit, fr5);
+    oatClobber(cUnit, fr6);
+    oatClobber(cUnit, fr7);
+    oatClobber(cUnit, fr8);
+    oatClobber(cUnit, fr9);
+    oatClobber(cUnit, fr10);
+    oatClobber(cUnit, fr11);
+    oatClobber(cUnit, fr12);
+    oatClobber(cUnit, fr13);
+    oatClobber(cUnit, fr14);
+    oatClobber(cUnit, fr15);
 }
 
 extern RegLocation oatGetReturnWide(CompilationUnit* cUnit)
diff --git a/src/compiler/codegen/arm/Codegen.h b/src/compiler/codegen/arm/Codegen.h
index a565cb1..49e39db 100644
--- a/src/compiler/codegen/arm/Codegen.h
+++ b/src/compiler/codegen/arm/Codegen.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.