Refactor the compilers out of libart.

This builds three separate compilers and dynamically links with the right one
at runtime.

Change-Id: I59d22b9884f41de733c09f97e29ee290236d5f4b
diff --git a/src/compiler/codegen/CodegenFactory.cc b/src/compiler/codegen/CodegenFactory.cc
index b27efe0..8a6e1bc 100644
--- a/src/compiler/codegen/CodegenFactory.cc
+++ b/src/compiler/codegen/CodegenFactory.cc
@@ -266,7 +266,7 @@
 }
 
 /*
- * Utiltiy to load the current Method*.  Broken out
+ * Utility to load the current Method*.  Broken out
  * to allow easy change between placing the current Method* in a
  * dedicated register or its home location in the frame.
  */
diff --git a/src/compiler/codegen/CompilerCodegen.h b/src/compiler/codegen/CompilerCodegen.h
index 1b54be9..9537e46 100644
--- a/src/compiler/codegen/CompilerCodegen.h
+++ b/src/compiler/codegen/CompilerCodegen.h
@@ -51,7 +51,7 @@
 void oatInitializeRegAlloc(CompilationUnit* cUnit);
 
 /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
-OatInstructionSetType oatInstructionSet(void);
+InstructionSet oatInstructionSet();
 
 /*
  * Implemented in codegen/<target>/<target_variant>/ArchVariant.c
diff --git a/src/compiler/codegen/Optimizer.h b/src/compiler/codegen/Optimizer.h
index 74a5b75..06c7732 100644
--- a/src/compiler/codegen/Optimizer.h
+++ b/src/compiler/codegen/Optimizer.h
@@ -21,9 +21,6 @@
 
 namespace art {
 
-#define STACK_ALIGN_WORDS 4
-#define STACK_ALIGNMENT (STACK_ALIGN_WORDS * 4)
-
 /* Forward declarations */
 struct CompilationUnit;
 struct LIR;
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc
index 232b304..cfda721 100644
--- a/src/compiler/codegen/RallocUtil.cc
+++ b/src/compiler/codegen/RallocUtil.cc
@@ -1227,23 +1227,4 @@
     return oatVRegOffset(cUnit, oatS2VReg(cUnit, sReg));
 }
 
-
-/* Return sp-relative offset in bytes using Method* */
-extern int oatVRegOffset(const DexFile::CodeItem* code_item,
-                         uint32_t core_spills, uint32_t fp_spills,
-                         size_t frame_size, int reg)
-{
-    int numIns = code_item->ins_size_;
-    int numRegs = code_item->registers_size_ - numIns;
-    int numOuts = code_item->outs_size_;
-    int numSpills = __builtin_popcount(core_spills) +
-                    __builtin_popcount(fp_spills);
-    int numPadding = (STACK_ALIGN_WORDS -
-        (numSpills + numRegs + numOuts + 2)) & (STACK_ALIGN_WORDS-1);
-    int regsOffset = (numOuts + numPadding + 1) * 4;
-    int insOffset = frame_size + 4;
-    return (reg < numRegs) ? regsOffset + (reg << 2) :
-           insOffset + ((reg - numRegs) << 2);
-}
-
 }  // namespace art
diff --git a/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc b/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
index 77844fc..dcf3a99 100644
--- a/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
+++ b/src/compiler/codegen/arm/armv7-a-neon/ArchVariant.cc
@@ -20,9 +20,9 @@
  * Determine the initial instruction set to be used for this trace.
  * Later components may decide to change this.
  */
-OatInstructionSetType oatInstructionSet(void)
+InstructionSet oatInstructionSet()
 {
-    return DALVIK_OAT_THUMB2;
+    return kThumb2;
 }
 
 /* Architecture-specific initializations and checks go here */
diff --git a/src/compiler/codegen/arm/armv7-a/ArchVariant.cc b/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
index 77844fc..dcf3a99 100644
--- a/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
+++ b/src/compiler/codegen/arm/armv7-a/ArchVariant.cc
@@ -20,9 +20,9 @@
  * Determine the initial instruction set to be used for this trace.
  * Later components may decide to change this.
  */
-OatInstructionSetType oatInstructionSet(void)
+InstructionSet oatInstructionSet()
 {
-    return DALVIK_OAT_THUMB2;
+    return kThumb2;
 }
 
 /* Architecture-specific initializations and checks go here */
diff --git a/src/compiler/codegen/mips/mips/ArchVariant.cc b/src/compiler/codegen/mips/mips/ArchVariant.cc
index 6d29fc5..6b04d70 100644
--- a/src/compiler/codegen/mips/mips/ArchVariant.cc
+++ b/src/compiler/codegen/mips/mips/ArchVariant.cc
@@ -25,9 +25,9 @@
  * Determine the initial instruction set to be used for this trace.
  * Later components may decide to change this.
  */
-OatInstructionSetType oatInstructionSet(void)
+InstructionSet oatInstructionSet()
 {
-    return DALVIK_OAT_MIPS32;
+    return kMips;
 }
 
 /* Architecture-specific initializations and checks go here */
diff --git a/src/compiler/codegen/x86/x86/ArchVariant.cc b/src/compiler/codegen/x86/x86/ArchVariant.cc
index 93b17e1..944311c 100644
--- a/src/compiler/codegen/x86/x86/ArchVariant.cc
+++ b/src/compiler/codegen/x86/x86/ArchVariant.cc
@@ -25,9 +25,9 @@
  * Determine the initial instruction set to be used for this trace.
  * Later components may decide to change this.
  */
-OatInstructionSetType oatInstructionSet(void)
+InstructionSet oatInstructionSet()
 {
-    return DALVIK_OAT_X86;
+    return kX86;
 }
 
 /* Architecture-specific initializations and checks go here */