ARM/ARM64: Dump thread offset.

Dump thread offset in compiler verbose log for arm32/arm64 and
oatdump for arm64.

Before patch :
0x4e: ldr      lr, [rSELF, #604]
After patch :
0x4e: ldr      lr, [rSELF, #604]  ; pTestSuspend

Change-Id: I514e69dc44b1cf4c8a8fa085b31f93cf6a1b7c91
diff --git a/compiler/dex/quick/arm/target_arm.cc b/compiler/dex/quick/arm/target_arm.cc
index 5538d79..13f9072 100644
--- a/compiler/dex/quick/arm/target_arm.cc
+++ b/compiler/dex/quick/arm/target_arm.cc
@@ -19,6 +19,7 @@
 #include <inttypes.h>
 
 #include <string>
+#include <sstream>
 
 #include "backend_arm.h"
 #include "base/logging.h"
@@ -490,6 +491,24 @@
        buf += *fmt++;
     }
   }
+  // Dump thread offset.
+  std::string fmt_str = GetTargetInstFmt(lir->opcode);
+  if (std::string::npos != fmt_str.find(", [!1C, #!2") && rARM_SELF == lir->operands[1] &&
+      std::string::npos != buf.find(", [")) {
+    int offset = lir->operands[2];
+    if (std::string::npos != fmt_str.find("#!2d")) {
+    } else if (std::string::npos != fmt_str.find("#!2E")) {
+      offset *= 4;
+    } else if (std::string::npos != fmt_str.find("#!2F")) {
+      offset *= 2;
+    } else {
+      LOG(FATAL) << "Should not reach here";
+    }
+    std::ostringstream tmp_stream;
+    Thread::DumpThreadOffset<4>(tmp_stream, offset);
+    buf += "  ; ";
+    buf += tmp_stream.str();
+  }
   return buf;
 }