Skip to content

Commit

Permalink
build: Add LLVM_NATIVE_ARCHNAME, which has the sensible value, withou…
Browse files Browse the repository at this point in the history
…t "Target"

appended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110109 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ddunbar committed Aug 3, 2010
1 parent 779b69d commit b1247c3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
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
Expand Down
1 change: 1 addition & 0 deletions cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ else ()
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
Expand Down
7 changes: 6 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -5017,6 +5017,11 @@ for a_target in $TARGETS_TO_BUILD; do
if test "$a_target" = "$LLVM_NATIVE_ARCH"; then
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
Expand Down Expand Up @@ -11391,7 +11396,7 @@ else
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
Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
3 changes: 3 additions & 0 deletions include/llvm/Config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 2 additions & 9 deletions include/llvm/Target/TargetSelect.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ extern "C" {
#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"
Expand Down Expand Up @@ -107,7 +100,7 @@ namespace llvm {
/// 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 ()
Expand All @@ -129,7 +122,7 @@ namespace llvm {
#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
Expand Down

0 comments on commit b1247c3

Please sign in to comment.