libart-compiler cleanup

- Move compile-time code to src/compiler and libart-compiler
  OatWriter, ImageWriter, ElfWriter, ElfFixup, ElfStripper, stub generation
- Move ClassReference and MethodReference to remove MethodVerifier dependency on CompilerDriver
- Move runtime_support_llvm.cc out of src/compiler and next to runtime_support.cc
- Change dex2oat and gtests to directly depend on libart-compiler
- Move non-common definitions from Android.common.mk to more specific makefiles
- Add LOCAL_ADDITIONAL_DEPENDENCIES on appropriate makefiles

Change-Id: I897027e69945914128f21f317a92caf9255bc600
diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc
index 74a79e0..31aec47 100644
--- a/src/verifier/method_verifier.cc
+++ b/src/verifier/method_verifier.cc
@@ -22,7 +22,6 @@
 #include "base/mutex-inl.h"
 #include "base/stringpiece.h"
 #include "class_linker.h"
-#include "compiler/driver/compiler_driver.h"
 #include "dex_file-inl.h"
 #include "dex_instruction-inl.h"
 #include "dex_instruction_visitor.h"
@@ -426,7 +425,7 @@
       // marked as rejected to prevent it from being compiled.
     case VERIFY_ERROR_BAD_CLASS_HARD: {
       if (Runtime::Current()->IsCompiler()) {
-        CompilerDriver::ClassReference ref(dex_file_, class_def_idx_);
+        ClassReference ref(dex_file_, class_def_idx_);
         AddRejectedClass(ref);
       }
       have_pending_hard_failure_ = true;
@@ -1001,9 +1000,6 @@
     return false;
   }
 
-  CompilerDriver::MethodReference ref(dex_file_, dex_method_idx_);
-
-
   /* Generate a register map and add it to the method. */
   UniquePtr<const std::vector<uint8_t> > map(GenerateGcMap());
   if (map.get() == NULL) {
@@ -1013,6 +1009,7 @@
   if (kIsDebugBuild) {
     VerifyGcMap(*map);
   }
+  MethodReference ref(dex_file_, dex_method_idx_);
   const std::vector<uint8_t>* dex_gc_map = CreateLengthPrefixedDexGcMap(*(map.get()));
   verifier::MethodVerifier::SetDexGcMap(ref, *dex_gc_map);
 
@@ -3816,7 +3813,7 @@
       if (pc_to_concrete_method_map.get() == NULL) {
         pc_to_concrete_method_map.reset(new PcToConcreteMethodMap());
       }
-      CompilerDriver::MethodReference concrete_ref(
+      MethodReference concrete_ref(
           concrete_method->GetDeclaringClass()->GetDexCache()->GetDexFile(),
           concrete_method->GetDexMethodIndex());
       pc_to_concrete_method_map->Put(dex_pc, concrete_ref);
@@ -3914,8 +3911,7 @@
   }
 }
 
-void MethodVerifier::SetDexGcMap(CompilerDriver::MethodReference ref,
-                                 const std::vector<uint8_t>& gc_map) {
+void MethodVerifier::SetDexGcMap(MethodReference ref, const std::vector<uint8_t>& gc_map) {
   {
     WriterMutexLock mu(Thread::Current(), *dex_gc_maps_lock_);
     DexGcMapTable::iterator it = dex_gc_maps_->find(ref);
@@ -3929,8 +3925,7 @@
 }
 
 
-void  MethodVerifier::SetSafeCastMap(CompilerDriver::MethodReference ref,
-                                     const MethodSafeCastSet* cast_set) {
+void  MethodVerifier::SetSafeCastMap(MethodReference ref, const MethodSafeCastSet* cast_set) {
   MutexLock mu(Thread::Current(), *safecast_map_lock_);
   SafeCastMap::iterator it = safecast_map_->find(ref);
   if (it != safecast_map_->end()) {
@@ -3942,7 +3937,7 @@
   CHECK(safecast_map_->find(ref) != safecast_map_->end());
 }
 
-bool MethodVerifier::IsSafeCast(CompilerDriver::MethodReference ref, uint32_t pc) {
+bool MethodVerifier::IsSafeCast(MethodReference ref, uint32_t pc) {
   MutexLock mu(Thread::Current(), *safecast_map_lock_);
   SafeCastMap::const_iterator it = safecast_map_->find(ref);
   if (it == safecast_map_->end()) {
@@ -3954,7 +3949,7 @@
   return cast_it != it->second->end();
 }
 
-const std::vector<uint8_t>* MethodVerifier::GetDexGcMap(CompilerDriver::MethodReference ref) {
+const std::vector<uint8_t>* MethodVerifier::GetDexGcMap(MethodReference ref) {
   ReaderMutexLock mu(Thread::Current(), *dex_gc_maps_lock_);
   DexGcMapTable::const_iterator it = dex_gc_maps_->find(ref);
   if (it == dex_gc_maps_->end()) {
@@ -3965,7 +3960,7 @@
   return it->second;
 }
 
-void  MethodVerifier::SetDevirtMap(CompilerDriver::MethodReference ref,
+void  MethodVerifier::SetDevirtMap(MethodReference ref,
                                    const PcToConcreteMethodMap* devirt_map) {
   WriterMutexLock mu(Thread::Current(), *devirt_maps_lock_);
   DevirtualizationMapTable::iterator it = devirt_maps_->find(ref);
@@ -3978,7 +3973,7 @@
   CHECK(devirt_maps_->find(ref) != devirt_maps_->end());
 }
 
-const CompilerDriver::MethodReference* MethodVerifier::GetDevirtMap(const CompilerDriver::MethodReference& ref,
+const MethodReference* MethodVerifier::GetDevirtMap(const MethodReference& ref,
                                                                     uint32_t dex_pc) {
   ReaderMutexLock mu(Thread::Current(), *devirt_maps_lock_);
   DevirtualizationMapTable::const_iterator it = devirt_maps_->find(ref);
@@ -4110,7 +4105,7 @@
   verifier::RegTypeCache::ShutDown();
 }
 
-void MethodVerifier::AddRejectedClass(CompilerDriver::ClassReference ref) {
+void MethodVerifier::AddRejectedClass(ClassReference ref) {
   {
     MutexLock mu(Thread::Current(), *rejected_classes_lock_);
     rejected_classes_->insert(ref);
@@ -4118,7 +4113,7 @@
   CHECK(IsClassRejected(ref));
 }
 
-bool MethodVerifier::IsClassRejected(CompilerDriver::ClassReference ref) {
+bool MethodVerifier::IsClassRejected(ClassReference ref) {
   MutexLock mu(Thread::Current(), *rejected_classes_lock_);
   return (rejected_classes_->find(ref) != rejected_classes_->end());
 }