[llvm-commits] target specific C++ file in llvm-gcc

Chris Lattner clattner at apple.com
Wed Jan 3 17:36:26 PST 2007


Thanks Devang,

Jim and Evan, can you move the monster altivec/sse macros out of the  
i386.h / rs6000.h files when convenient?

-Chris

On Jan 3, 2007, at 11:59 AM, Devang Patel wrote:

> I've applied following patch to support target-specific C++ file in
> llvm-gcc.
>
> -
> Devang
>
>
> $ cat  ~/patch_collection/llvm/R4897246.take2.diff
> Index: configure
> ===================================================================
> --- configure   (revision 121791)
> +++ configure   (working copy)
> @@ -309,7 +309,10 @@ ac_includes_default="\
> # include <unistd.h>
> #endif"
> -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
> PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
> program_transform_name bindir sbindir libexecdir datadir sysconfdir
> sharedstatedir localstatedir libdir includedir oldincludedir infodir
> mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T
> LIBS build build_cpu build_vendor build_os host host_cpu host_vendor
> host_os target target_cpu target_vendor target_os target_noncanonical
> build_subdir host_subdir target_subdir gcc_version_trigger
> gcc_version_full gcc_version GENINSRC CC CFLAGS LDFLAGS CPPFLAGS
> ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP
> strict1_warn warn_cflags WERROR checkingenabled_flag nocommon_flag
> TREEBROWSER valgrind_path valgrind_path_defines valgrind_command
> coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT
> TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep
> LLVMBASEPATH SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags
> INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target
> have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON
> NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB
> TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext
> gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL
> LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS
> cc_for_cross_gnattools CROSS ALL SYSTEM_HEADER_DIR inhibit_libc
> CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2
> libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar
> slibdir objdir subdirs srcdir all_boot_languages all_compilers
> all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files
> all_lang_makefrags all_lang_makefiles all_languages all_stagestuff
> build_exeext build_install_headers_dir build_xm_file_list
> build_xm_include_list build_xm_defines check_languages
> cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir
> xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs
> extra_parts extra_passes extra_programs float_h_file
> gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir host_exeext
> host_xm_file_list host_xm_include_list host_xm_defines
> out_host_hook_obj install lang_opt_files lang_specs_files
> lang_tree_files local_prefix md_file objc_boehm_gc out_file
> out_object_file stage_prefix_set_by_configure
> quoted_stage_prefix_set_by_configure thread_file tm_file_list
> tm_include_list tm_defines tm_p_file_list tm_p_include_list
> xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs
> target_cpu_default set_gcc_lib_path GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
> +# APPLE LOCAL begin LLVM
> +# Add out_cxx_file
> +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
> PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
> program_transform_name bindir sbindir libexecdir datadir sysconfdir
> sharedstatedir localstatedir libdir includedir oldincludedir infodir
> mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T
> LIBS build build_cpu build_vendor build_os host host_cpu host_vendor
> host_os target target_cpu target_vendor target_os target_noncanonical
> build_subdir host_subdir target_subdir gcc_version_trigger
> gcc_version_full gcc_version GENINSRC CC CFLAGS LDFLAGS CPPFLAGS
> ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP
> strict1_warn warn_cflags WERROR checkingenabled_flag nocommon_flag
> TREEBROWSER valgrind_path valgrind_path_defines valgrind_command
> coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT
> TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep
> LLVMBASEPATH SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags
> INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target
> have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON
> NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB
> TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext
> gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL
> LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS
> cc_for_cross_gnattools CROSS ALL SYSTEM_HEADER_DIR inhibit_libc
> CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2
> libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar
> slibdir objdir subdirs srcdir all_boot_languages all_compilers
> all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files
> all_lang_makefrags all_lang_makefiles all_languages all_stagestuff
> build_exeext build_install_headers_dir build_xm_file_list
> build_xm_include_list build_xm_defines check_languages
> cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir
> xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs
> extra_parts extra_passes extra_programs float_h_file
> gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir host_exeext
> host_xm_file_list host_xm_include_list host_xm_defines
> out_host_hook_obj install lang_opt_files lang_specs_files
> lang_tree_files local_prefix md_file objc_boehm_gc out_file
> out_cxx_file out_object_file out_cxx_object_file
> stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure
> thread_file tm_file_list tm_include_list tm_defines tm_p_file_list
> tm_p_include_list xm_file_list xm_include_list xm_defines
> c_target_objs cxx_target_objs target_cpu_default set_gcc_lib_path
> GMPLIBS GMPINC LIBOBJS LTLIBOBJS'
> +# APPLE LOCAL end LLVM
> ac_subst_files='language_hooks'
> # Initialize some variables set by options.
> @@ -12200,6 +12203,8 @@ fi
> # Say what files are being used for the output code and MD file.
> echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
> +# APPLE LOCAL LLVM
> +echo "Using \`$srcdir/config/$out_cxx_file' for machine-specific C++
> logic."
> echo "Using \`$srcdir/config/$md_file' as machine description file."
> # If any of the xm_file variables contain nonexistent files, warn
> @@ -12909,6 +12914,8 @@ cc_for_cross_gnattools=${CC}
> out_object_file=`basename $out_file .c`.o
> +# APPLE LOCAL LLVM
> +out_cxx_object_file=`basename $out_cxx_file .cpp`.o
> tm_file_list=
> tm_include_list=
> @@ -16615,7 +16622,11 @@ s, at local_prefix@,$local_prefix,;t t
> s, at md_file@,$md_file,;t t
> s, at objc_boehm_gc@,$objc_boehm_gc,;t t
> s, at out_file@,$out_file,;t t
> +# APPLE LOCAL LLVM
> +s, at out_cxx_file@,$out_cxx_file,;t t
> s, at out_object_file@,$out_object_file,;t t
> +# APPLE LOCAL LLVM
> +s, at out_cxx_object_file@,$out_cxx_object_file,;t t
> s, at stage_prefix_set_by_configure@,$stage_prefix_set_by_configure,;t t
> s, at quoted_stage_prefix_set_by_configure@,
> $quoted_stage_prefix_set_by_configure,;t t
> s, at thread_file@,$thread_file,;t t
> Index: config.gcc
> ===================================================================
> --- config.gcc  (revision 121791)
> +++ config.gcc  (working copy)
> @@ -64,10 +64,13 @@
> #                      defining header ${cpu_type}/${cpu_type.h}.
> #
> #  tm_p_file           Location of file with declarations for  
> functions
> -#                      in $out_file.
> +# APPLE LOCAL LLVM
> +#                      in $out_file & $out_cxx_file
> #
> #  out_file            The name of the machine description C support
> #                      file, if different from "$cpu_type/ 
> $cpu_type.c".
> +# APPLE LOCAL LLVM
> +#  out_cxx_file                The name of the machine description C+
> + support file.
> #
> #  md_file             The name of the machine-description file, if
> #                      different from "$cpu_type/$cpu_type.md".
> @@ -144,6 +147,8 @@
> #                      system normally uses GNU ld.
> out_file=
> +# APPLE LOCAL LLVM
> +out_cxx_file=
> tmake_file=
> extra_headers=
> extra_passes=
> @@ -961,6 +966,9 @@ i[34567]86-*-darwin*)
>    # APPLE LOCAL end mainline 2005-10-02 4218570
>          # APPLE LOCAL 4099000
>          tmake_file="${tmake_file} i386/t-darwin"
> +# APPLE LOCAL begin LLVM
> +       out_cxx_file=i386/llvm-i386.cpp
> +# APPLE LOCAL end LLVM
>          # APPLE LOCAL 4126124
>          need_64bit_hwint=yes
>          ;;
> @@ -2842,6 +2850,8 @@ case ${target} in
>                          target_cpu_default2="\\\"$with_cpu\\\""
>                  fi
>                  out_file=rs6000/rs6000.c
> +                # APPLE LOCAL begin LLVM
> +                out_cxx_file=rs6000/llvm-rs6000.cpp
>                  c_target_objs="${c_target_objs} rs6000-c.o"
>                  cxx_target_objs="${cxx_target_objs} rs6000-c.o"
>                  tmake_file="rs6000/t-rs6000 ${tmake_file}"
> Index: Makefile.in
> ===================================================================
> --- Makefile.in (revision 121791)
> +++ Makefile.in (working copy)
> @@ -428,7 +428,11 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT
> xmake_file=@xmake_file@
> tmake_file=@tmake_file@
> out_file=$(srcdir)/config/@out_file@
> +# APPLE LOCAL LLVM
> +out_cxx_file=$(srcdir)/config/@out_cxx_file@
> out_object_file=@out_object_file@
> +# APPLE LOCAL LLVM
> +out_cxx_object_file=@out_cxx_object_file@
> md_file=$(srcdir)/config/@md_file@
> tm_file_list=@tm_file_list@
> tm_include_list=@tm_include_list@
> @@ -1019,7 +1023,8 @@ OBJS-common = \
>    lambda-trans.o        lambda-code.o tree-loop-linear.o
> # APPLE LOCAL end lno, loops-to-memset
> -OBJS-md = $(out_object_file)
> +# APPLE LOCAL LLVM
> +OBJS-md = $(out_object_file) $(out_cxx_object_file)
> OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) tree-
> inline.o               \
>     cgraph.o cgraphunit.o tree-nomudflap.o
> @@ -1109,7 +1114,8 @@ endif
> endif
> # APPLE LOCAL end LLVM
> -OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive)
> +# APPLE LOCAL LLVM
> +OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive) $
> (out_cxx_object_file)
> OBJS-onestep = libbackend.o $(OBJS-archive)
> @@ -2465,6 +2471,15 @@ $(out_object_file): $(out_file) $(CONFIG
>      langhooks.h
>          $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
>                  $(out_file) $(OUTPUT_OPTION)
> +# APPLE LOCAL begin LLVM
> +$(out_cxx_object_file): $(out_cxx_file) $(CONFIG_H) coretypes.h $
> (TM_H) $(TREE_H) $(GGC_H) \
> +   $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h
> conditions.h \
> +   output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H)
> libfuncs.h \
> +   $(TARGET_DEF_H) function.h $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) $
> (OPTABS_H) \
> +   langhooks.h
> +       $(CXX) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> +               $(out_cxx_file) $(OUTPUT_OPTION)
> +# APPLE LOCAL end  LLVM
> # Build auxiliary files that support ecoff format.
> mips-tfile: mips-tfile.o version.o $(LIBDEPS)
> @@ -2481,7 +2496,8 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H)
> ifeq ($(LLVMOBJDIR),)
> # FIXME: writing proper dependencies for this is a *LOT* of work.
> -libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
> +# APPLE LOCAL LLVM
> +libbackend.o : $(OBJS-common:.o=.c) $(out_file) $(out_cxx_file) \
>     insn-config.h insn-flags.h insn-codes.h insn-constants.h \
>     insn-attr.h
>          $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> Index: config/i386/llvm-i386.cpp
> ===================================================================
> Index: config/rs6000/llvm-rs6000.cpp
> ===================================================================
> $
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list