This commit was manufactured by cvs2svn to create branch 'release_15'.

llvm-svn: 22067
diff --git a/External/PerfectClub/Makefile b/External/PerfectClub/Makefile
new file mode 100644
index 0000000..8ae9ae9
--- /dev/null
+++ b/External/PerfectClub/Makefile
@@ -0,0 +1,11 @@
+LEVEL = ../..
+include $(LEVEL)/Makefile.config
+
+# We can only compile these SPEC benchmarks with F2C
+ifdef USE_F2C
+PARALLEL_DIRS := adm arc2d bdna
+else
+PARALLEL_DIRS :=
+endif
+
+include $(LEVEL)/External/Makefile.external
diff --git a/External/PerfectClub/Makefile.perfect b/External/PerfectClub/Makefile.perfect
new file mode 100644
index 0000000..a9a4160
--- /dev/null
+++ b/External/PerfectClub/Makefile.perfect
@@ -0,0 +1,173 @@
+##===- Makefile.perfect ------------------------------------*- Makefile -*-===##
+#
+# This makefile is a template for building PERFECT as an external test.
+#
+##===----------------------------------------------------------------------===##
+
+include $(LEVEL)/Makefile.config
+
+## Information the test should have provided...
+ifndef STDOUT_FILENAME
+STDOUT_FILENAME := standard.out
+endif
+LDFLAGS += -lm
+
+# Get the current directory, the name of the benchmark, and the current
+# subdirectory of the PERFECT directory we are in
+#
+CURRENT_DIR := $(shell cd .; pwd)
+BENCH_NAME  := $(subst $(shell cd ..   ; pwd),,$(CURRENT_DIR))
+
+# Remove any leading /'s from the paths
+BENCH_NAME  := $(patsubst /%,%,$(BENCH_NAME))
+
+ifndef PERFECT_BENCH_DIR
+PERFECT_BENCH_DIR := $(PERFECT_ROOT)/$(BENCH_NAME)
+endif
+
+PROG := $(BENCH_NAME)
+ifndef Source
+Source := $(wildcard $(PERFECT_BENCH_DIR)/*.c $(PERFECT_BENCH_DIR)/*.cc)
+Source += $(wildcard $(PERFECT_BENCH_DIR)/*.f)
+endif
+
+# Disable the default Output/%.out-* targets...
+PROGRAMS_HAVE_CUSTOM_RUN_RULES := 1
+SourceDir := $(PERFECT_BENCH_DIR)
+
+include $(LEVEL)/MultiSource/Makefile.multisrc
+
+# Do not pass -Wall to compile commands...
+LCCFLAGS  := -O3
+LCXXFLAGS := -O3
+
+CPPFLAGS += -I$(PERFECT_BENCH_DIR)
+PERFECT_SANDBOX := $(PROGDIR)/External/PerfectClub/Sandbox.sh
+
+# Information about testing the program...
+REF_IN_DIR  := $(PERFECT_BENCH_DIR)
+
+# specify how to generate output from the PERFECT programs.  Basically we just
+# run the program in a sandbox (a special directory we create), then we cat all
+# of the outputs together.
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-nat): \
+Output/%.out-nat: Output/%.native
+	$(PERFECT_SANDBOX) nat $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../$*.native $(RUN_OPTIONS)
+	-(cd Output/nat; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/nat/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-lli): \
+Output/%.out-lli: Output/%.llvm.bc $(LLI)
+	$(PERFECT_SANDBOX) lli $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  $(LLI) $(LLI_OPTS) ../$*.llvm.bc $(RUN_OPTIONS)
+	-(cd Output/lli; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/lli/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-jit): \
+Output/%.out-jit: Output/%.llvm.bc $(LLI)
+	$(PERFECT_SANDBOX) jit $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  $(LLI) $(JIT_OPTS) ../$*.llvm.bc $(RUN_OPTIONS)
+	-(cd Output/jit; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/jit/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-jit-beta): \
+Output/%.out-jit-beta: Output/%.llvm.bc $(LLI)
+	$(PERFECT_SANDBOX) jit-beta $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  $(LLI) $(LLCBETAOPTION) $(JIT_OPTS) ../$*.llvm.bc $(RUN_OPTIONS)
+	-(cd Output/jit-beta; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/jit-beta/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-llc): \
+Output/%.out-llc: Output/%.llc
+	$(PERFECT_SANDBOX) llc $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../$*.llc $(RUN_OPTIONS)
+	-(cd Output/llc; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/llc/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-llc-beta): \
+Output/%.out-llc-beta: Output/%.llc-beta
+	$(PERFECT_SANDBOX) llc-beta $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../$*.llc-beta $(RUN_OPTIONS)
+	-(cd Output/llc-beta; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/llc-beta/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.out-cbe): \
+Output/%.out-cbe: Output/%.cbe
+	$(PERFECT_SANDBOX) cbe $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../$*.cbe $(RUN_OPTIONS)
+	-(cd Output/cbe; cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/cbe/$(STDOUT_FILENAME).time $@.time
+
+# perfectify stdin, reference output, and command line options for the program...
+BUGPOINT_OPTIONS += -input=$(STDIN_FILENAME) -output=../$*.out-nat
+BUGPOINT_OPTIONS += -timeout=$(RUNTIMELIMIT)
+BUGPOINT_OPTIONS += --tool-args $(LLCFLAGS)
+BUGPOINT_ARGS += --args -- $(RUN_OPTIONS)
+
+# Rules to bugpoint the GCCAS, GCCLD, LLC, or LLI commands...
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-gccas): \
+Output/%.bugpoint-gccas: Output/%.noopt-llvm.bc $(LBUGPOINT) \
+                         Output/gccas-pass-args Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.noopt-llvm.bc `cat Output/gccas-pass-args` $(OPTPASSES) \
+	    $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-gccld): \
+Output/%.bugpoint-gccld: Output/%.nogccldopt-llvm.bc $(LBUGPOINT) \
+                         Output/gccld-pass-args Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.nogccldopt-llvm.bc `cat Output/gccld-pass-args` $(OPTPASSES) \
+	    $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc): \
+Output/%.bugpoint-llc: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.llvm.bc -run-llc $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc-beta): \
+Output/%.bugpoint-llc-beta: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.llvm.bc -run-llc $(BUGPOINT_OPTIONS) \
+	    $(LLCBETAOPTION) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-jit): \
+Output/%.bugpoint-jit: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.llvm.bc -run-jit $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-jit-beta): \
+Output/%.bugpoint-jit-beta: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
+	$(PERFECT_SANDBOX) bugpoint $@ $(REF_IN_DIR) \
+	    $(LBUGPOINT) ../$*.llvm.bc -run-jit $(BUGPOINT_OPTIONS) \
+	    $(LLCBETAOPTION) $(BUGPOINT_ARGS)
+	@echo "===> Leaving Output/bugpoint"
+
+
+
+LIBPROFILESO = $(LLVM_OBJ_ROOT)/Debug/lib/libprofile_rt.so
+
+$(PROGRAMS_TO_TEST:%=Output/%.prof): \
+Output/%.prof: Output/%.llvm-prof.bc Output/%.out-nat $(LIBPROFILESO)
+	@rm -f $@
+	$(PERFECT_SANDBOX) profile Output/$*.out-prof $(REF_IN_DIR) \
+	  $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) $(LLI) $(JIT_OPTS)\
+            -fake-argv0 '../$*.llvm.bc' -load $(LIBPROFILESO) ../../$< -llvmprof-output ../../$@ $(RUN_OPTIONS)
+	-(cd Output/profile; cat $(LOCAL_OUTPUTS)) > Output/$*.out-prof
+	-cp Output/profile/$(STDOUT_FILENAME).time $@.time
+	-cp Output/profile/llvmprof.out $@
+	@cmp -s Output/$*.out-prof Output/$*.out-nat || \
+		printf "***\n***\n*** WARNING: Output of profiled program (Output/$*.out-prof)\n*** doesn't match the output of the native program (Output/$*.out-nat)!\n***\n***\n";
diff --git a/External/PerfectClub/Sandbox.sh b/External/PerfectClub/Sandbox.sh
new file mode 100755
index 0000000..f93c007
--- /dev/null
+++ b/External/PerfectClub/Sandbox.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Program:  Sandbox.sh
+#
+# Synopsis: This script is used to provide a sandbox for Perfect Club programs
+#           to execute in.  It provides an isolated environment, the input files
+#           necessary, and then finally runs the program.
+#
+# Syntax:  ./Sandbox.sh <uid> <output_file> <ref input> <program> <arguments>
+#
+
+TEST_UID=$1
+OUTPUT_FILE=$2
+INPUT_DIR=$3
+shift;shift;shift
+
+mkdir Output/$TEST_UID 2> /dev/null
+cd Output/$TEST_UID
+rm -rf *
+
+# Copy all of the test input files into the current directory...
+cp -r $INPUT_DIR/* .
+
+# Run the program now...
+echo Running: $*
+$*
+
+# This script is always successful...
+exit 0
+
diff --git a/External/PerfectClub/adm/Makefile b/External/PerfectClub/adm/Makefile
new file mode 100644
index 0000000..7641f5a
--- /dev/null
+++ b/External/PerfectClub/adm/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source := APSI.c TIMERS.c
+
+include ../Makefile.perfect
+
diff --git a/External/PerfectClub/arc2d/Makefile b/External/PerfectClub/arc2d/Makefile
new file mode 100644
index 0000000..79d7df5
--- /dev/null
+++ b/External/PerfectClub/arc2d/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   SRSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/dyfesm/Makefile b/External/PerfectClub/dyfesm/Makefile
new file mode 100644
index 0000000..d734789
--- /dev/null
+++ b/External/PerfectClub/dyfesm/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   SDSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/flo52/Makefile b/External/PerfectClub/flo52/Makefile
new file mode 100644
index 0000000..612d296
--- /dev/null
+++ b/External/PerfectClub/flo52/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   TFSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/mdg/Makefile b/External/PerfectClub/mdg/Makefile
new file mode 100644
index 0000000..582bce8
--- /dev/null
+++ b/External/PerfectClub/mdg/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   LWSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/mg3d/Makefile b/External/PerfectClub/mg3d/Makefile
new file mode 100644
index 0000000..2003cf0
--- /dev/null
+++ b/External/PerfectClub/mg3d/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   SMSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/ocean/Makefile b/External/PerfectClub/ocean/Makefile
new file mode 100644
index 0000000..396a87b
--- /dev/null
+++ b/External/PerfectClub/ocean/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   OCSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/qcd/Makefile b/External/PerfectClub/qcd/Makefile
new file mode 100644
index 0000000..b8daa35
--- /dev/null
+++ b/External/PerfectClub/qcd/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   LGSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/spec77/Makefile b/External/PerfectClub/spec77/Makefile
new file mode 100644
index 0000000..bf6fe12
--- /dev/null
+++ b/External/PerfectClub/spec77/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   WSSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/spice/Makefile b/External/PerfectClub/spice/Makefile
new file mode 100644
index 0000000..aae6d6b
--- /dev/null
+++ b/External/PerfectClub/spice/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   CSS.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/track/Makefile b/External/PerfectClub/track/Makefile
new file mode 100644
index 0000000..119597e
--- /dev/null
+++ b/External/PerfectClub/track/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   MTSI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect
diff --git a/External/PerfectClub/trfd/Makefile b/External/PerfectClub/trfd/Makefile
new file mode 100644
index 0000000..4a93274
--- /dev/null
+++ b/External/PerfectClub/trfd/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../..
+include $(LEVEL)/Makefile.f2c
+
+Source = COUNTY.f  DOEXTY.f  ENTERY.f  MINITY.f  DOENTY.f  DUMPY.f  \
+         EXITY.f   MENDY.f   TISI.f    TIMY.f    TIMERS.f 
+
+include ../Makefile.perfect