diff --git a/CREDITS.TXT b/CREDITS.TXT index 53cf63c9bd6..c2e2041e651 100644 --- a/CREDITS.TXT +++ b/CREDITS.TXT @@ -77,6 +77,10 @@ N: Brad Jones E: kungfoomaster@nondot.org D: Support for packed types +N: Eric Kidd +W: http://randomhacks.net/ +D: llvm-config script + N: Sumant Kowshik E: kowshik@uiuc.edu D: Author of the original C backend diff --git a/Makefile.config.in b/Makefile.config.in index 2c865605e13..85d518087ae 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -137,6 +137,7 @@ TAR := @TAR@ YACC := @YACC@ # Paths to miscellaneous programs we hope are present but might not be +PERL := @PERL@ BZIP2 := @BZIP2@ DOT := @DOT@ DOXYGEN := @DOXYGEN@ @@ -150,6 +151,8 @@ RUNTEST := @RUNTEST@ TCLSH := @TCLSH@ ZIP := @ZIP@ +HAVE_PERL := @HAVE_PERL@ + LIBS := @LIBS@ # Path to location for LLVM C/C++ front-end. You can modify this if you @@ -195,7 +198,7 @@ ENABLE_DOXYGEN = @ENABLE_DOXYGEN@ #VERBOSE = 1 # Enable JIT for this platform -@JIT@ +TARGET_HAS_JIT = @TARGET_HAS_JIT@ # Shared library extension for this platform. SHLIBEXT = @SHLIBEXT@ diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 42d38c8dff3..81dc0aa5d08 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -218,13 +218,13 @@ then AC_SUBST(JIT,[[]]) else case "$llvm_cv_target_arch" in - x86) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; - Sparc) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; - PowerPC) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; - x86_64) AC_SUBST(JIT,[[]]) ;; - Alpha) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;; - IA64) AC_SUBST(JIT,[[]]) ;; - *) AC_SUBST(JIT,[[]]) ;; + x86) AC_SUBST(TARGET_HAS_JIT,1) ;; + Sparc) AC_SUBST(TARGET_HAS_JIT,1) ;; + PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; + x86_64) AC_SUBST(TARGET_HAS_JIT,0) ;; + Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;; + IA64) AC_SUBST(TARGET_HAS_JIT,0) ;; + *) AC_SUBST(TARGET_HAS_JIT,0) ;; esac fi @@ -338,6 +338,15 @@ if test "$GV" != "echo gv" ; then [Define to path to gv program if found or 'echo gv' otherwise]) fi +dnl Look for a sufficiently recent version of Perl. +LLVM_PROG_PERL([5.006]) +AC_SUBST(PERL) +if test x"$PERL" = xnone; then + AC_SUBST(HAVE_PERL,0) +else + AC_SUBST(HAVE_PERL,1) +fi + dnl Find the install program AC_PROG_INSTALL diff --git a/autoconf/m4/path_perl.m4 b/autoconf/m4/path_perl.m4 new file mode 100644 index 00000000000..406656cb032 --- /dev/null +++ b/autoconf/m4/path_perl.m4 @@ -0,0 +1,16 @@ +dnl Check for a reasonable version of Perl. +dnl $1 - Minimum Perl version. Typically 5.006. +dnl +AC_DEFUN([LLVM_PROG_PERL], [ +AC_PATH_PROG(PERL, [perl], [none]) +if test "$PERL" != "none"; then + AC_MSG_CHECKING(for Perl $1 or newer) + if $PERL -e 'use $1;' 2>&1 > /dev/null; then + AC_MSG_RESULT(yes) + else + PERL=none + AC_MSG_RESULT(not found) + fi +fi +]) + diff --git a/configure b/configure index 421a5fd37db..fbeb766e56c 100755 --- a/configure +++ b/configure @@ -476,7 +476,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED DEBUG_RUNTIME JIT ENABLE_DOXYGEN ENABLE_THREADS TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR GRAPHVIZ GV INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE LIBADD_DL ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_COPYRIGHT subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVM_ON_UNIX LLVM_ON_WIN32 ARCH ENDIAN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT ENABLE_OPTIMIZED DEBUG_RUNTIME JIT TARGET_HAS_JIT ENABLE_DOXYGEN ENABLE_THREADS TARGETS_TO_BUILD CPP CXX CXXFLAGS ac_ct_CXX LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON ifGNUmake LN_S CMP CP DATE FIND GREP MKDIR MV RANLIB ac_ct_RANLIB RM SED TAR GRAPHVIZ GV PERL HAVE_PERL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA BZIP2 DOT DOXYGEN ETAGS GROFF GZIP POD2HTML POD2MAN RUNTEST TCLSH ZIP EGREP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE CONVENIENCE_LTDL_FALSE LIBADD_DL ECHO AR ac_ct_AR STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ETAGSFLAGS LLVMGCC LLVMGXX ALLOCA MMAP_FILE LLVMCC1 LLVMCC1PLUS LLVMGCCDIR SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -3011,19 +3011,19 @@ then else case "$llvm_cv_target_arch" in - x86) JIT=TARGET_HAS_JIT=1 + x86) TARGET_HAS_JIT=1 ;; - Sparc) JIT=TARGET_HAS_JIT=1 + Sparc) TARGET_HAS_JIT=1 ;; - PowerPC) JIT=TARGET_HAS_JIT=1 + PowerPC) TARGET_HAS_JIT=1 ;; - x86_64) JIT= + x86_64) TARGET_HAS_JIT=0 ;; - Alpha) JIT=TARGET_HAS_JIT=1 + Alpha) TARGET_HAS_JIT=1 ;; - IA64) JIT= + IA64) TARGET_HAS_JIT=0 ;; - *) JIT= + *) TARGET_HAS_JIT=0 ;; esac fi @@ -5202,6 +5202,69 @@ _ACEOF fi + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="none" + ;; +esac +fi +PERL=$ac_cv_path_PERL + +if test -n "$PERL"; then + echo "$as_me:$LINENO: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$PERL" != "none"; then + echo "$as_me:$LINENO: checking for Perl 5.006 or newer" >&5 +echo $ECHO_N "checking for Perl 5.006 or newer... $ECHO_C" >&6 + if $PERL -e 'use 5.006;' 2>&1 > /dev/null; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + PERL=none + echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + fi +fi + + +if test x"$PERL" = xnone; then + HAVE_PERL=0 + +else + HAVE_PERL=1 + +fi + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -8376,7 +8439,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 10433 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10852,7 +10915,7 @@ fi # Provide some information about the compiler. -echo "$as_me:10855:" \ +echo "$as_me:10918:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -11909,11 +11972,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11912: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11975: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11916: \$? = $ac_status" >&5 + echo "$as_me:11979: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12152,11 +12215,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12155: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12218: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12159: \$? = $ac_status" >&5 + echo "$as_me:12222: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12212,11 +12275,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12215: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12278: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12219: \$? = $ac_status" >&5 + echo "$as_me:12282: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14397,7 +14460,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:16754: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16695: \$? = $ac_status" >&5 + echo "$as_me:16758: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16748,11 +16811,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16751: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16814: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16755: \$? = $ac_status" >&5 + echo "$as_me:16818: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18109,7 +18172,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19110: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19051: \$? = $ac_status" >&5 + echo "$as_me:19114: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -19104,11 +19167,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19107: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19170: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19111: \$? = $ac_status" >&5 + echo "$as_me:19174: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21143,11 +21206,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21146: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21209: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21150: \$? = $ac_status" >&5 + echo "$as_me:21213: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21386,11 +21449,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21389: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21452: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21393: \$? = $ac_status" >&5 + echo "$as_me:21456: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -21446,11 +21509,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21449: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21512: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21453: \$? = $ac_status" >&5 + echo "$as_me:21516: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23631,7 +23694,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < $@ + $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@ # Rerun our configure substitutions as needed. llvm-config.in: llvm-config.in.in $(ConfigStatusScript) diff --git a/tools/llvm-config/find-cycles.pl b/tools/llvm-config/find-cycles.pl index b6609556bf4..a280887217a 100755 --- a/tools/llvm-config/find-cycles.pl +++ b/tools/llvm-config/find-cycles.pl @@ -18,6 +18,7 @@ # This file was written by Eric Kidd, and is placed into the public domain. # +use 5.006; use strict; use warnings; diff --git a/tools/llvm-config/llvm-config.in.in b/tools/llvm-config/llvm-config.in.in index 6f1533cb219..74bf7a9870e 100644 --- a/tools/llvm-config/llvm-config.in.in +++ b/tools/llvm-config/llvm-config.in.in @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!@PERL@ # # Program: llvm-config # @@ -10,6 +10,7 @@ # This file was written by Eric Kidd, and is placed into the public domain. # +use 5.006; use strict; use warnings; @@ -20,6 +21,7 @@ my $BINDIR = q{@LLVM_BINDIR@}; my $INCLUDEDIR = q{@LLVM_INCLUDEDIR@}; my $LIBDIR = q{@LLVM_LIBDIR@}; my $ARCH = lc(q{@ARCH@}); +my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@}; my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@}; #---- end autoconf values ---- @@ -106,7 +108,7 @@ Get various configuration information needed to compile programs which use LLVM. Typically called from 'configure' scripts. Examples: llvm-config --cxxflags llvm-config --ldflags - llvm-config --libs jitplus + llvm-config --libs engine bcreader scalaropts Options: --version LLVM version. @@ -122,8 +124,8 @@ Options: --targets-built List of all targets currently built. Typical components: all All LLVM libraries (default). - native A native-code backend for this platform, if any. - jitplus All libraries needed to use the LLVM JIT examples. + backend Either a native backend or the C backend. + engine Either a native JIT or a bytecode interpreter. __EOD__ exit(1); } @@ -163,7 +165,8 @@ sub fix_library_names (@) { sub load_dependencies; sub build_name_map; -sub find_native_platform; +sub have_native_backend; +sub find_best_engine; sub expand_names (@); sub find_all_required_sets (@); sub find_all_required_sets_helper ($$@); @@ -231,19 +234,29 @@ sub build_name_map { } # Add virtual entries. - $NAME_MAP{'native'} = find_native_platform; - $NAME_MAP{'jitplus'} = ['native', 'jit', 'bcreader', 'scalaropts']; - $NAME_MAP{'all'} = [name_map_entries]; # Must be last. + $NAME_MAP{'native'} = have_native_backend() ? [$ARCH] : []; + $NAME_MAP{'backend'} = have_native_backend() ? ['native'] : ['cbackend']; + $NAME_MAP{'engine'} = find_best_engine; + $NAME_MAP{'all'} = [name_map_entries]; # Must be last. } -# Figure our what native platform we should use, if any. -sub find_native_platform { +# Return true if we have a native backend to use. +sub have_native_backend { my %BUILT; foreach my $target (@TARGETS_BUILT) { $BUILT{$target} = 1; } - if (defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH}) { - return [$ARCH]; + return defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH}; +} + +# Find a working subclass of ExecutionEngine for this platform. +sub find_best_engine { + if (have_native_backend && $TARGET_HAS_JIT) { + # XXX - Right now, if we omit the interpreter, we get a linker + # error complaining about + # __ZN4llvm11Interpreter6createEPNS_6ModuleEPNS_17IntrinsicLoweringE. + # This needs investigation. + return ['jit', 'native', 'interpreter']; } else { - return []; + return ['interpreter']; } } diff --git a/utils/Makefile b/utils/Makefile index f37cd91fb1d..df03b567b16 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -17,3 +17,7 @@ EXTRA_DIST = check-each-file codegen-diff countloc.sh cvsupdate emacs \ include $(LEVEL)/Makefile.common +# Only include llvm-config if we have Perl to build it with. +ifeq ($(HAVE_PERL),1) + DIRS += llvm-config +endif diff --git a/utils/llvm-config/Makefile b/utils/llvm-config/Makefile index c4a5407374a..0fdbe829f56 100644 --- a/utils/llvm-config/Makefile +++ b/utils/llvm-config/Makefile @@ -9,6 +9,7 @@ LEVEL = ../.. +EXTRA_DIST = LibDeps.txt llvm-config.in.in find-cycles.pl include $(LEVEL)/Makefile.common @@ -32,7 +33,7 @@ LibDeps.txt: $(LEVEL)/utils/GenLibDeps.pl $(LibDir) # don't have to process them at runtime. FinalLibDeps.txt: find-cycles.pl # LibDeps.txt deliberately omitted. $(Echo) "Finding cyclic dependencies between LLVM libraries." - $(Verb) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@ + $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@ # Rerun our configure substitutions as needed. llvm-config.in: llvm-config.in.in $(ConfigStatusScript) diff --git a/utils/llvm-config/find-cycles.pl b/utils/llvm-config/find-cycles.pl index b6609556bf4..a280887217a 100755 --- a/utils/llvm-config/find-cycles.pl +++ b/utils/llvm-config/find-cycles.pl @@ -18,6 +18,7 @@ # This file was written by Eric Kidd, and is placed into the public domain. # +use 5.006; use strict; use warnings; diff --git a/utils/llvm-config/llvm-config.in.in b/utils/llvm-config/llvm-config.in.in index 6f1533cb219..74bf7a9870e 100644 --- a/utils/llvm-config/llvm-config.in.in +++ b/utils/llvm-config/llvm-config.in.in @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!@PERL@ # # Program: llvm-config # @@ -10,6 +10,7 @@ # This file was written by Eric Kidd, and is placed into the public domain. # +use 5.006; use strict; use warnings; @@ -20,6 +21,7 @@ my $BINDIR = q{@LLVM_BINDIR@}; my $INCLUDEDIR = q{@LLVM_INCLUDEDIR@}; my $LIBDIR = q{@LLVM_LIBDIR@}; my $ARCH = lc(q{@ARCH@}); +my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@}; my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@}; #---- end autoconf values ---- @@ -106,7 +108,7 @@ Get various configuration information needed to compile programs which use LLVM. Typically called from 'configure' scripts. Examples: llvm-config --cxxflags llvm-config --ldflags - llvm-config --libs jitplus + llvm-config --libs engine bcreader scalaropts Options: --version LLVM version. @@ -122,8 +124,8 @@ Options: --targets-built List of all targets currently built. Typical components: all All LLVM libraries (default). - native A native-code backend for this platform, if any. - jitplus All libraries needed to use the LLVM JIT examples. + backend Either a native backend or the C backend. + engine Either a native JIT or a bytecode interpreter. __EOD__ exit(1); } @@ -163,7 +165,8 @@ sub fix_library_names (@) { sub load_dependencies; sub build_name_map; -sub find_native_platform; +sub have_native_backend; +sub find_best_engine; sub expand_names (@); sub find_all_required_sets (@); sub find_all_required_sets_helper ($$@); @@ -231,19 +234,29 @@ sub build_name_map { } # Add virtual entries. - $NAME_MAP{'native'} = find_native_platform; - $NAME_MAP{'jitplus'} = ['native', 'jit', 'bcreader', 'scalaropts']; - $NAME_MAP{'all'} = [name_map_entries]; # Must be last. + $NAME_MAP{'native'} = have_native_backend() ? [$ARCH] : []; + $NAME_MAP{'backend'} = have_native_backend() ? ['native'] : ['cbackend']; + $NAME_MAP{'engine'} = find_best_engine; + $NAME_MAP{'all'} = [name_map_entries]; # Must be last. } -# Figure our what native platform we should use, if any. -sub find_native_platform { +# Return true if we have a native backend to use. +sub have_native_backend { my %BUILT; foreach my $target (@TARGETS_BUILT) { $BUILT{$target} = 1; } - if (defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH}) { - return [$ARCH]; + return defined $NAME_MAP{$ARCH} && defined $BUILT{$ARCH}; +} + +# Find a working subclass of ExecutionEngine for this platform. +sub find_best_engine { + if (have_native_backend && $TARGET_HAS_JIT) { + # XXX - Right now, if we omit the interpreter, we get a linker + # error complaining about + # __ZN4llvm11Interpreter6createEPNS_6ModuleEPNS_17IntrinsicLoweringE. + # This needs investigation. + return ['jit', 'native', 'interpreter']; } else { - return []; + return ['interpreter']; } }