Refine compiler runtime function list.

This CL includes several changes:

1. Define 3 different compiler runtime function list
   for different architecture:

   - COMPILER_RUNTIME_FUNC_LIST_ARM
   - COMPILER_RUNTIME_FUNC_LIST_MIPS
   - COMPILER_RUNTIME_FUNC_LIST_X86

2. Split MIPS compiler runtime function list from the
   X86 version.

3. Replace COMPILER_RUNTIME_FUNC_LIST with
   COMPILER_RUNTIME_FUNC_LIST_NATIVE.  "Native" means
   the host of the runtime.

Change-Id: Ic18b793dd8c153cac4f7bc82dcd07e44576b7f58
diff --git a/src/compiler_llvm/compiler_runtime_func_list.h b/src/compiler_llvm/compiler_runtime_func_list.h
index d9bdc8e..2eb3de9 100644
--- a/src/compiler_llvm/compiler_runtime_func_list.h
+++ b/src/compiler_llvm/compiler_runtime_func_list.h
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
 
-// NOTE: COMPILER_RUNTIME_FUNC_LIST should be sorted!
+#ifndef ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
+#define ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
 
-#if defined(__i386__) || defined(__mips__)
+// NOTE: COMPILER_RUNTIME_FUNC_LIST_* should be sorted!
 
-#define COMPILER_RUNTIME_FUNC_LIST(V) \
+#define COMPILER_RUNTIME_FUNC_LIST_X86(V) \
   V(__ashldi3) \
   V(__ashrdi3) \
   V(__divdi3) \
@@ -97,9 +98,69 @@
   V(truncf) \
   V(truncl)
 
-#elif defined(__arm__)
+#define COMPILER_RUNTIME_FUNC_LIST_MIPS(V) \
+  V(__ashldi3) \
+  V(__ashrdi3) \
+  V(__divdi3) \
+  V(__fixdfdi) \
+  V(__fixsfdi) \
+  V(__fixunsdfdi) \
+  V(__fixunsdfsi) \
+  V(__fixunssfdi) \
+  V(__fixunssfsi) \
+  V(__floatdidf) \
+  V(__floatdisf) \
+  V(__floatundidf) \
+  V(__floatundisf) \
+  V(__lshrdi3) \
+  V(__moddi3) \
+  V(__muldi3) \
+  V(__negdi2) \
+  V(__powidf2) \
+  V(__powisf2) \
+  V(__udivdi3) \
+  V(__umoddi3) \
+  V(ceil) \
+  V(ceilf) \
+  V(ceill) \
+  V(copysign) \
+  V(copysignf) \
+  V(copysignl) \
+  V(cos) \
+  V(cosf) \
+  V(exp) \
+  V(exp2) \
+  V(exp2f) \
+  V(expf) \
+  V(floor) \
+  V(floorf) \
+  V(floorl) \
+  V(fma) \
+  V(fmaf) \
+  V(fmod) \
+  V(fmodf) \
+  V(log) \
+  V(log10) \
+  V(log10f) \
+  V(logf) \
+  V(memcpy) \
+  V(memmove) \
+  V(memset) \
+  V(nearbyint) \
+  V(nearbyintf) \
+  V(pow) \
+  V(powf) \
+  V(rint) \
+  V(rintf) \
+  V(sin) \
+  V(sinf) \
+  V(sqrt) \
+  V(sqrtf) \
+  V(trunc) \
+  V(truncf) \
+  V(truncl)
 
-#define COMPILER_RUNTIME_FUNC_LIST(V) \
+#define COMPILER_RUNTIME_FUNC_LIST_ARM(V) \
   V(__aeabi_d2f) \
   V(__aeabi_d2iz) \
   V(__aeabi_d2lz) \
@@ -167,8 +228,15 @@
   V(memmove) \
   V(memset)
 
+
+#if defined(__arm__)
+#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_ARM(V)
+#elif defined(__mips__)
+#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_MIPS(V)
+#elif defined(__i386__)
+#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_X86(V)
 #else
-
 #error "Unknown target platform"
-
 #endif
+
+#endif // ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index dcd4d96..bf74e06 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -15,6 +15,7 @@
  */
 
 #include "class_linker.h"
+#include "compiler_runtime_func_list.h"
 #include "dex_file.h"
 #include "dex_instruction.h"
 #include "nth_caller_visitor.h"
@@ -22,6 +23,7 @@
 #include "object_utils.h"
 #include "reflection.h"
 #include "runtime_support.h"
+#include "runtime_support_func_list.h"
 #include "runtime_support_llvm.h"
 #include "ScopedLocalRef.h"
 #include "shadow_frame.h"
@@ -587,27 +589,20 @@
 
 #define EXTERNAL_LINKAGE(NAME) \
 extern "C" void NAME(...);
-
-#include "compiler_runtime_func_list.h"
-COMPILER_RUNTIME_FUNC_LIST(EXTERNAL_LINKAGE)
-#undef COMPILER_RUNTIME_FUNC_LIST
+COMPILER_RUNTIME_FUNC_LIST_NATIVE(EXTERNAL_LINKAGE)
 #undef EXTERNAL_LINKAGE
 
 static void* art_find_compiler_runtime_func(char const* name) {
 // TODO: If target support some math func, use the target's version. (e.g. art_d2i -> __aeabi_d2iz)
   static const char* const names[] = {
 #define DEFINE_ENTRY(NAME) #NAME ,
-#include "compiler_runtime_func_list.h"
-    COMPILER_RUNTIME_FUNC_LIST(DEFINE_ENTRY)
-#undef COMPILER_RUNTIME_FUNC_LIST
+    COMPILER_RUNTIME_FUNC_LIST_NATIVE(DEFINE_ENTRY)
 #undef DEFINE_ENTRY
   };
 
   static void* const funcs[] = {
 #define DEFINE_ENTRY(NAME) reinterpret_cast<void*>(NAME) ,
-#include "compiler_runtime_func_list.h"
-    COMPILER_RUNTIME_FUNC_LIST(DEFINE_ENTRY)
-#undef COMPILER_RUNTIME_FUNC_LIST
+    COMPILER_RUNTIME_FUNC_LIST_NATIVE(DEFINE_ENTRY)
 #undef DEFINE_ENTRY
   };
 
@@ -797,10 +792,7 @@
   static struct func_entry_t const tab[] = {
 #define DEFINE_ENTRY(ID, NAME) \
     { #NAME, sizeof(#NAME) - 1, reinterpret_cast<void*>(NAME) },
-
-#include "runtime_support_func_list.h"
     RUNTIME_SUPPORT_FUNC_LIST(DEFINE_ENTRY)
-#undef RUNTIME_SUPPORT_FUNC_LIST
 #undef DEFINE_ENTRY
   };