Implement GetCodeSize for LLVM build.

Change-Id: I8e271eb809c81615cc4605564cda5dc55251ea01
diff --git a/src/compiler_llvm/elf_loader.cc b/src/compiler_llvm/elf_loader.cc
index 8f8eff9..07072df 100644
--- a/src/compiler_llvm/elf_loader.cc
+++ b/src/compiler_llvm/elf_loader.cc
@@ -99,6 +99,14 @@
 }
 
 
+size_t ElfLoader::GetCodeSize(uint16_t elf_idx, uint16_t elf_func_idx) const {
+  CHECK_LT(elf_idx, executables_.size());
+  CHECK(executables_[elf_idx] != NULL);
+  return rsloaderGetSymbolSize(executables_[elf_idx],
+                               ElfFuncName(elf_func_idx).c_str());
+}
+
+
 const void* ElfLoader::GetAddr(size_t elf_idx, const char* sym_name) const {
   CHECK_LT(elf_idx, executables_.size());
   CHECK(executables_[elf_idx] != NULL);
diff --git a/src/compiler_llvm/elf_loader.h b/src/compiler_llvm/elf_loader.h
index ea98f61..263a9fa 100644
--- a/src/compiler_llvm/elf_loader.h
+++ b/src/compiler_llvm/elf_loader.h
@@ -43,6 +43,8 @@
   const Method::InvokeStub* GetMethodInvokeStubAddr(uint16_t elf_idx,
                                                     uint16_t elf_func_idx) const;
 
+  size_t GetCodeSize(uint16_t elf_idx, uint16_t elf_func_idx) const;
+
  private:
   const void* GetAddr(size_t elf_idx, const char* sym_name) const;
 
diff --git a/src/oat_file.cc b/src/oat_file.cc
index 81aa013..261fd60 100644
--- a/src/oat_file.cc
+++ b/src/oat_file.cc
@@ -397,8 +397,13 @@
     code &= ~0x1;
     return reinterpret_cast<uint32_t*>(code)[-1];
   } else {
+#if !defined(ART_USE_LLVM_COMPILER)
     UNIMPLEMENTED(ERROR);
     return 0;
+#else
+    CHECK(elf_loader_ != NULL);
+    return elf_loader_->GetCodeSize(code_elf_idx_, code_elf_func_idx_);
+#endif
   }
 }
 
@@ -428,8 +433,14 @@
     }
     return reinterpret_cast<uint32_t*>(code)[-1];
   } else {
+#if !defined(ART_USE_LLVM_COMPILER)
     UNIMPLEMENTED(WARNING);
     return 0;
+#else
+    CHECK(elf_loader_ != NULL);
+    return elf_loader_->GetCodeSize(invoke_stub_elf_idx_,
+                                    invoke_stub_elf_func_idx_);
+#endif
   }
 }
 
diff --git a/src/oatdump.cc b/src/oatdump.cc
index 978060d..d2a78af 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -423,16 +423,34 @@
     os << StringPrintf("\t\tgc_map: %p (offset=0x%08x)\n",
                        oat_method.GetGcMap(), oat_method.GetGcMapOffset());
     DumpGcMap(os, oat_method.GetGcMap());
-    os << StringPrintf("\t\tCODE: %p (offset=0x%08x size=%d)%s\n",
+    os << StringPrintf(
+#if defined(ART_USE_LLVM_COMPILER)
+                       "\t\tCODE: %p (offset=0x%08x size=%d elf_idx=%d elf_func_idx=%d)%s\n",
+#else
+                       "\t\tCODE: %p (offset=0x%08x size=%d)%s\n",
+#endif
                        oat_method.GetCode(),
                        oat_method.GetCodeOffset(),
                        oat_method.GetCodeSize(),
+#if defined(ART_USE_LLVM_COMPILER)
+                       static_cast<int>(oat_method.GetCodeElfIndex()),
+                       static_cast<int>(oat_method.GetCodeElfFuncIndex()),
+#endif
                        oat_method.GetCode() != NULL ? "..." : "");
     DumpCode(os, oat_method.GetCode(), oat_method.GetMappingTable(), dex_file, code_item);
-    os << StringPrintf("\t\tINVOKE STUB: %p (offset=0x%08x size=%d)%s\n",
+    os << StringPrintf(
+#if defined(ART_USE_LLVM_COMPILER)
+                       "\t\tINVOKE STUB: %p (offset=0x%08x size=%d elf_idx=%d elf_func_idx=%d)%s\n",
+#else
+                       "\t\tINVOKE STUB: %p (offset=0x%08x size=%d)%s\n",
+#endif
                        oat_method.GetInvokeStub(),
                        oat_method.GetInvokeStubOffset(),
                        oat_method.GetInvokeStubSize(),
+#if defined(ART_USE_LLVM_COMPILER)
+                       static_cast<int>(oat_method.GetInvokeStubElfIndex()),
+                       static_cast<int>(oat_method.GetInvokeStubElfFuncIndex()),
+#endif
                        oat_method.GetInvokeStub() != NULL ? "..." : "");
     DumpCode(os, reinterpret_cast<const void*>(oat_method.GetInvokeStub()), NULL, dex_file, NULL);
   }