gcc-patches@gcc.gnu.org
[Top] [All Lists]

[PATCH][PING][toplev] Add capability to build target libraries with FDO

Subject: [PATCH][PING][toplev] Add capability to build target libraries with FDO with libgfortran example
From: Richard Guenther
Date: Mon, 28 Nov 2005 11:48:40 +0100 CET
Ping!

Thanks,
Richard.

On Fri, 18 Nov 2005, Richard Guenther wrote:

> On Sat, 5 Nov 2005, Joseph S. Myers wrote:
> 
> > On Sat, 5 Nov 2005, Richard Guenther wrote:
> > 
> > > This patch adds the capability to build the target libraries with 
> > > -fprofile-generate/-fprofile-use.  A new toplevel configure switch
> > > --enable-profile=[target,host,yes,no] is introduced.  As example, 
> > > libgfortran is trained with the few execute tests in its torture 
> > > testsuite.  Further target libraries such as libstdc++ can be added
> > > to this procedure by adjusting the module specification in the
> > > Makefile.def.
> > 
> > Please document configure options in gcc/doc/install.texi.
> 
> Done.  New patch:
> 
> Ok for mainline after branch?
> 
> Thanks,
> Richard.
> 
> 
> 2005-11-18  Richard Guenther  <rguenther@xxxxxxx>
>  
>          * Makefile.tpl (target module build): Build target module
>          with profile-feedback, if required.
>          * configure.in (--enable-profiling): New flag.
>          * Makefile.in: Rebuild.
>          * configure: Rebuild.
> 
>        * doc/install.texi: Document --enable-profiling.
> 
>          * Makefile.def (libgfortran module): Add train_directory
>          and train_target entries.
> 
> 
> === Makefile.def
> ==================================================================
> --- Makefile.def      (revision 106379)
> +++ Makefile.def      (patch p level 1)
> @@ -117,7 +117,7 @@
>  target_modules = { module= libmudflap; lib_path=.libs; };
>  target_modules = { module= libssp; lib_path=.libs; };
>  target_modules = { module= newlib; };
> -target_modules = { module= libgfortran; };
> +target_modules = { module= libgfortran; train_directory=gcc; 
> train_target="check-fortran RUNTESTFLAGS=\"execute.exp 
> --target_board=unix/-fprofile-generate/-static\""; };
>  target_modules = { module= libobjc; };
>  target_modules = { module= libtermcap; no_check=true;
>                     missing=mostlyclean;
> === Makefile.tpl
> ==================================================================
> --- Makefile.tpl      (revision 106379)
> +++ Makefile.tpl      (patch p level 1)
> @@ -1041,14 +1041,36 @@
>  TARGET-[+prefix+][+module+]=[+
>    IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
>  maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
> +PROFILE_FLAGS=
> +@PROFILED_TARGET@PROFILE_FLAGS="-fprofile-generate"
>  all-[+prefix+][+module+]: configure-[+prefix+][+module+]
>       @[+ IF bootstrap +]test -f stage_last && exit 0; \
>       [+ ELSE bootstrap +]$(unstage)
> -     @[+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \
> +     @[+ ENDIF bootstrap +][+ IF train_target +]r=`${PWD_COMMAND}`; export 
> r; \
>       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
>       [+exports+] \
>       (cd [+subdir+]/[+module+] && \
> -       $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
> +       $(MAKE) CFLAGS="$(CFLAGS) $(PROFILE_FLAGS)" \
> +         CXXFLAGS="$(CXXFLAGS) $(PROFILE_FLAGS)" \
> +         GCJFLAGS="$(GCJFLAGS) $(PROFILE_FLAGS)" \
> +         FCFLAGS="$(FCFLAGS) $(PROFILE_FLAGS)" \
> +         [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
> +     @PROFILED_TARGET@@(cd [+train_directory+] && \
> +                        $(MAKE) -k [+train_target+])
> +     @PROFILED_TARGET@@r=`${PWD_COMMAND}`; export r; \
> +     s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +     [+exports+] \
> +     (cd [+subdir+]/[+module+] && \
> +       $(MAKE) CFLAGS="$(CFLAGS) -fprofile-use" \
> +         CXXFLAGS="$(CXXFLAGS) -fprofile-use" \
> +         GCJFLAGS="$(GCJFLAGS) -fprofile-use" \
> +         FCFLAGS="$(FCFLAGS) -fprofile-use" \
> +         [+args+] [+extra_make_flags+] clean $(TARGET-[+prefix+][+module+]))
> +     [+ ELSE train_target +]r=`${PWD_COMMAND}`; export r; \
> +     s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +     [+exports+] \
> +     (cd [+subdir+]/[+module+] && \
> +       $(MAKE) [+args+] [+extra_make_flags+] 
> $(TARGET-[+prefix+][+module+]))[+ ENDIF train_target +]
>  @endif [+prefix+][+module+]
>  
>  [+ IF bootstrap +]
> === configure.in
> ==================================================================
> --- configure.in      (revision 106379)
> +++ configure.in      (patch p level 1)
> @@ -298,6 +298,37 @@
>  esac
>  
>  
> +AC_ARG_ENABLE(profiling,
> +[  --enable-profiling[=LIST]
> +                           Enable profile-feedback for selected parts.
> +                           Valid list values are: yes,no,host,target.],
> +[ac_profiling_flags="${enableval}"],[ac_profiling_flags="no"])
> +ac_profiling_flags="no,${ac_profiling_flags}"
> +IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="$IFS,"
> +for flag in $ac_profiling_flags
> +do
> +     case $flag in
> +     yes)    PROFILED_TARGET= ;;
> +     no)     PROFILED_TARGET=\# ;;
> +     target) PROFILED_TARGET= ;;
> +     host)   AC_MSG_WARN([--enable-profiling=host is not yet supported.]) ;;
> +     *)      AC_MSG_ERROR([unknown profiling target $flag]) ;;
> +     esac
> +done
> +IFS="$ac_save_IFS"
> +if test "${host}" != "${target}"; then
> +  if test -z "$PROFILED_TARGET"; then
> +    AC_MSG_ERROR([target profiling only possible for host == target])
> +  fi
> +fi
> +if test "${host}" != "${build}"; then
> +  if test -z "$PROFILED_TARGET"; then
> +    AC_MSG_ERROR([profiling only possible for host == build])
> +  fi
> +fi
> +AC_SUBST(PROFILED_TARGET)
> +
> +
>  AC_ARG_ENABLE(libada,
>  [  --enable-libada        Builds libada directory],
>  ENABLE_LIBADA=$enableval,
> === gcc/doc/install.texi
> ==================================================================
> --- gcc/doc/install.texi      (revision 71621)
> +++ gcc/doc/install.texi      (local)
> @@ -1074,6 +1074,15 @@
>  Specify that the run-time libraries for stack smashing protection
>  should not be built.
>  
> +@item --enable-profiling=yes
> +@itemx --enable-profiling=@var{list}
> +Enables building certain parts of the compiler specified by @var{list}
> +with profile-feedback.  Supported parts are @samp{target} and @samp{host}
> +which build target libraries and the host compiler with profile feedback.
> +@samp{yes} (default if no parts specified) and @samp{no} (default, if
> +@samp{--enable-profiling} is not specified provide either both or none
> +of the two.
> +
>  @item --with-dwarf2
>  Specify that the compiler should
>  use DWARF 2 debugging information as the default.
> @@ -1693,6 +1702,9 @@
>  It is recommended to only use GCC for this.  Also parallel make is currently
>  not supported since collisions in profile collecting may occur.
>  
> +Support for building target libraries with profile feedback is provided
> +by the @samp{--enable-profiling} configure option.
> +
>  @html
>  <hr />
>  <p>
> 

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH][PING][toplev] Add capability to build target libraries with FDO (with libgfortran example), Richard Guenther <=