OSDN Git Service

[llvm-exegesis] Change how the native architecture is determined
authorJohn Brawn <john.brawn@arm.com>
Mon, 2 Jul 2018 13:53:46 +0000 (13:53 +0000)
committerJohn Brawn <john.brawn@arm.com>
Mon, 2 Jul 2018 13:53:46 +0000 (13:53 +0000)
Currently the llvm-exegesis native architecture is determined by comparing the
llvm native architecture with X86, so to add a new target would mean adding a
new check. Change this to building up a list of the targets llvm-exegesis
supports then using that, as this means that when adding a new target you just
add the target to the list of supported targets.

Differential Revision: https://reviews.llvm.org/D48778

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336105 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-exegesis/CMakeLists.txt
tools/llvm-exegesis/lib/CMakeLists.txt

index 01a795b..65b1ada 100644 (file)
@@ -11,8 +11,8 @@ add_llvm_tool(llvm-exegesis
 add_subdirectory(lib)
 
 # Link the native exegesis target if compiled and on the right host.
-if ((LLVM_TARGETS_TO_BUILD MATCHES "X86") AND ("${LLVM_NATIVE_ARCH}" STREQUAL "X86"))
-  set(LLVM_EXEGESIS_NATIVE_ARCH "X86")
+if ((LLVM_TARGETS_TO_BUILD MATCHES "${LLVM_NATIVE_ARCH}") AND (LLVM_EXEGESIS_TARGETS MATCHES "${LLVM_NATIVE_ARCH}"))
+  set(LLVM_EXEGESIS_NATIVE_ARCH "${LLVM_NATIVE_ARCH}")
 endif()
 
 if (LLVM_EXEGESIS_NATIVE_ARCH)
index 02eeb75..3c69dea 100644 (file)
@@ -1,5 +1,6 @@
 if (LLVM_TARGETS_TO_BUILD MATCHES "X86")
   add_subdirectory(X86)
+  set(LLVM_EXEGESIS_TARGETS "${LLVM_EXEGESIS_TARGETS} X86" PARENT_SCOPE)
 endif()
 
 add_library(LLVMExegesis