Annotate used fields.

Annotate all fields used by a method early during the
compilation, check acces rights and record field offset,
volatility, etc. Use these annotations when generating code
for IGET/IPUT/SGET/SPUT instructions.

Change-Id: I4bbf5cca4fecf53c9bf9c93ac1793e2f40c16b5f
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 5adb792..c7bf952 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -881,6 +881,24 @@
   }
 }
 
+void CompilerDriver::ProcessedInstanceField(bool resolved) {
+  if (!resolved) {
+    stats_->UnresolvedInstanceField();
+  } else {
+    stats_->ResolvedInstanceField();
+  }
+}
+
+void CompilerDriver::ProcessedStaticField(bool resolved, bool local) {
+  if (!resolved) {
+    stats_->UnresolvedStaticField();
+  } else if (local) {
+    stats_->ResolvedLocalStaticField();
+  } else {
+    stats_->ResolvedStaticField();
+  }
+}
+
 static mirror::Class* ComputeCompilingMethodsClass(ScopedObjectAccess& soa,
                                                    SirtRef<mirror::DexCache>& dex_cache,
                                                    const DexCompilationUnit* mUnit)
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 092fe52..5c5382b 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -197,6 +197,9 @@
                           bool* is_type_initialized, bool* use_direct_type_ptr,
                           uintptr_t* direct_type_ptr);
 
+  void ProcessedInstanceField(bool resolved);
+  void ProcessedStaticField(bool resolved, bool local);
+
   // Can we fast path instance field access in a verified accessor?
   // If yes, computes field's offset and volatility and whether the method is static or not.
   static bool ComputeSpecialAccessorInfo(uint32_t field_idx, bool is_put,