build: Add LLVM_NATIVE_ARCHNAME, which has the sensible value, without "Target"
appended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110109 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 0924a77..18c9669 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -599,6 +599,8 @@
 for a_target in $TARGETS_TO_BUILD; do
   if test "$a_target" = "$LLVM_NATIVE_ARCH"; then
     LLVM_NATIVE_ARCHTARGET="${LLVM_NATIVE_ARCH}Target"
+    AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCHNAME,$LLVM_NATIVE_ARCH,
+      [Short LLVM architecture name for the native architecture, if available])
     AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH,$LLVM_NATIVE_ARCHTARGET,
       [LLVM architecture name for the native architecture, if available])
   fi
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index d9450d9..e3e5e8d 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -207,6 +207,7 @@
 endif ()
   
 if (LLVM_NATIVE_ARCH)
+  set(LLVM_NATIVE_ARCHNAME ${LLVM_NATIVE_ARCH})
   list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
   if (NATIVE_ARCH_IDX EQUAL -1)
     message(STATUS 
diff --git a/configure b/configure
index 98a40c4..dd50155 100755
--- a/configure
+++ b/configure
@@ -5018,6 +5018,11 @@
     LLVM_NATIVE_ARCHTARGET="${LLVM_NATIVE_ARCH}Target"
 
 cat >>confdefs.h <<_ACEOF
+#define LLVM_NATIVE_ARCHNAME $LLVM_NATIVE_ARCH
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
 #define LLVM_NATIVE_ARCH $LLVM_NATIVE_ARCHTARGET
 _ACEOF
 
@@ -11391,7 +11396,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 11394 "configure"
+#line 11399 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index e7594ba..5468316 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -625,3 +625,6 @@
 
 /* Native LLVM architecture */
 #cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}Target
+
+/* Native LLVM architecture, short name */
+#cmakedefine LLVM_NATIVE_ARCHNAME ${LLVM_NATIVE_ARCH}
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index d76db86..9a10f7f 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -500,6 +500,9 @@
 /* LLVM architecture name for the native architecture, if available */
 #undef LLVM_NATIVE_ARCH
 
+/* Short LLVM architecture name for the native architecture, if available */
+#undef LLVM_NATIVE_ARCHNAME
+
 /* Define if this is Unixish platform */
 #undef LLVM_ON_UNIX
 
diff --git a/include/llvm/Target/TargetSelect.h b/include/llvm/Target/TargetSelect.h
index fc3244a..3ade00d 100644
--- a/include/llvm/Target/TargetSelect.h
+++ b/include/llvm/Target/TargetSelect.h
@@ -30,13 +30,6 @@
 #define LLVM_ASM_PRINTER(TargetName) void LLVMInitialize##TargetName##AsmPrinter();
 #include "llvm/Config/AsmPrinters.def"
 
-  // FIXME: Workaround for unfortunate definition of LLVM_NATIVE_ARCH.
-#define LLVM_ASM_PRINTER(TargetName) \
-  static inline void LLVMInitialize##TargetName##TargetAsmPrinter() { \
-    LLVMInitialize##TargetName##AsmPrinter(); \
-  }
-#include "llvm/Config/AsmPrinters.def"
-
   // Declare all of the available assembly parser initialization functions.
 #define LLVM_ASM_PARSER(TargetName) void LLVMInitialize##TargetName##AsmParser();
 #include "llvm/Config/AsmParsers.def"
@@ -107,7 +100,7 @@
   /// It is legal for a client to make multiple calls to this function.
   inline bool InitializeNativeTarget() {
   // If we have a native target, initialize it to ensure it is linked in.
-#ifdef LLVM_NATIVE_ARCH
+#ifdef LLVM_NATIVE_ARCHNAME
 #define DoInit2(TARG) \
     LLVMInitialize ## TARG ## Info ();          \
     LLVMInitialize ## TARG ()
@@ -129,7 +122,7 @@
 #define DoInit2(TARG) \
     LLVMInitialize ## TARG ## AsmPrinter ();
 #define DoInit(T) DoInit2(T)
-    DoInit(LLVM_NATIVE_ARCH);
+    DoInit(LLVM_NATIVE_ARCHNAME);
     return false;
 #undef DoInit
 #undef DoInit2