aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-03-23 23:21:29 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-03-23 23:21:29 +0000
commitb195d9d365e5f960c93ddfdf10638d5d147d9f6f (patch)
treeb9e444706691bb8fc0ff717926bb4e02fc3080e7 /utils
parent7e0911585ec2996837f151baab3d3fc9145a7e02 (diff)
downloadexternal_llvm-b195d9d365e5f960c93ddfdf10638d5d147d9f6f.zip
external_llvm-b195d9d365e5f960c93ddfdf10638d5d147d9f6f.tar.gz
external_llvm-b195d9d365e5f960c93ddfdf10638d5d147d9f6f.tar.bz2
Update to llvm-config tool, by Erik Kidd:
1. Check for Perl and only build llvm-config if its available. 2. Add some virtual components 3. Don't depend on "standard" location for Perl, but configured location 4. Document the tool with a POD file. This version is now ready for testing by users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile4
-rw-r--r--utils/llvm-config/Makefile3
-rwxr-xr-xutils/llvm-config/find-cycles.pl1
-rw-r--r--utils/llvm-config/llvm-config.in.in39
4 files changed, 33 insertions, 14 deletions
diff --git a/utils/Makefile b/utils/Makefile
index f37cd91..df03b56 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 c4a5407..0fdbe82 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 b660955..a280887 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 6f1533c..74bf7a9 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'];
}
}