[RFC] PCH support for pooma / gcc3.4
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Mon Jun 23 12:54:31 UTC 2003
Hi!
I finally got to add preliminary support for PCH to pooma (see attached
patch). Unfortunately the build system of pooma is a complete mess, so
the pch files cannot be used for compiling the testsuite. Also adding
support for Intel icc 8.0 pch will be difficult as it handles things
totally different. Also we may want to restructure the Pooma/ includes
quite a bit.
Comments? Who doesnt like the build system, too? Who would be happy with
a (stripped down in features) autoconf transition that would affect
library users?
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
# This is a BitKeeper generated patch for the following project:
# Project Name: pooma/cheetah repository tracking CVS/tarball
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.60 -> 1.61
# r2/configure 1.11 -> 1.12
# r2/config/Shared/compilerules.mk 1.1 -> 1.2
# r2/src/Pooma/objfile.mk 1.1 -> 1.2
# r2/bin/makeinstall 1.1 -> 1.2
# r2/config/Shared/rules.mk 1.2 -> 1.3
# r2/config/Shared/tail.mk 1.1 -> 1.2
# r2/config/arch/LINUXgcc.conf 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/23 rguenth at bellatrix.tat.physik.uni-tuebingen.de 1.61
# initial PCH support and other (unfortunate) random stuff
# --------------------------------------------
#
diff -Nru a/r2/bin/makeinstall b/r2/bin/makeinstall
--- a/r2/bin/makeinstall Mon Jun 23 14:50:59 2003
+++ b/r2/bin/makeinstall Mon Jun 23 14:50:59 2003
@@ -31,7 +31,7 @@
#
# Usage:
#
-# makeinstall <SUITE> <installdir> <arch> [<extensions>]
+# makeinstall <SUITE> <installdir> <arch> <pchextension> [<extensions>]
#
# where
#
@@ -56,20 +56,21 @@
### Make sure we have the right arguments
-if [ "$#" != "4" -a "$#" != "5" ]; then
- echo "Usage: $0 <SUITE> <installdir> <arch> <libext> [<extensions>]"
+if [ "$#" != "5" -a "$#" != "6" ]; then
+ echo "Usage: $0 <SUITE> <installdir> <arch> <libext> <pchextension> [<extensions>]"
exit 1
fi
suite=$1
libext=$4
+pchextension=$5
libbase=pooma
libname=lib$libbase
libfull=$libname.$libext
extensions=""
-if [ "$#" != "4" ]; then
- extensions=$5
+if [ "$#" != "5" ]; then
+ extensions=$6
fi
libfilename=$libname$extensions.$libext
@@ -127,6 +128,10 @@
srclista=`find src/arch -type f -print | grep -v CVS`
tar cf - $srclisth $srclistc $srclista | (cd $installdir ; tar xvf - )
+if test "$pchextension" != ""; then
+ echo "Copying pch files to $installdir ..."
+ for i in src/Pooma/$suite/*.$pchextension; do cp $i $installdir/src/Pooma; done
+fi
### Copy HTML files to html directory
diff -Nru a/r2/config/Shared/compilerules.mk b/r2/config/Shared/compilerules.mk
--- a/r2/config/Shared/compilerules.mk Mon Jun 23 14:50:59 2003
+++ b/r2/config/Shared/compilerules.mk Mon Jun 23 14:50:59 2003
@@ -65,6 +65,7 @@
#$(PF_OUT)/%.f: $(THISDIR)/%.g ajax; $(AjaxToPF_out)
#%.o: %.f; $(FCToSuite)\; @$(ProblemEcho)
+$(ODIR)/%.$(PCH_EXTENSION): $(THISDIR)/%.h; $(PCHToSuite)
# ACL:rcsinfo
# ----------------------------------------------------------------------
diff -Nru a/r2/config/Shared/rules.mk b/r2/config/Shared/rules.mk
--- a/r2/config/Shared/rules.mk Mon Jun 23 14:50:59 2003
+++ b/r2/config/Shared/rules.mk Mon Jun 23 14:50:59 2003
@@ -54,7 +54,7 @@
ifeq ("$(INSTREPO)", "1")
clean::
@echo Removing all .o files from suite $(SUITE) beneath `pwd`
- rm -f $(INSTANTIATION_DIR)/*.o; \
+ @rm -f $(INSTANTIATION_DIR)/*.o;
@$(foreach dir,$(shell $(FIND) . -name $(SUITE)),rm -f $(dir)/*.o;)
else
clean::
@@ -107,7 +107,7 @@
install::
@echo Installing files to directory $(INSTALL_DIR) ... ; \
cd $(PROJECT_ROOT) ; \
- bin/makeinstall $(SUITE) $(INSTALL_DIR) $(INSTALL_ARCH) $(INSTALL_LIBEXT) $(INSTALL_EXT)
+ bin/makeinstall $(SUITE) $(INSTALL_DIR) $(INSTALL_ARCH) $(INSTALL_LIBEXT) "$(PCH_EXTENSION)" $(INSTALL_EXT)
# Create a distribution file for this project, and place it in
# the top level of the build tree.
@@ -227,7 +227,7 @@
$(ToSuiteSetup)
@echo Linker location: `which $(LD)` >> $(INFO_FILE);
@echo LinkToSuite... See $(subst $(THISDIR)/,,$(INFO_FILE));\
- echo "$(PRE_CMDLINE) $(LD_LINK_CMDLINE)" | $(PERL) $(SHARED_ROOT)/pretty.pl ld >> $(INFO_FILE);
+ echo "$(PRE_CMDLINE) $(LD_LINK_CMDLINE)" >> $(INFO_FILE);
@$(PRE_CMDLINE) $(LD_LINK_CMDLINE) $(SUITE_REDIRECT)
@-ln -f $@ $@_$(PASS)
$(infotimestamp)
@@ -265,7 +265,7 @@
$(ToSuiteSetup)
@echo Compiler location: `which $(CXX)` >> $(INFO_FILE)
@echo CXXToSuite... See $(subst $(THISDIR)/,,$(INFO_FILE))
- @echo "$(PRE_CMDLINE) $(CXX_COMPILE_CMDLINE)" | $(PERL) $(SHARED_ROOT)/pretty.pl cc >> $(INFO_FILE)
+ @echo "$(PRE_CMDLINE) $(CXX_COMPILE_CMDLINE)" >> $(INFO_FILE)
@$(PRE_CMDLINE) $(CXX_COMPILE_CMDLINE) $(SUITE_REDIRECT)
$(infotimestamp)
endef
@@ -331,6 +331,15 @@
$(infotimestamp)
endef
+define PCHToSuite
+ $(ToSuiteSetup)
+ @echo Compiler location: `which $(CXX)` >> $(INFO_FILE)
+ @echo PCHToSuite... See $(subst $(THISDIR)/,,$(INFO_FILE))
+ @echo "$(PRE_CMDLINE) $(CXX_PCH_CMDLINE)" >> $(INFO_FILE)
+ @$(PRE_CMDLINE) $(CXX_PCH_CMDLINE) $(SUITE_REDIRECT)
+ $(infotimestamp)
+endef
+
define maketargetdir
if [ ! -d "$(dir $@)" ]; then mkdir $(dir $@); fi;\
if [ ! -h "$(dir $@)Makefile" ]; then ln -s $(SHARED_ROOT)/Makefile $(dir $@)Makefile; fi
diff -Nru a/r2/config/Shared/tail.mk b/r2/config/Shared/tail.mk
--- a/r2/config/Shared/tail.mk Mon Jun 23 14:50:59 2003
+++ b/r2/config/Shared/tail.mk Mon Jun 23 14:50:59 2003
@@ -89,6 +89,9 @@
# Build command line for prelink step
PRELINK_CMDLINE = $(PRELINK) $(RULE_PRELINK_OPTS) $(filter %.o,$+)
+# PCH command line for C++ compiler
+CXX_PCH_CMDLINE = $(CXX) -c $< -o $@ $(SUITE_DEFINES) $(RULE_CXXOPTS) $(RULE_INCLUDES)
+
# Build command line for archiver
ifeq ("$(INSTREPO)", "1")
AR_CMDLINE = $(AR) $(RULE_AR_OPTS) $@ $(filter %.o,$+) $(INSTANTIATION_DIR)/*.o
diff -Nru a/r2/config/arch/LINUXgcc.conf b/r2/config/arch/LINUXgcc.conf
--- a/r2/config/arch/LINUXgcc.conf Mon Jun 23 14:50:59 2003
+++ b/r2/config/arch/LINUXgcc.conf Mon Jun 23 14:50:59 2003
@@ -166,12 +166,14 @@
$cppverbose = "-v"; # flag for verbose compiler output
$cpponeper = ""; # flag to turn on one-instantance-per-obj
$cppstrict = " -ansi"; # flag for ANSI conformance checking
+$cpppchextension = "h.gch"; # extension for pch files
### debug or optimized build settings for C++ applications
$cppdbg_app = "-g";
-$cppopt_app = "-DNOPAssert -DNOCTAssert -O2 -fno-default-inline -funroll-loops -fstrict-aliasing";
+$cppopt_app = "-DNOPAssert -DNOCTAssert -O2 -march=athlon -fomit-frame-pointer -funroll-loops -ftime-report";
+#$cppopt_app = "-DNOPAssert -DNOCTAssert -O2 -fomit-frame-pointer -funroll-loops --param max-inline-slope=1000000";
### debug or optimized build settings for C++ libraries
diff -Nru a/r2/configure b/r2/configure
--- a/r2/configure Mon Jun 23 14:50:59 2003
+++ b/r2/configure Mon Jun 23 14:50:59 2003
@@ -210,6 +210,7 @@
$cheetahnm = "--messaging";
$strictnm = "--strict";
$archfnsnm = "--arch-specific-functions";
+$pchnm = "--pch";
### configure options
$dbgprntnm = "-v"; # turn on verbose output from configure
@@ -273,6 +274,7 @@
[$arargnm, "<args>", "include <args> in the archiver args."],
[$linknm, "<linker>", "use <linker> for the linker application."],
[$linkargnm, "<args>", "include <args> in the linker args."],
+ [$pchnm, "", "generate precompiled headers."],
[$dbgprntnm, "", "turn on verbose output from configure."],
[$nooverwritenm, "", "force check of whether to overwrite files."],
[$overwritenm, "", "force overwrite of all files."],
@@ -485,6 +487,7 @@
$cppopt_app = "";
$cppdbg_lib = "";
$cppdbg_app = "";
+$cpppchextension = "";
### the name and arguments for the C compiler
$c = "";
@@ -2021,6 +2024,12 @@
print FSUITE "INSTREPO = 1\n";
print FSUITE "INSTANTIATION_DIR = $instantiationdir\n";
print FSUITE "\n";
+ }
+
+ if (scalar @{$arghash{$pchnm}} > 1)
+ {
+ print FSUITE "GENERATE_PCH = 1\n";
+ print FSUITE "PCH_EXTENSION = $cpppchextension\n";
}
print FSUITE "### installation and distribution information\n";
diff -Nru a/r2/src/Pooma/objfile.mk b/r2/src/Pooma/objfile.mk
--- a/r2/src/Pooma/objfile.mk Mon Jun 23 14:50:59 2003
+++ b/r2/src/Pooma/objfile.mk Mon Jun 23 14:50:59 2003
@@ -36,6 +36,13 @@
$(UNIQUE)_OBJS := \
$(ODIR)/Pooma.cmpl.o
+ifneq ($(GENERATE_PCH),)
+$(UNIQUE)_OBJS := $($(UNIQUE)_OBJS) \
+ $(ODIR)/Arrays.$(PCH_EXTENSION) \
+ $(ODIR)/Fields.$(PCH_EXTENSION) \
+ $(ODIR)/Pooma.$(PCH_EXTENSION)
+endif
+
LOCAL_OBJS += $($(UNIQUE)_OBJS)
# Set rules for the ODIR directory
More information about the pooma-dev
mailing list