Quick compiler: Single .so for all targets

With this CL, all targets can be built into a single .so (but
we're not yet doing so - the compiler driver needs to be reworked).

A new Codgen class is introduced (see compiler/codegen/codegen.h),
along with target-specific sub-classes ArmCodegen, MipsCodegens and
X86Codegen (see compiler/codegen/*/codegen_[Arm|Mips|X86].h).

Additional minor code, comment and format refactoring.  Some source
files combined, temporary header files deleted and a few file
renames to better identify their function.

Next up is combining the Quick and Portable .so files.

Note: building all targets into libdvm-compiler.so increases its
size by 140K bytes.  I'm inclined to not bother introducing conditional
compilation to limit code to the specific target - the added build and
testing complexity doesn't doesn't seem worth such a modest size savings.

Change-Id: Id9c5b4502ad6b77cdb31f71d3126f51a4f2e9dfe
diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc
index c05130b..b8c9b8e 100644
--- a/src/compiler/frontend.cc
+++ b/src/compiler/frontend.cc
@@ -22,8 +22,8 @@
 #include "object.h"
 #include "runtime.h"
 #include "codegen/codegen_util.h"
-#include "codegen/method_bitcode.h"
-#include "codegen/method_codegen_driver.h"
+#include "codegen/mir_to_gbc.h"
+#include "codegen/mir_to_lir.h"
 
 #include <llvm/Support/Threading.h>
 
@@ -748,8 +748,21 @@
 }
 
 void CompilerInit(CompilationUnit* cu, const Compiler& compiler) {
-  if (!ArchInit()) {
-    LOG(FATAL) << "Failed to initialize oat";
+  bool success = false;
+  switch (compiler.GetInstructionSet()) {
+    case kThumb2:
+      success = InitArmCodegen(cu);
+      break;
+    case kMips:
+      success = InitMipsCodegen(cu);
+      break;
+    case kX86:
+      success = InitX86Codegen(cu);
+      break;
+    default:;
+  }
+  if (!success) {
+    LOG(FATAL) << "Failed to initialize codegen for " << compiler.GetInstructionSet();
   }
   if (!HeapInit(cu)) {
     LOG(FATAL) << "Failed to initialize oat heap";
@@ -1107,7 +1120,7 @@
     DumpCheckStats(cu.get());
   }
 
-  CompilerInitializeRegAlloc(cu.get());  // Needs to happen after SSA naming
+  cu.get()->cg->CompilerInitializeRegAlloc(cu.get());  // Needs to happen after SSA naming
 
   /* Allocate Registers using simple local allocation scheme */
   SimpleRegAlloc(cu.get());