[svn:parrot] r44610 - in branches/rm_cflags: . compilers/imcc config/auto config/gen config/gen/makefiles config/init t/steps/auto t/steps/gen

coke at svn.parrot.org coke at svn.parrot.org
Wed Mar 3 23:12:46 UTC 2010


Author: coke
Date: Wed Mar  3 23:12:45 2010
New Revision: 44610
URL: https://trac.parrot.org/parrot/changeset/44610

Log:
- actually remove CFLAGS.in, as it's now covered via config/make
- update all uses of @optimize@ and @ccwarn@ to try the most specific version
  that could be available
- eliminate most of config/auto/cgoto.pm - these were simple makefile rules
  better expressed directly in root.in
  - clean up associated test file
- update init::optimize to allow file-based overrides.
- don't put optimizer cflags in @ccflags@, but only in @optimize@
  - fixup usages of cflags to respect this.:
- document the "SUFFIX OVERRIDE" convention in root.in
- don't bother adding some sun specific warning overrides since we're not
warnings clean on those platforms anyway - we'll start from scratch using
the new auto::warnings  (these warnings didn't even go through CFLAGS anyway)

Deleted:
   branches/rm_cflags/config/gen/makefiles/CFLAGS.in
Modified:
   branches/rm_cflags/MANIFEST
   branches/rm_cflags/compilers/imcc/Rules.in
   branches/rm_cflags/config/auto/cgoto.pm
   branches/rm_cflags/config/auto/pmc.pm
   branches/rm_cflags/config/gen/makefiles.pm
   branches/rm_cflags/config/gen/makefiles/dynoplibs.in
   branches/rm_cflags/config/gen/makefiles/dynpmc.in
   branches/rm_cflags/config/gen/makefiles/root.in
   branches/rm_cflags/config/init/optimize.pm
   branches/rm_cflags/t/steps/auto/cgoto-01.t
   branches/rm_cflags/t/steps/gen/makefiles-01.t

Modified: branches/rm_cflags/MANIFEST
==============================================================================
--- branches/rm_cflags/MANIFEST	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/MANIFEST	Wed Mar  3 23:12:45 2010	(r44610)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Feb 27 01:56:00 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Mar  3 19:59:01 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -317,7 +317,6 @@
 config/gen/crypto/digest_pmc.in                             []
 config/gen/crypto/digest_t.in                               []
 config/gen/makefiles.pm                                     []
-config/gen/makefiles/CFLAGS.in                              []
 config/gen/makefiles/docs.in                                []
 config/gen/makefiles/dynoplibs.in                           []
 config/gen/makefiles/dynpmc.in                              []

Modified: branches/rm_cflags/compilers/imcc/Rules.in
==============================================================================
--- branches/rm_cflags/compilers/imcc/Rules.in	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/compilers/imcc/Rules.in	Wed Mar  3 23:12:45 2010	(r44610)
@@ -104,7 +104,7 @@
     compilers/imcc/unit.h \
     $(INC_DIR)/oplib/ops.h \
     $(PARROT_H_HEADERS)
-	$(CC) $(CFLAGS) @ccwarn::compilers/imcc/imclexer.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/imclexer.c
+	$(CC) $(CFLAGS) @optimize::compilers/imcc/imclexer.c@ @ccwarn::compilers/imcc/imclexer.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/imclexer.c
 
 ## SUFFIX OVERRIDE - Warnings (This is generated code)
 compilers/imcc/imcparser$(O) : \
@@ -123,7 +123,7 @@
     $(INC_DIR)/dynext.h \
     $(INC_DIR)/oplib/ops.h \
     $(PARROT_H_HEADERS)
-	$(CC) $(CFLAGS) @ccwarn::compilers/imcc/imcparser.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/imcparser.c
+	$(CC) $(CFLAGS) @optimize::compilers/imcc/imcparser.c@ @ccwarn::compilers/imcc/imcparser.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/imcparser.c
 
 compilers/imcc/main$(O) : \
     compilers/imcc/cfg.h \
@@ -156,7 +156,7 @@
     compilers/imcc/unit.h \
     $(INC_DIR)/oplib/ops.h \
     $(PARROT_H_HEADERS)
-	$(CC) $(CFLAGS) @ccwarn::compilers/imcc/optimizer.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/optimizer.c
+	$(CC) $(CFLAGS) @optimize::compilers/imcc/optimizer.c@ @ccwarn::compilers/imcc/optimizer.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c compilers/imcc/optimizer.c
 
 compilers/imcc/reg_alloc$(O) : \
     compilers/imcc/cfg.h \

Modified: branches/rm_cflags/config/auto/cgoto.pm
==============================================================================
--- branches/rm_cflags/config/auto/cgoto.pm	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/auto/cgoto.pm	Wed Mar  3 23:12:45 2010	(r44610)
@@ -22,10 +22,10 @@
 
 sub _init {
     my $self = shift;
-    my %data;
-    $data{description} = q{Does your compiler support computed goto};
-    $data{result}      = q{};
-    return \%data;
+    return {
+        'description' => 'Does your compiler support computed goto',
+        'result'      => '',
+    };
 }
 
 sub runstep {
@@ -58,29 +58,6 @@
     my $verbose = $conf->options->get('verbose');
     if ($test) {
         $conf->data->set(
-            TEMP_cg_h => '$(INC_DIR)/oplib/core_ops_cg.h $(INC_DIR)/oplib/core_ops_cgp.h',
-            TEMP_cg_c => <<'EOF',
-# generated by config/auto/cgoto.pm
-
-src/ops/core_ops_cg$(O): $(GENERAL_H_FILES) src/ops/core_ops_cg.c \
-	include/pmc/pmc_parrotlibrary.h
-src/ops/core_ops_cgp$(O): $(GENERAL_H_FILES) src/ops/core_ops_cgp.c \
-	include/pmc/pmc_parrotlibrary.h
-src/runcore/cores.c: $(INC_DIR)/oplib/core_ops_cgp.h
-
-$(INC_DIR)/oplib/core_ops_cg.h: src/ops/core_ops_cg.c
-
-src/ops/core_ops_cg.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGoto.pm lib/Parrot/OpLib/core.pm
-	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --core
-
-$(INC_DIR)/oplib/core_ops_cgp.h: src/ops/core_ops_cgp.c
-
-src/ops/core_ops_cgp.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGP.pm lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CPrederef.pm
-	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --core
-EOF
-            TEMP_cg_o => 'src/ops/core_ops_cg$(O) src/ops/core_ops_cgp$(O)',
-            TEMP_cg_r => '$(RM_F) $(INC_DIR)/oplib/core_ops_cg.h src/ops/core_ops_cg.c \
-                    $(INC_DIR)/oplib/core_ops_cgp.h src/ops/core_ops_cgp.c',
             cg_flag => '-DHAVE_COMPUTED_GOTO'
         );
         print " (yes) " if $verbose;
@@ -88,10 +65,6 @@
     }
     else {
         $conf->data->set(
-            TEMP_cg_h => '',
-            TEMP_cg_c => '',
-            TEMP_cg_o => '',
-            TEMP_cg_r => '',
             cg_flag   => ''
         );
         print " (no) " if $verbose;

Modified: branches/rm_cflags/config/auto/pmc.pm
==============================================================================
--- branches/rm_cflags/config/auto/pmc.pm	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/auto/pmc.pm	Wed Mar  3 23:12:45 2010	(r44610)
@@ -93,6 +93,7 @@
         my $cc_shared = $conf->data->get('cc_shared');
         my $cc_o_out  = $conf->data->get('cc_o_out');
         my $warnings  = $conf->data->get('ccwarn');
+        my $optimize  = $conf->data->get('optimize');
 
         $TEMP_pmc_build .= <<END
 src/pmc/$pmc.c : src/pmc/$pmc.dump
@@ -108,7 +109,7 @@
     $parent_headers $include_headers include/pmc/pmc_continuation.h \\
     include/pmc/pmc_callcontext.h include/pmc/pmc_fixedintegerarray.h \\
     src/pmc/$pmc.c
-\t\$(CC) \$(CFLAGS) $cc_shared $warnings -I\$(\@D) $cc_o_out \$@ -c src/pmc/$pmc.c
+\t\$(CC) \$(CFLAGS) $optimize $cc_shared $warnings -I\$(\@D) $cc_o_out \$@ -c src/pmc/$pmc.c
 
 END
     }

Modified: branches/rm_cflags/config/gen/makefiles.pm
==============================================================================
--- branches/rm_cflags/config/gen/makefiles.pm	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/gen/makefiles.pm	Wed Mar  3 23:12:45 2010	(r44610)
@@ -54,7 +54,6 @@
         'parrot.pc'     => { SOURCE => 'config/gen/makefiles/parrot_pc.in' },
         'docs/Makefile' => { SOURCE => 'config/gen/makefiles/docs.in' },
     };
-    $data{CFLAGS_source} = 'config/gen/makefiles/CFLAGS.in';
     return \%data;
 }
 
@@ -62,36 +61,10 @@
     my ( $self, $conf ) = @_;
 
     $self->makefiles($conf);
-    $self->cflags($conf);
 
     return 1;
 }
 
-sub cflags {
-    my ( $self, $conf ) = @_;
-
-    $conf->genfile( $self->{CFLAGS_source} => 'CFLAGS',
-        comment_type                     => '#'
-    );
-
-    open( my $CFLAGS, ">>", "CFLAGS" ) or die "open >> CFLAGS: $!";
-
-    # Why is this here?  I'd think this information belongs
-    # in the CFLAGS.in file. -- A.D.  March 12, 2004
-    if ( $conf->data->get('cpuarch') =~ /sun4|sparc64/ ) {
-
-        # CFLAGS entries must be left-aligned.
-        print {$CFLAGS} <<"EOF";
-src/jit_cpu.c -{-Wcast-align}        # lots of noise!
-src/nci.c     -{-Wstrict-prototypes} # lots of noise!
-EOF
-    }
-
-    close $CFLAGS;
-
-    return;
-}
-
 sub makefiles {
     my ( $self, $conf ) = @_;
 

Deleted: branches/rm_cflags/config/gen/makefiles/CFLAGS.in
==============================================================================
--- branches/rm_cflags/config/gen/makefiles/CFLAGS.in	Wed Mar  3 23:12:45 2010	(r44609)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,28 +0,0 @@
-# [ filename | {regex} ] -{removed options} +{added options} s/// ...
-#
-# Avoid using non-configure controlled +{} directly in this file, as
-# it'll most likely break on other platforms.
-#
-# Note, empty regex/options are just ignored.
-#
-
-src/tsq.c           -{@optimize@}           # never optimize tsq.c!
-
-# The src/ops/core_ops*.c files are challenging to optimize.
-# gcc can usually handle it, but don't assume any other compilers can,
-# until there is specific evidence otherwise.
-#UNLESS(gccversion):src/ops/core_ops_cg.c      -{@optimize@}
-#UNLESS(gccversion):src/ops/core_ops_cgp.c     -{@optimize@}
-#UNLESS(gccversion):src/ops/core_ops_switch.c  -{@optimize@}
-
-#IF(cpuarch==amd64):src/gc/system.c  -{@optimize@}              # TT #405 amd64 --optimize problem
-
-# io should be -Wunused clean
-{^src/io/}              s/-Wno-unused/-Wunused/
-
-# imcc file settings
-{^compilers/imcc/}            -{-Wwrite-strings -Wcast-qual}
-{^compilers/imcc/(?!imclexer)}      s/-Wno-unused/-Wunused/
-compilers/imcc/optimizer.c    -{-Wformat-nonliteral} # noisy
-compilers/imcc/imclexer.c     -{-Wunused}  # noisy
-compilers/imcc/imclexer.c     -{-Wswitch-default}  # occurs in generated code

Modified: branches/rm_cflags/config/gen/makefiles/dynoplibs.in
==============================================================================
--- branches/rm_cflags/config/gen/makefiles/dynoplibs.in	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/gen/makefiles/dynoplibs.in	Wed Mar  3 23:12:45 2010	(r44610)
@@ -14,7 +14,7 @@
 LD            = @ld@
 LDFLAGS       = @ldflags@ @ld_debug@ @rpath_blib@ @linkflags@
 LD_LOAD_FLAGS = @ld_load_flags@
-CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ @optimize@
 LIBPARROT     = @libparrot_ldflags@
 
 BUILD_TOOLS_DIR = $(BUILD_DIR)/tools/build

Modified: branches/rm_cflags/config/gen/makefiles/dynpmc.in
==============================================================================
--- branches/rm_cflags/config/gen/makefiles/dynpmc.in	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/gen/makefiles/dynpmc.in	Wed Mar  3 23:12:45 2010	(r44610)
@@ -14,7 +14,7 @@
 LD            = @ld@
 LDFLAGS       = @ldflags@ @ld_debug@ @rpath_blib@
 LD_LOAD_FLAGS = @ld_load_flags@
-CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ @optimize@
 LIBPARROT     = @libparrot_ldflags@
 
 BUILD_TOOLS_DIR = $(BUILD_DIR)/tools/build

Modified: branches/rm_cflags/config/gen/makefiles/root.in
==============================================================================
--- branches/rm_cflags/config/gen/makefiles/root.in	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/gen/makefiles/root.in	Wed Mar  3 23:12:45 2010	(r44610)
@@ -180,8 +180,6 @@
 #IF(has_crypto):    t/dynpmc/sha1.t \
 #IF(has_crypto):    t/dynpmc/sha256.t \
 #IF(has_crypto):    t/dynpmc/sha512.t \
-    CFLAGS \
-    compilers/imcc/CFLAGS \
     config_lib.pasm \
     parrot.pc \
     compilers/imcc/imcc.y.flag \
@@ -413,7 +411,9 @@
         include/pmc/pmc_parrotinterpreter.h
 
 # generated list of header files
-GENERAL_H_FILES   = $(NONGEN_HEADERS) $(GEN_HEADERS) @TEMP_cg_h@
+GENERAL_H_FILES   = $(NONGEN_HEADERS) $(GEN_HEADERS) \
+#IF(cg_flag): $(INC_DIR)/oplib/core_ops_cg.h $(INC_DIR)/oplib/core_ops_cgp.h
+
 
 CHARSET_O_FILES   = @TEMP_charset_o@
 CLASS_PMC_FILES   = @TEMP_pmc_classes_pmc@
@@ -501,13 +501,12 @@
     src/utils$(O) \
     src/vtables$(O) \
     src/warnings$(O) \
-    \
     src/packfile/pf_items$(O) \
-    \
-    @TEMP_cg_o@ \
     @TEMP_atomic_o@ \
     @TEMP_gc_o@ \
 #IF(platform_asm):    src/platform_asm$(O) \
+#IF(cg_flag):     src/ops/core_ops_cg$(O) src/ops/core_ops_cgp$(O) \
+
 
 OPS_FILES = @ops@ $(GEN_OPSFILES)
 
@@ -578,16 +577,26 @@
 .SUFFIXES : .c .S .s .pmc .dump $(O) .str .pir .pbc
 
 .c$(O) : # suffix rule (limited support)
-	$(CC) $(CFLAGS) $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
+	$(CC) $(CFLAGS) @optimize@ $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
 
 .s$(O) : # suffix rule (limited support)
-	$(CC) $(CFLAGS) $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
+	$(CC) $(CFLAGS) @optimize@ $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
 #UNLESS(win32).S$(O) : # suffix rule (limited support)
-#UNLESS(win32)	$(CC) $(CFLAGS) $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
+#UNLESS(win32)	$(CC) $(CFLAGS) @optimize@ $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
 
 .pir.pbc : # suffix rule (limited support)
 	$(PARROT) -o $@ $<
 
+# Note: Several rules in this makefile are tagged with a "SUFFIX OVERRIDE"
+# comment; this indicates that we have an explicit compilation rule for
+# that particular C file; this is done so that we override various
+# options for that file - to change optimization levels, or twiddle
+# warnings. Each of those overrides should use the most specific settings
+# possible for that file. When file-specific overrides are added during
+# Configure, the override must be allowed for in this file.
+# These will eventually be automatically generated.
+
+
 ###############################################################################
 #
 # USER TARGETS:
@@ -812,7 +821,7 @@
 runtime/parrot/include/config.fpmc : myconfig config_lib.pasm $(MINIPARROT)
 	$(MINIPARROT) config_lib.pasm > $@
 
-$(PARROT) : src/main$(O) $(GEN_HEADERS) $(LIBPARROT) CFLAGS \
+$(PARROT) : src/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
     lib/Parrot/OpLib/core.pm src/parrot_config$(O) \
     $(MINIPARROT)
 	$(LINK) @ld_out@$@ \
@@ -1258,7 +1267,7 @@
 ## SUFFIX OVERRIDE - dynloaded files need cc_shared
 src/extend$(O) : $(PARROT_H_HEADERS) $(INC_DIR)/extend.h \
     include/pmc/pmc_sub.h $(INC_DIR)/extend_vtable.h src/extend.c
-	$(CC) $(CFLAGS) $(CC_WARN) @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/extend.c
+	$(CC) $(CFLAGS) @optimize::src/extend.c@ @ccwarn::src/extend.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/extend.c
 
 src/runcore/main$(O) : \
 	src/runcore/main.str \
@@ -1373,7 +1382,9 @@
         $(INC_DIR)/runcore_api.h $(INC_DIR)/runcore_trace.h \
         $(PARROT_H_HEADERS)
 
-src/tsq$(O) : $(PARROT_H_HEADERS)
+## SUFFIX OVERRIDE
+src/tsq$(O) : $(PARROT_H_HEADERS) src/tsq.c
+	$(CC) $(CFLAGS) @optimize::src/tsq.c@ @ccwarn::src/tsq.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/tsq.c
 
 src/embed$(O) : $(PARROT_H_HEADERS) $(INC_DIR)/embed.h \
         $(INC_DIR)/oplib/ops.h $(INC_DIR)/runcore_api.h \
@@ -1400,13 +1411,13 @@
         include/pmc/pmc_unmanagedstruct.h \
         include/pmc/pmc_nci.h
 
-## SUFFIX OVERRIDE - Warnings
+## SUFFIX OVERRIDE
 src/nci/extra_thunks$(O) : src/nci/extra_thunks.str \
     $(PARROT_H_HEADERS) \
     include/pmc/pmc_unmanagedstruct.h \
     include/pmc/pmc_nci.h \
     src/nci/extra_thunks.c
-	$(CC) $(CFLAGS) @ccwarn::src/nci/extra_thunks.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/nci/extra_thunks.c
+	$(CC) $(CFLAGS) @optimize::src/nci/extra_thunks.c@ @ccwarn::src/nci/extra_thunks.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/nci/extra_thunks.c
 
 src/frame_builder$(O) : $(PARROT_H_HEADERS) src/frame_builder.h \
         include/pmc/pmc_fixedintegerarray.h \
@@ -1416,7 +1427,10 @@
 
 src/vtables$(O) : $(PARROT_H_HEADERS)
 
+## SUFFIX OVERRIDE
 src/gc/system$(O) : $(PARROT_H_HEADERS)  src/gc/gc_private.h
+	$(CC) $(CFLAGS) @optimize::src/gc/system.c@ @ccwarn::src/gc/system.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/gc/system.c
+
 src/gc/gc_private.h : $(INC_DIR)/settings.h
 
 src/warnings$(O) : $(PARROT_H_HEADERS)
@@ -1425,9 +1439,9 @@
 
 src/utils$(O) : $(PARROT_H_HEADERS) include/pmc/pmc_nci.h
 
-## SUFFIX OVERRIDE - Warnings
+## SUFFIX OVERRIDE
 src/spf_render$(O) : $(PARROT_H_HEADERS) src/spf_render.str
-	$(CC) $(CFLAGS) @ccwarn::src/spf_render.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/spf_render.c
+	$(CC) $(CFLAGS) @optimize::src/spf_render.c@ @ccwarn::src/spf_render.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/spf_render.c
 
 src/spf_vtable$(O) : $(PARROT_H_HEADERS) src/spf_vtable.str
 
@@ -1478,8 +1492,10 @@
 	include/pmc/pmc_continuation.h
 	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core @no_lines_flag@
 
+## SUFFIX OVERRIDE
 src/ops/core_ops_switch$(O) : $(GENERAL_H_FILES) src/ops/core_ops_switch.c \
 	include/pmc/pmc_parrotlibrary.h
+	$(CC) $(CFLAGS) @optimize::src/ops/core_ops_switch.c@ @ccwarn::src/ops/core_ops_switch.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_switch.c
 
 $(INC_DIR)/oplib/core_ops_switch.h : src/ops/core_ops_switch.c
 
@@ -1489,7 +1505,27 @@
 	lib/Parrot/OpTrans/CPrederef.pm
 	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core @no_lines_flag@
 
- at TEMP_cg_c@
+## SUFFIX OVERRIDE
+src/ops/core_ops_cg$(O): $(GENERAL_H_FILES) src/ops/core_ops_cg.c \
+        include/pmc/pmc_parrotlibrary.h
+	$(CC) $(CFLAGS) @optimize::src/ops/core_ops_cg.c@ @ccwarn::src/ops/core_ops_cg.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_cg.c
+
+## SUFFIX OVERRIDE
+src/ops/core_ops_cgp$(O): $(GENERAL_H_FILES) src/ops/core_ops_cgp.c \
+        include/pmc/pmc_parrotlibrary.h
+	$(CC) $(CFLAGS) @optimize::src/ops/core_ops_cgp.c@ @ccwarn::src/ops/core_ops_cgp.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops_cgp.c
+
+src/runcore/cores.c: $(INC_DIR)/oplib/core_ops_cgp.h
+
+$(INC_DIR)/oplib/core_ops_cg.h: src/ops/core_ops_cg.c
+
+src/ops/core_ops_cg.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGoto.pm lib/Parrot/OpLib/core.pm
+	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGoto --core
+
+$(INC_DIR)/oplib/core_ops_cgp.h: src/ops/core_ops_cgp.c
+
+src/ops/core_ops_cgp.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm lib/Parrot/OpTrans/CGP.pm lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CPrederef.pm
+	$(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CGP --core
 
 @TEMP_gc_c@
 
@@ -1820,7 +1856,8 @@
     ext-clean \
 #UNLESS(win32):    cover-clean \
     editor-clean
-	@TEMP_cg_r@
+	$(RM_F) $(INC_DIR)/oplib/core_ops_cg.h src/ops/core_ops_cg.c \
+    $(INC_DIR)/oplib/core_ops_cgp.h src/ops/core_ops_cgp.c
 	$(RM_F) chartypes "*.s" "*~"
 	$(RM_F) $(FLUID_FILES_1)
 	$(RM_F) $(FLUID_FILES_2)
@@ -2423,7 +2460,7 @@
 # for use by t/pmc/nci.t
 ## SUFFIX OVERRIDE - dynloaded files need cc_shared
 src/nci_test$(O): $(PARROT_H_HEADERS) src/nci_test.c
-	$(CC) $(CFLAGS) $(CC_WARN) @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/nci_test.c
+	$(CC) $(CFLAGS) @optimize::src/nci_test.c@ @ccwarn::src/nci_test.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/nci_test.c
 
 $(LIBNCI_TEST_SO): src/nci_test$(O) $(LIBPARROT)
 	$(LD) $(LD_LOAD_FLAGS) @ncilib_link_extra@ $(LDFLAGS) \
@@ -2450,9 +2487,9 @@
 	$(NCI_THUNK_GEN) --dynext --no-warn-dups \
 	    --output=src/extra_nci_thunks.c <src/nci/extra_thunks.nci
 
-## SUFFIX OVERRIDE - Warnings
+## SUFFIX OVERRIDE
 src/extra_nci_thunks$(O) : $(GENERAL_H_FILES) src/extra_nci_thunks.c
-	$(CC) $(CFLAGS) @ccwarn::src/extra_nci_thunks.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/extra_nci_thunks.c
+	$(CC) $(CFLAGS) @optimize::src/extra_nci_thunks.c@ @ccwarn::src/extra_nci_thunks.c@ @cc_shared@ -I$(@D) @cc_o_out@ $@ -c src/extra_nci_thunks.c
 
 $(EXTRANCITHUNKS_SO) : $(LIBPARROT) src/extra_nci_thunks$(O)
 	$(LD) $(LD_LOAD_FLAGS) $(LDFLAGS) \

Modified: branches/rm_cflags/config/init/optimize.pm
==============================================================================
--- branches/rm_cflags/config/init/optimize.pm	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/config/init/optimize.pm	Wed Mar  3 23:12:45 2010	(r44610)
@@ -21,10 +21,10 @@
 
 sub _init {
     my $self = shift;
-    my %data;
-    $data{description} = q{Enable optimization};
-    $data{result}      = q{};
-    return \%data;
+    return {
+        'description', 'Enable optimization',
+        'result',      '',
+    };
 }
 
 our $verbose;
@@ -41,41 +41,56 @@
     # A plain --optimize means use perl5's $Config{optimize}.  If an argument
     # is given, however, use that instead.
     my $optimize = $conf->options->get('optimize');
-    if ( defined $optimize ) {
-        $self->set_result('yes');
 
-        # disable debug flags
-        $conf->data->set( cc_debug => '' );
-        $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" );
-        if ( $optimize eq "1" ) {
-
-            # use perl5's value
-            # gcc 4.1 doesn't like -mcpu=xx, i.e. it's deprecated
-            my $opts = $conf->data->get('optimize_provisional');
-            my $gccversion = $conf->data->get( 'gccversion' );
-            my $arch_opt = 'cpu';
-            if ( defined $gccversion and $gccversion > 3.3 ) {
-                $arch_opt = 'arch';
-            }
-            $opts =~ s/-mcpu=/-m$arch_opt=/;
-            $conf->data->add( ' ', ccflags => $opts );
-            print "opts: ", $opts, "\n" if $verbose;
-
-            # record what optimization was enabled
-            $conf->data->set( optimize => $opts );
-        }
-        else {
+    if (! defined $optimize) {
+        $self->set_result('no');
+        print "(none requested) " if $conf->options->get('verbose');
+        return 1;
+    }
 
-            # use what was passed to --optimize on the CLI
-            $conf->data->add( ' ', ccflags => $optimize );
+    $self->set_result('yes');
+    my $gccversion = $conf->data->get( 'gccversion' );
 
-            # record what optimization was enabled
-            $conf->data->set( optimize => $optimize );
+    my $options;
+    if ( $optimize eq "1" ) {
+        # start with perl5's flags ...
+        $options = $conf->data->get('optimize_provisional');
+
+        # ... but gcc 4.1 doesn't like -mcpu=xx, i.e. it's deprecated
+        if ( defined $gccversion and $gccversion > 3.3 ) {
+            $options =~ s/-mcpu=/-march=/;
         }
     }
     else {
-        $self->set_result('no');
-        print "(none requested) " if $conf->options->get('verbose');
+        # use the command line verbatim
+        $options = $optimize; 
+    }
+
+    # save the options, however we got them.
+    $conf->data->set( optimize => $options );
+    print "optimize options: ", $options, "\n" if $verbose;
+
+    # disable debug flags.
+    $conf->data->set( cc_debug => '' );
+    $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" );
+
+    # per file overrides - not every compiler can optimize every file.
+
+    # never optimize this file.
+    $conf->data->set('optimize::src/tsq.c','');
+
+    # The src/ops/core_ops*.c files are challenging to optimize.
+    # gcc can usually handle it, but don't assume any other compilers can,
+    # until there is specific evidence otherwise.
+    if ( ! defined($gccversion)) {
+        $conf->data->set('optimize::src/ops/core_ops_cg.c','');
+        $conf->data->set('optimize::src/ops/core_ops_cgp.c','');
+        $conf->data->set('optimize::src/ops/core_ops_switch.c','');
+    }
+
+    # TT #405
+    if ($conf->data->get('cpuarch') eq 'amd64') {
+        $conf->data->set('optimize::src/gc/system.c','');
     }
 
     return 1;

Modified: branches/rm_cflags/t/steps/auto/cgoto-01.t
==============================================================================
--- branches/rm_cflags/t/steps/auto/cgoto-01.t	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/t/steps/auto/cgoto-01.t	Wed Mar  3 23:12:45 2010	(r44610)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  45;
+use Test::More tests =>  25;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::auto::cgoto');
@@ -37,10 +37,6 @@
 my $ret = $step->runstep($conf);
 ok( $ret, "runstep() returned true value" );
 ok(defined($step->result()), "A result was defined");
-ok(defined($conf->data->get('TEMP_cg_h')), "An attribute has been defined");
-ok(defined($conf->data->get('TEMP_cg_c')), "An attribute has been defined");
-ok(defined($conf->data->get('TEMP_cg_o')), "An attribute has been defined");
-ok(defined($conf->data->get('TEMP_cg_r')), "An attribute has been defined");
 ok(defined($conf->data->get('cg_flag')), "An attribute has been defined");
 
 $conf->replenish($serialized);
@@ -68,18 +64,10 @@
 ########### _evaluate_cgoto() ###########
 
 $step->_evaluate_cgoto($conf, 1);
-ok($conf->data->get('TEMP_cg_h'), "An attribute was set to true value");
-ok($conf->data->get('TEMP_cg_c'), "An attribute was set to true value");
-ok($conf->data->get('TEMP_cg_o'), "An attribute was set to true value");
-ok($conf->data->get('TEMP_cg_r'), "An attribute was set to true value");
 ok($conf->data->get('cg_flag'), "An attribute was set to true value");
 is($step->result(), q{yes}, "Expected result was set");
 
 $step->_evaluate_cgoto($conf, 0);
-is($conf->data->get('TEMP_cg_h'), q{}, "An attribute was set to empty string");
-is($conf->data->get('TEMP_cg_c'), q{}, "An attribute was set to empty string");
-is($conf->data->get('TEMP_cg_o'), q{}, "An attribute was set to empty string");
-is($conf->data->get('TEMP_cg_r'), q{}, "An attribute was set to empty string");
 is($conf->data->get('cg_flag'), q{}, "An attribute was set to empty string");
 is($step->result(), q{no}, "Expected result was set");
 
@@ -99,10 +87,6 @@
         sub { $step->_evaluate_cgoto($conf, 1) },
         \$stdout
     );
-    ok($conf->data->get('TEMP_cg_h'), "An attribute was set to true value");
-    ok($conf->data->get('TEMP_cg_c'), "An attribute was set to true value");
-    ok($conf->data->get('TEMP_cg_o'), "An attribute was set to true value");
-    ok($conf->data->get('TEMP_cg_r'), "An attribute was set to true value");
     ok($conf->data->get('cg_flag'), "An attribute was set to true value");
     is($step->result(), q{yes}, "Expected result was set");
 }
@@ -113,14 +97,6 @@
         sub { $step->_evaluate_cgoto($conf, 0) },
         \$stdout
     );
-    is($conf->data->get('TEMP_cg_h'), q{},
-        "An attribute was set to empty string");
-    is($conf->data->get('TEMP_cg_c'), q{},
-        "An attribute was set to empty string");
-    is($conf->data->get('TEMP_cg_o'), q{},
-        "An attribute was set to empty string");
-    is($conf->data->get('TEMP_cg_r'), q{},
-        "An attribute was set to empty string");
     is($conf->data->get('cg_flag'), q{},
         "An attribute was set to empty string");
     is($step->result(), q{no}, "Expected result was set");

Modified: branches/rm_cflags/t/steps/gen/makefiles-01.t
==============================================================================
--- branches/rm_cflags/t/steps/gen/makefiles-01.t	Wed Mar  3 22:08:40 2010	(r44609)
+++ branches/rm_cflags/t/steps/gen/makefiles-01.t	Wed Mar  3 23:12:45 2010	(r44610)
@@ -71,7 +71,7 @@
       );
 }
 
-use Test::More tests => (8 + @cond_tests);
+use Test::More tests => (7 + @cond_tests);
 use Carp;
 use lib qw( . lib );
 
@@ -108,7 +108,6 @@
 }
 
 is($missing_SOURCE, 0, "No Makefile source file missing");
-ok(-f $step->{CFLAGS_source}, "CFLAGS source file located");
 
 my $index = undef;
 sub result {


More information about the parrot-commits mailing list