diff --git a/contrib/gcc/Makefile.in b/contrib/gcc/Makefile.in index 67076d30c76a..d0ec7688e672 100644 --- a/contrib/gcc/Makefile.in +++ b/contrib/gcc/Makefile.in @@ -1,6 +1,8 @@ -# Makefile for GNU C compiler. -# Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 -# 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Makefile for GNU Compiler Collection +# Run 'configure' to generate Makefile from Makefile.in + +# Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, +# 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. #This file is part of GCC. @@ -25,32 +27,103 @@ # stage1, stage2, stage3, stage4. # This is the default target. -all: +# Set by autoconf to "all.internal" for a native build, or +# "all.cross" to build a cross compiler. +all: @ALL@ -# Suppress smart makes who think they know how to automake Yacc files +# Depend on this to specify a phony target portably. +force: + +# This tells GNU make version 3 not to export the variables +# defined in this file into the environment (and thus recursive makes). +.NOEXPORT: +# And this tells it not to automatically pass command-line variables +# to recursive makes. +MAKEOVERRIDES = + +# Suppress smart makes who think they know how to automake yacc and flex file .y.c: +.l.c: + +# The only suffixes we want for implicit rules are .c and .o, so clear +# the list and add them. This speeds up GNU Make, and allows -r to work. +# For i18n support, we also need .gmo, .po, .pox. +# This must come before the language makefile fragments to allow them to +# add suffixes and rules of their own. +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo + +# ------------------------------- +# Standard autoconf-set variables +# ------------------------------- + +build=@build@ +host=@host@ +target=@target@ +target_noncanonical:=@target_noncanonical@ + +# Sed command to transform gcc to installed name. +program_transform_name := @program_transform_name@ + +# ----------------------------- +# Directories used during build +# ----------------------------- # Directory where sources are, from where we are. srcdir = @srcdir@ +docdir = @srcdir@/doc + +# Directory where sources are, absolute. +abs_srcdir = @abs_srcdir@ +abs_docdir = @abs_srcdir@/doc + +# Top build directory, relative to here. +top_builddir = .. +# objdir is set by configure. +# It's normally the absolute path to the current directory. +objdir = @objdir@ + +# -------- +# Defined vpaths +# -------- + +# Directory where sources are, from where we are. VPATH = @srcdir@ -# Pointer to the GCC Project website -website=http://gcc.gnu.org +# We define a vpath for the sources of the .texi files here because they +# are split between multiple directories and we would rather use one implicit +# pattern rule for everything. +# This vpath could be extended within the Make-lang fragments. + +vpath %.texi $(docdir):$(docdir)/include + +# ---- +# Default values for variables overridden in Makefile fragments. +# These need to be quite early in the Makefile so as to avoid +# trouble induced by changes in fragment ordering. +# ---- + +# For ada/Make-lang.in; overridden in, for example, config/pa/x-ada. +X_ADA_CFLAGS = +T_ADA_CFLAGS = +X_ADAFLAGS = +T_ADAFLAGS = + +# -------- +# UNSORTED +# -------- # Variables that exist for you to override. # See below for how to change them for certain systems. # List of language subdirectories. -# This is overridden by configure. SUBDIRS =@subdirs@ # Selection of languages to be made. -# This is overridden by configure. CONFIG_LANGUAGES = @all_languages@ -LANGUAGES = c gcov$(exeext) $(CONFIG_LANGUAGES) +LANGUAGES = c gcov$(exeext) gcov-dump$(exeext) $(CONFIG_LANGUAGES) # Selection of languages to be made during stage1 build. -# This is overridden by configure. BOOT_LANGUAGES = c @all_boot_languages@ # Various ways of specifying flags for compilations: @@ -71,10 +144,9 @@ BOOT_CFLAGS = -g -O2 # Flags to determine code coverage. When coverage is disabled, this will # contain the optimization flags, as you normally want code coverage -# without optimization. The -dumpbase $@ makes sure that the auxilary -# files end up near the object files. +# without optimization. COVERAGE_FLAGS = @coverage_flags@ -coverageexts = .{da,bb,bbg} +coverageexts = .{gcda,gcno} # The warning flags are separate from BOOT_CFLAGS because people tend to # override optimization flags and we'd like them to still have warnings @@ -89,26 +161,43 @@ coverageexts = .{da,bb,bbg} # with other compilers. This is partially controlled by configure in # stage1, as not all versions of gcc understand -Wno-long-long. LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -STRICT_WARN = -Wtraditional @strict1_warn@ -STRICT2_WARN = -Wtraditional -pedantic -Wno-long-long +STRICT_WARN = @strict1_warn@ +STRICT2_WARN = -pedantic -Wno-long-long -Wold-style-definition @WERROR@ # This is set by --enable-checking. The idea is to catch forgotten # "extern" tags in header files. NOCOMMON_FLAG = @nocommon_flag@ +# This is set by --disable-maintainer-mode (default) to "#" +MAINT := @MAINT@ + # These are set by --enable-checking=valgrind. RUN_GEN = @valgrind_command@ VALGRIND_DRIVER_DEFINES = @valgrind_path_defines@ # This is how we control whether or not the additional warnings are applied. .-warn = $(STRICT_WARN) -GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) +GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn) + +# These files are to have -Werror bypassed in stage2: +# These are very hard to completely clean due to target complexities. +gcc.o-warn = -Wno-error +insn-conditions.o-warn = -Wno-error +# Bison-1.75 output often yields (harmless) -Wtraditional warnings +gengtype-yacc.o-warn = -Wno-error +c-parse.o-warn = -Wno-error +# flex output may yield harmless "no previous prototype" warnings +gengtype-lex.o-warn = -Wno-error +# SYSCALLS.c misses prototypes +SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error # All warnings have to be shut off in stage1 if the compiler used then # isn't gcc; configure determines that. WARN_CFLAGS will be either # $(GCC_WARN_CFLAGS), or nothing. WARN_CFLAGS = @warn_cflags@ +CPPFLAGS = @CPPFLAGS@ + # These exists to be overridden by the x-* and t-* files, respectively. X_CFLAGS = T_CFLAGS = @@ -116,7 +205,6 @@ T_CFLAGS = X_CPPFLAGS = T_CPPFLAGS = -ADAC = @ADAC@ AWK = @AWK@ CC = @CC@ BISON = @BISON@ @@ -125,8 +213,12 @@ FLEX = @FLEX@ FLEXFLAGS = AR = ar AR_FLAGS = rc -DLLTOOL = dlltool RANLIB = @RANLIB@ + +# ------------------------------------------- +# Programs which operate on the build machine +# ------------------------------------------- + SHELL = @SHELL@ # pwd command to use. Allow user to override default by setting PWDCMD in # the environment to account for automounters. The make variable must not @@ -146,22 +238,27 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL@ MAKEINFO = @MAKEINFO@ -MAKEINFOFLAGS = +MAKEINFOFLAGS = --no-split TEXI2DVI = texi2dvi TEXI2POD = perl $(srcdir)/../contrib/texi2pod.pl POD2MAN = pod2man --center="GNU" --release="gcc-$(version)" -# For GNUmake: let us decide what gets passed to recursive makes. -MAKEOVERRIDES = -@SET_MAKE@ -# Some compilers can't handle cc -c blah.c -o foo/blah.o. -# In stage2 and beyond, we force this to "-o $@" since we know we're using gcc. -OUTPUT_OPTION = @OUTPUT_OPTION@ - # Some versions of `touch' (such as the version on Solaris 2.8) # do not correctly set the timestamp due to buggy versions of `utime' # in the kernel. So, we use `echo' instead. STAMP = echo timestamp > +# Make sure the $(MAKE) variable is defined. +@SET_MAKE@ +REMAKEFLAGS=LANGUAGES="$(LANGUAGES)" BOOT_CFLAGS="$(BOOT_CFLAGS)" + +# -------- +# UNSORTED +# -------- + +# Some compilers can't handle cc -c blah.c -o foo/blah.o. +# In stage2 and beyond, we force this to "-o $@" since we know we're using gcc. +OUTPUT_OPTION = @OUTPUT_OPTION@ + # This is where we get zlib from. zlibdir is -L../zlib and zlibinc is # -I../zlib, unless we were configured with --with-system-zlib, in which # case both are empty. @@ -189,37 +286,25 @@ USER_H = $(srcdir)/ginclude/float.h \ # The GCC to use for compiling libgcc.a and crt*.o. # Usually the one we just built. # Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS). -GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include +GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include -L$(objdir)/../ld # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. # It omits XCFLAGS, and specifies -B./. # It also specifies -isystem ./include to find, e.g., stddef.h. -GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -isystem ./include $(TCFLAGS) +GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS) -# Sed command to transform gcc to installed name. Overwritten by configure. -program_transform_name = @program_transform_name@ -program_transform_cross_name = s,^,$(target_alias)-, - -build_canonical = @build_canonical@ -host_canonical = @host_canonical@ - -# Tools to use when building a cross-compiler. -# These are used because `configure' appends `cross-make' -# to the makefile when making a cross-compiler. - -# Use the tools from the build tree, if they are available. - -# objdir is set by configure. -objdir = @objdir@ +# --------------------------------------------------- +# Programs which produce files for the target machine +# --------------------------------------------------- AR_FOR_TARGET = ` \ if [ -f $(objdir)/../binutils/ar ] ; then \ echo $(objdir)/../binutils/ar ; \ else \ - if [ "$(host_canonical)" = "$(target)" ] ; then \ + if [ "$(host)" = "$(target)" ] ; then \ echo ar; \ else \ - t='$(program_transform_cross_name)'; echo ar | sed -e $$t ; \ + t='$(program_transform_name)'; echo ar | sed -e $$t ; \ fi; \ fi` AR_FLAGS_FOR_TARGET = @@ -229,29 +314,29 @@ RANLIB_FOR_TARGET = ` \ if [ -f $(objdir)/../binutils/ranlib ] ; then \ echo $(objdir)/../binutils/ranlib ; \ else \ - if [ "$(host_canonical)" = "$(target)" ] ; then \ - echo ranlib; \ + if [ "$(host)" = "$(target)" ] ; then \ + echo $(RANLIB); \ else \ - t='$(program_transform_cross_name)'; echo ranlib | sed -e $$t ; \ + t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \ fi; \ fi` -RANLIB_TEST_FOR_TARGET = \ - [ -f $(RANLIB_FOR_TARGET) ] \ - || ( [ "$(host_canonical)" = "$(target)" ] \ - && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ) NM_FOR_TARGET = ` \ if [ -f ./nm ] ; then \ echo ./nm ; \ elif [ -f $(objdir)/../binutils/nm-new ] ; then \ echo $(objdir)/../binutils/nm-new ; \ else \ - if [ "$(host_canonical)" = "$(target)" ] ; then \ + if [ "$(host)" = "$(target)" ] ; then \ echo nm; \ else \ - t='$(program_transform_cross_name)'; echo nm | sed -e $$t ; \ + t='$(program_transform_name)'; echo nm | sed -e $$t ; \ fi; \ fi` +# -------- +# UNSORTED +# -------- + # Where to find some libiberty headers. HASHTAB_H = $(srcdir)/../include/hashtab.h OBSTACK_H = $(srcdir)/../include/obstack.h @@ -262,7 +347,7 @@ PARTITION_H = $(srcdir)/../include/partition.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. NATIVE_SYSTEM_HEADER_DIR = /usr/include # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. -CROSS_SYSTEM_HEADER_DIR = $(build_tooldir)/sys-include +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ # autoconf sets SYSTEM_HEADER_DIR to one of the above. SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ @@ -274,37 +359,49 @@ STMP_FIXINC = @STMP_FIXINC@ # Test to see whether exists in the system header files. LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] -target=@target@ -target_alias=@target_alias@ -xmake_file=@dep_host_xmake_file@ -tmake_file=@dep_tmake_file@ +# Directory for prefix to system directories, for +# each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc. +TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ + +xmake_file=@xmake_file@ +tmake_file=@tmake_file@ out_file=$(srcdir)/config/@out_file@ out_object_file=@out_object_file@ md_file=$(srcdir)/config/@md_file@ +tm_file_list=@tm_file_list@ +tm_include_list=@tm_include_list@ tm_defines=@tm_defines@ tm_p_file_list=@tm_p_file_list@ -tm_p_file=@tm_p_file@ +tm_p_include_list=@tm_p_include_list@ build_xm_file_list=@build_xm_file_list@ -build_xm_file=@build_xm_file@ +build_xm_include_list=@build_xm_include_list@ build_xm_defines=@build_xm_defines@ host_xm_file_list=@host_xm_file_list@ -host_xm_file=@host_xm_file@ +host_xm_include_list=@host_xm_include_list@ host_xm_defines=@host_xm_defines@ -xm_file=@xm_file@ +xm_file_list=@xm_file_list@ +xm_include_list=@xm_include_list@ xm_defines=@xm_defines@ +lang_checks=check-gcc +lang_opt_files=@lang_opt_files@ $(srcdir)/c.opt $(srcdir)/common.opt lang_specs_files=@lang_specs_files@ -lang_options_files=@lang_options_files@ lang_tree_files=@lang_tree_files@ target_cpu_default=@target_cpu_default@ GCC_THREAD_FILE=@thread_file@ OBJC_BOEHM_GC=@objc_boehm_gc@ GTHREAD_FLAGS=@gthread_flags@ +extra_modes_file=@extra_modes_file@ +host_hook_obj=@out_host_hook_obj@ # Be prepared for gcc2 merges. gcc_version=@gcc_version@ gcc_version_trigger=@gcc_version_trigger@ version=$(gcc_version) mainversion=`grep version_string $(srcdir)/version.c | sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/'` +# ------------------------ +# Installation directories +# ------------------------ + # Common prefix for installation directories. # NOTE: This directory must exist when you start installation. prefix = @prefix@ @@ -319,8 +416,17 @@ exec_prefix = @exec_prefix@ bindir = @bindir@ # Directory in which to put the directories used by the compiler. libdir = @libdir@ -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version) +# Directory in which GCC puts its executables. +libexecdir = @libexecdir@ + +# -------- +# UNSORTED +# -------- + +# Directory in which the compiler finds libraries etc. +libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version) +# Directory in which the compiler finds executables +libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version) # Used to produce a relative $(gcc_tooldir) in gcc.o unlibsubdir = ../../.. # Directory in which to find other cross-compilation tools and headers. @@ -330,7 +436,7 @@ gcc_tooldir = @gcc_tooldir@ # Used to install the shared libgcc. slibdir = @slibdir@ # Since gcc_tooldir does not exist at build-time, use -B$(build_tooldir)/bin/ -build_tooldir = $(exec_prefix)/$(target_alias) +build_tooldir = $(exec_prefix)/$(target_noncanonical) # Directory in which the compiler finds target-independent g++ includes. gcc_gxx_include_dir = @gcc_gxx_include_dir@ # Directory to search for site-specific includes. @@ -357,21 +463,16 @@ man7dir = $(mandir)/man7 # Dir for temp files. tmpdir = /tmp -# Top build directory, relative to here. -top_builddir = . - # Whether we were configured with NLS. USE_NLS = @USE_NLS@ # Internationalization library. -INTLLIBS = @INTLLIBS@ -INTLDEPS = @INTLDEPS@ +LIBINTL = @LIBINTL@ +LIBINTL_DEP = @LIBINTL_DEP@ # Character encoding conversion library. LIBICONV = @LIBICONV@ - -# List of internationalization subdirectories. -INTL_SUBDIRS = intl +LIBICONV_DEP = @LIBICONV_DEP@ # The GC method to be used on this system. GGC=@GGC@.o @@ -399,11 +500,11 @@ TARGET_LIBGCC2_CFLAGS = # Options to use when compiling crtbegin/end. CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ -finhibit-size-directive -fno-inline-functions -fno-exceptions \ - -fno-zero-initialized-in-bss + -fno-zero-initialized-in-bss -fno-unit-at-a-time # Additional sources to handle exceptions; overridden by targets as needed. LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ - $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h # nm flags to list global symbols in libgcc object files. @@ -427,10 +528,9 @@ EXTRA_OBJS = @extra_objs@ # List of extra object files that should be compiled and linked with # the gcc driver. -EXTRA_GCC_OBJS =@host_extra_gcc_objs@ +EXTRA_GCC_OBJS =@extra_gcc_objs@ # List of additional header files to install. -# Often this is edited directly by `configure'. EXTRA_HEADERS =@extra_headers_list@ # It is convenient for configure to add the assignment at the beginning, @@ -466,7 +566,6 @@ GENERATED_MANPAGES = @GENERATED_MANPAGES@ OTHER_FIXINCLUDES_DIRS= # A list of all the language-specific executables. -# This is overridden by configure. COMPILERS = cc1$(exeext) @all_compilers@ # List of things which should already be built whenever we try to use xgcc @@ -490,31 +589,21 @@ BUILD_PREFIX = @BUILD_PREFIX@ # out of the way of the other rules for compiling the same source files. BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # Native compiler for the build machine and its switches. -HOST_CC = @HOST_CC@ -HOST_CFLAGS= @HOST_CFLAGS@ -DGENERATOR_FILE +CC_FOR_BUILD = @CC_FOR_BUILD@ +BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE # Native linker and preprocessor flags. For x-fragment overrides. -HOST_LDFLAGS=$(LDFLAGS) -HOST_CPPFLAGS=$(ALL_CPPFLAGS) +BUILD_LDFLAGS=$(LDFLAGS) +BUILD_CPPFLAGS=$(ALL_CPPFLAGS) # Actual name to use when installing a native compiler. -GCC_INSTALL_NAME = `echo gcc|sed '$(program_transform_name)'` -GCC_TARGET_INSTALL_NAME = $(target_alias)-`echo gcc|sed '$(program_transform_name)'` -CPP_INSTALL_NAME = `echo cpp|sed '$(program_transform_name)'` -PROTOIZE_INSTALL_NAME = `echo protoize|sed '$(program_transform_name)'` -UNPROTOIZE_INSTALL_NAME = `echo unprotoize|sed '$(program_transform_name)'` -GCOV_INSTALL_NAME = `echo gcov|sed '$(program_transform_name)'` -GCCBUG_INSTALL_NAME = `echo gccbug|sed '$(program_transform_name)'` - -# Actual name to use when installing a cross-compiler. -GCC_CROSS_NAME = `echo gcc|sed '$(program_transform_cross_name)'` -CPP_CROSS_NAME = `echo cpp|sed '$(program_transform_cross_name)'` -PROTOIZE_CROSS_NAME = `echo protoize|sed '$(program_transform_cross_name)'` -UNPROTOIZE_CROSS_NAME = `echo unprotoize|sed '$(program_transform_cross_name)'` - -# Set by autoconf to "all.internal" for a native build, or -# "all.cross" to build a cross compiler. -ALL = @ALL@ +GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') +GCC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcc|sed '$(program_transform_name)') +CPP_INSTALL_NAME := $(shell echo cpp|sed '$(program_transform_name)') +PROTOIZE_INSTALL_NAME := $(shell echo protoize|sed '$(program_transform_name)') +UNPROTOIZE_INSTALL_NAME := $(shell echo unprotoize|sed '$(program_transform_name)') +GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)') +GCCBUG_INSTALL_NAME := $(shell echo gccbug|sed '$(program_transform_name)') # Setup the testing framework, if you have one EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \ @@ -543,38 +632,38 @@ T = T_TARGET = T_TARGET : $(T_TARGET) +# This should name the specs file that we're going to install. Target +# Makefiles may override it and name another file to be generated from +# the built-in specs and installed as the default spec, as long as +# they also introduce a rule to generate a file name specs, to be used +# at build time. +SPECS = specs + # End of variables for you to override. -# Definition of `all' is here so that new rules inserted by sed -# do not specify the default target. -# The real definition is under `all.internal' (for native compilers) -# or `all.cross' (for cross compilers). -all: all.indirect - -# This tells GNU Make version 3 not to put all variables in the environment. -.NOEXPORT: - -# GCONFIG_H lists the config files that the generator files depend on, while -# CONFIG_H lists the ones ordinary gcc files depend on, which includes -# several files generated by those generators. -GCONFIG_H = config.h $(host_xm_file_list) -HCONFIG_H = hconfig.h $(build_xm_file_list) -CONFIG_H = $(GCONFIG_H) insn-constants.h insn-flags.h +# GTM_H lists the config files that the generator files depend on, +# while TM_H lists the ones ordinary gcc files depend on, which +# includes several files generated by those generators. +BCONFIG_H = bconfig.h $(build_xm_file_list) +CONFIG_H = config.h $(host_xm_file_list) TCONFIG_H = tconfig.h $(xm_file_list) -TARGET_H = target.h +TM_P_H = tm_p.h $(tm_p_file_list) +GTM_H = tm.h $(tm_file_list) +TM_H = $(GTM_H) insn-constants.h insn-flags.h + +TARGET_H = $(TM_H) target.h HOOKS_H = hooks.h LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H) TARGET_DEF_H = target-def.h $(HOOKS_H) -TM_P_H = tm_p.h $(tm_p_file_list) tm-preds.h - -MACHMODE_H = machmode.h machmode.def @extra_modes_file@ +MACHMODE_H = machmode.h mode-classes.def insn-modes.h RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) -RTL_H = $(RTL_BASE_H) genrtl.h +RTL_H = $(RTL_BASE_H) genrtl.h input.h PARAMS_H = params.h params.def TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \ - location.h + input.h BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \ - hard-reg-set.h + hard-reg-set.h cfghooks.h +COVERAGE_H = coverage.h gcov-io.h gcov-iov.h DEMANGLE_H = $(srcdir)/../include/demangle.h RECOG_H = recog.h EXPR_H = expr.h @@ -583,7 +672,7 @@ REGS_H = regs.h varray.h $(MACHMODE_H) INTEGRATE_H = integrate.h varray.h LOOP_H = loop.h varray.h bitmap.h GCC_H = gcc.h version.h -GGC_H = ggc.h varray.h gtype-desc.h +GGC_H = ggc.h gtype-desc.h TIMEVAR_H = timevar.h timevar.def INSN_ATTR_H = insn-attr.h $(srcdir)/insn-addr.h $(srcdir)/varray.h C_COMMON_H = c-common.h $(SPLAY_TREE_H) $(CPPLIB_H) @@ -591,26 +680,20 @@ C_TREE_H = c-tree.h $(C_COMMON_H) SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = cpplib.h line-map.h +PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H) +DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H) +C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H) -# sed inserts variable overrides after the following line. -####target overrides -@target_overrides@ - -####host overrides -@host_overrides@ # # Now figure out from those variables how to compile and link. -all.indirect: $(ALL) - # IN_GCC distinguishes between code compiled into GCC itself and other # programs built during a bootstrap. # autoconf inserts -DCROSS_COMPILE if we are building a cross compiler. INTERNAL_CFLAGS = -DIN_GCC @CROSS@ -# This is the variable actually used when we compile. -# If you change this line, you probably also need to change the definition -# of HOST_CFLAGS in build-make to match. +# This is the variable actually used when we compile. If you change this, +# you probably want to update BUILD_CFLAGS in configure.ac ALL_CFLAGS = $(X_CFLAGS) $(T_CFLAGS) \ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) $(XCFLAGS) @DEFS@ @@ -623,15 +706,15 @@ LIBIBERTY = ../libiberty/libiberty.a BUILD_LIBIBERTY = @FORBUILD@/libiberty/libiberty.a # Dependencies on the intl and portability libraries. -LIBDEPS= $(INTLDEPS) $(LIBIBERTY) +LIBDEPS= $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) # Likewise, for use in the tools that must run on this machine # even if we are cross-building GCC. -HOST_LIBDEPS= $(BUILD_LIBIBERTY) +BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # How to link with both our special library facilities # and the system's installed libraries. -LIBS = $(INTLLIBS) @LIBS@ $(LIBIBERTY) +LIBS = @LIBS@ $(LIBIBERTY) $(LIBINTL) $(LIBICONV) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -641,16 +724,16 @@ LDEXP_LIB = @LDEXP_LIB@ # Likewise, for use in the tools that must run on this machine # even if we are cross-building GCC. -HOST_LIBS = $(BUILD_LIBIBERTY) +BUILD_LIBS = $(BUILD_LIBIBERTY) -HOST_RTL = $(BUILD_PREFIX)rtl.o read-rtl.o $(BUILD_PREFIX)bitmap.o \ - $(BUILD_PREFIX)ggc-none.o -HOST_SUPPORT = gensupport.o insn-conditions.o -HOST_EARLY_SUPPORT = gensupport.o dummy-conditions.o +BUILD_RTL = $(BUILD_PREFIX)rtl.o read-rtl.o $(BUILD_PREFIX)bitmap.o \ + $(BUILD_PREFIX)ggc-none.o min-insn-modes.o +BUILD_SUPPORT = gensupport.o insn-conditions.o +BUILD_EARLY_SUPPORT = gensupport.o dummy-conditions.o -HOST_PRINT = print-rtl1.o -HOST_ERRORS = $(BUILD_PREFIX)errors.o -HOST_VARRAY = $(BUILD_PREFIX)varray.o +BUILD_PRINT = print-rtl1.o +BUILD_ERRORS = $(BUILD_PREFIX)errors.o +BUILD_VARRAY = $(BUILD_PREFIX)varray.o # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, @@ -658,21 +741,18 @@ HOST_VARRAY = $(BUILD_PREFIX)varray.o # subdirectory rather than in the source directory. # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file # currently being compiled, in both source trees, to be examined as well. +# libintl.h will be found in ../intl if we are using the included libintl. INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ - -I$(srcdir)/config -I$(srcdir)/../include + -I$(srcdir)/../include @INCINTL@ -# Always use -I$(srcdir)/config when compiling. .c.o: $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) -# This tells GNU make version 3 not to export all the variables -# defined in this file into the environment. -.NOEXPORT: # -# Support for additional languages (other than c and objc). -# ??? objc can be supported this way too (leave for later). +# Support for additional languages (other than C). +# C can be supported this way too (leave for later). -# These next lines are overridden by configure. +LANG_MAKEFRAGS = @all_lang_makefrags@ LANG_MAKEFILES = @all_lang_makefiles@ LANG_STAGESTUFF = @all_stagestuff@ @@ -681,17 +761,30 @@ LANG_STAGESTUFF = @all_stagestuff@ # because we need CC="stage1/xgcc -Bstage1/" to work in the language # subdirectories. # ??? The choices here will need some experimenting with. + +export AR_FOR_TARGET +export AR_CREATE_FOR_TARGET +export AR_FLAGS_FOR_TARGET +export AR_EXTRACT_FOR_TARGET +export AWK +export BUILD_PREFIX +export BUILD_PREFIX_1 +export DESTDIR +export GCC_FOR_TARGET +export INCLUDES +export INSTALL_DATA +export LIB1ASMSRC +export LIBGCC2_CFLAGS +export MACHMODE_H +export NM_FOR_TARGET +export RANLIB_FOR_TARGET +export libsubdir +export slibdir + ORDINARY_FLAGS_TO_PASS = \ - "AR=$(AR)" \ - "AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \ - "AR_CREATE_FOR_TARGET=$(AR_CREATE_FOR_TARGET)" \ - "AR_EXTRACT_FOR_TARGET=$(AR_EXTRACT_FOR_TARGET)" \ - "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ "BISON=$(BISON)" \ "BISONFLAGS=$(BISONFLAGS)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ - "DESTDIR=$(DESTDIR)" \ - "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ "LDFLAGS=$(LDFLAGS)" \ "FLEX=$(FLEX)" \ "FLEXFLAGS=$(FLEXFLAGS)" \ @@ -700,8 +793,6 @@ ORDINARY_FLAGS_TO_PASS = \ "MAKEINFO=$(MAKEINFO)" \ "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \ "MAKEOVERRIDES=" \ - "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ - "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \ "SHELL=$(SHELL)" \ "exeext=$(exeext)" \ "build_exeext=$(build_exeext)" \ @@ -713,7 +804,7 @@ ORDINARY_FLAGS_TO_PASS = \ "build_tooldir=$(build_tooldir)" \ "gcc_tooldir=$(gcc_tooldir)" \ "bindir=$(bindir)" \ - "libsubdir=$(libsubdir)" \ + "libexecsubdir=$(libsubdir)" \ "datadir=$(datadir)" \ "localedir=$(localedir)" FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) "CC=@cc_set_by_configure@" \ @@ -739,32 +830,44 @@ CXX_TARGET_OBJS=@cxx_target_objs@ # Language-specific object files for C and Objective C. C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \ c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \ - c-objc-common.o c-dump.o libcpp.a $(C_TARGET_OBJS) + c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \ + c-objc-common.o c-dump.o c-pch.o libcpp.a $(C_TARGET_OBJS) # Language-specific object files for C. -C_OBJS = c-parse.o c-lang.o c-pretty-print.o $(C_AND_OBJC_OBJS) +C_OBJS = c-parse.o c-lang.o c-pretty-print.o stub-objc.o $(C_AND_OBJC_OBJS) # Language-independent object files. -OBJS = alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \ +OBJS-common = \ + alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \ cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfglayout.o cfgloop.o \ - cfgrtl.o combine.o conflict.o convert.o cse.o cselib.o dbxout.o \ - debug.o df.o diagnostic.o doloop.o dominance.o \ - dwarf2asm.o dwarf2out.o dwarfout.o emit-rtl.o except.o explow.o \ + cfgloopanal.o cfgloopmanip.o loop-init.o loop-unswitch.o loop-unroll.o \ + cfgrtl.o combine.o conflict.o convert.o coverage.o cse.o cselib.o \ + dbxout.o debug.o df.o diagnostic.o dojump.o doloop.o dominance.o \ + dwarf2asm.o dwarf2out.o emit-rtl.o except.o explow.o \ expmed.o expr.o final.o flow.o fold-const.o function.o gcse.o \ genrtl.o ggc-common.o global.o graph.o gtype-desc.o \ - haifa-sched.o hashtable.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o \ + haifa-sched.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o insn-modes.o \ insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o \ - integrate.o intl.o jump.o langhooks.o lcm.o lists.o local-alloc.o \ - loop.o mbchar.o optabs.o params.o predict.o print-rtl.o print-tree.o \ + integrate.o intl.o jump.o langhooks.o lcm.o lists.o local-alloc.o \ + loop.o optabs.o options.o opts.o params.o postreload.o predict.o \ + print-rtl.o print-tree.o value-prof.o \ profile.o ra.o ra-build.o ra-colorize.o ra-debug.o ra-rewrite.o \ real.o recog.o reg-stack.o regclass.o regmove.o regrename.o \ reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o \ sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o \ - sibcall.o simplify-rtx.o ssa.o ssa-ccp.o ssa-dce.o stmt.o \ - stor-layout.o stringpool.o timevar.o toplev.o tracer.o tree.o tree-dump.o \ - tree-inline.o unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o \ - et-forest.o $(GGC) $(out_object_file) $(EXTRA_OBJS) + sibcall.o simplify-rtx.o sreal.o stmt.o stor-layout.o stringpool.o \ + targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o unroll.o \ + varasm.o varray.o version.o vmsdbgout.o xcoffout.o alloc-pool.o \ + et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o + +OBJS-md = $(out_object_file) +OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) hashtable.o tree-inline.o \ + tree-optimize.o cgraph.o cgraphunit.o + +OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive) + +OBJS-onestep = libbackend.o $(OBJS-archive) BACKEND = main.o libbackend.a @@ -772,8 +875,8 @@ BACKEND = main.o libbackend.a STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \ insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \ insn-attr.h insn-attrtab.c insn-opinit.c insn-constants.h tm-preds.h \ - tree-check.h insn-conditions.c \ - s-flags s-config s-codes s-mlib s-genrtl s-gtype gtyp-gen.h \ + tree-check.h insn-conditions.c min-insn-modes.c insn-modes.c insn-modes.h \ + s-flags s-config s-codes s-mlib s-genrtl s-modes s-gtype gtyp-gen.h \ s-output s-recog s-emit s-extract s-peep s-check s-conditions \ s-attr s-attrtab s-opinit s-preds s-constants s-crt0 \ genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \ @@ -781,27 +884,21 @@ STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \ genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \ genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \ gencheck$(build_exeext) genpreds$(build_exeext) genconstants$(build_exeext) \ - gengtype$(build_exeext) genconditions$(build_exeext) \ + gengtype$(build_exeext) genconditions$(build_exeext) genmodes$(build_exeext) \ genrtl.c genrtl.h gt-*.h gtype-*.h gtype-desc.c \ xgcc$(exeext) cpp$(exeext) cc1$(exeext) $(EXTRA_PASSES) \ - $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) cc1obj$(exeext) \ + $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \ protoize$(exeext) unprotoize$(exeext) \ - specs collect2$(exeext) $(USE_COLLECT2) \ - gcov$(exeext) *.[0-9][0-9].* *.[si] libcpp.a libbackend.a libgcc.mk \ + $(SPECS) collect2$(exeext) $(USE_COLLECT2) \ + gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \ + *.[0-9][0-9].* *.[si] libcpp.a libbackend.a libgcc.mk \ $(LANG_STAGESTUFF) -# Library members defined in libgcc2.c. -# Variable length limited to 255 charactes when passed to a shell script. -LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \ - _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \ - _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi - -LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \ - _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \ - _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors - # Defined in libgcc2.c, included only in the static library. -LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp +LIB2FUNCS_ST = _eprintf __gcc_bcmp + +# Defined in libgcov.c, included only in gcov library +LIBGCOV = _gcov _gcov_merge_add _gcov_merge_single _gcov_merge_delta FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ @@ -822,82 +919,92 @@ TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \ # unwinder info. LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 -# The only suffixes we want for implicit rules are .c and .o, so clear -# the list and add them. This speeds up GNU Make, and allows -r to work. -# For i18n support, we also need .gmo, .po, .pox. -# This must come before the language makefile fragments to allow them to -# add suffixes and rules of their own. -.SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo - # # Language makefile fragments. # The following targets define the interface between us and the languages. # # all.cross, start.encap, rest.encap, -# info, dvi, # install-normal, install-common, install-info, install-man, # uninstall, -# mostlyclean, clean, distclean, extraclean, maintainer-clean, +# mostlyclean, clean, distclean, maintainer-clean, # stage1, stage2, stage3, stage4 # -# Each language is linked in with a series of hooks (since we can't use `::' -# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info). -# Configure computes and adds these here. +# Each language is linked in with a series of hooks. The name of each +# hooked is "lang.${target_name}" (eg: lang.info). Configure computes +# and adds these here. We use double-colon rules for some of the hooks; +# double-colon rules should be preferred for any new hooks. -####language hooks +# language hooks, generated by configure @language_hooks@ -# sed inserts language fragments after the following line. -####language fragments -@language_fragments@ +# per-language makefile fragments +ifneq ($(LANG_MAKEFRAGS),) +include $(LANG_MAKEFRAGS) +endif + +# target and host overrides must follow the per-language makefile fragments +# so they can override or augment language-specific variables + +# target overrides +ifneq ($(tmake_file),) +include $(tmake_file) +endif + +# host overrides +ifneq ($(xmake_file),) +include $(xmake_file) +endif -# End of language makefile fragments. # -Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \ - $(xmake_file) $(tmake_file) $(LANG_MAKEFILES) - $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \ - "$(xmake_file)" "$(tmake_file)" - cp config.status config.run - LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run - rm -f config.run +# ----------------------------- +# Rebuilding this configuration +# ----------------------------- + +Makefile: config.status $(srcdir)/Makefile.in $(srcdir)/version.c $(LANG_MAKEFRAGS) + LANGUAGES="$(CONFIG_LANGUAGES)" \ + CONFIG_HEADERS= \ + CONFIG_SHELL="$(SHELL)" \ + CONFIG_FILES=$@ $(SHELL) config.status config.h: cs-config.h ; @true -hconfig.h: cs-hconfig.h ; @true +bconfig.h: cs-bconfig.h ; @true tconfig.h: cs-tconfig.h ; @true +tm.h: cs-tm.h ; @true tm_p.h: cs-tm_p.h ; @true cs-config.h: Makefile - TM_DEFINES="$(tm_defines)" \ - HEADERS="$(host_xm_file)" XM_DEFINES="$(host_xm_defines)" \ - TARGET_CPU_DEFAULT="$(target_cpu_default)" \ + TARGET_CPU_DEFAULT="" \ + HEADERS="$(host_xm_include_list)" DEFINES="$(host_xm_defines)" \ $(SHELL) $(srcdir)/mkconfig.sh config.h -cs-hconfig.h: Makefile - TM_DEFINES="$(tm_defines)" \ - HEADERS="$(build_xm_file)" XM_DEFINES="$(build_xm_defines)" \ - TARGET_CPU_DEFAULT="$(target_cpu_default)" \ - $(SHELL) $(srcdir)/mkconfig.sh hconfig.h +cs-bconfig.h: Makefile + TARGET_CPU_DEFAULT="" \ + HEADERS="$(build_xm_include_list)" DEFINES="$(build_xm_defines)" \ + $(SHELL) $(srcdir)/mkconfig.sh bconfig.h cs-tconfig.h: Makefile - TM_DEFINES="$(tm_defines)" \ - HEADERS="$(xm_file)" XM_DEFINES="$(xm_defines)" \ TARGET_CPU_DEFAULT="" \ + HEADERS="$(xm_include_list)" DEFINES="$(xm_defines)" \ $(SHELL) $(srcdir)/mkconfig.sh tconfig.h +cs-tm.h: Makefile + TARGET_CPU_DEFAULT="$(target_cpu_default)" \ + HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \ + $(SHELL) $(srcdir)/mkconfig.sh tm.h + cs-tm_p.h: Makefile - TM_DEFINES="" \ - HEADERS="$(tm_p_file)" XM_DEFINES="" TARGET_CPU_DEFAULT="" \ + TARGET_CPU_DEFAULT="" \ + HEADERS="$(tm_p_include_list)" DEFINES="" \ $(SHELL) $(srcdir)/mkconfig.sh tm_p.h -# Don't automatically run autoconf, since configure.in might be accidentally +# Don't automatically run autoconf, since configure.ac might be accidentally # newer than configure. Also, this writes into the source directory which # might be on a read-only file system. If configured for maintainer mode # then do allow autoconf to be run. -$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in +$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac (cd $(srcdir) && autoconf) gccbug: $(srcdir)/gccbug.in @@ -922,13 +1029,15 @@ mkheaders: $(srcdir)/mkheaders.in # Don't run autoheader automatically either. # Only run it if maintainer mode is enabled. @MAINT@ $(srcdir)/config.in: $(srcdir)/cstamp-h.in -@MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h +@MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.ac @MAINT@ (cd $(srcdir) && autoheader) @MAINT@ @rm -f $(srcdir)/cstamp-h.in @MAINT@ echo timestamp > $(srcdir)/cstamp-h.in auto-host.h: cstamp-h ; @true cstamp-h: config.in config.status - CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status + CONFIG_HEADERS=auto-host.h:config.in \ + CONFIG_FILES= \ + LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status # Really, really stupid make features, such as SUN's KEEP_STATE, may force # a target to build even if it is up-to-date. So we must verify that @@ -941,18 +1050,22 @@ config.status: $(srcdir)/configure $(srcdir)/config.gcc version.c LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \ fi +# -------- +# UNSORTED +# -------- + all.internal: start.encap rest.encap doc # This is what to compile if making a cross-compiler. all.cross: native gcc-cross cpp$(exeext) specs \ $(LIBGCC) $(EXTRA_PARTS) lang.all.cross doc # This is what must be made before installing GCC and converting libraries. start.encap: native xgcc$(exeext) cpp$(exeext) specs \ - xlimits.h lang.start.encap + xlimits.h lang.start.encap @GENINSRC@ srcextra # These can't be made until after GCC can run. rest.encap: $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap # This is what is made with the host's compiler # whether making a cross compiler or not. -native: config.status auto-host.h intl.all build-@POSUB@ $(LANGUAGES) \ +native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \ $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) # Define the names for selecting languages in LANGUAGES. @@ -971,9 +1084,9 @@ rest.cross: $(LIBGCC) specs compilations: $(BACKEND) # Like libcpp.a, this archive is strictly for the host. -libbackend.a: $(OBJS) +libbackend.a: $(OBJS@onestep@) -rm -rf libbackend.a - $(AR) $(AR_FLAGS) libbackend.a $(OBJS) + $(AR) $(AR_FLAGS) libbackend.a $(OBJS@onestep@) -$(RANLIB) libbackend.a # We call this executable `xgcc' rather than `gcc' @@ -993,9 +1106,9 @@ cpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \ prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) # Dump a specs file to make -B./ read these specs over installed ones. -specs: xgcc$(exeext) +$(SPECS): xgcc$(exeext) $(GCC_FOR_TARGET) -dumpspecs > tmp-specs - mv tmp-specs specs + mv tmp-specs $(SPECS) # We do want to create an executable named `xgcc', so we can use it to # compile libgcc2.a. @@ -1024,9 +1137,8 @@ LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) xgcc$(exeext) specs objext='$(objext)' \ LIB1ASMFUNCS='$(LIB1ASMFUNCS)' \ - LIB2FUNCS_1='$(LIB2FUNCS_1)' \ - LIB2FUNCS_2='$(LIB2FUNCS_2)' \ LIB2FUNCS_ST='$(LIB2FUNCS_ST)' \ + LIBGCOV='$(LIBGCOV)' \ LIB2ADD='$(LIB2ADD)' \ LIB2ADD_ST='$(LIB2ADD_ST)' \ LIB2ADDEH='$(LIB2ADDEH)' \ @@ -1055,26 +1167,20 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) xgcc$(exeext # All the things that might cause us to want to recompile bits of libgcc. LIBGCC_DEPS = $(GCC_PASSES) $(LANGUAGES) stmp-int-hdrs $(STMP_FIXPROTO) \ - libgcc.mk $(srcdir)/libgcc2.c $(TCONFIG_H) \ + libgcc.mk $(srcdir)/libgcc2.c $(srcdir)/libgcov.c $(TCONFIG_H) \ $(MACHMODE_H) longlong.h gbl-ctors.h config.status stmp-int-hdrs \ tsystem.h $(FPBIT) $(DPBIT) $(TPBIT) $(LIB2ADD) \ $(LIB2ADD_ST) $(LIB2ADDEH) $(LIB2ADDEHDEP) $(EXTRA_PARTS) \ - $(srcdir)/config/$(LIB1ASMSRC) + $(srcdir)/config/$(LIB1ASMSRC) \ + $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h + +libgcov.a: libgcc.a; @true libgcc.a: $(LIBGCC_DEPS) - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - BUILD_PREFIX="$(BUILD_PREFIX)" BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + $(MAKE) \ CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ - RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ - NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ + CONFIG_H="$(TCONFIG_H)" TM_H="$(TM_H)" \ INCLUDES="$(INCLUDES)" \ - CONFIG_H="$(TCONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ - LIB1ASMSRC='$(LIB1ASMSRC)' \ MAKEOVERRIDES= \ -f libgcc.mk all @@ -1104,19 +1210,9 @@ s-mlib: $(srcdir)/genmultilib Makefile # Build multiple copies of libgcc.a, one for each target switch. stmp-multilib: $(LIBGCC_DEPS) - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - BUILD_PREFIX="$(BUILD_PREFIX)" BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + $(MAKE) \ CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ - RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ - NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ - INCLUDES="$(INCLUDES)" \ - CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ - LIB1ASMSRC='$(LIB1ASMSRC)' \ + CONFIG_H="$(CONFIG_H)" \ MAKEOVERRIDES= \ -f libgcc.mk all $(STAMP) stmp-multilib @@ -1125,33 +1221,33 @@ stmp-multilib: $(LIBGCC_DEPS) # linked using GCC on systems using COFF or ELF, for the sake of C++ # constructors. $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ -o $(T)crtbegin$(objext) $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END \ -o $(T)crtend$(objext) # These are versions of crtbegin and crtend for shared libraries. $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \ -o $(T)crtbeginS$(objext) $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \ -o $(T)crtendS$(objext) # This is a version of crtbegin for -static links. $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ @inhibit_libc@ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ -o $(T)crtbeginT$(objext) @@ -1175,58 +1271,61 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H) # C language specific files. -c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) flags.h \ - diagnostic.h $(TM_P_H) -c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) $(GGC_H) intl.h \ - $(C_TREE_H) input.h flags.h $(SYSTEM_H) toplev.h output.h $(CPPLIB_H) \ - gt-c-parse.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -c $(srcdir)/c-parse.c $(OUTPUT_OPTION) +c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) flags.h $(DIAGNOSTIC_H) $(TM_P_H) +c-parse.o : c-parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(GGC_H) intl.h $(C_TREE_H) input.h flags.h toplev.h output.h $(CPPLIB_H) \ + varray.h gt-c-parse.h -$(srcdir)/c-parse.c: $(srcdir)/c-parse.y - cd $(srcdir) && \ - if $(BISON) $(BISONFLAGS) -o c-p$$$$.c c-parse.y; then \ - test -f c-p$$$$.output && mv -f c-p$$$$.output c-parse.output ; \ - mv -f c-p$$$$.c c-parse.c ; \ - else \ - rm -f c-p$$$$.* ; \ - false ; \ - fi +srcextra: gcc.srcextra lang.srcextra -$(srcdir)/c-parse.y: c-parse.in +gcc.srcextra: c-parse.y c-parse.c gengtype-lex.c gengtype-yacc.c gengtype-yacc.h + -cp -p $^ $(srcdir) + +c-parse.c: c-parse.y + -$(BISON) $(BISONFLAGS) -o $@ $< + +c-parse.y: c-parse.in echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y - sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ - -e "/^ifc$$/d" -e "/^end ifc$$/d" \ - $(srcdir)/c-parse.in >>tmp-c-parse.y - $(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y + sed -e "/^@@ifobjc.*/,/^@@end_ifobjc.*/d" \ + -e "/^@@ifc.*/d" -e "/^@@end_ifc.*/d" $< >>tmp-c-parse.y + $(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $@ -c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \ - $(GGC_H) $(TARGET_H) flags.h function.h output.h $(EXPR_H) \ - debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) c-pragma.h \ - gt-c-decl.h libfuncs.h except.h -c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ +c-incpath.o: c-incpath.c c-incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \ + intl.h prefix.h coretypes.h $(TM_H) cppdefault.h + +c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) flags.h function.h output.h \ + $(EXPR_H) debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) \ + opts.h c-pragma.h gt-c-decl.h cgraph.h $(HASHTAB_H) libfuncs.h except.h \ + $(LANGHOOKS_DEF_H) +c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \ $(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H) -c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ - $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) c-common.h gtype-c.h -c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \ - debug.h $(C_TREE_H) c-common.h real.h \ +c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \ + $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h +stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ + $(GGC_H) $(C_COMMON_H) +c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) real.h c-incpath.h cppdefault.h \ c-pragma.h input.h intl.h flags.h toplev.h output.h \ - mbchar.h $(CPPLIB_H) $(EXPR_H) $(TM_P_H) -c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ - $(C_TREE_H) $(RTL_H) insn-config.h integrate.h $(EXPR_H) $(C_TREE_H) \ - flags.h toplev.h tree-inline.h diagnostic.h integrate.h $(VARRAY_H) \ - langhooks.h $(GGC_H) gt-c-objc-common.h $(TARGET_H) -c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ - flags.h toplev.h -c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h toplev.h \ - $(C_COMMON_H) -c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) function.h \ - c-pragma.h toplev.h output.h $(GGC_H) $(TM_P_H) $(C_COMMON_H) gt-c-pragma.h -mbchar.o: mbchar.c $(CONFIG_H) $(SYSTEM_H) mbchar.h -graph.o: graph.c $(CONFIG_H) $(SYSTEM_H) toplev.h flags.h output.h $(RTL_H) \ - function.h hard-reg-set.h $(BASIC_BLOCK_H) graph.h -sbitmap.o: sbitmap.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h \ - $(BASIC_BLOCK_H) + $(CPPLIB_H) $(EXPR_H) $(TM_P_H) +c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) cpphash.h $(TM_P_H) c-pragma.h +c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) $(C_TREE_H) \ + flags.h toplev.h tree-inline.h $(DIAGNOSTIC_H) $(VARRAY_H) \ + langhooks.h $(GGC_H) $(TARGET_H) cgraph.h +c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) flags.h toplev.h +c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + flags.h toplev.h $(C_COMMON_H) real.h +c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + function.h c-pragma.h toplev.h output.h $(GGC_H) $(TM_P_H) $(C_COMMON_H) gt-c-pragma.h +graph.o: graph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h flags.h output.h \ + $(RTL_H) function.h hard-reg-set.h $(BASIC_BLOCK_H) graph.h +sbitmap.o: sbitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + hard-reg-set.h $(BASIC_BLOCK_H) COLLECT2_OBJS = collect2.o tlink.o intl.o version.o COLLECT2_LIBS = @COLLECT2_LIBS@ @@ -1236,57 +1335,74 @@ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS) $(COLLECT2_OBJS) $(LIBS) $(COLLECT2_LIBS) mv -f T$@ $@ -collect2.o : collect2.c $(CONFIG_H) $(SYSTEM_H) gstab.h intl.h \ +collect2.o : collect2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) gstab.h intl.h \ $(OBSTACK_H) $(DEMANGLE_H) collect2.h version.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DTARGET_MACHINE=\"$(target_alias)\" \ + -DTARGET_MACHINE=\"$(target_noncanonical)\" \ -c $(srcdir)/collect2.c $(OUTPUT_OPTION) -tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) \ +tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(OBSTACK_H) collect2.h intl.h # A file used by all variants of C. -c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(OBSTACK_H) \ - $(C_COMMON_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ - $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def $(TARGET_H) \ - diagnostic.h except.h gt-c-common.h real.h langhooks.h c-tree.h -c-pretty-print.o : c-pretty-print.c c-pretty-print.h pretty-print.h \ - $(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) real.h +c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(OBSTACK_H) $(C_COMMON_H) flags.h toplev.h output.h c-pragma.h intl.h \ + $(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \ + $(DIAGNOSTIC_H) gt-c-common.h langhooks.h varray.h $(RTL_H) \ + $(TARGET_H) $(C_TREE_H) +c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \ + $(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) real.h -c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_COMMON_H) \ - c-pragma.h flags.h toplev.h langhooks.h tree-inline.h diagnostic.h \ - intl.h +c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + c-pragma.h flags.h toplev.h langhooks.h tree-inline.h $(DIAGNOSTIC_H) \ + intl.h debug.h $(C_COMMON_H) opts.h options.h $(PARAMS_H) + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@ + +c-cppbuiltin.o : c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TREE_H) $(C_COMMON_H) c-pragma.h flags.h toplev.h langhooks.h \ + output.h except.h real.h $(TM_P_H) # A file used by all variants of C and some other languages. -attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \ +attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flags.h \ toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) $(EXPR_H) $(TM_P_H) \ builtin-types.def $(TARGET_H) langhooks.h -c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) langhooks.h \ - $(C_COMMON_H) flags.h toplev.h intl.h diagnostic.h +c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \ + $(C_COMMON_H) flags.h toplev.h intl.h $(DIAGNOSTIC_H) -c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ - flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ - $(EXPR_H) $(PREDICT_H) +c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ + $(EXPR_H) $(PREDICT_H) tree-inline.h -c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) tree-dump.h +c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) tree-dump.h + +c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \ + $(C_COMMON_H) output.h toplev.h c-pragma.h $(GGC_H) debug.h \ + langhooks.h flags.h hosthooks.h version.h $(TARGET_H) + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \ + $< $(OUTPUT_OPTION) # Language-independent files. DRIVER_DEFINES = \ -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \ - -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \ + -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ + -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \ -DDEFAULT_TARGET_VERSION=\"$(version)\" \ - -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \ + -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \ -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \ -DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \ + @TARGET_SYSTEM_ROOT_DEFINE@ \ $(VALGRIND_DRIVER_DEFINES) \ `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \ `test "X$${SHLIB_MULTILIB}" = "X" || echo "-DNO_SHARED_LIBGCC_MULTILIB"` -gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) intl.h multilib.h \ +gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \ Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) (SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ @@ -1294,14 +1410,14 @@ gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) intl.h multilib.h \ $(DRIVER_DEFINES) \ -c $(srcdir)/gcc.c $(OUTPUT_OPTION)) -gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) $(GCC_H) +gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) (SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(DRIVER_DEFINES) \ -c $(srcdir)/gccspec.c $(OUTPUT_OPTION)) -cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) $(GCC_H) +cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) tree-check.h: s-check ; @true s-check : gencheck$(build_exeext) $(srcdir)/move-if-change @@ -1309,14 +1425,12 @@ s-check : gencheck$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-check.h tree-check.h $(STAMP) s-check -gencheck$(build_exeext) : gencheck.o $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gencheck.o $(HOST_LIBS) +gencheck$(build_exeext) : gencheck.o $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + gencheck.o $(BUILD_LIBS) -gencheck.o : gencheck.c gencheck.h tree.def $(HCONFIG_H) $(SYSTEM_H) \ - $(lang_tree_files) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/gencheck.c $(OUTPUT_OPTION) +gencheck.o : gencheck.c gencheck.h tree.def $(BCONFIG_H) $(SYSTEM_H) \ + coretypes.h $(GTM_H) $(lang_tree_files) gencheck.h : s-gencheck ; @true s-gencheck : Makefile @@ -1326,14 +1440,6 @@ s-gencheck : Makefile $(SHELL) $(srcdir)/move-if-change tmp-gencheck.h gencheck.h $(STAMP) s-gencheck -options.h : s-options ; @true -s-options : Makefile - lof="$(lang_options_files)"; for f in $$lof; do \ - echo "#include \"$$f\""; \ - done | sed 's|$(srcdir)/||' > tmp-options.h - $(SHELL) $(srcdir)/move-if-change tmp-options.h options.h - $(STAMP) s-options - specs.h : s-specs ; @true s-specs : Makefile lsf="$(lang_specs_files)"; for f in $$lsf; do \ @@ -1342,331 +1448,395 @@ s-specs : Makefile $(SHELL) $(srcdir)/move-if-change tmp-specs.h specs.h $(STAMP) s-specs +options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h intl.h + +options.h: $(lang_opt_files) $(srcdir)/opts.sh Makefile + AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh \ + '$(SHELL) $(srcdir)/move-if-change' \ + options.c options.h $(lang_opt_files) + dumpvers: dumpvers.c version.o: version.c version.h -gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) varray.h $(HASHTAB_H) \ - $(TREE_H) $(RTL_H) function.h insn-config.h $(EXPR_H) $(OPTABS_H) \ +gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) varray.h \ + $(HASHTAB_H) $(TREE_H) $(RTL_H) function.h insn-config.h $(EXPR_H) $(OPTABS_H) \ libfuncs.h debug.h $(GGC_H) bitmap.h $(BASIC_BLOCK_H) hard-reg-set.h \ - ssa.h cselib.h insn-addr.h + cselib.h insn-addr.h -ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - flags.h $(GGC_H) varray.h $(HASHTAB_H) $(TM_P_H) langhooks.h \ - $(PARAMS_H) +ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \ + $(HASHTAB_H) toplev.h $(PARAMS_H) hosthooks.h -ggc-simple.o: ggc-simple.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - $(GGC_H) varray.h $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) +ggc-simple.o: ggc-simple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h $(GGC_H) varray.h $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) -ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - toplev.h $(GGC_H) $(TIMEVAR_H) $(TM_P_H) +ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h toplev.h $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) -stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(OBSTACK_H) \ - flags.h toplev.h $(GGC_H) +ggc-zone.o: ggc-zone.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h toplev.h $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) -hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) +stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TREE_H) $(GGC_H) gt-stringpool.h -line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H) - -ggc-none.o: ggc-none.c $(GCONFIG_H) $(SYSTEM_H) $(GGC_H) +ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(GGC_H) $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) -prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h +prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) Makefile prefix.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ -DPREFIX=\"$(prefix)\" \ -c $(srcdir)/prefix.c $(OUTPUT_OPTION) -convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h convert.h \ - toplev.h langhooks.h +convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flags.h \ + convert.h toplev.h langhooks.h -langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) toplev.h \ - tree-inline.h $(RTL_H) insn-config.h integrate.h langhooks.h \ - $(LANGHOOKS_DEF_H) flags.h -tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h function.h toplev.h \ - $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \ +langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) toplev.h \ + tree-inline.h $(RTL_H) insn-config.h $(INTEGRATE_H) langhooks.h \ + $(LANGHOOKS_DEF_H) flags.h $(GGC_H) gt-langhooks.h diagnostic.h +tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flags.h function.h \ + toplev.h $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h \ real.h gt-tree.h -tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ - flags.h langhooks.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ +tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) flags.h langhooks.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ $(EXPR_H) $(SPLAY_TREE_H) tree-dump.h -tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \ - expr.h flags.h params.h input.h insn-config.h $(INTEGRATE_H) \ - $(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h langhooks.h \ - $(C_COMMON_H) tree-inline.h -print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H) \ - langhooks.h real.h -stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \ - function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H) \ +tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TREE_H) $(RTL_H) $(EXPR_H) flags.h $(PARAMS_H) input.h insn-config.h \ + $(INTEGRATE_H) $(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h \ + langhooks.h $(C_COMMON_H) tree-inline.h cgraph.h intl.h +tree-optimize.o : tree-optimize.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TREE_H) toplev.h langhooks.h cgraph.h $(TIMEVAR_H) function.h $(GGC_H) + +print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(GGC_H) langhooks.h real.h +stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + flags.h function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H) \ langhooks.h -fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h real.h \ - toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h -diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \ - $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \ +fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + flags.h real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h +diagnostic.o : diagnostic.c $(DIAGNOSTIC_H) real.h \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \ input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H) -toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \ - flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \ +opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(RTL_H) \ + output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h +targhooks.o : targhooks.c targhooks.h $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(TREE_H) $(TM_H) $(RTL_H) $(TM_P_H) function.h \ + output.h toplev.h + +toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) \ debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \ dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \ - graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \ - ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \ - langhooks.h insn-flags.h options.h cfglayout.h real.h + graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) value-prof.h \ + $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \ + langhooks.h insn-flags.h cfglayout.h real.h cfgloop.h \ + hosthooks.h $(LANGHOOKS_DEF_H) cgraph.h $(COVERAGE_H) alloc-pool.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DTARGET_NAME=\"$(target_alias)\" \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ -c $(srcdir)/toplev.c $(OUTPUT_OPTION) -main.o : main.c $(CONFIG_H) $(SYSTEM_H) toplev.h +main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h -rtl-error.o: rtl-error.c system.h $(RTL_H) $(INSN_ATTR_H) insn-config.h \ - input.h toplev.h intl.h diagnostic.h $(CONFIG_H) +host-default.o : host-default.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + hosthooks.h hosthooks-def.h -rtl.o : rtl.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) real.h $(GGC_H) errors.h +rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(INSN_ATTR_H) \ + insn-config.h input.h toplev.h intl.h $(DIAGNOSTIC_H) $(CONFIG_H) + +rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(RTL_H) real.h \ + $(GGC_H) errors.h $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) -print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - hard-reg-set.h $(BASIC_BLOCK_H) real.h -rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) toplev.h $(RTL_H) \ - hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) real.h flags.h +print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) real.h $(TM_P_H) +rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \ + $(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) real.h flags.h \ + $(BASIC_BLOCK_H) -errors.o : errors.c $(GCONFIG_H) $(SYSTEM_H) errors.h +errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) -varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ - function.h $(EXPR_H) hard-reg-set.h $(REGS_H) \ +varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + flags.h function.h $(EXPR_H) hard-reg-set.h $(REGS_H) \ output.h c-pragma.h toplev.h xcoffout.h debug.h $(GGC_H) $(TM_P_H) \ $(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h real.h -function.o : function.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - function.h $(EXPR_H) libfuncs.h $(REGS_H) hard-reg-set.h \ +function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h function.h $(EXPR_H) $(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h \ insn-config.h $(RECOG_H) output.h toplev.h except.h $(HASHTAB_H) $(GGC_H) \ - $(TM_P_H) langhooks.h gt-function.h -stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h function.h \ - insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \ + $(TM_P_H) langhooks.h gt-function.h $(TARGET_H) +stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \ + function.h insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \ $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) \ - langhooks.h $(PREDICT_H) gt-stmt.h -except.o : except.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - except.h function.h $(EXPR_H) libfuncs.h integrate.h langhooks.h \ - insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \ + langhooks.h $(PREDICT_H) gt-stmt.h $(OPTABS_H) $(TARGET_H) +except.o : except.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(TREE_H) flags.h except.h function.h $(EXPR_H) libfuncs.h $(INTEGRATE_H) \ + langhooks.h insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \ dwarf2asm.h dwarf2out.h toplev.h $(HASHTAB_H) intl.h $(GGC_H) \ - gt-except.h -expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h function.h \ - $(REGS_H) $(EXPR_H) $(OPTABS_H) libfuncs.h insn-attr.h insn-config.h \ + gt-except.h cgraph.h +expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \ + function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) libfuncs.h $(INSN_ATTR_H) insn-config.h \ $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \ - except.h reload.h $(GGC_H) langhooks.h intl.h $(TM_P_H) real.h -builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - $(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) insn-config.h \ + except.h reload.h $(GGC_H) langhooks.h intl.h $(TM_P_H) real.h $(TARGET_H) +dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h function.h $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \ + langhooks.h +builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H)\ + flags.h $(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) insn-config.h \ $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \ except.h $(TM_P_H) $(PREDICT_H) libfuncs.h real.h langhooks.h -calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - $(EXPR_H) langhooks.h $(TARGET_H) \ - libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H) \ - except.h -expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) real.h \ +calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \ + $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \ + libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H) cgraph.h except.h +expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) real.h \ toplev.h $(TM_P_H) langhooks.h -explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \ - toplev.h function.h ggc.h $(TM_P_H) gt-explow.h -optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h $(RECOG_H) reload.h \ - toplev.h $(GGC_H) real.h $(TM_P_H) except.h gt-optabs.h $(BASIC_BLOCK_H) -dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ - $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \ - insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h -debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) -sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ - function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \ - insn-config.h xcoffout.h c-pragma.h ggc.h \ +explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \ + toplev.h function.h $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h +optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h $(RECOG_H) reload.h \ + toplev.h $(GGC_H) real.h $(TM_P_H) except.h gt-optabs.h $(BASIC_BLOCK_H) \ + $(TARGET_H) +dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + flags.h $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \ + insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h \ + $(GGC_H) gt-dbxout.h +debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) +sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + flags.h function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \ + insn-config.h xcoffout.h c-pragma.h $(GGC_H) $(TARGET_H) \ sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h gt-sdbout.h -dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \ - flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \ - debug.h langhooks.h -dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf2.h \ - debug.h flags.h insn-config.h reload.h output.h diagnostic.h real.h \ +dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h $(DIAGNOSTIC_H) real.h \ hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \ - $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) gt-dwarf2out.h -dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \ - output.h dwarf2asm.h $(TM_P_H) $(GGC_H) -vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ - output.h vmsdbg.h debug.h langhooks.h function.h -xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) xcoffout.h \ - flags.h toplev.h output.h dbxout.h $(GGC_H) $(TARGET_H) -emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - function.h $(REGS_H) insn-config.h $(RECOG_H) real.h $(GGC_H) \ - $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h toplev.h \ - $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h -real.o : real.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) toplev.h $(TM_P_H) -integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - debug.h $(INTEGRATE_H) insn-config.h $(EXPR_H) real.h $(REGS_H) \ + $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) \ + gt-dwarf2out.h $(TARGET_H) cgraph.h +dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \ + $(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h +vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(RTL_H) flags.h output.h vmsdbg.h debug.h langhooks.h function.h $(TARGET_H) +xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + xcoffout.h flags.h toplev.h output.h dbxout.h $(GGC_H) $(TARGET_H) +emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h $(GGC_H) \ + $(EXPR_H) $(OBSTACK_H) hard-reg-set.h bitmap.h toplev.h \ + $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h gt-emit-rtl.h +real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) toplev.h $(TM_P_H) +integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h debug.h $(INTEGRATE_H) insn-config.h $(EXPR_H) real.h $(REGS_H) \ intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H) \ $(PARAMS_H) $(TM_P_H) $(TARGET_H) langhooks.h gt-integrate.h -jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \ - insn-config.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \ - toplev.h $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) +jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \ + toplev.h $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) $(TIMEVAR_H) \ + $(DIAGNOSTIC_H) -simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) \ +simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(REGS_H) hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ + output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) $(TREE_H) $(TARGET_H) +cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + langhooks.h toplev.h flags.h $(GGC_H) $(TARGET_H) cgraph.h gt-cgraph.h \ + output.h intl.h +cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + langhooks.h tree-inline.h toplev.h flags.h $(GGC_H) $(TARGET_H) cgraph.h intl.h \ + function.h +coverage.o : coverage.c gcov-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(RTL_H) $(TREE_H) flags.h output.h $(REGS_H) $(EXPR_H) function.h \ + toplev.h $(GGC_H) $(TARGET_H) langhooks.h $(COVERAGE_H) libfuncs.h \ + gt-coverage.h $(HASHTAB_H) +cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ - output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) $(TREE_H) -cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) \ + output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h $(PARAMS_H) +cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ - output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h -cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ - real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h function.h \ - $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) -gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) hard-reg-set.h \ - flags.h real.h insn-config.h ggc.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \ - function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) except.h gt-gcse.h -sibcall.o : sibcall.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) function.h \ - hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) -resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \ - $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \ + output.h function.h $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \ + except.h $(TARGET_H) $(PARAMS_H) +web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ + hard-reg-set.h flags.h $(BASIC_BLOCK_H) function.h output.h toplev.h df.h +gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ + hard-reg-set.h flags.h real.h insn-config.h $(GGC_H) $(RECOG_H) $(EXPR_H) \ + $(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) \ + except.h gt-gcse.h $(TREE_H) cselib.h +sibcall.o : sibcall.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ + function.h hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) +resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) coretypes.h \ + $(TM_H) $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \ $(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H) -lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ - real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \ - $(TM_P_H) df.h -ssa.o : ssa.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) varray.h $(EXPR_H) \ - hard-reg-set.h flags.h function.h real.h insn-config.h $(RECOG_H) \ - $(BASIC_BLOCK_H) output.h ssa.h -ssa-dce.o : ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) ssa.h insn-config.h $(RECOG_H) output.h -ssa-ccp.o : ssa-ccp.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) ssa.h insn-config.h $(RECOG_H) output.h \ - errors.h $(GGC_H) df.h function.h -df.o : df.c $(CONFIG_H) system.h $(RTL_H) insn-config.h $(RECOG_H) \ - function.h $(REGS_H) $(OBSTACK_H) hard-reg-set.h $(BASIC_BLOCK_H) df.h \ - $(FIBHEAP_H) -conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) $(HASHTAB_H) \ - $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H) -profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \ - gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H) \ - langhooks.h profile.h libfuncs.h gt-profile.h -loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \ +lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ + hard-reg-set.h flags.h real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) \ + $(BASIC_BLOCK_H) $(TM_P_H) df.h function.h +df.o : df.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + insn-config.h $(RECOG_H) function.h $(REGS_H) alloc-pool.h hard-reg-set.h \ + $(BASIC_BLOCK_H) df.h $(FIBHEAP_H) +conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OBSTACK_H) \ + $(HASHTAB_H) $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H) +profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(TREE_H) flags.h output.h $(REGS_H) $(EXPR_H) function.h \ + toplev.h $(BASIC_BLOCK_H) $(COVERAGE_H) $(TREE_H) value-prof.h +value-prof.o : value-prof.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h value-prof.h $(EXPR_H) output.h flags.h \ + $(RECOG_H) insn-config.h $(OPTABS_H) $(REGS_H) +loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \ insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \ - real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h \ - toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H) -doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \ - $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h -unroll.o : unroll.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h function.h \ - $(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \ - hard-reg-set.h varray.h $(BASIC_BLOCK_H) $(TM_P_H) $(PREDICT_H) $(PARAMS_H) -flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h insn-config.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ - function.h except.h $(EXPR_H) ssa.h $(GGC_H) $(TM_P_H) -cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ - function.h except.h $(GGC_H) $(TM_P_H) -cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ - function.h except.h $(GGC_H) $(TM_P_H) insn-config.h -cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(BASIC_BLOCK_H) \ - hard-reg-set.h insn-config.h $(RECOG_H) $(GGC_H) $(TM_P_H) -cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ + real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \ + toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H) $(GGC_H) +doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \ + cfgloop.h +unroll.o : unroll.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \ + function.h $(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \ + hard-reg-set.h varray.h $(BASIC_BLOCK_H) $(TM_P_H) $(PREDICT_H) $(PARAMS_H) \ + cfgloop.h +alloc-pool.o : alloc-pool.c $(CONFIG_H) $(SYSTEM_H) alloc-pool.h $(HASHTAB_H) +flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \ + $(RECOG_H) function.h except.h $(EXPR_H) $(GGC_H) $(TM_P_H) +cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h insn-config.h \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ + function.h except.h $(GGC_H) $(TM_P_H) alloc-pool.h +cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + $(BASIC_BLOCK_H) cfglayout.h +cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ + function.h except.h $(GGC_H) $(TM_P_H) insn-config.h $(EXPR_H) +cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(GGC_H) $(TM_P_H) +cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ function.h except.h $(GGC_H) -cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TIMEVAR_H)\ - $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h \ - $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) $(PARAMS_H) -cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ - $(BASIC_BLOCK_H) hard-reg-set.h -dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) et-forest.h -et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) et-forest.h -combine.o : combine.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h function.h \ - insn-config.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \ - $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h $(TM_P_H) -regclass.o : regclass.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) hard-reg-set.h flags.h \ - $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h \ - toplev.h function.h output.h $(GGC_H) $(TM_P_H) $(EXPR_H) -local-alloc.o : local-alloc.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ +cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h \ + $(RECOG_H) toplev.h $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) \ + $(PARAMS_H) +cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h +cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h $(EXPR_H) coretypes.h $(TM_H) +cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h cfglayout.h output.h coretypes.h $(TM_H) +loop-init.o : loop-init.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h cfglayout.h \ + coretypes.h $(TM_H) +loop-unswitch.o : loop-unswitch.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h cfglayout.h $(PARAMS_H) \ + output.h $(EXPR_H) coretypes.h $(TM_H) +loop-unroll.o: loop-unroll.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h cfglayout.h $(PARAMS_H) \ + output.h $(EXPR_H) coretypes.h $(TM_H) +dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h +et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) et-forest.h alloc-pool.h +combine.o : combine.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + function.h insn-config.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \ + $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h $(TM_P_H) $(TREE_H) $(TARGET_H) +regclass.o : regclass.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + hard-reg-set.h flags.h $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h \ + real.h toplev.h function.h output.h $(GGC_H) $(TM_P_H) $(EXPR_H) $(TIMEVAR_H) +local-alloc.o : local-alloc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + flags.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ output.h function.h $(INSN_ATTR_H) toplev.h except.h $(TM_P_H) -bitmap.o : bitmap.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h \ +bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(RTL_H) flags.h \ $(BASIC_BLOCK_H) $(REGS_H) $(GGC_H) $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) -global.o : global.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h reload.h function.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h \ - $(TM_P_H) -varray.o : varray.c $(CONFIG_H) $(SYSTEM_H) varray.h $(GGC_H) errors.h -ra.o : ra.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_P_H) insn-config.h \ - $(RECOG_H) integrate.h function.h $(REGS_H) $(OBSTACK_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) df.h expr.h output.h toplev.h flags.h reload.h ra.h -ra-build.o : ra-build.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_P_H) \ +global.o : global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + reload.h function.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h \ + toplev.h $(TM_P_H) +varray.o : varray.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) varray.h $(GGC_H) errors.h +ra.o : ra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h \ + $(RECOG_H) $(INTEGRATE_H) function.h $(REGS_H) $(OBSTACK_H) hard-reg-set.h \ + $(BASIC_BLOCK_H) df.h $(EXPR_H) output.h toplev.h flags.h reload.h ra.h +ra-build.o : ra-build.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TM_P_H) \ insn-config.h $(RECOG_H) function.h $(REGS_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) df.h output.h ggc.h ra.h gt-ra-build.h reload.h -ra-colorize.o : ra-colorize.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_P_H) \ - function.h $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) df.h output.h ra.h -ra-debug.o : ra-debug.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h \ - $(RECOG_H) function.h hard-reg-set.h $(BASIC_BLOCK_H) df.h output.h ra.h \ - $(TM_P_H) -ra-rewrite.o : ra-rewrite.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_P_H) \ - function.h $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) df.h expr.h \ + $(BASIC_BLOCK_H) df.h output.h $(GGC_H) ra.h gt-ra-build.h reload.h +ra-colorize.o : ra-colorize.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(TM_P_H) function.h $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) df.h output.h ra.h +ra-debug.o : ra-debug.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + insn-config.h $(RECOG_H) function.h hard-reg-set.h $(BASIC_BLOCK_H) df.h output.h \ + ra.h $(TM_P_H) +ra-rewrite.o : ra-rewrite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(TM_P_H) function.h $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) df.h $(EXPR_H) \ output.h except.h ra.h reload.h insn-config.h -reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h output.h \ +reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h output.h \ $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) hard-reg-set.h insn-config.h \ - $(REGS_H) function.h real.h toplev.h $(TM_P_H) -reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) real.h flags.h \ + $(REGS_H) function.h real.h toplev.h $(TM_P_H) $(PARAMS_H) +reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) real.h flags.h \ + $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \ + $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h $(TM_P_H) \ + except.h $(TREE_H) +postreload.o : postreload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) real.h flags.h \ $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \ $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h cselib.h $(TM_P_H) \ except.h $(TREE_H) -caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h \ - $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \ +caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + flags.h $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \ $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H) -reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) conditions.h hard-reg-set.h \ - $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(INSN_ATTR_H) except.h \ +bt-load.o : bt-load.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(BASIC_BLOCK_H) $(RTL_H) hard-reg-set.h $(REGS_H) $(OBSTACK_H) $(TM_P_H) \ + $(FIBHEAP_H) output.h $(TARGET_H) $(EXPR_H) flags.h $(INSN_ATTR_H) +reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) conditions.h \ + hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(INSN_ATTR_H) except.h \ $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H) -alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h \ - $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) \ +alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ + hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) \ $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) langhooks.h $(TARGET_H) \ - gt-alias.h -regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h \ + gt-alias.h $(TIMEVAR_H) cgraph.h +regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \ $(RECOG_H) output.h $(REGS_H) hard-reg-set.h flags.h function.h \ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h -haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ +haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) -sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ +sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h $(PARAMS_H) $(TM_P_H) -sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ +sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) -sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ - $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) -sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ - hard-reg-set.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(REGS_H) $(TM_P_H) \ +sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + sched-int.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ + $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(PARAMS_H) +sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + sched-int.h hard-reg-set.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(REGS_H) $(TM_P_H) \ $(TARGET_H) real.h -final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \ - $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \ - real.h output.h hard-reg-set.h except.h debug.h xcoffout.h profile.h \ - toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) -recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) function.h $(BASIC_BLOCK_H) \ - $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h flags.h insn-config.h \ +final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h intl.h $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) \ + function.h real.h output.h hard-reg-set.h except.h debug.h xcoffout.h \ + toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) \ + $(EXPR_H) +recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) function.h \ + $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h flags.h insn-config.h \ $(INSN_ATTR_H) real.h toplev.h output.h reload.h $(TM_P_H) -reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) $(RECOG_H) \ - $(REGS_H) hard-reg-set.h flags.h insn-config.h toplev.h reload.h \ +reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + $(RECOG_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h toplev.h reload.h \ varray.h function.h $(TM_P_H) $(GGC_H) gt-reg-stack.h -predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ - insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \ - $(RECOG_H) function.h except.h $(EXPR_H) $(TM_P_H) $(PREDICT_H) real.h \ - $(PARAMS_H) $(TARGET_H) -lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) toplev.h $(RTL_H) $(GGC_H) -bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - flags.h $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h $(TARGET_H) -tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h flags.h \ - $(PARAMS_H) profile.h -cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h function.h \ - cfglayout.h -timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) $(TIMEVAR_H) flags.h intl.h -regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h $(RECOG_H) function.h \ +sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h +predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \ + $(RECOG_H) function.h except.h $(EXPR_H) $(TM_P_H) $(PREDICT_H) sreal.h \ + $(PARAMS_H) $(TARGET_H) cfgloop.h $(COVERAGE_H) +lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(RTL_H) $(GGC_H) +bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(BASIC_BLOCK_H) flags.h timevar.h output.h cfglayout.h $(FIBHEAP_H) \ + $(TARGET_H) +tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ + $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h flags.h timevar.h \ + $(PARAMS_H) $(COVERAGE_H) +cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \ + function.h cfglayout.h cfgloop.h $(TARGET_H) gt-cfglayout.h $(GGC_H) +timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TIMEVAR_H) flags.h \ + intl.h toplev.h +regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h $(RECOG_H) function.h \ resource.h $(OBSTACK_H) flags.h $(TM_P_H) -ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(REGS_H) toplev.h \ - flags.h insn-config.h function.h $(RECOG_H) $(BASIC_BLOCK_H) $(EXPR_H) \ - output.h except.h $(TM_P_H) real.h -params.o : params.c $(CONFIG_H) $(SYSTEM_H) $(PARAMS_H) toplev.h -hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) $(HOOKS_H) +ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(REGS_H) toplev.h flags.h insn-config.h function.h $(RECOG_H) $(TARGET_H) \ + $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) real.h $(OPTABS_H) \ + cfgloop.h +params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h +hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H) +pretty-print.o: $(CONFIG_H) $(SYSTEM_H) pretty-print.c $(PRETTY_PRINT_H) -$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \ +$(out_object_file): $(out_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) \ @@ -1678,12 +1848,21 @@ $(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \ mips-tfile: mips-tfile.o version.o $(LIBDEPS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS) -mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) version.h +mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) coretypes.h $(TM_H) version.h mips-tdump: mips-tdump.o version.o $(LIBDEPS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS) -mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) +mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) coretypes.h $(TM_H) version.h + +# FIXME: writing proper dependencies for this is a *LOT* of work. +libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ + insn-attr.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ + -c $(filter %.c,$^) -o $@ # # Generate header and source files from the machine description, @@ -1724,14 +1903,14 @@ s-conditions : $(md_file) genconditions$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-conditions.c insn-conditions.c $(STAMP) s-conditions -insn-conditions.o : insn-conditions.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) \ - $(TM_P_H) $(REGS_H) function.h $(RECOG_H) real.h output.h flags.h \ - hard-reg-set.h resource.h toplev.h reload.h gensupport.h insn-constants.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) insn-conditions.c +insn-conditions.o : insn-conditions.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(GTM_H) $(RTL_H) $(TM_P_H) $(REGS_H) function.h $(RECOG_H) real.h output.h \ + flags.h hard-reg-set.h resource.h toplev.h reload.h gensupport.h \ + insn-constants.h + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) insn-conditions.c -dummy-conditions.o : dummy-conditions.c $(HCONFIG_H) $(SYSTEM_H) gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/dummy-conditions.c $(OUTPUT_OPTION) +dummy-conditions.o : dummy-conditions.c $(BCONFIG_H) $(SYSTEM_H) \ + coretypes.h $(GTM_H) gensupport.h insn-flags.h: s-flags ; @true s-flags : $(md_file) genflags$(build_exeext) $(srcdir)/move-if-change @@ -1751,9 +1930,9 @@ s-constants : $(md_file) genconstants$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-constants.h insn-constants.h $(STAMP) s-constants -insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \ - insn-config.h $(OPTABS_H) $(SYSTEM_H) reload.h $(RECOG_H) toplev.h \ - function.h flags.h hard-reg-set.h resource.h $(TM_P_H) +insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(EXPR_H) real.h output.h insn-config.h $(OPTABS_H) reload.h \ + $(RECOG_H) toplev.h function.h flags.h hard-reg-set.h resource.h $(TM_P_H) $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c \ $(OUTPUT_OPTION) @@ -1763,9 +1942,9 @@ s-emit : $(md_file) genemit$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-emit.c insn-emit.c $(STAMP) s-emit -insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \ - real.h output.h flags.h $(SYSTEM_H) function.h hard-reg-set.h resource.h \ - $(TM_P_H) toplev.h reload.h +insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) insn-config.h $(RECOG_H) real.h output.h flags.h function.h \ + hard-reg-set.h resource.h $(TM_P_H) toplev.h reload.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c \ $(OUTPUT_OPTION) @@ -1775,8 +1954,8 @@ s-recog : $(md_file) genrecog$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-recog.c insn-recog.c $(STAMP) s-recog -insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) \ - insn-config.h flags.h $(RECOG_H) $(EXPR_H) $(OPTABS_H) reload.h $(SYSTEM_H) +insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) insn-config.h flags.h $(RECOG_H) $(EXPR_H) $(OPTABS_H) reload.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c \ $(OUTPUT_OPTION) @@ -1786,8 +1965,8 @@ s-opinit : $(md_file) genopinit$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c $(STAMP) s-opinit -insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) toplev.h \ - insn-config.h $(RECOG_H) +insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) toplev.h insn-config.h $(RECOG_H) $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c \ $(OUTPUT_OPTION) @@ -1797,8 +1976,9 @@ s-extract : $(md_file) genextract$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-extract.c insn-extract.c $(STAMP) s-extract -insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \ - $(SYSTEM_H) insn-config.h $(RECOG_H) except.h function.h $(TM_P_H) +insn-peep.o : insn-peep.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(REGS_H) output.h real.h insn-config.h $(RECOG_H) except.h \ + function.h $(TM_P_H) $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c \ $(OUTPUT_OPTION) @@ -1808,9 +1988,9 @@ s-peep : $(md_file) genpeep$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-peep.c insn-peep.c $(STAMP) s-peep -insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \ - output.h $(INSN_ATTR_H) insn-config.h $(SYSTEM_H) toplev.h $(RECOG_H) \ - $(TM_P_H) flags.h +insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(REGS_H) real.h output.h $(INSN_ATTR_H) insn-config.h toplev.h \ + $(RECOG_H) $(TM_P_H) flags.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c \ $(OUTPUT_OPTION) @@ -1826,10 +2006,10 @@ s-attrtab : $(md_file) genattrtab$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c $(STAMP) s-attrtab -insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(GGC_H) $(REGS_H) real.h \ - conditions.h hard-reg-set.h insn-config.h $(INSN_ATTR_H) $(EXPR_H) \ - output.h $(RECOG_H) function.h $(SYSTEM_H) toplev.h flags.h \ - insn-codes.h $(TM_P_H) +insn-output.o : insn-output.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(GGC_H) $(REGS_H) real.h conditions.h hard-reg-set.h \ + insn-config.h $(INSN_ATTR_H) $(EXPR_H) output.h $(RECOG_H) function.h \ + toplev.h flags.h insn-codes.h $(TM_P_H) $(TARGET_H) $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c \ $(OUTPUT_OPTION) @@ -1839,17 +2019,31 @@ s-output : $(md_file) genoutput$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-output.c insn-output.c $(STAMP) s-output -genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) $(GGC_H) +genrtl.o : genrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ + $(GGC_H) genrtl.c genrtl.h : s-genrtl @true # force gnu make to recheck modification times. -s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RTL_BASE_H) +s-genrtl: gengenrtl$(build_exeext) $(srcdir)/move-if-change $(RUN_GEN) ./gengenrtl$(build_exeext) -h > tmp-genrtl.h $(SHELL) $(srcdir)/move-if-change tmp-genrtl.h genrtl.h $(RUN_GEN) ./gengenrtl$(build_exeext) > tmp-genrtl.c $(SHELL) $(srcdir)/move-if-change tmp-genrtl.c genrtl.c $(STAMP) s-genrtl +insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(MACHMODE_H) real.h +min-insn-modes.c insn-modes.c insn-modes.h : s-modes ; @true + +s-modes: genmodes$(build_exeext) $(srcdir)/move-if-change + $(RUN_GEN) ./genmodes$(build_exeext) -h > tmp-modes.h + $(SHELL) $(srcdir)/move-if-change tmp-modes.h insn-modes.h + $(RUN_GEN) ./genmodes$(build_exeext) -m > tmp-min-modes.c + $(SHELL) $(srcdir)/move-if-change tmp-min-modes.c min-insn-modes.c + $(RUN_GEN) ./genmodes$(build_exeext) > tmp-modes.c + $(SHELL) $(srcdir)/move-if-change tmp-modes.c insn-modes.c + $(STAMP) s-modes + tm-preds.h: s-preds; @true s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change @@ -1857,22 +2051,22 @@ s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change $(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h $(STAMP) s-preds -GTFILES = $(GCONFIG_H) $(srcdir)/location.h \ - $(HASHTAB_H) \ - $(srcdir)/bitmap.h $(srcdir)/function.h $(srcdir)/rtl.h $(srcdir)/optabs.h \ - $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h $(srcdir)/real.h \ - $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h $(srcdir)/cselib.h \ +GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \ + $(host_xm_file_list) $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) \ + $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h $(srcdir)/rtl.h \ + $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \ + $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h \ + $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \ $(srcdir)/c-common.h $(srcdir)/c-tree.h \ - $(srcdir)/basic-block.h \ - $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c \ - $(srcdir)/dwarf2out.c $(srcdir)/emit-rtl.c \ - $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \ + $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ + $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \ + $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \ $(srcdir)/fold-const.c $(srcdir)/function.c \ $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \ $(srcdir)/profile.c $(srcdir)/ra-build.c $(srcdir)/regclass.c \ - $(srcdir)/reg-stack.c \ + $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/langhooks.c \ $(srcdir)/sdbout.c $(srcdir)/stmt.c $(srcdir)/stor-layout.c \ - $(srcdir)/tree.c $(srcdir)/varasm.c \ + $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \ $(out_file) \ @all_gtfiles@ @@ -1881,36 +2075,37 @@ GTFILES_FILES_FILES = @all_gtfiles_files_files@ GTFILES_LANG_DIR_NAMES = @subdirs@ GTFILES_SRCDIR = @srcdir@ -gtype-desc.h gtype-desc.c gt-except.h gt-function.h : s-gtype; @true -gt-integrate.h gt-stmt.h gt-tree.h gt-varasm.h gt-emit-rtl.h : s-gtype; @true -gt-explow.h gt-stor-layout.h gt-regclass.h gt-lists.h : s-gtype; @true -gt-alias.h gt-cselib.h gt-fold-const.h gt-gcse.h gt-profile.h : s-gtype; @true -gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dwarf2out.h : s-gtype ; @true -gt-ra-build.h gt-reg-stack.h : s-gtype ; @true -gt-c-common.h gt-c-decl.h gt-c-parse.h gt-c-pragma.h : s-gtype; @true -gt-c-objc-common.h gtype-c.h gt-location.h : s-gtype ; @true +gt-cgraph.h gt-coverage.h gtype-desc.h gtype-desc.c gt-except.h \ +gt-function.h gt-integrate.h gt-stmt.h gt-tree.h gt-varasm.h \ +gt-emit-rtl.h gt-explow.h gt-stor-layout.h gt-regclass.h \ +gt-lists.h gt-alias.h gt-cselib.h gt-fold-const.h gt-gcse.h \ +gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h \ +gt-dwarf2out.h gt-ra-build.h gt-reg-stack.h gt-dwarf2asm.h \ +gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parse.h \ +gt-c-pragma.h gtype-c.h gt-input.h gt-cfglayout.h \ +gt-stringpool.h gt-langhooks.h : s-gtype ; @true gtyp-gen.h: Makefile echo "/* This file is machine generated. Do not edit. */" > tmp-gtyp.h - echo "static const char *srcdir = " >> tmp-gtyp.h + echo "static const char *const srcdir = " >> tmp-gtyp.h echo "\"$(GTFILES_SRCDIR)\"" >> tmp-gtyp.h echo ";" >> tmp-gtyp.h - echo "static const char *lang_files[] = {" >> tmp-gtyp.h + echo "static const char *const lang_files[] = {" >> tmp-gtyp.h ll="$(GTFILES_FILES_FILES)"; \ for f in $$ll; do \ echo "\"$$f\", "; done >> tmp-gtyp.h echo "NULL};" >> tmp-gtyp.h - echo "static const char *langs_for_lang_files[] = {" >> tmp-gtyp.h + echo "static const char *const langs_for_lang_files[] = {" >> tmp-gtyp.h ff="$(GTFILES_FILES_LANGS)"; \ for f in $$ff; do \ echo "\"$$f\", " ; done >> tmp-gtyp.h echo "NULL};" >> tmp-gtyp.h - echo "static const char *all_files[] = {" >> tmp-gtyp.h + echo "static const char *const all_files[] = {" >> tmp-gtyp.h gf="$(GTFILES)"; \ for f in $$gf; do \ echo "\"$$f\", "; done >> tmp-gtyp.h echo " NULL};" >> tmp-gtyp.h - echo "static const char *lang_dir_names[] = { \"c\", " >> tmp-gtyp.h + echo "static const char *const lang_dir_names[] = { \"c\", " >> tmp-gtyp.h gf="$(GTFILES_LANG_DIR_NAMES)"; \ for l in $$gf; do \ echo "\"$$l\", "; done >> tmp-gtyp.h @@ -1923,7 +2118,7 @@ s-gtype: gengtype$(build_exeext) $(GTFILES) # # Compile the programs that generate insn-* from the machine description. -# They are compiled with $(HOST_CC), and associated libraries, +# They are compiled with $(CC_FOR_BUILD), and associated libraries, # since they need to run on this machine # even if GCC is being compiled to run on some other machine. @@ -1932,280 +2127,211 @@ s-gtype: gengtype$(build_exeext) $(GTFILES) # about the target machine. They do depend on config.h itself, # since that describes the host machine. -read-rtl.o: read-rtl.c $(HCONFIG_H) $(SYSTEM_H) $(RTL_H) \ +# The names of programs that run on the "build" machine. +genprognames=genconfig genflags gencodes genemit genopinit genrecog \ + genextract genpeep genattr genoutput + +# The names of the executable files for those programs. +genprogs=$(genprognames:%=%$(build_exeext)) + +# Object files used in those programs. +genobjs=$(genprognames:%=%.o) read-rtl.o gensupport.o genattrtab.o \ + genautomata.o gengenrtl.o genmodes.o genpreds.o gengtype.o \ + genconstants.o gen-protos.o scan.o fix-header.o scan-decls.o \ + gencheck.o dummy-conditions.o genconditions.o + +$(genprogs): %$(build_exeext): %.o $(BUILD_RTL) $(BUILD_SUPPORT) \ + $(BUILD_PRINT) $(BUILD_ERRORS) \ + $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + $< $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) \ + $(BUILD_ERRORS) $(BUILD_LIBS) + +$(genobjs): %.o : %.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + +read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(RTL_H) \ $(OBSTACK_H) $(HASHTAB_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/read-rtl.c $(OUTPUT_OPTION) -gensupport.o: gensupport.c $(RTL_H) $(OBSTACK_H) $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gensupport.c $(OUTPUT_OPTION) +gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(RTL_H) \ + $(OBSTACK_H) errors.h $(HASHTAB_H) gensupport.h -genconfig$(build_exeext) : genconfig.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genconfig.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) +genconfig.o : genconfig.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genconfig.o : genconfig.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c $(OUTPUT_OPTION) +genflags.o : genflags.c $(RTL_H) $(OBSTACK_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genflags$(build_exeext) : genflags.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genflags.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) +gencodes.o : gencodes.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genflags.o : genflags.c $(RTL_H) $(OBSTACK_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c $(OUTPUT_OPTION) +genconstants$(build_exeext) : genconstants.o $(BUILD_RTL) $(BUILD_EARLY_SUPPORT) \ + $(BUILD_ERRORS) $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + genconstants.o $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) \ + $(BUILD_ERRORS) $(BUILD_LIBS) -gencodes$(build_exeext) : gencodes.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gencodes.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) +genconstants.o : genconstants.c $(RTL_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ + errors.h -gencodes.o : gencodes.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c $(OUTPUT_OPTION) +genemit.o : genemit.c $(RTL_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ + errors.h gensupport.h -genconstants$(build_exeext) : genconstants.o $(HOST_RTL) $(HOST_EARLY_SUPPORT) \ - $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genconstants.o $(HOST_EARLY_SUPPORT) $(HOST_RTL) \ - $(HOST_ERRORS) $(HOST_LIBS) +genopinit.o : genopinit.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genconstants.o : genconstants.c $(RTL_H) $(HCONFIG_H) $(SYSTEM_H) errors.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconstants.c $(OUTPUT_OPTION) +genrecog.o : genrecog.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genemit$(build_exeext) : genemit.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genemit.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) +genextract.o : genextract.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) insn-config.h errors.h gensupport.h -genemit.o : genemit.c $(RTL_H) $(HCONFIG_H) $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c $(OUTPUT_OPTION) +genpeep.o : genpeep.c $(RTL_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ + errors.h gensupport.h -genopinit$(build_exeext) : genopinit.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genopinit.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) - -genopinit.o : genopinit.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c $(OUTPUT_OPTION) - -genrecog$(build_exeext) : genrecog.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genrecog.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) - -genrecog.o : genrecog.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c $(OUTPUT_OPTION) - -genextract$(build_exeext) : genextract.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genextract.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) - -genextract.o : genextract.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) insn-config.h errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c $(OUTPUT_OPTION) - -genpeep$(build_exeext) : genpeep.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genpeep.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) - -genpeep.o : genpeep.c $(RTL_H) $(HCONFIG_H) $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c $(OUTPUT_OPTION) - -genattr$(build_exeext) : genattr.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genattr.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) - -genattr.o : genattr.c $(RTL_H) $(HCONFIG_H) $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c $(OUTPUT_OPTION) +genattr.o : genattr.c $(RTL_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h \ + gensupport.h genattrtab$(build_exeext) : genattrtab.o genautomata.o \ - $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_VARRAY) \ - $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) $(BUILD_VARRAY) \ + $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ genattrtab.o genautomata.o \ - $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) $(HOST_ERRORS) \ - $(HOST_VARRAY) $(HOST_LIBS) -lm + $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \ + $(BUILD_VARRAY) $(BUILD_LIBS) -lm -genattrtab.o : genattrtab.c $(RTL_H) $(OBSTACK_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h $(GGC_H) gensupport.h genattrtab.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c $(OUTPUT_OPTION) +genattrtab.o : genattrtab.c $(RTL_H) $(OBSTACK_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(GGC_H) gensupport.h genattrtab.h -genautomata.o : genautomata.c $(RTL_H) $(OBSTACK_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h varray.h genattrtab.h $(HASHTAB_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genautomata.c $(OUTPUT_OPTION) +genautomata.o : genautomata.c $(RTL_H) $(OBSTACK_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h varray.h genattrtab.h $(HASHTAB_H) -genoutput$(build_exeext) : genoutput.o $(HOST_RTL) $(HOST_SUPPORT) \ - $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genoutput.o $(HOST_RTL) $(HOST_SUPPORT) $(HOST_PRINT) \ - $(HOST_ERRORS) $(HOST_LIBS) +genoutput.o : genoutput.c $(RTL_H) $(BCONFIG_H) \ + $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h -genoutput.o : genoutput.c $(RTL_H) $(HCONFIG_H) \ - $(SYSTEM_H) errors.h gensupport.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c $(OUTPUT_OPTION) +gengenrtl$(build_exeext) : gengenrtl.o $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + gengenrtl.o $(BUILD_LIBS) -gengenrtl$(build_exeext) : gengenrtl.o $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gengenrtl.o $(HOST_LIBS) +gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def -gengenrtl.o : gengenrtl.c $(RTL_BASE_H) $(HCONFIG_H) $(SYSTEM_H) real.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c $(OUTPUT_OPTION) +genmodes$(build_exeext) : genmodes.o $(BUILD_ERRORS) $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + genmodes.o $(BUILD_ERRORS) $(BUILD_LIBS) -genpreds$(build_exeext) : genpreds.o $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genpreds.o $(HOST_LIBS) +genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h $(HASHTAB_H) \ + machmode.def $(extra_modes_file) -genpreds.o : genpreds.c $(RTL_BASE_H) $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpreds.c $(OUTPUT_OPTION) +genpreds$(build_exeext) : genpreds.o $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + genpreds.o $(BUILD_LIBS) + +genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) gengtype$(build_exeext) : gengtype.o gengtype-lex.o gengtype-yacc.o \ - $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gengtype.o gengtype-lex.o gengtype-yacc.o $(HOST_LIBS) + $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + gengtype.o gengtype-lex.o gengtype-yacc.o $(BUILD_LIBS) -gengtype.o : gengtype.c gengtype.h $(HCONFIG_H) $(SYSTEM_H) real.h rtl.def \ - gtyp-gen.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/gengtype.c $(OUTPUT_OPTION) +gengtype.o : gengtype.c gengtype.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ + real.h $(RTL_BASE_H) gtyp-gen.h -gengtype-lex.o : $(srcdir)/gengtype-lex.c gengtype.h $(srcdir)/gengtype-yacc.c \ - $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/gengtype-lex.c $(OUTPUT_OPTION) +gengtype-lex.o : gengtype-lex.c gengtype.h gengtype-yacc.h \ + $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) \ + $< $(OUTPUT_OPTION) -gengtype-yacc.o : $(srcdir)/gengtype-yacc.c gengtype.h $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/gengtype-yacc.c $(OUTPUT_OPTION) +gengtype-yacc.o : gengtype-yacc.c gengtype.h $(BCONFIG_H) $(SYSTEM_H) \ + coretypes.h $(GTM_H) + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) \ + $< $(OUTPUT_OPTION) -# The sed command works around a bug in flex-2.5.4. -$(srcdir)/gengtype-lex.c : $(srcdir)/gengtype-lex.l - cd $(srcdir) && \ - $(FLEX) $(FLEXFLAGS) -t -o$@ gengtype-lex.l | \ - sed 's/^\(char msg\[\];\)/yyconst \1/' > g-$$$$ ; \ - if test $$? -eq 0 ; then \ - mv -f g-$$$$ gengtype-lex.c ; \ - else \ - rm -f g-$$$$.* ; \ - false ; \ - fi +gengtype-lex.c : gengtype-lex.l + -$(FLEX) $(FLEXFLAGS) -o$@ $< -$(srcdir)/gengtype-yacc.c: $(srcdir)/gengtype-yacc.y - (cd $(srcdir) && \ - $(BISON) $(BISONFLAGS) -d -o gengtype-yacc.c gengtype-yacc.y || \ - ( rm -f $@ && false ) ) +gengtype-yacc.c gengtype-yacc.h: gengtype-yacc.y + -$(BISON) $(BISONFLAGS) -d -o gengtype-yacc.c $< -genconditions$(build_exeext) : genconditions.o $(HOST_EARLY_SUPPORT) \ - $(HOST_RTL) $(HOST_ERRORS) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genconditions.o $(HOST_EARLY_SUPPORT) $(HOST_RTL) \ - $(HOST_ERRORS) $(HOST_LIBS) +genconditions$(build_exeext) : genconditions.o $(BUILD_EARLY_SUPPORT) \ + $(BUILD_RTL) $(BUILD_ERRORS) $(BUILD_LIBDEPS) + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + genconditions.o $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) \ + $(BUILD_ERRORS) $(BUILD_LIBS) -genconditions.o : genconditions.c $(RTL_H) $(HCONFIG_H) $(SYSTEM_H) errors.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/genconditions.c $(OUTPUT_OPTION) +genconditions.o : genconditions.c $(RTL_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h \ + $(GTM_H) errors.h # # Compile the libraries to be used by gen*. # If we are not cross-building, gen* use the same .o's that cc1 will use, # and BUILD_PREFIX_1 is `loser-', just to ensure these rules don't conflict # with the rules for rtl.o, etc. -$(BUILD_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(HCONFIG_H) $(SYSTEM_H) $(RTL_H) \ +$(BUILD_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) $(RTL_H) \ real.h $(GGC_H) errors.h rm -f $(BUILD_PREFIX)rtl.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(BUILD_PREFIX)rtl.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)rtl.c $(OUTPUT_OPTION) + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/rtl.c > $(BUILD_PREFIX)rtl.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)rtl.c $(OUTPUT_OPTION) -print-rtl1.o: $(srcdir)/print-rtl.c $(HCONFIG_H) \ - $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) +print-rtl1.o: $(srcdir)/print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \ + $(GTM_H) $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) rm -f print-rtl1.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > print-rtl1.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) print-rtl1.c $(OUTPUT_OPTION) + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/print-rtl.c > print-rtl1.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) print-rtl1.c $(OUTPUT_OPTION) -$(BUILD_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(HCONFIG_H) $(SYSTEM_H) \ +$(BUILD_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \ $(RTL_H) flags.h $(BASIC_BLOCK_H) $(REGS_H) $(GGC_H) rm -f $(BUILD_PREFIX)bitmap.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(BUILD_PREFIX)bitmap.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)bitmap.c $(OUTPUT_OPTION) + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/bitmap.c > $(BUILD_PREFIX)bitmap.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)bitmap.c $(OUTPUT_OPTION) -$(BUILD_PREFIX_1)errors.o: errors.c $(HCONFIG_H) $(SYSTEM_H) errors.h +$(BUILD_PREFIX_1)errors.o: errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h rm -f $(BUILD_PREFIX)errors.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/errors.c > $(BUILD_PREFIX)errors.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)errors.c $(OUTPUT_OPTION) + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/errors.c > $(BUILD_PREFIX)errors.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)errors.c $(OUTPUT_OPTION) -$(BUILD_PREFIX_1)varray.o: varray.c $(HCONFIG_H) $(SYSTEM_H) varray.h \ +$(BUILD_PREFIX_1)varray.o: varray.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) varray.h \ $(RTL_H) $(GGC_H) $(TREE_H) bitmap.h errors.h rm -f $(BUILD_PREFIX)varray.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/varray.c > \ + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/varray.c > \ $(BUILD_PREFIX)varray.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) \ $(BUILD_PREFIX)varray.c $(OUTPUT_OPTION) -$(BUILD_PREFIX_1)ggc-none.o: ggc-none.c $(HCONFIG_H) $(SYSTEM_H) $(GGC_H) +$(BUILD_PREFIX_1)ggc-none.o: ggc-none.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) $(GGC_H) rm -f $(BUILD_PREFIX)ggc-none.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/ggc-none.c > $(BUILD_PREFIX)ggc-none.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)ggc-none.c $(OUTPUT_OPTION) + sed -e 's/config[.]h/bconfig.h/' $(srcdir)/ggc-none.c > $(BUILD_PREFIX)ggc-none.c + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $(BUILD_PREFIX)ggc-none.c $(OUTPUT_OPTION) + +min-insn-modes.o: min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H) $(MACHMODE_H) + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) \ + min-insn-modes.c $(OUTPUT_OPTION) # # Remake internationalization support. -intl.o: intl.c $(CONFIG_H) system.h intl.h Makefile +intl.o: intl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h Makefile $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ -DLOCALEDIR=\"$(localedir)\" \ -c $(srcdir)/intl.c $(OUTPUT_OPTION) -$(top_builddir)/intl/libintl.a: intl.all - -intl.all intl.install intl.uninstall \ - intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean: - @for d in $(INTL_SUBDIRS); do \ - target=`expr $@ : 'intl.\(.*\)'` && \ - echo "(cd $$d && $(MAKE) $$target)" && \ - (cd $$d && AWK='$(AWK)' $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $$target); \ - if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \ - done - -# intl.all and intl.install need config.h to exist, and the files it includes. -# (FIXME: intl/*.c shouldn't need to see insn-foo.h!) -intl.all intl.install: config.h insn-flags.h insn-constants.h - -# Make-lang.in should add dependencies of po-generated on any generated -# files which need to be scanned by gettext (usually Yacc-generated parsers). -po-generated: c-parse.c - # # Remake cpp and protoize. PREPROCESSOR_DEFINES = \ -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ - -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \ + -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \ -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \ -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \ - -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ - -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" + -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \ + -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ + @TARGET_SYSTEM_ROOT_DEFINE@ LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \ - cpphash.o cpperror.o cppinit.o cppdefault.o cppmain.o \ - hashtable.o line-map.o mkdeps.o prefix.o mbchar.o + cpphash.o cpperror.o cppinit.o cppcharset.o \ + hashtable.o line-map.o mkdeps.o cpppch.o LIBCPP_DEPS = $(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \ - $(OBSTACK_H) $(SYSTEM_H) + $(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) # Most of the other archives built/used by this makefile are for # targets. This one is strictly for the host. @@ -2214,25 +2340,27 @@ libcpp.a: $(LIBCPP_OBJS) $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS) -$(RANLIB) libcpp.a -cppmain.o: cppmain.c $(CONFIG_H) $(LIBCPP_DEPS) +cppcharset.o: cppcharset.c $(LIBCPP_DEPS) cppucnid.h +cpperror.o: cpperror.c $(LIBCPP_DEPS) +cppexp.o: cppexp.c $(LIBCPP_DEPS) +cpplex.o: cpplex.c $(LIBCPP_DEPS) +cppmacro.o: cppmacro.c $(LIBCPP_DEPS) +cpplib.o: cpplib.c $(LIBCPP_DEPS) +cpphash.o: cpphash.c $(LIBCPP_DEPS) +cpptrad.o: cpptrad.c $(LIBCPP_DEPS) +cppfiles.o: cppfiles.c $(LIBCPP_DEPS) $(HASHTAB_H) mkdeps.h +cppinit.o: cppinit.c $(LIBCPP_DEPS) mkdeps.h +cpppch.o: cpppch.c $(LIBCPP_DEPS) mkdeps.h -cpperror.o: cpperror.c $(CONFIG_H) $(LIBCPP_DEPS) -cppexp.o: cppexp.c $(CONFIG_H) $(LIBCPP_DEPS) -cpplex.o: cpplex.c $(CONFIG_H) $(LIBCPP_DEPS) mbchar.h -cppmacro.o: cppmacro.c $(CONFIG_H) $(LIBCPP_DEPS) -cpplib.o: cpplib.c $(CONFIG_H) $(LIBCPP_DEPS) -cpphash.o: cpphash.c $(CONFIG_H) $(LIBCPP_DEPS) -cpptrad.o: cpptrad.c $(CONFIG_H) $(LIBCPP_DEPS) -cppfiles.o: cppfiles.c $(CONFIG_H) $(LIBCPP_DEPS) $(SPLAY_TREE_H) mkdeps.h -cppinit.o: cppinit.c $(CONFIG_H) $(LIBCPP_DEPS) cppdefault.h \ - mkdeps.h prefix.h - -cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile +cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + cppdefault.h Makefile $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(PREPROCESSOR_DEFINES) \ -c $(srcdir)/cppdefault.c $(OUTPUT_OPTION) mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h +hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) +line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H) # Note for the stamp targets, we run the program `true' instead of # having an empty command (nothing following the semicolon). @@ -2248,7 +2376,7 @@ unprotoize$(exeext): unprotoize.o $(PROTO_OBJS) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ unprotoize.o $(PROTO_OBJS) $(LIBS) protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) $(SYSTEM_H) \ - Makefile version.h + coretypes.h $(TM_H) Makefile version.h (SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ @@ -2303,13 +2431,28 @@ test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES) diff $(srcdir)/protoize.c tmp-proto.c | cat -rm -f tmp-proto.[cs] tmp-proto$(objext) -gcov.o: gcov.c gcov-io.h intl.h $(SYSTEM_H) $(CONFIG_H) +# gcov-iov.c is run on the build machine to generate gcov-iov.h from version.c +gcov-iov.o: gcov-iov.c version.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) coretypes.h $(TM_H) + $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $(srcdir)/gcov-iov.c $(OUTPUT_OPTION) +gcov-iov$(build_exeext): gcov-iov.o + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) gcov-iov.o -o $@ +gcov-iov.h: s-iov +s-iov: gcov-iov$(build_exeext) $(srcdir)/move-if-change + ./gcov-iov$(build_exeext) > tmp-gcov-iov.h + $(SHELL) $(srcdir)/move-if-change tmp-gcov-iov.h gcov-iov.h + $(STAMP) s-iov + +gcov.o: gcov.c gcov-io.h gcov-io.c gcov-iov.h intl.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H) +gcov-dump.o: gcov-dump.c gcov-io.h gcov-io.c gcov-iov.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H) # Only one of 'gcov' or 'gcov.exe' is actually built, depending # upon whether $(exeext) is empty or not. GCOV_OBJS = gcov.o intl.o version.o gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@ +GCOV_DUMP_OBJS = gcov-dump.o version.o +gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) $(LIBS) -o $@ # # Build the include directory. The stamp files are stmp-* rather than # s-* so that mostlyclean does not force the include directory to @@ -2351,19 +2494,34 @@ specs.ready: specs $(STAMP) specs.ready; \ fi +# Until someone fixes this recursive make nightmare (please note where +# BUILD_CFLAGS and WARN_CFLAGS are first expanded below versus which +# later make invocation has the fine-grain -warn markings for fixinc): +fixinc.sh-warn = -Wno-error + FIXINCSRCDIR=$(srcdir)/fixinc fixinc.sh: $(FIXINCSRCDIR)/mkfixinc.sh $(FIXINCSRCDIR)/fixincl.c \ - $(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/gnu-regex.c \ - $(FIXINCSRCDIR)/server.c $(FIXINCSRCDIR)/gnu-regex.h \ + $(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/server.c \ $(FIXINCSRCDIR)/server.h $(FIXINCSRCDIR)/inclhack.def specs.ready (MAKE="$(MAKE)"; srcdir=`cd $(srcdir)/fixinc && ${PWD_COMMAND}` ; \ - CC="$(HOST_CC)"; CFLAGS="$(HOST_CFLAGS)"; LDFLAGS="$(HOST_LDFLAGS)"; \ - WARN_CFLAGS="$(WARN_CFLAGS)"; \ - export MAKE srcdir CC CFLAGS LDFLAGS WARN_CFLAGS; cd ./fixinc && \ - $(SHELL) $${srcdir}/mkfixinc.sh $(build_canonical) $(target)) + CC="$(CC_FOR_BUILD)"; CFLAGS="$(BUILD_CFLAGS)"; LDFLAGS="$(BUILD_LDFLAGS)"; \ + WARN_CFLAGS="$(WARN_CFLAGS)"; LIBERTY=`${PWD_COMMAND}`/"$(BUILD_LIBIBERTY)"; \ + export MAKE srcdir CC CFLAGS LDFLAGS WARN_CFLAGS LIBERTY; \ + cd ./fixinc && \ + $(SHELL) $${srcdir}/mkfixinc.sh $(build) $(target)) + +.PHONY: install-gcc-tooldir +install-gcc-tooldir: + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) # Build fixed copies of system files. stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ + if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ + then sleep 1; else exit 1; fi; \ + fi rm -rf include; mkdir include -chmod a+rx include (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \ @@ -2377,29 +2535,15 @@ stmp-fixinc: fixinc.sh gsyslimits.h cp $(srcdir)/gsyslimits.h include/syslimits.h; \ fi; \ chmod a+r include/syslimits.h) -# If $(SYSTEM_HEADER_DIR) is $(build_tooldir)/sys-include, and -# that directory exists, then make sure that $(libsubdir) exists. -# This is because cpp is compiled to find $(gcc_tooldir)/include via -# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir) -# exists. -# ??? Better would be to use -isystem $(build_tooldir)/sys-include, -# but fixincludes does not take such arguments. - if [ "$(SYSTEM_HEADER_DIR)" = "$(build_tooldir)/sys-include" ] \ - && [ -d $(build_tooldir)/sys-include ]; then \ - if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \ - if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \ - if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \ - if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \ - else true; fi $(STAMP) stmp-fixinc # Files related to the fixproto script. -# gen-protos and fix-header are compiled with HOST_CC, but they are only +# gen-protos and fix-header are compiled with CC_FOR_BUILD, but they are only # used in native and host-x-target builds, so it's safe to link them with # libiberty.a. deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs - if [ -d $(SYSTEM_HEADER_DIR) ]; \ + if [ -d "$(SYSTEM_HEADER_DIR)" ]; \ then \ CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -isystem include -isystem ${SYSTEM_HEADER_DIR}"; \ export CC; \ @@ -2411,14 +2555,12 @@ deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs GEN_PROTOS_OBJS = gen-protos.o scan.o gen-protos$(build_exeext): $(GEN_PROTOS_OBJS) - ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - $(GEN_PROTOS_OBJS) $(HOST_LIBS) + ${CC_FOR_BUILD} $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ + $(GEN_PROTOS_OBJS) $(BUILD_LIBS) -gen-protos.o: gen-protos.c scan.h $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c $(OUTPUT_OPTION) +gen-protos.o: gen-protos.c scan.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) -scan.o: scan.c scan.h $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c $(OUTPUT_OPTION) +scan.o: scan.c scan.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_exeext) Makefile sed -e s/TARGET_GETGROUPS_T/$(TARGET_GETGROUPS_T)/ \ @@ -2433,16 +2575,14 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_ # This is nominally a 'build' program, but it's run only when host==build, # so we can (indeed, must) use $(LIBDEPS) and $(LIBS). fix-header$(build_exeext): fix-header.o scan-decls.o scan.o xsys-protos.h \ - $(LIBDEPS) libcpp.a - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \ - scan-decls.o scan.o libcpp.a $(LIBS) + c-incpath.o cppdefault.o prefix.o $(LIBDEPS) libcpp.a + $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \ + c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o libcpp.a $(LIBS) fix-header.o: fix-header.c $(OBSTACK_H) scan.h \ - xsys-protos.h $(HCONFIG_H) $(SYSTEM_H) $(CPPLIB_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c $(OUTPUT_OPTION) + xsys-protos.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(CPPLIB_H) -scan-decls.o: scan-decls.c scan.h $(CPPLIB_H) $(HCONFIG_H) $(SYSTEM_H) - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c $(OUTPUT_OPTION) +scan-decls.o: scan-decls.c scan.h $(CPPLIB_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) # stmp-fixproto depends on this, not on fix-header directly. # The idea is to make sure fix-header gets built, @@ -2465,7 +2605,7 @@ stmp-fixproto: fixhdr.ready fixproto stmp-int-hdrs FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \ mkinstalldirs="$(SHELL) $(srcdir)/mkinstalldirs"; \ export mkinstalldirs; \ - if [ -d $(SYSTEM_HEADER_DIR) ] ; then \ + if [ -d "$(SYSTEM_HEADER_DIR)" ]; then \ $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \ if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \ else true; fi; \ @@ -2475,132 +2615,111 @@ stmp-fixproto: fixhdr.ready fixproto stmp-int-hdrs # # Remake the info files. -docdir = $(srcdir)/doc - doc: $(BUILD_INFO) $(GENERATED_MANPAGES) gccbug -info: $(docdir)/cpp.info $(docdir)/gcc.info $(docdir)/gccint.info $(docdir)/gccinstall.info lang.info $(docdir)/cppinternals.info -TEXI_CPP_FILES = $(docdir)/cpp.texi $(docdir)/include/fdl.texi \ - $(docdir)/cppenv.texi $(docdir)/cppopts.texi +INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \ + doc/gccinstall.info doc/cppinternals.info -TEXI_GCC_FILES = $(docdir)/gcc.texi $(docdir)/include/gcc-common.texi \ - $(docdir)/frontends.texi $(docdir)/standards.texi \ - $(docdir)/invoke.texi $(docdir)/extend.texi $(docdir)/md.texi \ - $(docdir)/objc.texi $(docdir)/gcov.texi $(docdir)/trouble.texi \ - $(docdir)/bugreport.texi $(docdir)/service.texi \ - $(docdir)/contribute.texi $(docdir)/compat.texi \ - $(docdir)/include/funding.texi $(docdir)/gnu.texi \ - $(docdir)/include/gpl.texi $(docdir)/include/fdl.texi \ - $(docdir)/contrib.texi $(docdir)/cppenv.texi $(docdir)/cppopts.texi +info: $(INFOFILES) lang.info @GENINSRC@ srcinfo lang.srcinfo -TEXI_GCCINT_FILES = $(docdir)/gccint.texi \ - $(docdir)/include/gcc-common.texi $(docdir)/contribute.texi \ - $(docdir)/makefile.texi $(docdir)/configterms.texi \ - $(docdir)/portability.texi $(docdir)/interface.texi \ - $(docdir)/passes.texi $(docdir)/c-tree.texi \ - $(docdir)/rtl.texi $(docdir)/md.texi $(docdir)/tm.texi \ - $(docdir)/hostconfig.texi $(docdir)/fragments.texi \ - $(docdir)/configfiles.texi $(docdir)/collect2.texi \ - $(docdir)/headerdirs.texi $(docdir)/include/funding.texi \ - $(docdir)/gnu.texi $(docdir)/include/gpl.texi \ - $(docdir)/include/fdl.texi $(docdir)/contrib.texi \ - $(docdir)/languages.texi $(docdir)/sourcebuild.texi \ - $(docdir)/gty.texi +srcinfo: $(INFOFILES) + -cp -p $^ $(srcdir)/doc -TEXI_GCCINSTALL_FILES = $(docdir)/install.texi $(docdir)/install-old.texi \ - $(docdir)/include/fdl.texi +TEXI_CPP_FILES = cpp.texi fdl.texi cppenv.texi cppopts.texi -TEXI_CPPINT_FILES = $(docdir)/cppinternals.texi +TEXI_GCC_FILES = gcc.texi gcc-common.texi frontends.texi standards.texi \ + invoke.texi extend.texi md.texi objc.texi gcov.texi trouble.texi \ + bugreport.texi service.texi contribute.texi compat.texi funding.texi \ + gnu.texi gpl.texi fdl.texi contrib.texi cppenv.texi cppopts.texi -$(docdir)/cpp.info: $(TEXI_CPP_FILES) - cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/cpp.info doc/cpp.texi +TEXI_GCCINT_FILES = gccint.texi gcc-common.texi contribute.texi makefile.texi \ + configterms.texi portability.texi interface.texi passes.texi \ + c-tree.texi rtl.texi md.texi tm.texi hostconfig.texi fragments.texi \ + configfiles.texi collect2.texi headerdirs.texi funding.texi gnu.texi \ + gpl.texi fdl.texi contrib.texi languages.texi sourcebuild.texi \ + gty.texi libgcc.texi -$(docdir)/gcc.info: $(TEXI_GCC_FILES) - cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/gcc.info doc/gcc.texi +TEXI_GCCINSTALL_FILES = install.texi install-old.texi fdl.texi -$(docdir)/gccint.info: $(TEXI_GCCINT_FILES) - cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/gccint.info doc/gccint.texi +TEXI_CPPINT_FILES = cppinternals.texi -$(docdir)/gccinstall.info: $(TEXI_GCCINSTALL_FILES) - cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/gccinstall.info doc/install.texi +# The *.1, *.7, *.info, and *.dvi files are being generated from implicit +# patterns. To use them, put each of the specific target with with their +# specific dependencies but no build commands. -$(docdir)/cppinternals.info: $(TEXI_CPPINT_FILES) - cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/cppinternals.info \ - doc/cppinternals.texi +doc/cpp.info: $(TEXI_CPP_FILES) +doc/gcc.info: $(TEXI_GCC_FILES) +doc/gccint.info: $(TEXI_GCCINT_FILES) +doc/cppinternals.info: $(TEXI_CPPINT_FILES) -dvi: gcc.dvi gccint.dvi gccinstall.dvi cpp.dvi lang.dvi cppinternals.dvi +doc/%.info: %.texi + if [ x$(BUILD_INFO) = xinfo ]; then \ + $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) \ + -I $(docdir)/include -o $@ $<; \ + fi -# This works with GNU Make's default rule. -cpp.dvi: $(TEXI_CPP_FILES) - $(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/cpp.texi +# Duplicate entry to handle renaming of gccinstall.info +doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES) + if [ x$(BUILD_INFO) = xinfo ]; then \ + $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) \ + -I $(docdir)/include -o $@ $<; \ + fi -gcc.dvi: $(TEXI_GCC_FILES) - $(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/gcc.texi +doc/cpp.dvi: $(TEXI_CPP_FILES) +doc/gcc.dvi: $(TEXI_GCC_FILES) +doc/gccint.dvi: $(TEXI_GCCINT_FILES) +doc/cppinternals.dvi: $(TEXI_CPPINT_FILES) -gccint.dvi: $(TEXI_GCCINT_FILES) - $(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/gccint.texi +dvi:: doc/gcc.dvi doc/gccint.dvi doc/gccinstall.dvi doc/cpp.dvi \ + doc/cppinternals.dvi -gccinstall.dvi: $(TEXI_GCCINSTALL_FILES) - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(TEXI2DVI) -I $$s/doc -I $$s/doc/include -o $@ $$s/doc/install.texi +doc/%.dvi: %.texi + $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< -cppinternals.dvi: $(TEXI_CPPINT_FILES) - $(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/cppinternals.texi +# Duplicate entry to handle renaming of gccinstall.dvi +doc/gccinstall.dvi: $(TEXI_GCCINSTALL_FILES) + $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< -generated-manpages: $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1 \ - $(docdir)/gfdl.7 $(docdir)/gpl.7 $(docdir)/fsf-funding.7 \ - lang.generated-manpages +MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7 -$(docdir)/gcov.1: $(docdir)/gcov.texi - $(STAMP) $(docdir)/gcov.1 - -$(TEXI2POD) $(docdir)/gcov.texi > gcov.pod - -($(POD2MAN) --section=1 gcov.pod > $(docdir)/gcov.1.T$$$$ && \ - mv -f $(docdir)/gcov.1.T$$$$ $(docdir)/gcov.1) || \ - (rm -f $(docdir)/gcov.1.T$$$$ && exit 1) - -rm -f gcov.pod +generated-manpages: man -$(docdir)/cpp.1: $(docdir)/cpp.texi $(docdir)/cppenv.texi \ - $(docdir)/cppopts.texi - $(STAMP) $(docdir)/cpp.1 - -$(TEXI2POD) $(docdir)/cpp.texi > cpp.pod - -($(POD2MAN) --section=1 cpp.pod > $(docdir)/cpp.1.T$$$$ && \ - mv -f $(docdir)/cpp.1.T$$$$ $(docdir)/cpp.1) || \ - (rm -f $(docdir)/cpp.1.T$$$$ && exit 1) - -rm -f cpp.pod +man: $(MANFILES) lang.man @GENINSRC@ srcman lang.srcman -$(docdir)/gcc.1: $(docdir)/invoke.texi $(docdir)/cppenv.texi \ - $(docdir)/cppopts.texi - $(STAMP) $(docdir)/gcc.1 - -$(TEXI2POD) $(docdir)/invoke.texi > gcc.pod - -($(POD2MAN) --section=1 gcc.pod > $(docdir)/gcc.1.T$$$$ && \ - mv -f $(docdir)/gcc.1.T$$$$ $(docdir)/gcc.1) || \ - (rm -f $(docdir)/gcc.1.T$$$$ && exit 1) - -rm -f gcc.pod +srcman: $(MANFILES) + -cp -p $^ $(srcdir)/doc -$(docdir)/gfdl.7: $(docdir)/include/fdl.texi - $(STAMP) $(docdir)/gfdl.7 - -$(TEXI2POD) $(docdir)/include/fdl.texi > gfdl.pod - -($(POD2MAN) --section=7 gfdl.pod > $(docdir)/gfdl.7.T$$$$ && \ - mv -f $(docdir)/gfdl.7.T$$$$ $(docdir)/gfdl.7) || \ - (rm -f $(docdir)/gfdl.7.T$$$$ && exit 1) - -rm -f gfdl.pod +doc/%.1: %.pod + $(STAMP) $@ + -($(POD2MAN) --section=1 $< > $(@).T$$$$ && \ + mv -f $(@).T$$$$ $@) || \ + (rm -f $(@).T$$$$ && exit 1) -$(docdir)/gpl.7: $(docdir)/include/gpl.texi - $(STAMP) $(docdir)/gpl.7 - -$(TEXI2POD) $(docdir)/include/gpl.texi > gpl.pod - -($(POD2MAN) --section=7 gpl.pod > $(docdir)/gpl.7.T$$$$ && \ - mv -f $(docdir)/gpl.7.T$$$$ $(docdir)/gpl.7) || \ - (rm -f $(docdir)/gpl.7.T$$$$ && exit 1) - -rm -f gpl.pod +doc/%.7: %.pod + $(STAMP) $@ + -($(POD2MAN) --section=7 $< > $(@).T$$$$ && \ + mv -f $(@).T$$$$ $@) || \ + (rm -f $(@).T$$$$ && exit 1) -$(docdir)/fsf-funding.7: $(docdir)/include/funding.texi - $(STAMP) $(docdir)/fsf-funding.7 - -$(TEXI2POD) $(docdir)/include/funding.texi > fsf-funding.pod - -($(POD2MAN) --section=7 fsf-funding.pod \ - > $(docdir)/fsf-funding.7.T$$$$ && \ - mv -f $(docdir)/fsf-funding.7.T$$$$ $(docdir)/fsf-funding.7) || \ - (rm -f $(docdir)/fsf-funding.7.T$$$$ && exit 1) - -rm -f fsf-funding.pod +%.pod: %.texi + $(STAMP) $@ + -$(TEXI2POD) $< > $@ + +.INTERMEDIATE: cpp.pod gcc.pod gfdl.pod fsf-funding.pod +cpp.pod: cpp.texi cppenv.texi cppopts.texi + +# These next rules exist because the output name is not the same as +# the input name, so our implict %.pod rule will not work. + +gcc.pod: invoke.texi cppenv.texi cppopts.texi + $(STAMP) $@ + -$(TEXI2POD) $< > $@ +gfdl.pod: fdl.texi + $(STAMP) $@ + -$(TEXI2POD) $< > $@ +fsf-funding.pod: funding.texi + $(STAMP) $@ + -$(TEXI2POD) $< > $@ # # Deletion of files made during compilation. @@ -2616,27 +2735,26 @@ $(docdir)/fsf-funding.7: $(docdir)/include/funding.texi # We remove as much from the language subdirectories as we can # (less duplicated code). -INTL_MOSTLYCLEAN = intl.mostlyclean -mostlyclean: $(INTL_MOSTLYCLEAN) lang.mostlyclean +mostlyclean: lang.mostlyclean -rm -f $(STAGESTUFF) -rm -f *$(coverageexts) -rm -rf libgcc # Delete the temporary source copies for cross compilation. -rm -f $(BUILD_PREFIX_1)rtl.c $(BUILD_PREFIX_1)print-rtl.c -rm -f $(BUILD_PREFIX_1)bitmap.c $(BUILD_PREFIX_1)errors.c - -rm -f $(BUILD_PREFIX_1)ggc-none.c + -rm -f $(BUILD_PREFIX_1)ggc-none.c print-rtl1.c # Delete the temp files made in the course of building libgcc.a. -rm -f xlimits.h # Delete other built files. -rm -f xsys-protos.hT - -rm -f specs.h options.h gencheck.h + -rm -f specs.h gencheck.h options.c options.h # Delete the stamp and temporary files. -rm -f s-* tmp-* stamp-* stmp-* -rm -f */stamp-* */tmp-* # Delete debugging dump files. -rm -f *.[0-9][0-9].* */*.[0-9][0-9].* # Delete some files made during installation. - -rm -f specs SYSCALLS.c.X SYSCALLS.c + -rm -f specs $(SPECS) SYSCALLS.c.X SYSCALLS.c -rm -f collect collect2 mips-tfile mips-tdump # Delete files generated for fixproto -rm -rf fix-header$(build_exeext) xsys-protos.h deduced.h tmp-deduced.h \ @@ -2659,14 +2777,13 @@ mostlyclean: $(INTL_MOSTLYCLEAN) lang.mostlyclean # Delete all files made by compilation # that don't exist in the distribution. -INTL_CLEAN = intl.clean -clean: mostlyclean $(INTL_CLEAN) lang.clean - -rm -f libgcc.a libgcc_eh.a libgcc_s$(SHLIB_EXT) libgcc_s$(SHLIB_EXT).1 - -rm -f config.h tconfig.h hconfig.h tm_p.h +clean: mostlyclean lang.clean + -rm -f libgcc.a libgcc_eh.a libgcov.a + -rm -f libgcc_s$(SHLIB_EXT) libgcc_s$(SHLIB_EXT).1 + -rm -f config.h tconfig.h bconfig.h tm_p.h tm.h -rm -f cs-* -rm -rf libgcc - -rm -f *.dvi - -rm -f */*.dvi + -rm -f doc/*.dvi # Delete the include directory. -rm -rf include # Delete files used by the "multilib" facility (including libgcc subdirs). @@ -2676,7 +2793,7 @@ clean: mostlyclean $(INTL_CLEAN) lang.clean else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \ rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \ fi ; fi - -rm -fr stage1 stage2 stage3 stage4 + -rm -fr stage1 stage2 stage3 stage4 stageprofile stagefeedback # Delete stamps of bootstrap stages -rm -f stage?_* -rm -f clean?_* @@ -2684,23 +2801,21 @@ clean: mostlyclean $(INTL_CLEAN) lang.clean # Delete all files that users would normally create # while building and installing GCC. -INTL_DISTCLEAN = intl.distclean -distclean: clean $(INTL_DISTCLEAN) lang.distclean +distclean: clean lang.distclean -rm -f auto-host.h auto-build.h -rm -f cstamp-h -rm -f config.status config.run config.cache config.bak -rm -f Make-lang Make-hooks Make-host Make-target -rm -f Makefile *.oaux -rm -f gthr-default.h - -rm -f */stage1 */stage2 */stage3 */stage4 */include - -rm -f c-parse.output + -rm -f */stage1 */stage2 */stage3 */stage4 */include */stageprofile */stagefeedback + -rm -f c-parse.y c-parse.c c-parse.output TAGS */TAGS -rm -f *.asm -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak -rm -f testsuite/*.log testsuite/*.sum -cd testsuite && rm -f x *.x *.x? *.exe *.rpo *.o *.s *.S *.c - -cd testsuite && rm -f *.out *.gcov *.bb *.bbg + -cd testsuite && rm -f *.out *.gcov *$(coverageexts) -rm -rf ${QMTEST_DIR} stamp-qmtest - -rm -f intl/libintl.h libintl.h -rm -f cxxmain.c -rm -f mklibgcc mkheaders gccbug .gdbinit configargs.h -rm -f gcov.pod @@ -2709,41 +2824,16 @@ distclean: clean $(INTL_DISTCLEAN) lang.distclean -if [ ! -f po/exgettext ]; then rm -f po/*.gmo; fi -rmdir ada cp f java objc fixinc intl po testsuite 2>/dev/null -# Delete anything likely to be found in the source directory -# that shouldn't be in the distribution. -extraclean: distclean lang.extraclean - -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~* - -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej - -rm -f config/*/=* config/*/"#"* config/*/*~* - -rm -f config/*/*.orig config/*/*.rej - -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz - -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs - -rm -f *lose config/*lose config/*/*lose - -rm -f *.s *.s[0-9] *.i config/ChangeLog - -rm -f y.tab.c yacc.* - -rm -f */=* */"#"* */*~* - -rm -f */patch* */*.orig */*.rej - -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz - -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs - -rm -f */*lose */*.s */*.s[0-9] */*.i - # Get rid of every file that's generated from some other file, except for `configure'. # Most of these files ARE PRESENT in the GCC distribution. -# We define INTL_DISTCLEAN, INTL_CLEAN & INTL_MOSTLYCLEAN to be empty in the -# submake, so that we don't descend into intl after its makefile has been -# removed. maintainer-clean: @echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.' - $(MAKE) INTL_DISTCLEAN= INTL_CLEAN= INTL_MOSTLYCLEAN= \ - intl.maintainer-clean lang.maintainer-clean distclean - -rm -f c-parse.y c-parse.c c-parse.output TAGS + $(MAKE) lang.maintainer-clean distclean + -rm -f $(srcdir)/c-parse.y $(srcdir)/c-parse.c -rm -f cpp.??s cpp.*aux -rm -f gcc.??s gcc.*aux - -rm -f $(docdir)/cpp.info* $(docdir)/gcc.info* $(docdir)/gccint.info* - -rm -f $(docdir)/cppinternals.info* - -rm -f $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1 - -rm -f $(docdir)/fsf-funding.7 $(docdir)/gfdl.7 $(docdir)/gpl.7 + -rm -f $(docdir)/*.info $(docdir)/*.1 $(docdir)/*.7 $(docdir)/*.dvi # # Entry points `install' and `uninstall'. # Also use `install-collect2' to install collect2 when the config files don't. @@ -2752,31 +2842,23 @@ maintainer-clean: # Install the driver last so that the window when things are # broken is small. install: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \ - install-cpp install-man install-info intl.install install-@POSUB@ \ + install-cpp install-man install-info install-@POSUB@ \ lang.install-normal install-driver # Handle cpp installation. install-cpp: cpp$(exeext) - -if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(DESTDIR)$(bindir)/$(CPP_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_CROSS_NAME)$(exeext); \ - if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ - else true; fi; \ - else \ - rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \ - if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - else true; fi; \ - fi + -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext) + -$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext) + -if [ x$(cpp_install_dir) != x ]; then \ + rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ + else true; fi # Create the installation directories. -# $(libdir)/gcc-lib/include isn't currently searched by cpp. +# $(libdir)/gcc/include isn't currently searched by cpp. installdirs: $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(libsubdir) + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(libexecsubdir) $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(bindir) $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(includedir) $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(infodir) @@ -2785,18 +2867,18 @@ installdirs: $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(man7dir) # Install the compiler executables built during cross compilation. -install-common: native $(EXTRA_PARTS) lang.install-common +install-common: native $(EXTRA_PARTS) lang.install-common installdirs for file in $(COMPILERS); do \ if [ -f $$file ] ; then \ - rm -f $(DESTDIR)$(libsubdir)/$$file; \ - $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libsubdir)/$$file; \ + rm -f $(DESTDIR)$(libexecsubdir)/$$file; \ + $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libexecsubdir)/$$file; \ else true; \ fi; \ done for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \ if [ x"$$file" != x.. ]; then \ - rm -f $(DESTDIR)$(libsubdir)/$$file; \ - $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libsubdir)/$$file; \ + rm -f $(DESTDIR)$(libexecsubdir)/$$file; \ + $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libexecsubdir)/$$file; \ else true; fi; \ done for file in $(EXTRA_PARTS) ..; do \ @@ -2809,165 +2891,116 @@ install-common: native $(EXTRA_PARTS) lang.install-common # Don't mess with specs if it doesn't exist yet. -if [ -f specs ] ; then \ rm -f $(DESTDIR)$(libsubdir)/specs; \ - $(INSTALL_DATA) specs $(DESTDIR)$(libsubdir)/specs; \ + $(INSTALL_DATA) $(SPECS) $(DESTDIR)$(libsubdir)/specs; \ chmod a-x $(DESTDIR)$(libsubdir)/specs; \ fi # Install protoize if it was compiled. - -if [ -f protoize$(exeext) ]; \ - then \ - if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(DESTDIR)$(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) protoize$(exeext) $(DESTDIR)$(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \ - rm -f $(DESTDIR)$(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) unprotoize$(exeext) $(DESTDIR)$(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \ - else \ - rm -f $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) protoize$(exeext) $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ - rm -f $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) unprotoize$(exeext) $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ - fi ; \ - rm -f $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ - $(INSTALL_DATA) SYSCALLS.c.X $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ - chmod a-x $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ + -if [ -f protoize$(exeext) ]; then \ + rm -f $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) protoize$(exeext) $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ + rm -f $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) unprotoize$(exeext) $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ + rm -f $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ + $(INSTALL_DATA) SYSCALLS.c.X $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ + chmod a-x $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \ fi # Install gcov if it was compiled. -if [ -f gcov$(exeext) ]; \ then \ - rm -f $(DESTDIR)$(bindir)/gcov$(exeext); \ + rm -f $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \ $(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \ fi $(INSTALL_SCRIPT) gccbug $(DESTDIR)$(bindir)/$(GCCBUG_INSTALL_NAME) -# Install the driver program as $(target_alias)-gcc, -# $(target-alias)-gcc-$(version) +# Install the driver program as $(target_noncanonical)-gcc, +# $(target_noncanonical)-gcc-$(version) # and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc. install-driver: installdirs xgcc$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version) + -( cd $(DESTDIR)$(bindir) && \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version) ) -if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(DESTDIR)$(bindir)/$(GCC_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(bindir)/$(GCC_CROSS_NAME)$(exeext); \ - rm -f $(DESTDIR)$(bindir)/$(target_alias)-gcc-$(version); \ - ( cd $(DESTDIR)$(bindir) && \ - $(LN) $(GCC_CROSS_NAME)$(exeext) $(target_alias)-gcc-$(version) ); \ if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ else true; fi; \ else \ - rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ - rm -f $(DESTDIR)$(bindir)/$(target_alias)-gcc-$(version); \ + rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \ ( cd $(DESTDIR)$(bindir) && \ - $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_alias)-gcc-$(version) ); \ - rm -f $(DESTDIR)$(bindir)/$(target_alias)-gcc-tmp$(exeext); \ - ( cd $(DESTDIR)$(bindir) && \ - $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_alias)-gcc-tmp$(exeext) && \ - mv -f $(target_alias)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \ + mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ fi # Install the info files. # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir # to do the install. -install-info: doc installdirs lang.install-info - -rm -f $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info* - -rm -f $(DESTDIR)$(infodir)/cppinternals.info* $(DESTDIR)$(infodir)/gccint.info* - if [ -f $(docdir)/gcc.info ]; then \ - for f in $(docdir)/cpp.info* $(docdir)/gcc.info* \ - $(docdir)/cppinternals.info* $(docdir)/gccint.info*; do \ +install-info:: doc installdirs \ + $(DESTDIR)$(infodir)/cpp.info \ + $(DESTDIR)$(infodir)/gcc.info \ + $(DESTDIR)$(infodir)/cppinternals.info \ + $(DESTDIR)$(infodir)/gccinstall.info \ + $(DESTDIR)$(infodir)/gccint.info + +$(DESTDIR)$(infodir)/%.info: doc/%.info installdirs + rm -f $@ + if [ -f $< ]; then \ + for f in $(<)*; do \ realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \ + chmod a-x $(DESTDIR)$(infodir)/$$realfile; \ done; \ else true; fi -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ - if [ -f $(DESTDIR)$(infodir)/dir ] ; then \ - for f in cpp.info gcc.info gccint.info cppinternals.info; do \ - if [ -f $(DESTDIR)$(infodir)/$$f ]; then \ - install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/$$f; \ - else true; fi; \ - done; \ + if [ -f $@ ]; then \ + install-info --dir-file=$(DESTDIR)$(infodir)/dir $@; \ else true; fi; \ else true; fi; - -chmod a-x $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info* - -chmod a-x $(DESTDIR)$(infodir)/cppinternals.info* $(DESTDIR)$(infodir)/gccint.info* # Install the man pages. -install-man: installdirs $(GENERATED_MANPAGES) lang.install-man - -if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \ - $(INSTALL_DATA) $(docdir)/gcc.1 $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \ - chmod a-x $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \ - else \ - rm -f $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \ - $(INSTALL_DATA) $(docdir)/gcc.1 $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \ - chmod a-x $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \ - fi - -rm -f $(DESTDIR)$(man1dir)/cpp$(man1ext) - -$(INSTALL_DATA) $(docdir)/cpp.1 $(DESTDIR)$(man1dir)/cpp$(man1ext) - -chmod a-x $(DESTDIR)$(man1dir)/cpp$(man1ext) - -rm -f $(DESTDIR)$(man1dir)/gcov$(man1ext) - -$(INSTALL_DATA) $(docdir)/gcov.1 $(DESTDIR)$(man1dir)/gcov$(man1ext) - -chmod a-x $(DESTDIR)$(man1dir)/gcov$(man1ext) - -rm -f $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) - -$(INSTALL_DATA) $(docdir)/fsf-funding.7 $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) - -chmod a-x $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) - -rm -f $(DESTDIR)$(man7dir)/gfdl$(man7ext) - -$(INSTALL_DATA) $(docdir)/gfdl.7 $(DESTDIR)$(man7dir)/gfdl$(man7ext) - -chmod a-x $(DESTDIR)$(man7dir)/gfdl$(man7ext) - -rm -f $(DESTDIR)$(man7dir)/gpl$(man7ext) - -$(INSTALL_DATA) $(docdir)/gpl.7 $(DESTDIR)$(man7dir)/gpl$(man7ext) - -chmod a-x $(DESTDIR)$(man7dir)/gpl$(man7ext) +install-man: installdirs lang.install-man \ + $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \ + $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \ + $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \ + $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \ + $(DESTDIR)$(man7dir)/gfdl$(man7ext) \ + $(DESTDIR)$(man7dir)/gpl$(man7ext) + +$(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +$(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext): doc/gcc.1 + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +$(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext): doc/cpp.1 + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +$(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext): doc/gcov.1 + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ # Install the library. -install-libgcc: libgcc.mk libgcc.a installdirs - if $(RANLIB_TEST_FOR_TARGET); then \ - r_f_t=$(RANLIB_FOR_TARGET); \ - else \ - r_f_t=: ; \ - fi; \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - BUILD_PREFIX="$(BUILD_PREFIX)" BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ +install-libgcc: libgcc.mk libgcc.a libgcov.a installdirs + $(MAKE) \ CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ - RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ - NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ - INCLUDES="$(INCLUDES)" \ - CONFIG_H="$(TCONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ - LIB1ASMSRC='$(LIB1ASMSRC)' \ + CONFIG_H="$(TCONFIG_H)" \ MAKEOVERRIDES= \ - INSTALL_DATA="$(INSTALL_DATA)" \ - RANLIB_FOR_TARGET="$$r_f_t" \ - DESTDIR="$(DESTDIR)" \ - libsubdir="$(libsubdir)" \ - slibdir="$(slibdir)" \ -f libgcc.mk install -# Install multiple versions of libgcc.a. +# Install multiple versions of libgcc.a, libgcov.a. install-multilib: stmp-multilib installdirs - if $(RANLIB_TEST_FOR_TARGET); then \ - r_f_t=$(RANLIB_FOR_TARGET); \ - else \ - r_f_t=: ; \ - fi; \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - BUILD_PREFIX="$(BUILD_PREFIX)" BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + $(MAKE) \ CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ - RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ - NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ - INCLUDES="$(INCLUDES)" \ - CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ - LIB1ASMSRC='$(LIB1ASMSRC)' \ + CONFIG_H="$(CONFIG_H)" \ MAKEOVERRIDES= \ - INSTALL_DATA="$(INSTALL_DATA)" \ - RANLIB_FOR_TARGET="$$r_f_t" \ - DESTDIR="$(DESTDIR)" \ - libsubdir="$(libsubdir)" \ - slibdir="$(slibdir)" \ -f libgcc.mk install # Install all the header files built in the include subdirectory. @@ -3015,67 +3048,67 @@ install-headers-cpio: stmp-int-hdrs $(STMP_FIXPROTO) install-include-dir install-headers-cp: stmp-int-hdrs $(STMP_FIXPROTO) install-include-dir cp -p -r include $(DESTDIR)$(libsubdir) -itoolsdir = $(libsubdir)/install-tools +itoolsdir = $(libexecsubdir)/install-tools +itoolsdatadir = $(libsubdir)/install-tools # Don't install the headers. Instead, install appropriate scripts # and supporting files for fixincludes to be run later. install-mkheaders: stmp-int-hdrs $(STMP_FIXPROTO) install-include-dir \ mkheaders xlimits.h - -rm -rf $(DESTDIR)$(itoolsdir) - $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(itoolsdir)/include + -rm -rf $(DESTDIR)$(itoolsdir) $(DESTDIR)$(itoolsdatadir) + $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(itoolsdatadir)/include + $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(itoolsdir) for file in $(USER_H); do \ realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ $(INSTALL_DATA) $$file \ - $(DESTDIR)$(itoolsdir)/include/$$realfile ; \ + $(DESTDIR)$(itoolsdatadir)/include/$$realfile ; \ done - $(INSTALL_DATA) xlimits.h $(DESTDIR)$(itoolsdir)/include/limits.h + $(INSTALL_DATA) xlimits.h $(DESTDIR)$(itoolsdatadir)/include/limits.h if [ x$(STMP_FIXINC) != x ] ; then \ $(INSTALL_DATA) $(srcdir)/README-fixinc \ - $(DESTDIR)$(itoolsdir)/include/README ; \ - $(INSTALL_PROGRAM) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \ + $(DESTDIR)$(itoolsdatadir)/include/README ; \ + $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \ $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \ - $(INSTALL_DATA) $(srcdir)/gsyslimits.h $(DESTDIR)$(itoolsdir)/gsyslimits.h ; \ + $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ + $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \ else :; fi if [ x$(STMP_FIXPROTO) != x ] ; then \ - $(INSTALL_PROGRAM) $(srcdir)/mkinstalldirs \ + $(INSTALL_SCRIPT) $(srcdir)/mkinstalldirs \ $(DESTDIR)$(itoolsdir)/mkinstalldirs ; \ - $(INSTALL_PROGRAM) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \ + $(INSTALL_SCRIPT) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \ $(INSTALL_PROGRAM) fix-header$(build_exeext) \ $(DESTDIR)$(itoolsdir)/fix-header$(build_exeext) ; \ else :; fi - $(INSTALL_PROGRAM) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders - echo 'SYSTEM_HEADER_DIR="$(SYSTEM_HEADER_DIR)"' \ - > $(DESTDIR)$(itoolsdir)/mkheaders.conf + $(INSTALL_SCRIPT) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders + echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \ + > $(DESTDIR)$(itoolsdatadir)/mkheaders.conf echo 'OTHER_FIXINCLUDES_DIRS="$(OTHER_FIXINCLUDES_DIRS)"' \ - >> $(DESTDIR)$(itoolsdir)/mkheaders.conf + >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf echo 'FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"' \ - >> $(DESTDIR)$(itoolsdir)/mkheaders.conf - echo 'STMP_FIXPROTO="$(STMP_FIXPROTO)"' >> $(DESTDIR)$(itoolsdir)/mkheaders.conf - echo 'STMP_FIXINC="$(STMP_FIXINC)"' >> $(DESTDIR)$(itoolsdir)/mkheaders.conf + >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf + echo 'STMP_FIXPROTO="$(STMP_FIXPROTO)"' \ + >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf + echo 'STMP_FIXINC="$(STMP_FIXINC)"' \ + >> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf # Use this target to install the program `collect2' under the name `collect2'. install-collect2: collect2 installdirs - $(INSTALL_PROGRAM) collect2$(exeext) $(DESTDIR)$(libsubdir)/collect2$(exeext) + $(INSTALL_PROGRAM) collect2$(exeext) $(DESTDIR)$(libexecsubdir)/collect2$(exeext) # Install the driver program as $(libsubdir)/gcc for collect2. - $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(libsubdir)/gcc$(exeext) + $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(libexecsubdir)/gcc$(exeext) # Cancel installation by deleting the installed files. -uninstall: intl.uninstall lang.uninstall +uninstall: lang.uninstall -rm -rf $(DESTDIR)$(libsubdir) + -rm -rf $(DESTDIR)$(libexecsubdir) -rm -rf $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) - -rm -rf $(DESTDIR)$(bindir)/$(GCC_CROSS_NAME)$(exeext) -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext) - -rm -f $(DESTDIR)$(bindir)/$(CPP_CROSS_NAME)$(exeext) -if [ x$(cpp_install_dir) != x ]; then \ rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ else true; fi -rm -rf $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext) - -rm -rf $(DESTDIR)$(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext) -rm -rf $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext) - -rm -rf $(DESTDIR)$(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext) -rm -rf $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext) -rm -rf $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) - -rm -rf $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(man1ext) -rm -rf $(DESTDIR)$(man1dir)/cpp$(man1ext) -rm -rf $(DESTDIR)$(man1dir)/protoize$(man1ext) -rm -rf $(DESTDIR)$(man1dir)/unprotoize$(man1ext) @@ -3085,7 +3118,6 @@ uninstall: intl.uninstall lang.uninstall # These targets are for the dejagnu testsuites. The file site.exp # contains global variables that all the testsuites will use. -# Set to $(target_alias)/ for cross. target_subdir = @target_subdir@ site.exp: ./config.status Makefile @@ -3098,13 +3130,13 @@ site.exp: ./config.status Makefile @echo "# add them to the last section" >> ./tmp0 @echo "set rootme \"`${PWD_COMMAND}`\"" >> ./tmp0 @echo "set srcdir \"`cd ${srcdir}; ${PWD_COMMAND}`\"" >> ./tmp0 - @echo "set host_triplet $(host_canonical)" >> ./tmp0 - @echo "set build_triplet $(build_canonical)" >> ./tmp0 + @echo "set host_triplet $(host)" >> ./tmp0 + @echo "set build_triplet $(build)" >> ./tmp0 @echo "set target_triplet $(target)" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 + @echo "set target_alias $(target_noncanonical)" >> ./tmp0 # CFLAGS is set even though it's empty to show we reserve the right to set it. @echo "set CFLAGS \"\"" >> ./tmp0 - @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0 + @echo "set CXXFLAGS \"\"" >> ./tmp0 @echo "set TESTING_IN_BUILD_TREE 1" >> ./tmp0 @echo "set HAVE_LIBSTDCXX_V3 1" >> ./tmp0 # If newlib has been configured, we need to pass -B to gcc so it can find @@ -3116,9 +3148,10 @@ site.exp: ./config.status Makefile # ??? Another way to solve this might be to rely on linker scripts. Then # theoretically the -B won't be needed. # We also need to pass -L ../ld so that the linker can find ldscripts. - @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \ - echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \ - echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \ + @if [ -d $(objdir)/../$(target_subdir)/newlib ] \ + && [ "${host}" != "${target}" ]; then \ + echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)/newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \ + echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)/newlib/\"" >> ./tmp0; \ echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \ @@ -3130,12 +3163,16 @@ site.exp: ./config.status Makefile fi echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0 + @if [ "X$(ALT_CC_UNDER_TEST)" != "X" ] ; then \ + echo "set ALT_CC_UNDER_TEST \"$(ALT_CC_UNDER_TEST)\"" >> ./tmp0; \ + else true; \ + fi @if [ "X$(ALT_CXX_UNDER_TEST)" != "X" ] ; then \ - echo "set ALT_CXX_UNDER_TEST $(ALT_CXX_UNDER_TEST)" >> ./tmp0; \ + echo "set ALT_CXX_UNDER_TEST \"$(ALT_CXX_UNDER_TEST)\"" >> ./tmp0; \ else true; \ fi @if [ "X$(COMPAT_OPTIONS)" != "X" ] ; then \ - echo "set COMPAT_OPTIONS $(COMPAT_OPTIONS)" >> ./tmp0; \ + echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./tmp0; \ else true; \ fi @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 @@ -3146,10 +3183,6 @@ site.exp: ./config.status Makefile CHECK_TARGETS = check-gcc @check_languages@ -check-c++ : check-g++ -check-f77 : check-g77 -check-java : - check: $(CHECK_TARGETS) # The idea is to parallelize testing of multilibs, for example: @@ -3157,7 +3190,8 @@ check: $(CHECK_TARGETS) # will run 3 concurrent sessions of check-gcc, eventually testing # all 10 combinations. GNU make is required, as is a shell that expands # alternations within braces. -check-gcc//% check-g++//% check-g77//% check-objc//%: site.exp +lang_checks_parallel = $(lang_checks:=//%) +$(lang_checks_parallel): site.exp target=`echo "$@" | sed 's,//.*,,'`; \ variant=`echo "$@" | sed 's,^[^/]*//,,'`; \ vardots=`echo "$$variant" | sed 's,/,.,g'`; \ @@ -3172,7 +3206,7 @@ $(TESTSUITEDIR)/site.exp: site.exp -rm -f $@ sed '/set tmpdir/ s|testsuite|$(TESTSUITEDIR)|' < site.exp > $@ -check-g++: $(TESTSUITEDIR)/site.exp +$(lang_checks): check-% : $(TESTSUITEDIR)/site.exp -(rootme=`${PWD_COMMAND}`; export rootme; \ srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \ cd $(TESTSUITEDIR); \ @@ -3180,37 +3214,7 @@ check-g++: $(TESTSUITEDIR)/site.exp if [ -f $${rootme}/../expect/expect ] ; then \ TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \ export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool g++ $(RUNTESTFLAGS)) - -check-gcc: $(TESTSUITEDIR)/site.exp - -(rootme=`${PWD_COMMAND}`; export rootme; \ - srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \ - cd $(TESTSUITEDIR); \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool gcc $(RUNTESTFLAGS)) - -check-g77: $(TESTSUITEDIR)/site.exp - -(rootme=`${PWD_COMMAND}`; export rootme; \ - srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \ - cd $(TESTSUITEDIR); \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool g77 $(RUNTESTFLAGS)) - -check-objc: $(TESTSUITEDIR)/site.exp - -(rootme=`${PWD_COMMAND}`; export rootme; \ - srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \ - cd $(TESTSUITEDIR); \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool objc $(RUNTESTFLAGS)) + $(RUNTEST) --tool $* $(RUNTESTFLAGS)) check-consistency: testsuite/site.exp -rootme=`${PWD_COMMAND}`; export rootme; \ @@ -3231,13 +3235,13 @@ QMTEST_PATH=qmtest QMTESTFLAGS= # The flags to pass to "qmtest run". -QMTESTRUNFLAGS= +QMTESTRUNFLAGS=-f none --result-stream dejagnu_stream.DejaGNUStream # The command to use to invoke qmtest. QMTEST=${QMTEST_PATH} ${QMTESTFLAGS} # The tests (or suites) to run. -QMTEST_GPP_TESTS=gpp +QMTEST_GPP_TESTS=g++ # The subdirectory of the OBJDIR that will be used to store the QMTest # test database configuration and that will be used for temporary @@ -3246,48 +3250,32 @@ QMTEST_DIR=qmtestsuite # Create the QMTest database configuration. ${QMTEST_DIR} stamp-qmtest: - debug_options=""; \ - ${STAMP} empty.C; \ - for option in \ - -gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff; do \ - (./cc1plus -q $${option} empty.C 2>&1 | \ - grep "unknown or unsupported -g option" > /dev/null) || \ - debug_options="$${debug_options}$${option} "; done; \ - ${QMTEST} -D ${QMTEST_DIR} create-tdb \ - -c gcc_database.GCCDatabase \ - -a GCCDatabase.testsuite_root=`cd ${srcdir}/testsuite && pwd` \ - -a GCCDatabase.debug_options="$${debug_options}" - rm -f empty.C empty.s - $(STAMP) stamp-qmtest + ${QMTEST} -D ${QMTEST_DIR} create-tdb \ + -c gcc_database.GCCDatabase \ + -a srcdir=`cd ${srcdir}/testsuite && ${PWD_COMMAND}` && \ + $(STAMP) stamp-qmtest # Create the QMTest context file. ${QMTEST_DIR}/context: stamp-qmtest - echo "GCCTest.flags=-B${objdir}" >> $@ - echo "GCCTest.objdir=${objdir}/.." >> $@ - echo "GCCTest.host=${host_canonical}" >> $@ - echo "GCCTest.target=${target}" >> $@ - echo "GCCTest.gcov=${objdir}/gcov" >> $@ - echo "GPPTest.gpp=${objdir}/g++" >> $@ - echo "DGTest.demangler=${objdir}/c++filt" >> $@ + rm -f $@ + echo "CompilerTable.languages=c cplusplus" >> $@ + echo "CompilerTable.c_kind=GCC" >> $@ + echo "CompilerTable.c_path=${objdir}/xgcc" >> $@ + echo "CompilerTable.c_options=-B${objdir}/" >> $@ + echo "CompilerTable.cplusplus_kind=GCC" >> $@ + echo "CompilerTable.cplusplus_path=${objdir}/g++" >> $@ + echo "CompilerTable.cplusplus_options=-B${objdir}/" >> $@ + echo "DejaGNUTest.target=${target_noncanonical}" >> $@ # Run the G++ testsuite using QMTest. -qmtest-g++: ${QMTEST_DIR}/context ${QMTEST_DIR}/gpp-expected.qmr +qmtest-g++: ${QMTEST_DIR}/context cd ${QMTEST_DIR} && ${QMTEST} run ${QMTESTRUNFLAGS} -C context \ - -o gpp.qmr -O gpp-expected.qmr \ - ${QMTEST_GPP_TESTS} + -o g++.qmr ${QMTEST_GPP_TESTS} # Use the QMTest GUI. qmtest-gui: ${QMTEST_DIR}/context cd ${QMTEST_DIR} && ${QMTEST} gui -C context -# Build the set of expected G++ failures. -${QMTEST_DIR}/gpp-expected.qmr: ${QMTEST_DIR}/context - echo "Determining expected results..." - cd ${QMTEST_DIR} && ${QMTEST} run ${QMTESTRUNFLAGS} -C context \ - -c "GCCTest.generate_xfails=1" -o gpp-expected.qmr \ - ${QMTEST_GPP_TESTS} \ - > /dev/null - .PHONY: qmtest-g++ # Run Paranoia on real.c. @@ -3302,13 +3290,24 @@ paranoia: paranoia.o real.o $(LIBIBERTY) # These exist for maintenance purposes. # Update the tags table. -TAGS: force - (cd $(srcdir); \ - mkdir tmp-tags; \ - mv -f c-parse.[ch] =*.[chy] tmp-tags; \ - etags *.y *.h *.c; \ - mv tmp-tags/* .; \ - rmdir tmp-tags) +TAGS: lang.tags + (cd $(srcdir); \ + incs= ; \ + list='$(SUBDIRS)'; for dir in $$list; do \ + if test -f $$dir/TAGS; then \ + incs="$$incs --include $$dir/TAGS.sub"; \ + fi; \ + done; \ + mkdir tmp-tags; \ + mv -f c-parse.[ch] tmp-tags; \ + etags -o TAGS.sub *.y *.h *.c; \ + mv tmp-tags/* .; \ + rmdir tmp-tags; \ + etags --include TAGS.sub $$incs) + +# ------------------------------------------------------ +# Bootstrap-related targets (not used during 'make all') +# ------------------------------------------------------ # A list of files to be destroyed during "lean" builds. VOL_FILES=`echo $(BACKEND) $(OBJS) $(C_OBJS) $(LIBCPP_OBJS) *.c *.h gen*` @@ -3316,30 +3315,42 @@ VOL_FILES=`echo $(BACKEND) $(OBJS) $(C_OBJS) $(LIBCPP_OBJS) *.c *.h gen*` # Flags to pass to stage2 and later recursive makes. Note that the # WARN_CFLAGS setting can't be to the expansion of GCC_WARN_CFLAGS in # the context of the stage_x rule. -STAGE2_FLAGS_TO_PASS = \ - ADAC="\$$(CC)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ + +POSTSTAGE1_FLAGS_TO_PASS = \ + ADAFLAGS="$(BOOT_ADAFLAGS)" \ CFLAGS="$(BOOT_CFLAGS)" \ LDFLAGS="$(BOOT_LDFLAGS)" \ WARN_CFLAGS="\$$(GCC_WARN_CFLAGS)" \ STRICT_WARN="$(STRICT2_WARN)" \ libdir=$(libdir) \ LANGUAGES="$(LANGUAGES)" \ + MAKEINFO="$(MAKEINFO)" \ + MAKEINFOFLAGS="$(MAKEINFOFLAGS)" \ MAKEOVERRIDES= \ OUTPUT_OPTION="-o \$$@" +STAGE2_FLAGS_TO_PASS = \ + CFLAGS="$(BOOT_CFLAGS)" \ + WERROR="@WERROR@" \ + +STAGEPROFILE_FLAGS_TO_PASS = \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" + +# Files never linked into the final executable produces warnings about missing +# profile. +STAGEFEEDBACK_FLAGS_TO_PASS = \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" + # Only build the C compiler for stage1, because that is the only one that # we can guarantee will build with the native compiler, and also it is the # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS), # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them # overrideable (for a bootstrap build stage1 also builds gcc.info). stage1_build: - $(MAKE) AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ - CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \ + $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \ CFLAGS="$(STAGE1_CFLAGS)" MAKEINFO="$(MAKEINFO)" \ - MAKEINFOFLAGS="$(MAKEINFOFLAGS)" COVERAGE_FLAGS= + MAKEINFOFLAGS="$(MAKEINFOFLAGS)" COVERAGE_FLAGS= \ + OBJS-onestep="$(OBJS)" $(STAMP) stage1_build echo stage1_build > stage_last @@ -3349,8 +3360,9 @@ stage1_copy: stage1_build echo stage2_build > stage_last stage2_build: stage1_copy - $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ + $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage1/ \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ $(STAGE2_FLAGS_TO_PASS) $(STAMP) stage2_build echo stage2_build > stage_last @@ -3360,13 +3372,40 @@ stage2_copy: stage2_build $(STAMP) stage2_copy echo stage3_build > stage_last +stageprofile_build: stage1_copy + $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ + STAGE_PREFIX=stage1/ \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(STAGEPROFILE_FLAGS_TO_PASS) + $(STAMP) stageprofile_build + echo stageprofile_build > stage_last + +stageprofile_copy: stageprofile_build + $(MAKE) stageprofile + $(STAMP) stageprofile_copy + echo stagefeedback_build > stage_last + stage3_build: stage2_copy - $(MAKE) CC="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \ + $(MAKE) CC="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage2/ \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ $(STAGE2_FLAGS_TO_PASS) $(STAMP) stage3_build echo stage3_build > stage_last +stagefeedback_build: stageprofile_copy stage1_copy + $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ + STAGE_PREFIX=stage1/ \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(STAGEFEEDBACK_FLAGS_TO_PASS) + $(STAMP) stagefeedback_build + echo stagefeedback_build > stage_last + +stagefeedback_copy: stagefeedback_build + $(MAKE) stagefeedback + $(STAMP) stagefeedback_copy + echo stagefeedback2_build > stage_last + # For bootstrap4: stage3_copy: stage3_build $(MAKE) stage3 @@ -3374,8 +3413,9 @@ stage3_copy: stage3_build echo stage4_build > stage_last stage4_build: stage3_copy - $(MAKE) CC="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" \ + $(MAKE) CC="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage3/ \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ $(STAGE2_FLAGS_TO_PASS) $(STAMP) stage4_build echo stage4_build > stage_last @@ -3411,12 +3451,13 @@ bootstrap3 bootstrap3-lean: bootstrap bootstrap4 bootstrap4-lean: stage4_build -unstage1 unstage2 unstage3 unstage4: +unstage1 unstage2 unstage3 unstage4 unstageprofile unstagefeedback: -set -vx; stage=`echo $@ | sed -e 's/un//'`; \ rm -f $$stage/as$(exeext); \ rm -f $$stage/ld$(exeext); \ rm -f $$stage/collect-ld$(exeext); \ if test -d $$stage; then \ + mv $$stage/specs $(SPECS) 2>/dev/null || :; \ mv $$stage/* . 2>/dev/null; \ for i in `cd $$stage; echo *` ; do \ if test -d $$stage/$$i; then \ @@ -3430,75 +3471,104 @@ unstage1 unstage2 unstage3 unstage4: echo $${stage}_build > stage_last restage1: unstage1 - $(MAKE) stage1_build + $(MAKE) $(REMAKEFLAGS) stage1_build restage2: unstage2 - $(MAKE) LANGUAGES="$(LANGUAGES)" stage2_build + $(MAKE) $(REMAKEFLAGS) stage2_build restage3: unstage3 - $(MAKE) LANGUAGES="$(LANGUAGES)" stage3_build + $(MAKE) $(REMAKEFLAGS) stage3_build restage4: unstage4 - $(MAKE) LANGUAGES="$(LANGUAGES)" stage4_build + $(MAKE) $(REMAKEFLAGS) stage4_build +restageprofile: unstageprofile + $(MAKE) $(REMAKEFLAGS) stageprofile_build + +restagefeedback: unstagefeedback + $(MAKE) $(REMAKEFLAGS) stagefeedback_build + +# Bubble up a bugfix through all the stages. Primarily useful for fixing +# bugs that cause the compiler to crash while building stage 2. bubblestrap: - if test -f stage3_build; then true; else \ - echo; echo You must \"make bootstrap\" first.; \ - exit 1; \ + if test -f stage_last; then \ + LAST=`sed -e 's/_build//' < stage_last`; \ + if test "$$LAST" != "stage1"; then \ + $(MAKE) $(REMAKEFLAGS) $$LAST; \ + $(STAMP) $${LAST}_copy; \ + fi; \ + fi + if test -f stage1_copy; then $(MAKE) unstage1; fi + $(MAKE) $(REMAKEFLAGS) stage1_copy + if test -f stage2_copy; then $(MAKE) unstage2; fi + $(MAKE) $(REMAKEFLAGS) stage2_copy + if test -f stage3_copy; then $(MAKE) unstage3; fi + $(MAKE) $(REMAKEFLAGS) stage3_build + if test -f stage4_copy; then \ + $(MAKE) $(REMAKEFLAGS) stage3_copy; $(MAKE) unstage4; \ + $(MAKE) $(REMAKEFLAGS) stage4_build || exit 1; \ fi - for i in stage3 \ - unstage1 stage1_build stage1_copy \ - unstage2 stage2_build stage2_copy \ - unstage3 stage3_build ; \ - do \ - $(MAKE) LANGUAGES="$(LANGUAGES)" $$i || exit 1 ; \ - done quickstrap: if test -f stage_last ; then \ - LAST=`cat stage_last`; rm $$LAST; $(MAKE) LANGUAGES="$(LANGUAGES)" $$LAST; \ + LAST=`cat stage_last`; rm $$LAST; $(MAKE) $(REMAKEFLAGS) $$LAST; \ else \ - $(MAKE) stage1_build; \ + $(MAKE) $(REMAKEFLAGS) stage1_build; \ fi cleanstrap: -$(MAKE) clean - $(MAKE) LANGUAGES="$(LANGUAGES)" bootstrap + $(MAKE) $(REMAKEFLAGS) bootstrap unstrap: -rm -rf stage[234]* $(MAKE) unstage1 + -rm -f stage_last # Differs from cleanstrap in that it starts from the earlier stage1 build, # not from scratch. restrap: $(MAKE) unstrap - $(MAKE) LANGUAGES="$(LANGUAGES)" bootstrap + $(MAKE) $(REMAKEFLAGS) bootstrap -# Compare the object files in the current directory with those in the -# stage2 directory. - -# ./ avoids bug in some versions of tail. -compare compare3 compare4 compare-lean compare3-lean compare4-lean: force +# These targets compare the object files in the current directory with +# those in a stage directory. We need to skip the first N bytes of +# each object file. The "slow" mechanism assumes nothing special +# about cmp and uses the tail command to skip. ./ avoids a bug in +# some versions of tail. The "gnu" targets use gnu cmp (diffutils +# v2.4 or later), to avoid running tail and the overhead of twice +# copying each object file. Likewise, the "fast" targets use the skip +# parameter of cmp available on some systems to accomplish the same +# thing. An exit status of 1 is precisely the result we're looking +# for (other values mean other problems). +slowcompare slowcompare3 slowcompare4 slowcompare-lean slowcompare3-lean slowcompare4-lean \ +fastcompare fastcompare3 fastcompare4 fastcompare-lean fastcompare3-lean fastcompare4-lean \ + gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force -rm -f .bad_compare - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for file in *$(objext); do \ - tail +16c ./$$file > tmp-foo1; \ - tail +16c stage$$stage/$$file > tmp-foo2 \ - && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ - done - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for dir in tmp-foo intl $(SUBDIRS); do \ + case "$@" in *compare | *compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^[a-z]*compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + for dir in . $(SUBDIRS); do \ if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ for file in $$dir/*$(objext); do \ - tail +16c ./$$file > tmp-foo1; \ - tail +16c stage$$stage/$$file > tmp-foo2 \ - && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + case "$@" in \ + slowcompare* ) \ + tail +16c ./$$file > tmp-foo1; \ + tail +16c stage$$stage/$$file > tmp-foo2 \ + && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + ;; \ + fastcompare* ) \ + cmp $$file stage$$stage/$$file 16 16 > /dev/null 2>&1; \ + test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \ + ;; \ + gnucompare* ) \ + cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \ + test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \ + ;; \ + esac ; \ done; \ else true; fi; \ done -rm -f tmp-foo* - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + case "$@" in *compare | *compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^[a-z]*compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ if [ -f .bad_compare ]; then \ echo "Bootstrap comparison failure!"; \ cat .bad_compare; \ @@ -3510,91 +3580,75 @@ compare compare3 compare4 compare-lean compare3-lean compare4-lean: force esac; true; \ fi -# Compare the object files in the current directory with those in the -# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid -# running tail and the overhead of twice copying each object file. -# An exit status of 1 is precisely the result we're looking for (other -# values mean other problems). -gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force - -rm -f .bad_compare - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for file in *$(objext); do \ - cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \ - test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \ - done - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for dir in tmp-foo intl $(SUBDIRS); do \ - if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ - for file in $$dir/*$(objext); do \ - cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \ - test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \ - done; \ - else true; fi; \ - done - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - if [ -f .bad_compare ]; then \ - echo "Bootstrap comparison failure!"; \ - cat .bad_compare; \ - exit 1; \ - else \ - case "$@" in \ - *-lean ) rm -rf stage$$stage ;; \ - esac; true; \ - fi +# Forwarding wrappers to the most appropriate version. +compare: @make_compare_target@ +compare3: @make_compare_target@3 +compare4: @make_compare_target@4 +compare-lean: @make_compare_target@-lean +compare3-lean: @make_compare_target@3-lean +compare4-lean: @make_compare_target@4-lean # Copy the object files from a particular stage into a subdirectory. stage1-start: -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi $(MAKE) -f libgcc.mk libgcc-stage-start stage=stage1 - -for dir in intl $(SUBDIRS) ; \ + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ do \ if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \ done +# If SPECS is overridden, make sure it is `installed' as specs. + -mv $(SPECS) stage1/specs -mv $(STAGESTUFF) stage1 - -mv intl/*$(objext) stage1/intl # Copy as/ld if they exist to stage dir, so that running xgcc from the stage # dir will work properly. -if [ -f as$(exeext) ] ; then (cd stage1 && $(LN_S) ../as$(exeext) .) ; else true ; fi -if [ -f ld$(exeext) ] ; then (cd stage1 && $(LN_S) ../ld$(exeext) .) ; else true ; fi -if [ -f collect-ld$(exeext) ] ; then (cd stage1 && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi - -rm -f stage1/libgcc.a stage1/libgcc_eh.a + -rm -f stage1/libgcc.a stage1/libgcc_eh.a stage1/libgcov.a + -rm -f stage1/libgcc_s*$(SHLIB_EXT) -cp libgcc.a stage1 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage1/libgcc.a; \ - else true; fi + -$(RANLIB_FOR_TARGET) stage1/libgcc.a + -cp libgcov.a stage1 + -$(RANLIB_FOR_TARGET) stage1/libgcov.a -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stage1; \ - if $(RANLIB_TEST_FOR_TARGET) ; then \ $(RANLIB_FOR_TARGET) stage1/libgcc_eh.a; \ - else true; fi; fi + fi + -cp libgcc_s*$(SHLIB_EXT) stage1 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ cp stage1/$${f} . ; \ else true; \ fi; done stage1: force stage1-start lang.stage1 + -for dir in . $(SUBDIRS) ; \ + do \ + rm -f $$dir/*$(coverageexts) ; \ + done stage2-start: -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi $(MAKE) -f libgcc.mk libgcc-stage-start stage=stage2 - -for dir in intl $(SUBDIRS) ; \ + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ do \ if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \ done +# If SPECS is overridden, make sure it is `installed' as specs. + -mv $(SPECS) stage2/specs -mv $(STAGESTUFF) stage2 - -mv intl/*$(objext) stage2/intl # Copy as/ld if they exist to stage dir, so that running xgcc from the stage # dir will work properly. -if [ -f as$(exeext) ] ; then (cd stage2 && $(LN_S) ../as$(exeext) .) ; else true ; fi -if [ -f ld$(exeext) ] ; then (cd stage2 && $(LN_S) ../ld$(exeext) .) ; else true ; fi -if [ -f collect-ld$(exeext) ] ; then (cd stage2 && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi - -rm -f stage2/libgcc.a stage2/libgcc_eh.a + -rm -f stage2/libgcc.a stage2/libgcov.a stage2/libgcc_eh.a + -rm -f stage2/libgcc_s*$(SHLIB_EXT) -cp libgcc.a stage2 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage2/libgcc.a; \ - else true; fi + -$(RANLIB_FOR_TARGET) stage2/libgcc.a + -cp libgcov.a stage2 + -$(RANLIB_FOR_TARGET) stage2/libgcov.a -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stage2; \ - if $(RANLIB_TEST_FOR_TARGET) ; then \ $(RANLIB_FOR_TARGET) stage2/libgcc_eh.a; \ - else true; fi; fi + fi + -cp libgcc_s*$(SHLIB_EXT) stage2 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ cp stage2/$${f} . ; \ else true; \ @@ -3604,26 +3658,28 @@ stage2: force stage2-start lang.stage2 stage3-start: -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi $(MAKE) -f libgcc.mk libgcc-stage-start stage=stage3 - -for dir in intl $(SUBDIRS) ; \ + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ do \ if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \ done +# If SPECS is overridden, make sure it is `installed' as specs. + -mv $(SPECS) stage3/specs -mv $(STAGESTUFF) stage3 - -mv intl/*$(objext) stage3/intl # Copy as/ld if they exist to stage dir, so that running xgcc from the stage # dir will work properly. -if [ -f as$(exeext) ] ; then (cd stage3 && $(LN_S) ../as$(exeext) .) ; else true ; fi -if [ -f ld$(exeext) ] ; then (cd stage3 && $(LN_S) ../ld$(exeext) .) ; else true ; fi -if [ -f collect-ld$(exeext) ] ; then (cd stage3 && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi - -rm -f stage3/libgcc.a stage3/libgcc_eh.a + -rm -f stage3/libgcc.a stage3/libgcov.a stage3/libgcc_eh.a + -rm -f stage3/libgcc_s*$(SHLIB_EXT) -cp libgcc.a stage3 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage3/libgcc.a; \ - else true; fi + -$(RANLIB_FOR_TARGET) stage3/libgcc.a + -cp libgcov.a stage3 + -$(RANLIB_FOR_TARGET) stage3/libgcov.a -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stage3; \ - if $(RANLIB_TEST_FOR_TARGET) ; then \ $(RANLIB_FOR_TARGET) stage3/libgcc_eh.a; \ - else true; fi; fi + fi + -cp libgcc_s*$(SHLIB_EXT) stage3 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ cp stage3/$${f} . ; \ else true; \ @@ -3633,32 +3689,97 @@ stage3: force stage3-start lang.stage3 stage4-start: -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi $(MAKE) -f libgcc.mk libgcc-stage-start stage=stage4 - -for dir in intl $(SUBDIRS) ; \ + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ do \ if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \ done +# If SPECS is overridden, make sure it is `installed' as specs. + -mv $(SPECS) stage4/specs -mv $(STAGESTUFF) stage4 - -mv intl/*$(objext) stage4/intl # Copy as/ld if they exist to stage dir, so that running xgcc from the stage # dir will work properly. -if [ -f as$(exeext) ] ; then (cd stage4 && $(LN_S) ../as$(exeext) .) ; else true ; fi -if [ -f ld$(exeext) ] ; then (cd stage4 && $(LN_S) ../ld$(exeext) .) ; else true ; fi -if [ -f collect-ld$(exeext) ] ; then (cd stage4 && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi - -rm -f stage4/libgcc.a stage4/libgcc_eh.a + -rm -f stage4/libgcc.a stage4/libgcov.a stage4/libgcc_eh.a + -rm -f stage4/libgcc_s*$(SHLIB_EXT) -cp libgcc.a stage4 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage4/libgcc.a; \ - else true; fi + -$(RANLIB_FOR_TARGET) stage4/libgcc.a + -cp libgcov.a stage4 + -$(RANLIB_FOR_TARGET) stage4/libgcov.a -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stage4; \ - if $(RANLIB_TEST_FOR_TARGET) ; then \ $(RANLIB_FOR_TARGET) stage4/libgcc_eh.a; \ - else true; fi; fi + fi + -cp libgcc_s*$(SHLIB_EXT) stage4 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ cp stage4/$${f} . ; \ else true; \ fi; done stage4: force stage4-start lang.stage4 +stageprofile-start: + -if [ -d stageprofile ] ; then true ; else mkdir stageprofile ; fi + $(MAKE) -f libgcc.mk libgcc-stage-start stage=stageprofile + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ + do \ + if [ -d stageprofile/$$dir ] ; then true ; else mkdir stageprofile/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stageprofile +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then (cd stageprofile && $(LN_S) ../as$(exeext) .) ; else true ; fi + -if [ -f ld$(exeext) ] ; then (cd stageprofile && $(LN_S) ../ld$(exeext) .) ; else true ; fi + -if [ -f collect-ld$(exeext) ] ; then (cd stageprofile && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi + -rm -f stageprofile/libgcc.a stageprofile/libgcov.a stageprofile/libgcc_eh.a + -rm -f stageprofile/libgcc_s*$(SHLIB_EXT) + -cp libgcc.a stageprofile + -$(RANLIB_FOR_TARGET) stageprofile/libgcc.a + -cp libgcov.a stageprofile + -$(RANLIB_FOR_TARGET) stageprofile/libgcov.a + -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stageprofile; \ + $(RANLIB_FOR_TARGET) stageprofile/libgcc_eh.a; \ + fi + -cp libgcc_s*$(SHLIB_EXT) stageprofile + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stageprofile/$${f} . ; \ + else true; \ + fi; done +stageprofile: force stageprofile-start lang.stageprofile + +stagefeedback-start: + -if [ -d stagefeedback ] ; then true ; else mkdir stagefeedback ; fi + $(MAKE) -f libgcc.mk libgcc-stage-start stage=stagefeedback + -subdirs="$(SUBDIRS)"; for dir in $$subdirs; \ + do \ + if [ -d stagefeedback/$$dir ] ; then true ; else mkdir stagefeedback/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stagefeedback +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then (cd stagefeedback && $(LN_S) ../as$(exeext) .) ; else true ; fi + -if [ -f ld$(exeext) ] ; then (cd stagefeedback && $(LN_S) ../ld$(exeext) .) ; else true ; fi + -if [ -f collect-ld$(exeext) ] ; then (cd stagefeedback && $(LN_S) ../collect-ld$(exeext) .) ; else true ; fi + -rm -f stagefeedback/libgcc.a stagefeedback/libgcov.a stagefeedback/libgcc_eh.a + -rm -f stagefeedback/libgcc_s*$(SHLIB_EXT) + -rm -f *.da + -for dir in fixinc po testsuite $(SUBDIRS); \ + do \ + rm -f $$dir/*.da ; \ + done + -cp libgcc.a stagefeedback + -$(RANLIB_FOR_TARGET) stagefeedback/libgcc.a + -cp libgcov.a stagefeedback + -$(RANLIB_FOR_TARGET) stagefeedback/libgcov.a + -if [ -f libgcc_eh.a ] ; then cp libgcc_eh.a stagefeedback; \ + $(RANLIB_FOR_TARGET) stagefeedback/libgcc_eh.a; \ + fi + -cp libgcc_s*$(SHLIB_EXT) stagefeedback + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stagefeedback/$${f} . ; \ + else true; \ + fi; done +stagefeedback: force stagefeedback-start lang.stagefeedback + # Copy just the executable files from a particular stage into a subdirectory, # and delete the object files. Use this if you're just verifying a version # that is pretty sure to work, and you are short of disk space. @@ -3677,11 +3798,12 @@ risky-stage4: stage4 #In GNU Make, ignore whether `stage*' exists. .PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 +.PHONY: stagefeedback stageprofile -force: - +# ----------------------------------------------------- # Rules for generating translated message descriptions. # Disabled by autoconf if the tools are not available. +# ----------------------------------------------------- XGETTEXT = @XGETTEXT@ GMSGFMT = @GMSGFMT@ @@ -3725,7 +3847,7 @@ update-po: $(CATALOGS:.gmo=.pox) # with the distribution. install-po: $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir) - for cat in $(CATALOGS); do \ + cats="$(CATALOGS)"; for cat in $$cats; do \ lang=`basename $$cat | sed 's/\.gmo$$//'`; \ if [ -f $$cat ]; then :; \ elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \ @@ -3746,8 +3868,8 @@ install-po: # fairly modern (POSIX-compliant) awk. # The .pot file is left in the build directory. $(PACKAGE).pot: po/$(PACKAGE).pot -po/$(PACKAGE).pot: force +po/$(PACKAGE).pot: force options.c -test -d po || mkdir po - $(MAKE) po-generated + $(MAKE) srcextra AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \ $(XGETTEXT) $(PACKAGE) $(srcdir) diff --git a/contrib/gcc/builtins.c b/contrib/gcc/builtins.c index d0882740e385..dadb6cd41a0e 100644 --- a/contrib/gcc/builtins.c +++ b/contrib/gcc/builtins.c @@ -1,6 +1,6 @@ /* Expand builtin functions. - Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -21,6 +21,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "machmode.h" #include "real.h" #include "rtl.h" @@ -62,7 +64,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA const char *const built_in_class_names[4] = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"}; -#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT) STRINGX(X), +#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM) #X, const char *const built_in_names[(int) END_BUILTINS] = { #include "builtins.def" @@ -72,86 +74,97 @@ const char *const built_in_names[(int) END_BUILTINS] = /* Setup an array of _DECL trees, make sure each element is initialized to NULL_TREE. */ tree built_in_decls[(int) END_BUILTINS]; +/* Declarations used when constructing the builtin implicitly in the compiler. + It may be NULL_TREE when this is invalid (for instance runtime is not + required to implement the function call in all cases. */ +tree implicit_built_in_decls[(int) END_BUILTINS]; -static int get_pointer_alignment PARAMS ((tree, unsigned int)); -static tree c_strlen PARAMS ((tree)); -static const char *c_getstr PARAMS ((tree)); -static rtx c_readstr PARAMS ((const char *, - enum machine_mode)); -static int target_char_cast PARAMS ((tree, char *)); -static rtx get_memory_rtx PARAMS ((tree)); -static int apply_args_size PARAMS ((void)); -static int apply_result_size PARAMS ((void)); +static int get_pointer_alignment (tree, unsigned int); +static tree c_strlen (tree, int); +static const char *c_getstr (tree); +static rtx c_readstr (const char *, enum machine_mode); +static int target_char_cast (tree, char *); +static rtx get_memory_rtx (tree); +static tree build_string_literal (int, const char *); +static int apply_args_size (void); +static int apply_result_size (void); #if defined (HAVE_untyped_call) || defined (HAVE_untyped_return) -static rtx result_vector PARAMS ((int, rtx)); +static rtx result_vector (int, rtx); #endif -static rtx expand_builtin_setjmp PARAMS ((tree, rtx)); -static void expand_builtin_prefetch PARAMS ((tree)); -static rtx expand_builtin_apply_args PARAMS ((void)); -static rtx expand_builtin_apply_args_1 PARAMS ((void)); -static rtx expand_builtin_apply PARAMS ((rtx, rtx, rtx)); -static void expand_builtin_return PARAMS ((rtx)); -static enum type_class type_to_class PARAMS ((tree)); -static rtx expand_builtin_classify_type PARAMS ((tree)); -static rtx expand_builtin_mathfn PARAMS ((tree, rtx, rtx)); -static rtx expand_builtin_constant_p PARAMS ((tree)); -static rtx expand_builtin_args_info PARAMS ((tree)); -static rtx expand_builtin_next_arg PARAMS ((tree)); -static rtx expand_builtin_va_start PARAMS ((tree)); -static rtx expand_builtin_va_end PARAMS ((tree)); -static rtx expand_builtin_va_copy PARAMS ((tree)); -static rtx expand_builtin_memcmp PARAMS ((tree, tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strcmp PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strncmp PARAMS ((tree, rtx, - enum machine_mode)); -static rtx builtin_memcpy_read_str PARAMS ((PTR, HOST_WIDE_INT, - enum machine_mode)); -static rtx expand_builtin_strcat PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strncat PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strspn PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strcspn PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_memcpy PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strcpy PARAMS ((tree, rtx, - enum machine_mode)); -static rtx builtin_strncpy_read_str PARAMS ((PTR, HOST_WIDE_INT, - enum machine_mode)); -static rtx expand_builtin_strncpy PARAMS ((tree, rtx, - enum machine_mode)); -static rtx builtin_memset_read_str PARAMS ((PTR, HOST_WIDE_INT, - enum machine_mode)); -static rtx builtin_memset_gen_str PARAMS ((PTR, HOST_WIDE_INT, - enum machine_mode)); -static rtx expand_builtin_memset PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_bzero PARAMS ((tree)); -static rtx expand_builtin_strlen PARAMS ((tree, rtx)); -static rtx expand_builtin_strstr PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strpbrk PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strchr PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_strrchr PARAMS ((tree, rtx, - enum machine_mode)); -static rtx expand_builtin_alloca PARAMS ((tree, rtx)); -static rtx expand_builtin_ffs PARAMS ((tree, rtx, rtx)); -static rtx expand_builtin_frame_address PARAMS ((tree)); -static rtx expand_builtin_fputs PARAMS ((tree, int, int)); -static tree stabilize_va_list PARAMS ((tree, int)); -static rtx expand_builtin_expect PARAMS ((tree, rtx)); -static tree fold_builtin_constant_p PARAMS ((tree)); -static tree fold_builtin_classify_type PARAMS ((tree)); -static tree fold_builtin_inf PARAMS ((tree, int)); -static tree fold_builtin_nan PARAMS ((tree, tree, int)); -static tree build_function_call_expr PARAMS ((tree, tree)); -static int validate_arglist PARAMS ((tree, ...)); +static rtx expand_builtin_setjmp (tree, rtx); +static void expand_builtin_prefetch (tree); +static rtx expand_builtin_apply_args (void); +static rtx expand_builtin_apply_args_1 (void); +static rtx expand_builtin_apply (rtx, rtx, rtx); +static void expand_builtin_return (rtx); +static enum type_class type_to_class (tree); +static rtx expand_builtin_classify_type (tree); +static void expand_errno_check (tree, rtx); +static rtx expand_builtin_mathfn (tree, rtx, rtx); +static rtx expand_builtin_mathfn_2 (tree, rtx, rtx); +static rtx expand_builtin_constant_p (tree, enum machine_mode); +static rtx expand_builtin_args_info (tree); +static rtx expand_builtin_next_arg (tree); +static rtx expand_builtin_va_start (tree); +static rtx expand_builtin_va_end (tree); +static rtx expand_builtin_va_copy (tree); +static rtx expand_builtin_memcmp (tree, tree, rtx, enum machine_mode); +static rtx expand_builtin_strcmp (tree, rtx, enum machine_mode); +static rtx expand_builtin_strncmp (tree, rtx, enum machine_mode); +static rtx builtin_memcpy_read_str (void *, HOST_WIDE_INT, enum machine_mode); +static rtx expand_builtin_strcat (tree, rtx, enum machine_mode); +static rtx expand_builtin_strncat (tree, rtx, enum machine_mode); +static rtx expand_builtin_strspn (tree, rtx, enum machine_mode); +static rtx expand_builtin_strcspn (tree, rtx, enum machine_mode); +static rtx expand_builtin_memcpy (tree, rtx, enum machine_mode); +static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode, int); +static rtx expand_builtin_memmove (tree, rtx, enum machine_mode); +static rtx expand_builtin_bcopy (tree); +static rtx expand_builtin_strcpy (tree, rtx, enum machine_mode); +static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode); +static rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode); +static rtx expand_builtin_strncpy (tree, rtx, enum machine_mode); +static rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); +static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode); +static rtx expand_builtin_memset (tree, rtx, enum machine_mode); +static rtx expand_builtin_bzero (tree); +static rtx expand_builtin_strlen (tree, rtx, enum machine_mode); +static rtx expand_builtin_strstr (tree, rtx, enum machine_mode); +static rtx expand_builtin_strpbrk (tree, rtx, enum machine_mode); +static rtx expand_builtin_strchr (tree, rtx, enum machine_mode); +static rtx expand_builtin_strrchr (tree, rtx, enum machine_mode); +static rtx expand_builtin_alloca (tree, rtx); +static rtx expand_builtin_unop (enum machine_mode, tree, rtx, rtx, optab); +static rtx expand_builtin_frame_address (tree, tree); +static rtx expand_builtin_fputs (tree, rtx, bool); +static rtx expand_builtin_printf (tree, rtx, enum machine_mode, bool); +static rtx expand_builtin_fprintf (tree, rtx, enum machine_mode, bool); +static rtx expand_builtin_sprintf (tree, rtx, enum machine_mode); +static tree stabilize_va_list (tree, int); +static rtx expand_builtin_expect (tree, rtx); +static tree fold_builtin_constant_p (tree); +static tree fold_builtin_classify_type (tree); +static tree fold_builtin_inf (tree, int); +static tree fold_builtin_nan (tree, tree, int); +static int validate_arglist (tree, ...); +static bool integer_valued_real_p (tree); +static tree fold_trunc_transparent_mathfn (tree); +static bool readonly_data_expr (tree); +static rtx expand_builtin_fabs (tree, rtx, rtx); +static rtx expand_builtin_cabs (tree, rtx); +static tree fold_builtin_cabs (tree, tree, tree); +static tree fold_builtin_trunc (tree); +static tree fold_builtin_floor (tree); +static tree fold_builtin_ceil (tree); +static tree fold_builtin_bitop (tree); +static tree fold_builtin_memcpy (tree); +static tree fold_builtin_mempcpy (tree); +static tree fold_builtin_memmove (tree); +static tree fold_builtin_strcpy (tree); +static tree fold_builtin_strncpy (tree); +static tree fold_builtin_memcmp (tree); +static tree fold_builtin_strcmp (tree); +static tree fold_builtin_strncmp (tree); /* Return the alignment in bits of EXP, a pointer valued expression. But don't return more than MAX_ALIGN no matter what. @@ -162,9 +175,7 @@ static int validate_arglist PARAMS ((tree, ...)); expression is actually pointing at an object whose alignment is tighter. */ static int -get_pointer_alignment (exp, max_align) - tree exp; - unsigned int max_align; +get_pointer_alignment (tree exp, unsigned int max_align) { unsigned int align, inner; @@ -227,20 +238,42 @@ get_pointer_alignment (exp, max_align) way, because it could contain a zero byte in the middle. TREE_STRING_LENGTH is the size of the character array, not the string. + ONLY_VALUE should be nonzero if the result is not going to be emitted + into the instruction stream and zero if it is going to be expanded. + E.g. with i++ ? "foo" : "bar", if ONLY_VALUE is nonzero, constant 3 + is returned, otherwise NULL, since + len = c_strlen (src, 1); if (len) expand_expr (len, ...); would not + evaluate the side-effects. + The value returned is of type `ssizetype'. Unfortunately, string_constant can't access the values of const char arrays with initializers, so neither can we do so here. */ static tree -c_strlen (src) - tree src; +c_strlen (tree src, int only_value) { tree offset_node; HOST_WIDE_INT offset; int max; const char *ptr; + STRIP_NOPS (src); + if (TREE_CODE (src) == COND_EXPR + && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) + { + tree len1, len2; + + len1 = c_strlen (TREE_OPERAND (src, 1), only_value); + len2 = c_strlen (TREE_OPERAND (src, 2), only_value); + if (tree_int_cst_equal (len1, len2)) + return len1; + } + + if (TREE_CODE (src) == COMPOUND_EXPR + && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) + return c_strlen (TREE_OPERAND (src, 1), only_value); + src = string_constant (src, &offset_node); if (src == 0) return 0; @@ -299,8 +332,7 @@ c_strlen (src) or sum of string constant and integer constant. */ static const char * -c_getstr (src) - tree src; +c_getstr (tree src) { tree offset_node; @@ -321,9 +353,7 @@ c_getstr (src) GET_MODE_BITSIZE (MODE) bits from string constant STR. */ static rtx -c_readstr (str, mode) - const char *str; - enum machine_mode mode; +c_readstr (const char *str, enum machine_mode mode) { HOST_WIDE_INT c[2]; HOST_WIDE_INT ch; @@ -357,9 +387,7 @@ c_readstr (str, mode) P. */ static int -target_char_cast (cst, p) - tree cst; - char *p; +target_char_cast (tree cst, char *p) { unsigned HOST_WIDE_INT val, hostval; @@ -387,10 +415,8 @@ target_char_cast (cst, p) address located within it (depending on FNDECL_CODE). */ rtx -expand_builtin_return_addr (fndecl_code, count, tem) - enum built_in_function fndecl_code; - int count; - rtx tem; +expand_builtin_return_addr (enum built_in_function fndecl_code, int count, + rtx tem) { int i; @@ -450,9 +476,7 @@ static HOST_WIDE_INT setjmp_alias_set = -1; handling code. */ void -expand_builtin_setjmp_setup (buf_addr, receiver_label) - rtx buf_addr; - rtx receiver_label; +expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label) { enum machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); rtx stack_save; @@ -461,10 +485,7 @@ expand_builtin_setjmp_setup (buf_addr, receiver_label) if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (buf_addr) != Pmode) - buf_addr = convert_memory_address (Pmode, buf_addr); -#endif + buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, force_operand (buf_addr, NULL_RTX)); @@ -513,8 +534,7 @@ expand_builtin_setjmp_setup (buf_addr, receiver_label) This is used directly by sjlj exception handling code. */ void -expand_builtin_setjmp_receiver (receiver_label) - rtx receiver_label ATTRIBUTE_UNUSED; +expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED) { /* Clobber the FP when we get here, so we have to make sure it's marked as used by this function. */ @@ -586,9 +606,7 @@ expand_builtin_setjmp_receiver (receiver_label) them. */ static rtx -expand_builtin_setjmp (arglist, target) - tree arglist; - rtx target; +expand_builtin_setjmp (tree arglist, rtx target) { rtx buf_addr, next_lab, cont_lab; @@ -606,10 +624,11 @@ expand_builtin_setjmp (arglist, target) expand_builtin_setjmp_setup (buf_addr, next_lab); - /* Set TARGET to zero and branch to the continue label. */ + /* Set TARGET to zero and branch to the continue label. Use emit_jump to + ensure that pending stack adjustments are flushed. */ emit_move_insn (target, const0_rtx); - emit_jump_insn (gen_jump (cont_lab)); - emit_barrier (); + emit_jump (cont_lab); + emit_label (next_lab); expand_builtin_setjmp_receiver (next_lab); @@ -639,8 +658,7 @@ expand_builtin_setjmp (arglist, target) them. */ void -expand_builtin_longjmp (buf_addr, value) - rtx buf_addr, value; +expand_builtin_longjmp (rtx buf_addr, rtx value) { rtx fp, lab, stack, insn, last; enum machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); @@ -648,10 +666,7 @@ expand_builtin_longjmp (buf_addr, value) if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (buf_addr) != Pmode) - buf_addr = convert_memory_address (Pmode, buf_addr); -#endif + buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, buf_addr); @@ -695,6 +710,13 @@ expand_builtin_longjmp (buf_addr, value) { lab = copy_to_reg (lab); + emit_insn (gen_rtx_CLOBBER (VOIDmode, + gen_rtx_MEM (BLKmode, + gen_rtx_SCRATCH (VOIDmode)))); + emit_insn (gen_rtx_CLOBBER (VOIDmode, + gen_rtx_MEM (BLKmode, + hard_frame_pointer_rtx))); + emit_move_insn (hard_frame_pointer_rtx, fp); emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX); @@ -729,8 +751,7 @@ expand_builtin_longjmp (buf_addr, value) effects. */ static void -expand_builtin_prefetch (arglist) - tree arglist; +expand_builtin_prefetch (tree arglist) { tree arg0, arg1, arg2; rtx op0, op1, op2; @@ -793,12 +814,9 @@ expand_builtin_prefetch (arglist) if ((! (*insn_data[(int) CODE_FOR_prefetch].operand[0].predicate) (op0, insn_data[(int) CODE_FOR_prefetch].operand[0].mode)) - || (GET_MODE(op0) != Pmode)) + || (GET_MODE (op0) != Pmode)) { -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE(op0) != Pmode) - op0 = convert_memory_address (Pmode, op0); -#endif + op0 = convert_memory_address (Pmode, op0); op0 = force_reg (Pmode, op0); } emit_insn (gen_prefetch (op0, op1, op2)); @@ -816,16 +834,12 @@ expand_builtin_prefetch (arglist) to be used to be used in a string instruction (cmpstrsi, movstrsi, ..). */ static rtx -get_memory_rtx (exp) - tree exp; +get_memory_rtx (tree exp) { rtx addr = expand_expr (exp, NULL_RTX, ptr_mode, EXPAND_SUM); rtx mem; -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (addr) != Pmode) - addr = convert_memory_address (Pmode, addr); -#endif + addr = convert_memory_address (Pmode, addr); mem = gen_rtx_MEM (BLKmode, memory_address (BLKmode, addr)); @@ -879,8 +893,7 @@ static int apply_args_reg_offset[FIRST_PSEUDO_REGISTER]; needed in objc-act.c. */ int -apply_args_register_offset (regno) - int regno; +apply_args_register_offset (int regno) { apply_args_size (); @@ -896,7 +909,7 @@ apply_args_register_offset (regno) and initialize apply_args_mode. */ static int -apply_args_size () +apply_args_size (void) { static int size = -1; int align; @@ -911,7 +924,7 @@ apply_args_size () /* The second value is the structure value address unless this is passed as an "invisible" first argument. */ - if (struct_value_rtx) + if (targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0)) size += GET_MODE_SIZE (Pmode); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) @@ -976,7 +989,7 @@ apply_args_size () and initialize apply_result_mode. */ static int -apply_result_size () +apply_result_size (void) { static int size = -1; int align, regno; @@ -1052,14 +1065,12 @@ apply_result_size () restore the values. */ static rtx -result_vector (savep, result) - int savep; - rtx result; +result_vector (int savep, rtx result) { int regno, size, align, nelts; enum machine_mode mode; rtx reg, mem; - rtx *savevec = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); + rtx *savevec = alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); size = nelts = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) @@ -1083,11 +1094,12 @@ result_vector (savep, result) arguments as were passed to the current function. */ static rtx -expand_builtin_apply_args_1 () +expand_builtin_apply_args_1 (void) { - rtx registers; + rtx registers, tem; int size, align, regno; enum machine_mode mode; + rtx struct_incoming_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 1); /* Create a block where the arg-pointer, structure value address, and argument registers can be saved. */ @@ -1095,15 +1107,13 @@ expand_builtin_apply_args_1 () /* Walk past the arg-pointer and structure value address. */ size = GET_MODE_SIZE (Pmode); - if (struct_value_rtx) + if (targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0)) size += GET_MODE_SIZE (Pmode); /* Save each register used in calling a function to the block. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_args_mode[regno]) != VOIDmode) { - rtx tem; - align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; @@ -1115,16 +1125,25 @@ expand_builtin_apply_args_1 () } /* Save the arg pointer to the block. */ - emit_move_insn (adjust_address (registers, Pmode, 0), - copy_to_reg (virtual_incoming_args_rtx)); + tem = copy_to_reg (virtual_incoming_args_rtx); +#ifdef STACK_GROWS_DOWNWARD + /* We need the pointer as the caller actually passed them to us, not + as we might have pretended they were passed. Make sure it's a valid + operand, as emit_move_insn isn't expected to handle a PLUS. */ + tem + = force_operand (plus_constant (tem, current_function_pretend_args_size), + NULL_RTX); +#endif + emit_move_insn (adjust_address (registers, Pmode, 0), tem); + size = GET_MODE_SIZE (Pmode); /* Save the structure value address unless this is passed as an "invisible" first argument. */ - if (struct_value_incoming_rtx) + if (struct_incoming_value) { emit_move_insn (adjust_address (registers, Pmode, size), - copy_to_reg (struct_value_incoming_rtx)); + copy_to_reg (struct_incoming_value)); size += GET_MODE_SIZE (Pmode); } @@ -1140,7 +1159,7 @@ expand_builtin_apply_args_1 () saved. */ static rtx -expand_builtin_apply_args () +expand_builtin_apply_args (void) { /* Don't do __builtin_apply_args more than once in a function. Save the result of the first call and reuse it. */ @@ -1175,19 +1194,16 @@ expand_builtin_apply_args () untyped return of whatever value was returned by the given function. */ static rtx -expand_builtin_apply (function, arguments, argsize) - rtx function, arguments, argsize; +expand_builtin_apply (rtx function, rtx arguments, rtx argsize) { int size, align, regno; enum machine_mode mode; rtx incoming_args, result, reg, dest, src, call_insn; rtx old_stack_level = 0; rtx call_fusage = 0; + rtx struct_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (arguments) != Pmode) - arguments = convert_memory_address (Pmode, arguments); -#endif + arguments = convert_memory_address (Pmode, arguments); /* Create a block where the return registers can be saved. */ result = assign_stack_local (BLKmode, apply_result_size (), -1); @@ -1209,7 +1225,7 @@ expand_builtin_apply (function, arguments, argsize) do_pending_stack_adjust (); NO_DEFER_POP; - /* Save the stack with nonlocal if available */ + /* Save the stack with nonlocal if available. */ #ifdef HAVE_save_stack_nonlocal if (HAVE_save_stack_nonlocal) emit_stack_save (SAVE_NONLOCAL, &old_stack_level, NULL_RTX); @@ -1217,12 +1233,16 @@ expand_builtin_apply (function, arguments, argsize) #endif emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); - /* Push a block of memory onto the stack to store the memory arguments. - Save the address in a register, and copy the memory arguments. ??? I - haven't figured out how the calling convention macros effect this, - but it's likely that the source and/or destination addresses in - the block copy will need updating in machine specific ways. */ - dest = allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT); + /* Allocate a block of memory onto the stack and copy the memory + arguments to the outgoing arguments address. */ + allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT); + dest = virtual_outgoing_args_rtx; +#ifndef STACK_GROWS_DOWNWARD + if (GET_CODE (argsize) == CONST_INT) + dest = plus_constant (dest, -INTVAL (argsize)); + else + dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize)); +#endif dest = gen_rtx_MEM (BLKmode, dest); set_mem_align (dest, PARM_BOUNDARY); src = gen_rtx_MEM (BLKmode, incoming_args); @@ -1236,7 +1256,7 @@ expand_builtin_apply (function, arguments, argsize) /* Walk past the arg-pointer and structure value address. */ size = GET_MODE_SIZE (Pmode); - if (struct_value_rtx) + if (struct_value) size += GET_MODE_SIZE (Pmode); /* Restore each of the registers previously saved. Make USE insns @@ -1256,13 +1276,13 @@ expand_builtin_apply (function, arguments, argsize) /* Restore the structure value address unless this is passed as an "invisible" first argument. */ size = GET_MODE_SIZE (Pmode); - if (struct_value_rtx) + if (struct_value) { rtx value = gen_reg_rtx (Pmode); emit_move_insn (value, adjust_address (arguments, Pmode, size)); - emit_move_insn (struct_value_rtx, value); - if (GET_CODE (struct_value_rtx) == REG) - use_reg (&call_fusage, struct_value_rtx); + emit_move_insn (struct_value, value); + if (GET_CODE (struct_value) == REG) + use_reg (&call_fusage, struct_value); size += GET_MODE_SIZE (Pmode); } @@ -1309,29 +1329,10 @@ expand_builtin_apply (function, arguments, argsize) #endif abort (); - /* Find the CALL insn we just emitted. */ - for (call_insn = get_last_insn (); - call_insn && GET_CODE (call_insn) != CALL_INSN; - call_insn = PREV_INSN (call_insn)) - ; - - if (! call_insn) - abort (); - - /* Put the register usage information on the CALL. If there is already - some usage information, put ours at the end. */ - if (CALL_INSN_FUNCTION_USAGE (call_insn)) - { - rtx link; - - for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0; - link = XEXP (link, 1)) - ; - - XEXP (link, 1) = call_fusage; - } - else - CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage; + /* Find the CALL insn we just emitted, and attach the register usage + information. */ + call_insn = last_call_insn (); + add_function_usage_to (call_insn, call_fusage); /* Restore the stack. */ #ifdef HAVE_save_stack_nonlocal @@ -1345,28 +1346,20 @@ expand_builtin_apply (function, arguments, argsize) /* Return the address of the result block. */ result = copy_addr_to_reg (XEXP (result, 0)); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (result) != ptr_mode) - result = convert_memory_address (ptr_mode, result); -#endif - return result; + return convert_memory_address (ptr_mode, result); } /* Perform an untyped return. */ static void -expand_builtin_return (result) - rtx result; +expand_builtin_return (rtx result) { int size, align, regno; enum machine_mode mode; rtx reg; rtx call_fusage = 0; -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (result) != Pmode) - result = convert_memory_address (Pmode, result); -#endif + result = convert_memory_address (Pmode, result); apply_result_size (); result = gen_rtx_MEM (BLKmode, result); @@ -1403,14 +1396,13 @@ expand_builtin_return (result) /* Return whatever values was restored by jumping directly to the end of the function. */ - expand_null_return (); + expand_naked_return (); } /* Used by expand_builtin_classify_type and fold_builtin_classify_type. */ static enum type_class -type_to_class (type) - tree type; +type_to_class (tree type) { switch (TREE_CODE (type)) { @@ -1442,8 +1434,7 @@ type_to_class (type) ARGLIST. */ static rtx -expand_builtin_classify_type (arglist) - tree arglist; +expand_builtin_classify_type (tree arglist) { if (arglist != 0) return GEN_INT (type_to_class (TREE_TYPE (TREE_VALUE (arglist)))); @@ -1453,11 +1444,8 @@ expand_builtin_classify_type (arglist) /* Expand expression EXP, which is a call to __builtin_constant_p. */ static rtx -expand_builtin_constant_p (exp) - tree exp; +expand_builtin_constant_p (tree arglist, enum machine_mode target_mode) { - tree arglist = TREE_OPERAND (exp, 1); - enum machine_mode value_mode = TYPE_MODE (TREE_TYPE (exp)); rtx tmp; if (arglist == 0) @@ -1465,14 +1453,166 @@ expand_builtin_constant_p (exp) arglist = TREE_VALUE (arglist); /* We have taken care of the easy cases during constant folding. This - case is not obvious, so emit (constant_p_rtx (ARGLIST)) and let CSE get a - chance to see if it can deduce whether ARGLIST is constant. */ + case is not obvious, so emit (constant_p_rtx (ARGLIST)) and let CSE + get a chance to see if it can deduce whether ARGLIST is constant. + If CSE isn't going to run, of course, don't bother waiting. */ + + if (cse_not_expected) + return const0_rtx; + + current_function_calls_constant_p = 1; tmp = expand_expr (arglist, NULL_RTX, VOIDmode, 0); - tmp = gen_rtx_CONSTANT_P_RTX (value_mode, tmp); + tmp = gen_rtx_CONSTANT_P_RTX (target_mode, tmp); return tmp; } +/* This helper macro, meant to be used in mathfn_built_in below, + determines which among a set of three builtin math functions is + appropriate for a given type mode. The `F' and `L' cases are + automatically generated from the `double' case. */ +#define CASE_MATHFN(BUILT_IN_MATHFN) \ + case BUILT_IN_MATHFN: case BUILT_IN_MATHFN##F: case BUILT_IN_MATHFN##L: \ + fcode = BUILT_IN_MATHFN; fcodef = BUILT_IN_MATHFN##F ; \ + fcodel = BUILT_IN_MATHFN##L ; break; + +/* Return mathematic function equivalent to FN but operating directly + on TYPE, if available. If we can't do the conversion, return zero. */ +tree +mathfn_built_in (tree type, enum built_in_function fn) +{ + const enum machine_mode type_mode = TYPE_MODE (type); + enum built_in_function fcode, fcodef, fcodel; + + switch (fn) + { + CASE_MATHFN (BUILT_IN_ACOS) + CASE_MATHFN (BUILT_IN_ACOSH) + CASE_MATHFN (BUILT_IN_ASIN) + CASE_MATHFN (BUILT_IN_ASINH) + CASE_MATHFN (BUILT_IN_ATAN) + CASE_MATHFN (BUILT_IN_ATAN2) + CASE_MATHFN (BUILT_IN_ATANH) + CASE_MATHFN (BUILT_IN_CBRT) + CASE_MATHFN (BUILT_IN_CEIL) + CASE_MATHFN (BUILT_IN_COPYSIGN) + CASE_MATHFN (BUILT_IN_COS) + CASE_MATHFN (BUILT_IN_COSH) + CASE_MATHFN (BUILT_IN_DREM) + CASE_MATHFN (BUILT_IN_ERF) + CASE_MATHFN (BUILT_IN_ERFC) + CASE_MATHFN (BUILT_IN_EXP) + CASE_MATHFN (BUILT_IN_EXP10) + CASE_MATHFN (BUILT_IN_EXP2) + CASE_MATHFN (BUILT_IN_EXPM1) + CASE_MATHFN (BUILT_IN_FABS) + CASE_MATHFN (BUILT_IN_FDIM) + CASE_MATHFN (BUILT_IN_FLOOR) + CASE_MATHFN (BUILT_IN_FMA) + CASE_MATHFN (BUILT_IN_FMAX) + CASE_MATHFN (BUILT_IN_FMIN) + CASE_MATHFN (BUILT_IN_FMOD) + CASE_MATHFN (BUILT_IN_FREXP) + CASE_MATHFN (BUILT_IN_GAMMA) + CASE_MATHFN (BUILT_IN_HUGE_VAL) + CASE_MATHFN (BUILT_IN_HYPOT) + CASE_MATHFN (BUILT_IN_ILOGB) + CASE_MATHFN (BUILT_IN_INF) + CASE_MATHFN (BUILT_IN_J0) + CASE_MATHFN (BUILT_IN_J1) + CASE_MATHFN (BUILT_IN_JN) + CASE_MATHFN (BUILT_IN_LDEXP) + CASE_MATHFN (BUILT_IN_LGAMMA) + CASE_MATHFN (BUILT_IN_LLRINT) + CASE_MATHFN (BUILT_IN_LLROUND) + CASE_MATHFN (BUILT_IN_LOG) + CASE_MATHFN (BUILT_IN_LOG10) + CASE_MATHFN (BUILT_IN_LOG1P) + CASE_MATHFN (BUILT_IN_LOG2) + CASE_MATHFN (BUILT_IN_LOGB) + CASE_MATHFN (BUILT_IN_LRINT) + CASE_MATHFN (BUILT_IN_LROUND) + CASE_MATHFN (BUILT_IN_MODF) + CASE_MATHFN (BUILT_IN_NAN) + CASE_MATHFN (BUILT_IN_NANS) + CASE_MATHFN (BUILT_IN_NEARBYINT) + CASE_MATHFN (BUILT_IN_NEXTAFTER) + CASE_MATHFN (BUILT_IN_NEXTTOWARD) + CASE_MATHFN (BUILT_IN_POW) + CASE_MATHFN (BUILT_IN_POW10) + CASE_MATHFN (BUILT_IN_REMAINDER) + CASE_MATHFN (BUILT_IN_REMQUO) + CASE_MATHFN (BUILT_IN_RINT) + CASE_MATHFN (BUILT_IN_ROUND) + CASE_MATHFN (BUILT_IN_SCALB) + CASE_MATHFN (BUILT_IN_SCALBLN) + CASE_MATHFN (BUILT_IN_SCALBN) + CASE_MATHFN (BUILT_IN_SIGNIFICAND) + CASE_MATHFN (BUILT_IN_SIN) + CASE_MATHFN (BUILT_IN_SINCOS) + CASE_MATHFN (BUILT_IN_SINH) + CASE_MATHFN (BUILT_IN_SQRT) + CASE_MATHFN (BUILT_IN_TAN) + CASE_MATHFN (BUILT_IN_TANH) + CASE_MATHFN (BUILT_IN_TGAMMA) + CASE_MATHFN (BUILT_IN_TRUNC) + CASE_MATHFN (BUILT_IN_Y0) + CASE_MATHFN (BUILT_IN_Y1) + CASE_MATHFN (BUILT_IN_YN) + + default: + return 0; + } + + if (type_mode == TYPE_MODE (double_type_node)) + return implicit_built_in_decls[fcode]; + else if (type_mode == TYPE_MODE (float_type_node)) + return implicit_built_in_decls[fcodef]; + else if (type_mode == TYPE_MODE (long_double_type_node)) + return implicit_built_in_decls[fcodel]; + else + return 0; +} + +/* If errno must be maintained, expand the RTL to check if the result, + TARGET, of a built-in function call, EXP, is NaN, and if so set + errno to EDOM. */ + +static void +expand_errno_check (tree exp, rtx target) +{ + rtx lab = gen_label_rtx (); + + /* Test the result; if it is NaN, set errno=EDOM because + the argument was not in the domain. */ + emit_cmp_and_jump_insns (target, target, EQ, 0, GET_MODE (target), + 0, lab); + +#ifdef TARGET_EDOM + /* If this built-in doesn't throw an exception, set errno directly. */ + if (TREE_NOTHROW (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))) + { +#ifdef GEN_ERRNO_RTX + rtx errno_rtx = GEN_ERRNO_RTX; +#else + rtx errno_rtx + = gen_rtx_MEM (word_mode, gen_rtx_SYMBOL_REF (Pmode, "errno")); +#endif + emit_move_insn (errno_rtx, GEN_INT (TARGET_EDOM)); + emit_label (lab); + return; + } +#endif + + /* We can't set errno=EDOM directly; let the library call do it. + Pop the arguments right away in case the call gets deleted. */ + NO_DEFER_POP; + expand_call (exp, target, 0); + OK_DEFER_POP; + emit_label (lab); +} + + /* Expand a call to one of the builtin math functions (sin, cos, or sqrt). Return 0 if a normal call should be emitted rather than expanding the function in-line. EXP is the expression that is a call to the builtin @@ -1480,42 +1620,20 @@ expand_builtin_constant_p (exp) SUBTARGET may be used as the target for computing one of EXP's operands. */ static rtx -expand_builtin_mathfn (exp, target, subtarget) - tree exp; - rtx target, subtarget; +expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) { optab builtin_optab; - rtx op0, insns; - tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + rtx op0, insns, before_call; + tree fndecl = get_callee_fndecl (exp); tree arglist = TREE_OPERAND (exp, 1); - enum machine_mode argmode; + enum machine_mode mode; + bool errno_set = false; + tree arg, narg; if (!validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) return 0; - /* Stabilize and compute the argument. */ - if (TREE_CODE (TREE_VALUE (arglist)) != VAR_DECL - && TREE_CODE (TREE_VALUE (arglist)) != PARM_DECL) - { - exp = copy_node (exp); - TREE_OPERAND (exp, 1) = arglist; - /* Wrap the computation of the argument in a SAVE_EXPR. That - way, if we need to expand the argument again (as in the - flag_errno_math case below where we cannot directly set - errno), we will not perform side-effects more than once. - Note that here we're mutating the original EXP as well as the - copy; that's the right thing to do in case the original EXP - is expanded later. */ - TREE_VALUE (arglist) = save_expr (TREE_VALUE (arglist)); - arglist = copy_node (arglist); - } - op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0); - - /* Make a suitable register to place result in. */ - target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp))); - - emit_queue (); - start_sequence (); + arg = TREE_VALUE (arglist); switch (DECL_FUNCTION_CODE (fndecl)) { @@ -1530,67 +1648,238 @@ expand_builtin_mathfn (exp, target, subtarget) case BUILT_IN_SQRT: case BUILT_IN_SQRTF: case BUILT_IN_SQRTL: - builtin_optab = sqrt_optab; break; + errno_set = ! tree_expr_nonnegative_p (arg); + builtin_optab = sqrt_optab; + break; case BUILT_IN_EXP: case BUILT_IN_EXPF: case BUILT_IN_EXPL: - builtin_optab = exp_optab; break; + errno_set = true; builtin_optab = exp_optab; break; case BUILT_IN_LOG: case BUILT_IN_LOGF: case BUILT_IN_LOGL: - builtin_optab = log_optab; break; + errno_set = true; builtin_optab = log_optab; break; + case BUILT_IN_TAN: + case BUILT_IN_TANF: + case BUILT_IN_TANL: + builtin_optab = tan_optab; break; + case BUILT_IN_ATAN: + case BUILT_IN_ATANF: + case BUILT_IN_ATANL: + builtin_optab = atan_optab; break; + case BUILT_IN_FLOOR: + case BUILT_IN_FLOORF: + case BUILT_IN_FLOORL: + builtin_optab = floor_optab; break; + case BUILT_IN_CEIL: + case BUILT_IN_CEILF: + case BUILT_IN_CEILL: + builtin_optab = ceil_optab; break; + case BUILT_IN_TRUNC: + case BUILT_IN_TRUNCF: + case BUILT_IN_TRUNCL: + builtin_optab = btrunc_optab; break; + case BUILT_IN_ROUND: + case BUILT_IN_ROUNDF: + case BUILT_IN_ROUNDL: + builtin_optab = round_optab; break; + case BUILT_IN_NEARBYINT: + case BUILT_IN_NEARBYINTF: + case BUILT_IN_NEARBYINTL: + builtin_optab = nearbyint_optab; break; default: abort (); } + /* Make a suitable register to place result in. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + + if (! flag_errno_math || ! HONOR_NANS (mode)) + errno_set = false; + + /* Before working hard, check whether the instruction is available. */ + if (builtin_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing) + { + target = gen_reg_rtx (mode); + + /* Wrap the computation of the argument in a SAVE_EXPR, as we may + need to expand the argument again. This way, we will not perform + side-effects more the once. */ + narg = save_expr (arg); + if (narg != arg) + { + arglist = build_tree_list (NULL_TREE, arg); + exp = build_function_call_expr (fndecl, arglist); + } + + op0 = expand_expr (arg, subtarget, VOIDmode, 0); + + emit_queue (); + start_sequence (); + + /* Compute into TARGET. + Set TARGET to wherever the result comes back. */ + target = expand_unop (mode, builtin_optab, op0, target, 0); + + if (target != 0) + { + if (errno_set) + expand_errno_check (exp, target); + + /* Output the entire sequence. */ + insns = get_insns (); + end_sequence (); + emit_insn (insns); + return target; + } + + /* If we were unable to expand via the builtin, stop the sequence + (without outputting the insns) and call to the library function + with the stabilized argument list. */ + end_sequence (); + } + + before_call = get_last_insn (); + + target = expand_call (exp, target, target == const0_rtx); + + /* If this is a sqrt operation and we don't care about errno, try to + attach a REG_EQUAL note with a SQRT rtx to the emitted libcall. + This allows the semantics of the libcall to be visible to the RTL + optimizers. */ + if (builtin_optab == sqrt_optab && !errno_set) + { + /* Search backwards through the insns emitted by expand_call looking + for the instruction with the REG_RETVAL note. */ + rtx last = get_last_insn (); + while (last != before_call) + { + if (find_reg_note (last, REG_RETVAL, NULL)) + { + rtx note = find_reg_note (last, REG_EQUAL, NULL); + /* Check that the REQ_EQUAL note is an EXPR_LIST with + two elements, i.e. symbol_ref(sqrt) and the operand. */ + if (note + && GET_CODE (note) == EXPR_LIST + && GET_CODE (XEXP (note, 0)) == EXPR_LIST + && XEXP (XEXP (note, 0), 1) != NULL_RTX + && XEXP (XEXP (XEXP (note, 0), 1), 1) == NULL_RTX) + { + rtx operand = XEXP (XEXP (XEXP (note, 0), 1), 0); + /* Check operand is a register with expected mode. */ + if (operand + && GET_CODE (operand) == REG + && GET_MODE (operand) == mode) + { + /* Replace the REG_EQUAL note with a SQRT rtx. */ + rtx equiv = gen_rtx_SQRT (mode, operand); + set_unique_reg_note (last, REG_EQUAL, equiv); + } + } + break; + } + last = PREV_INSN (last); + } + } + + return target; +} + +/* Expand a call to the builtin binary math functions (pow and atan2). + Return 0 if a normal call should be emitted rather than expanding the + function in-line. EXP is the expression that is a call to the builtin + function; if convenient, the result should be placed in TARGET. + SUBTARGET may be used as the target for computing one of EXP's + operands. */ + +static rtx +expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) +{ + optab builtin_optab; + rtx op0, op1, insns; + tree fndecl = get_callee_fndecl (exp); + tree arglist = TREE_OPERAND (exp, 1); + tree arg0, arg1, temp, narg; + enum machine_mode mode; + bool errno_set = true; + bool stable = true; + + if (!validate_arglist (arglist, REAL_TYPE, REAL_TYPE, VOID_TYPE)) + return 0; + + arg0 = TREE_VALUE (arglist); + arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + + switch (DECL_FUNCTION_CODE (fndecl)) + { + case BUILT_IN_POW: + case BUILT_IN_POWF: + case BUILT_IN_POWL: + builtin_optab = pow_optab; break; + case BUILT_IN_ATAN2: + case BUILT_IN_ATAN2F: + case BUILT_IN_ATAN2L: + builtin_optab = atan2_optab; break; + default: + abort (); + } + + /* Make a suitable register to place result in. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + + /* Before working hard, check whether the instruction is available. */ + if (builtin_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing) + return 0; + + target = gen_reg_rtx (mode); + + if (! flag_errno_math || ! HONOR_NANS (mode)) + errno_set = false; + + /* Alway stabilize the argument list. */ + narg = save_expr (arg1); + if (narg != arg1) + { + temp = build_tree_list (NULL_TREE, narg); + stable = false; + } + else + temp = TREE_CHAIN (arglist); + + narg = save_expr (arg0); + if (narg != arg0) + { + arglist = tree_cons (NULL_TREE, narg, temp); + stable = false; + } + else if (! stable) + arglist = tree_cons (NULL_TREE, arg0, temp); + + if (! stable) + exp = build_function_call_expr (fndecl, arglist); + + op0 = expand_expr (arg0, subtarget, VOIDmode, 0); + op1 = expand_expr (arg1, 0, VOIDmode, 0); + + emit_queue (); + start_sequence (); + /* Compute into TARGET. Set TARGET to wherever the result comes back. */ - argmode = TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))); - target = expand_unop (argmode, builtin_optab, op0, target, 0); + target = expand_binop (mode, builtin_optab, op0, op1, + target, 0, OPTAB_DIRECT); - /* If we were unable to expand via the builtin, stop the - sequence (without outputting the insns) and return 0, causing - a call to the library function. */ + /* If we were unable to expand via the builtin, stop the sequence + (without outputting the insns) and call to the library function + with the stabilized argument list. */ if (target == 0) { end_sequence (); - return 0; + return expand_call (exp, target, target == const0_rtx); } - /* If errno must be maintained, we must set it to EDOM for NaN results. */ - - if (flag_errno_math && HONOR_NANS (argmode)) - { - rtx lab1; - - lab1 = gen_label_rtx (); - - /* Test the result; if it is NaN, set errno=EDOM because - the argument was not in the domain. */ - emit_cmp_and_jump_insns (target, target, EQ, 0, GET_MODE (target), - 0, lab1); - -#ifdef TARGET_EDOM - { -#ifdef GEN_ERRNO_RTX - rtx errno_rtx = GEN_ERRNO_RTX; -#else - rtx errno_rtx - = gen_rtx_MEM (word_mode, gen_rtx_SYMBOL_REF (Pmode, "errno")); -#endif - - emit_move_insn (errno_rtx, GEN_INT (TARGET_EDOM)); - } -#else - /* We can't set errno=EDOM directly; let the library call do it. - Pop the arguments right away in case the call gets deleted. */ - NO_DEFER_POP; - expand_call (exp, target, 0); - OK_DEFER_POP; -#endif - - emit_label (lab1); - } + if (errno_set) + expand_errno_check (exp, target); /* Output the entire sequence. */ insns = get_insns (); @@ -1600,31 +1889,295 @@ expand_builtin_mathfn (exp, target, subtarget) return target; } +/* To evaluate powi(x,n), the floating point value x raised to the + constant integer exponent n, we use a hybrid algorithm that + combines the "window method" with look-up tables. For an + introduction to exponentiation algorithms and "addition chains", + see section 4.6.3, "Evaluation of Powers" of Donald E. Knuth, + "Seminumerical Algorithms", Vol. 2, "The Art of Computer Programming", + 3rd Edition, 1998, and Daniel M. Gordon, "A Survey of Fast Exponentiation + Methods", Journal of Algorithms, Vol. 27, pp. 129-146, 1998. */ + +/* Provide a default value for POWI_MAX_MULTS, the maximum number of + multiplications to inline before calling the system library's pow + function. powi(x,n) requires at worst 2*bits(n)-2 multiplications, + so this default never requires calling pow, powf or powl. */ + +#ifndef POWI_MAX_MULTS +#define POWI_MAX_MULTS (2*HOST_BITS_PER_WIDE_INT-2) +#endif + +/* The size of the "optimal power tree" lookup table. All + exponents less than this value are simply looked up in the + powi_table below. This threshold is also used to size the + cache of pseudo registers that hold intermediate results. */ +#define POWI_TABLE_SIZE 256 + +/* The size, in bits of the window, used in the "window method" + exponentiation algorithm. This is equivalent to a radix of + (1<= POWI_TABLE_SIZE) + { + if (val & 1) + { + digit = val & ((1 << POWI_WINDOW_SIZE) - 1); + result += powi_lookup_cost (digit, cache) + + POWI_WINDOW_SIZE + 1; + val >>= POWI_WINDOW_SIZE; + } + else + { + val >>= 1; + result++; + } + } + + return result + powi_lookup_cost (val, cache); +} + +/* Recursive subroutine of expand_powi. This function takes the array, + CACHE, of already calculated exponents and an exponent N and returns + an RTX that corresponds to CACHE[1]**N, as calculated in mode MODE. */ + +static rtx +expand_powi_1 (enum machine_mode mode, unsigned HOST_WIDE_INT n, rtx *cache) +{ + unsigned HOST_WIDE_INT digit; + rtx target, result; + rtx op0, op1; + + if (n < POWI_TABLE_SIZE) + { + if (cache[n]) + return cache[n]; + + target = gen_reg_rtx (mode); + cache[n] = target; + + op0 = expand_powi_1 (mode, n - powi_table[n], cache); + op1 = expand_powi_1 (mode, powi_table[n], cache); + } + else if (n & 1) + { + target = gen_reg_rtx (mode); + digit = n & ((1 << POWI_WINDOW_SIZE) - 1); + op0 = expand_powi_1 (mode, n - digit, cache); + op1 = expand_powi_1 (mode, digit, cache); + } + else + { + target = gen_reg_rtx (mode); + op0 = expand_powi_1 (mode, n >> 1, cache); + op1 = op0; + } + + result = expand_mult (mode, op0, op1, target, 0); + if (result != target) + emit_move_insn (target, result); + return target; +} + +/* Expand the RTL to evaluate powi(x,n) in mode MODE. X is the + floating point operand in mode MODE, and N is the exponent. This + function needs to be kept in sync with powi_cost above. */ + +static rtx +expand_powi (rtx x, enum machine_mode mode, HOST_WIDE_INT n) +{ + unsigned HOST_WIDE_INT val; + rtx cache[POWI_TABLE_SIZE]; + rtx result; + + if (n == 0) + return CONST1_RTX (mode); + + val = (n < 0) ? -n : n; + + memset (cache, 0, sizeof (cache)); + cache[1] = x; + + result = expand_powi_1 (mode, (n < 0) ? -n : n, cache); + + /* If the original exponent was negative, reciprocate the result. */ + if (n < 0) + result = expand_binop (mode, sdiv_optab, CONST1_RTX (mode), + result, NULL_RTX, 0, OPTAB_LIB_WIDEN); + + return result; +} + +/* Expand a call to the pow built-in mathematical function. Return 0 if + a normal call should be emitted rather than expanding the function + in-line. EXP is the expression that is a call to the builtin + function; if convenient, the result should be placed in TARGET. */ + +static rtx +expand_builtin_pow (tree exp, rtx target, rtx subtarget) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg0, arg1; + + if (! validate_arglist (arglist, REAL_TYPE, REAL_TYPE, VOID_TYPE)) + return 0; + + arg0 = TREE_VALUE (arglist); + arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + + if (TREE_CODE (arg1) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (arg1)) + { + REAL_VALUE_TYPE cint; + REAL_VALUE_TYPE c; + HOST_WIDE_INT n; + + c = TREE_REAL_CST (arg1); + n = real_to_integer (&c); + real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0); + if (real_identical (&c, &cint)) + { + /* If the exponent is -1, 0, 1 or 2, then expand_powi is exact. + Otherwise, check the number of multiplications required. + Note that pow never sets errno for an integer exponent. */ + if ((n >= -1 && n <= 2) + || (flag_unsafe_math_optimizations + && ! optimize_size + && powi_cost (n) <= POWI_MAX_MULTS)) + { + enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); + rtx op = expand_expr (arg0, subtarget, VOIDmode, 0); + op = force_reg (mode, op); + return expand_powi (op, mode, n); + } + } + } + return expand_builtin_mathfn_2 (exp, target, NULL_RTX); +} + /* Expand expression EXP which is a call to the strlen builtin. Return 0 if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient. */ static rtx -expand_builtin_strlen (exp, target) - tree exp; - rtx target; +expand_builtin_strlen (tree arglist, rtx target, + enum machine_mode target_mode) { - tree arglist = TREE_OPERAND (exp, 1); - enum machine_mode value_mode = TYPE_MODE (TREE_TYPE (exp)); - if (!validate_arglist (arglist, POINTER_TYPE, VOID_TYPE)) return 0; else { rtx pat; - tree src = TREE_VALUE (arglist); - - int align - = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - + tree len, src = TREE_VALUE (arglist); rtx result, src_reg, char_rtx, before_strlen; - enum machine_mode insn_mode = value_mode, char_mode; + enum machine_mode insn_mode = target_mode, char_mode; enum insn_code icode = CODE_FOR_nothing; + int align; + + /* If the length can be computed at compile-time, return it. */ + len = c_strlen (src, 0); + if (len) + return expand_expr (len, target, target_mode, EXPAND_NORMAL); + + /* If the length can be computed at compile-time and is constant + integer, but there are side-effects in src, evaluate + src for side-effects, then return len. + E.g. x = strlen (i++ ? "xfoo" + 1 : "bar"); + can be optimized into: i++; x = 3; */ + len = c_strlen (src, 1); + if (len && TREE_CODE (len) == INTEGER_CST) + { + expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (len, target, target_mode, EXPAND_NORMAL); + } + + align = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; /* If SRC is not a pointer type, don't do this operation inline. */ if (align == 0) @@ -1686,12 +2239,12 @@ expand_builtin_strlen (exp, target) emit_insn_before (pat, get_insns ()); /* Return the value in the proper mode for this function. */ - if (GET_MODE (result) == value_mode) + if (GET_MODE (result) == target_mode) target = result; else if (target != 0) convert_move (target, result, 0); else - target = convert_to_mode (value_mode, result, 0); + target = convert_to_mode (target_mode, result, 0); return target; } @@ -1702,10 +2255,7 @@ expand_builtin_strlen (exp, target) in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_strstr (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strstr (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; @@ -1729,7 +2279,8 @@ expand_builtin_strstr (arglist, target, mode) /* Return an offset into the constant string argument. */ return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, ssize_int (r - p1))), + s1, convert (TREE_TYPE (s1), + ssize_int (r - p1)))), target, mode, EXPAND_NORMAL); } @@ -1739,7 +2290,7 @@ expand_builtin_strstr (arglist, target, mode) if (p2[1] != '\0') return 0; - fn = built_in_decls[BUILT_IN_STRCHR]; + fn = implicit_built_in_decls[BUILT_IN_STRCHR]; if (!fn) return 0; @@ -1758,10 +2309,7 @@ expand_builtin_strstr (arglist, target, mode) in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_strchr (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strchr (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; @@ -1789,7 +2337,8 @@ expand_builtin_strchr (arglist, target, mode) /* Return an offset into the constant string argument. */ return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, ssize_int (r - p1))), + s1, convert (TREE_TYPE (s1), + ssize_int (r - p1)))), target, mode, EXPAND_NORMAL); } @@ -1804,10 +2353,7 @@ expand_builtin_strchr (arglist, target, mode) in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_strrchr (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strrchr (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; @@ -1836,14 +2382,15 @@ expand_builtin_strrchr (arglist, target, mode) /* Return an offset into the constant string argument. */ return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, ssize_int (r - p1))), + s1, convert (TREE_TYPE (s1), + ssize_int (r - p1)))), target, mode, EXPAND_NORMAL); } if (! integer_zerop (s2)) return 0; - fn = built_in_decls[BUILT_IN_STRCHR]; + fn = implicit_built_in_decls[BUILT_IN_STRCHR]; if (!fn) return 0; @@ -1858,10 +2405,7 @@ expand_builtin_strrchr (arglist, target, mode) in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_strpbrk (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strpbrk (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; @@ -1885,7 +2429,8 @@ expand_builtin_strpbrk (arglist, target, mode) /* Return an offset into the constant string argument. */ return expand_expr (fold (build (PLUS_EXPR, TREE_TYPE (s1), - s1, ssize_int (r - p1))), + s1, convert (TREE_TYPE (s1), + ssize_int (r - p1)))), target, mode, EXPAND_NORMAL); } @@ -1901,7 +2446,7 @@ expand_builtin_strpbrk (arglist, target, mode) if (p2[1] != '\0') return 0; /* Really call strpbrk. */ - fn = built_in_decls[BUILT_IN_STRCHR]; + fn = implicit_built_in_decls[BUILT_IN_STRCHR]; if (!fn) return 0; @@ -1920,10 +2465,8 @@ expand_builtin_strpbrk (arglist, target, mode) constant. */ static rtx -builtin_memcpy_read_str (data, offset, mode) - PTR data; - HOST_WIDE_INT offset; - enum machine_mode mode; +builtin_memcpy_read_str (void *data, HOST_WIDE_INT offset, + enum machine_mode mode) { const char *str = (const char *) data; @@ -1936,15 +2479,11 @@ builtin_memcpy_read_str (data, offset, mode) } /* Expand a call to the memcpy builtin, with arguments in ARGLIST. - Return 0 if we failed, the caller should emit a normal call, otherwise - try to get the result in TARGET, if convenient (and in mode MODE if - that's convenient). */ - + Return 0 if we failed, the caller should emit a normal call, + otherwise try to get the result in TARGET, if convenient (and in + mode MODE if that's convenient). */ static rtx -expand_builtin_memcpy (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_memcpy (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) @@ -1955,7 +2494,6 @@ expand_builtin_memcpy (arglist, target, mode) tree src = TREE_VALUE (TREE_CHAIN (arglist)); tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); const char *src_str; - unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); unsigned int dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); @@ -1966,13 +2504,21 @@ expand_builtin_memcpy (arglist, target, mode) return 0; /* If the LEN parameter is zero, return DEST. */ - if (host_integerp (len, 1) && tree_low_cst (len, 1) == 0) + if (integer_zerop (len)) { /* Evaluate and ignore SRC in case it has side-effects. */ expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); return expand_expr (dest, target, mode, EXPAND_NORMAL); } + /* If SRC and DEST are the same (and not volatile), return DEST. */ + if (operand_equal_p (src, dest, 0)) + { + /* Evaluate and ignore LEN in case it has side-effects. */ + expand_expr (len, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (dest, target, mode, EXPAND_NORMAL); + } + /* If either SRC is not a pointer type, don't do this operation in-line. */ if (src_align == 0) @@ -1990,16 +2536,13 @@ expand_builtin_memcpy (arglist, target, mode) && GET_CODE (len_rtx) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1 && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str, - (PTR) src_str, dest_align)) + (void *) src_str, dest_align)) { - store_by_pieces (dest_mem, INTVAL (len_rtx), - builtin_memcpy_read_str, - (PTR) src_str, dest_align); + dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx), + builtin_memcpy_read_str, + (void *) src_str, dest_align, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_mem) != ptr_mode) - dest_mem = convert_memory_address (ptr_mode, dest_mem); -#endif + dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; } @@ -2013,43 +2556,247 @@ expand_builtin_memcpy (arglist, target, mode) if (dest_addr == 0) { dest_addr = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_addr) != ptr_mode) - dest_addr = convert_memory_address (ptr_mode, dest_addr); -#endif + dest_addr = convert_memory_address (ptr_mode, dest_addr); } - return dest_addr; } } +/* Expand a call to the mempcpy builtin, with arguments in ARGLIST. + Return 0 if we failed the caller should emit a normal call, + otherwise try to get the result in TARGET, if convenient (and in + mode MODE if that's convenient). If ENDP is 0 return the + destination pointer, if ENDP is 1 return the end pointer ala + mempcpy, and if ENDP is 2 return the end pointer minus one ala + stpcpy. */ + +static rtx +expand_builtin_mempcpy (tree arglist, rtx target, enum machine_mode mode, + int endp) +{ + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + /* If return value is ignored, transform mempcpy into memcpy. */ + else if (target == const0_rtx) + { + tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; + + if (!fn) + return 0; + + return expand_expr (build_function_call_expr (fn, arglist), + target, mode, EXPAND_NORMAL); + } + else + { + tree dest = TREE_VALUE (arglist); + tree src = TREE_VALUE (TREE_CHAIN (arglist)); + tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + const char *src_str; + unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + unsigned int dest_align + = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + rtx dest_mem, src_mem, len_rtx; + + /* If DEST is not a pointer type, call the normal function. */ + if (dest_align == 0) + return 0; + + /* If SRC and DEST are the same (and not volatile), do nothing. */ + if (operand_equal_p (src, dest, 0)) + { + tree expr; + + if (endp == 0) + { + /* Evaluate and ignore LEN in case it has side-effects. */ + expand_expr (len, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (dest, target, mode, EXPAND_NORMAL); + } + + if (endp == 2) + len = fold (build (MINUS_EXPR, TREE_TYPE (len), dest, + integer_one_node)); + len = convert (TREE_TYPE (dest), len); + expr = fold (build (PLUS_EXPR, TREE_TYPE (dest), dest, len)); + return expand_expr (expr, target, mode, EXPAND_NORMAL); + } + + /* If LEN is not constant, call the normal function. */ + if (! host_integerp (len, 1)) + return 0; + + /* If the LEN parameter is zero, return DEST. */ + if (tree_low_cst (len, 1) == 0) + { + /* Evaluate and ignore SRC in case it has side-effects. */ + expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (dest, target, mode, EXPAND_NORMAL); + } + + /* If either SRC is not a pointer type, don't do this + operation in-line. */ + if (src_align == 0) + return 0; + + len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); + src_str = c_getstr (src); + + /* If SRC is a string constant and block move would be done + by pieces, we can avoid loading the string from memory + and only stored the computed constants. */ + if (src_str + && GET_CODE (len_rtx) == CONST_INT + && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1 + && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str, + (void *) src_str, dest_align)) + { + dest_mem = get_memory_rtx (dest); + set_mem_align (dest_mem, dest_align); + dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx), + builtin_memcpy_read_str, + (void *) src_str, dest_align, endp); + dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); + dest_mem = convert_memory_address (ptr_mode, dest_mem); + return dest_mem; + } + + if (GET_CODE (len_rtx) == CONST_INT + && can_move_by_pieces (INTVAL (len_rtx), + MIN (dest_align, src_align))) + { + dest_mem = get_memory_rtx (dest); + set_mem_align (dest_mem, dest_align); + src_mem = get_memory_rtx (src); + set_mem_align (src_mem, src_align); + dest_mem = move_by_pieces (dest_mem, src_mem, INTVAL (len_rtx), + MIN (dest_align, src_align), endp); + dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); + dest_mem = convert_memory_address (ptr_mode, dest_mem); + return dest_mem; + } + + return 0; + } +} + +/* Expand expression EXP, which is a call to the memmove builtin. Return 0 + if we failed the caller should emit a normal call. */ + +static rtx +expand_builtin_memmove (tree arglist, rtx target, enum machine_mode mode) +{ + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + else + { + tree dest = TREE_VALUE (arglist); + tree src = TREE_VALUE (TREE_CHAIN (arglist)); + tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + unsigned int dest_align + = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + + /* If DEST is not a pointer type, call the normal function. */ + if (dest_align == 0) + return 0; + + /* If the LEN parameter is zero, return DEST. */ + if (integer_zerop (len)) + { + /* Evaluate and ignore SRC in case it has side-effects. */ + expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (dest, target, mode, EXPAND_NORMAL); + } + + /* If SRC and DEST are the same (and not volatile), return DEST. */ + if (operand_equal_p (src, dest, 0)) + { + /* Evaluate and ignore LEN in case it has side-effects. */ + expand_expr (len, const0_rtx, VOIDmode, EXPAND_NORMAL); + return expand_expr (dest, target, mode, EXPAND_NORMAL); + } + + /* If either SRC is not a pointer type, don't do this + operation in-line. */ + if (src_align == 0) + return 0; + + /* If src is categorized for a readonly section we can use + normal memcpy. */ + if (readonly_data_expr (src)) + { + tree const fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; + if (!fn) + return 0; + return expand_expr (build_function_call_expr (fn, arglist), + target, mode, EXPAND_NORMAL); + } + + /* Otherwise, call the normal function. */ + return 0; + } +} + +/* Expand expression EXP, which is a call to the bcopy builtin. Return 0 + if we failed the caller should emit a normal call. */ + +static rtx +expand_builtin_bcopy (tree arglist) +{ + tree src, dest, size, newarglist; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return NULL_RTX; + + src = TREE_VALUE (arglist); + dest = TREE_VALUE (TREE_CHAIN (arglist)); + size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* New argument list transforming bcopy(ptr x, ptr y, int z) to + memmove(ptr y, ptr x, size_t z). This is done this way + so that if it isn't expanded inline, we fallback to + calling bcopy instead of memmove. */ + + newarglist = build_tree_list (NULL_TREE, convert (sizetype, size)); + newarglist = tree_cons (NULL_TREE, src, newarglist); + newarglist = tree_cons (NULL_TREE, dest, newarglist); + + return expand_builtin_memmove (newarglist, const0_rtx, VOIDmode); +} + /* Expand expression EXP, which is a call to the strcpy builtin. Return 0 if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_strcpy (exp, target, mode) - tree exp; - rtx target; - enum machine_mode mode; +expand_builtin_strcpy (tree arglist, rtx target, enum machine_mode mode) { - tree arglist = TREE_OPERAND (exp, 1); tree fn, len, src, dst; if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; - fn = built_in_decls[BUILT_IN_MEMCPY]; + src = TREE_VALUE (TREE_CHAIN (arglist)); + dst = TREE_VALUE (arglist); + + /* If SRC and DST are equal (and not volatile), return DST. */ + if (operand_equal_p (src, dst, 0)) + return expand_expr (dst, target, mode, EXPAND_NORMAL); + + fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; if (!fn) return 0; - src = TREE_VALUE (TREE_CHAIN (arglist)); - len = c_strlen (src); + len = c_strlen (src, 1); if (len == 0 || TREE_SIDE_EFFECTS (len)) return 0; - dst = TREE_VALUE (arglist); len = size_binop (PLUS_EXPR, len, ssize_int (1)); arglist = build_tree_list (NULL_TREE, len); arglist = tree_cons (NULL_TREE, src, arglist); @@ -2058,15 +2805,55 @@ expand_builtin_strcpy (exp, target, mode) target, mode, EXPAND_NORMAL); } +/* Expand a call to the stpcpy builtin, with arguments in ARGLIST. + Return 0 if we failed the caller should emit a normal call, + otherwise try to get the result in TARGET, if convenient (and in + mode MODE if that's convenient). */ + +static rtx +expand_builtin_stpcpy (tree arglist, rtx target, enum machine_mode mode) +{ + if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) + return 0; + else + { + tree dst, src, len; + + /* If return value is ignored, transform stpcpy into strcpy. */ + if (target == const0_rtx) + { + tree fn = implicit_built_in_decls[BUILT_IN_STRCPY]; + if (!fn) + return 0; + + return expand_expr (build_function_call_expr (fn, arglist), + target, mode, EXPAND_NORMAL); + } + + /* Ensure we get an actual string whose length can be evaluated at + compile-time, not an expression containing a string. This is + because the latter will potentially produce pessimized code + when used to produce the return value. */ + src = TREE_VALUE (TREE_CHAIN (arglist)); + if (! c_getstr (src) || ! (len = c_strlen (src, 0))) + return 0; + + dst = TREE_VALUE (arglist); + len = fold (size_binop (PLUS_EXPR, len, ssize_int (1))); + arglist = build_tree_list (NULL_TREE, len); + arglist = tree_cons (NULL_TREE, src, arglist); + arglist = tree_cons (NULL_TREE, dst, arglist); + return expand_builtin_mempcpy (arglist, target, mode, /*endp=*/2); + } +} + /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) bytes from constant string DATA + OFFSET and return it as target constant. */ static rtx -builtin_strncpy_read_str (data, offset, mode) - PTR data; - HOST_WIDE_INT offset; - enum machine_mode mode; +builtin_strncpy_read_str (void *data, HOST_WIDE_INT offset, + enum machine_mode mode) { const char *str = (const char *) data; @@ -2080,17 +2867,14 @@ builtin_strncpy_read_str (data, offset, mode) if we failed the caller should emit a normal call. */ static rtx -expand_builtin_strncpy (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strncpy (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; else { - tree slen = c_strlen (TREE_VALUE (TREE_CHAIN (arglist))); + tree slen = c_strlen (TREE_VALUE (TREE_CHAIN (arglist)), 1); tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); tree fn; @@ -2130,23 +2914,20 @@ expand_builtin_strncpy (arglist, target, mode) if (!p || dest_align == 0 || !host_integerp (len, 1) || !can_store_by_pieces (tree_low_cst (len, 1), builtin_strncpy_read_str, - (PTR) p, dest_align)) + (void *) p, dest_align)) return 0; dest_mem = get_memory_rtx (dest); store_by_pieces (dest_mem, tree_low_cst (len, 1), builtin_strncpy_read_str, - (PTR) p, dest_align); + (void *) p, dest_align, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_mem) != ptr_mode) - dest_mem = convert_memory_address (ptr_mode, dest_mem); -#endif + dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; } /* OK transform into builtin memcpy. */ - fn = built_in_decls[BUILT_IN_MEMCPY]; + fn = implicit_built_in_decls[BUILT_IN_MEMCPY]; if (!fn) return 0; return expand_expr (build_function_call_expr (fn, arglist), @@ -2159,10 +2940,8 @@ expand_builtin_strncpy (arglist, target, mode) constant. */ static rtx -builtin_memset_read_str (data, offset, mode) - PTR data; - HOST_WIDE_INT offset ATTRIBUTE_UNUSED; - enum machine_mode mode; +builtin_memset_read_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED, + enum machine_mode mode) { const char *c = (const char *) data; char *p = alloca (GET_MODE_SIZE (mode)); @@ -2178,10 +2957,8 @@ builtin_memset_read_str (data, offset, mode) 4 bytes wide, return the RTL for 0x01010101*data. */ static rtx -builtin_memset_gen_str (data, offset, mode) - PTR data; - HOST_WIDE_INT offset ATTRIBUTE_UNUSED; - enum machine_mode mode; +builtin_memset_gen_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED, + enum machine_mode mode) { rtx target, coeff; size_t size; @@ -2206,13 +2983,8 @@ builtin_memset_gen_str (data, offset, mode) convenient). */ static rtx -expand_builtin_memset (exp, target, mode) - tree exp; - rtx target; - enum machine_mode mode; +expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode) { - tree arglist = TREE_OPERAND (exp, 1); - if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; @@ -2233,7 +3005,7 @@ expand_builtin_memset (exp, target, mode) return 0; /* If the LEN parameter is zero, return DEST. */ - if (host_integerp (len, 1) && tree_low_cst (len, 1) == 0) + if (integer_zerop (len)) { /* Evaluate and ignore VAL in case it has side-effects. */ expand_expr (val, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -2256,7 +3028,7 @@ expand_builtin_memset (exp, target, mode) c = 1; if (!can_store_by_pieces (tree_low_cst (len, 1), builtin_memset_read_str, - (PTR) &c, dest_align)) + &c, dest_align)) return 0; val = fold (build1 (CONVERT_EXPR, unsigned_char_type_node, val)); @@ -2266,12 +3038,9 @@ expand_builtin_memset (exp, target, mode) dest_mem = get_memory_rtx (dest); store_by_pieces (dest_mem, tree_low_cst (len, 1), builtin_memset_gen_str, - (PTR) val_rtx, dest_align); + val_rtx, dest_align, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_mem) != ptr_mode) - dest_mem = convert_memory_address (ptr_mode, dest_mem); -#endif + dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; } @@ -2283,19 +3052,16 @@ expand_builtin_memset (exp, target, mode) if (!host_integerp (len, 1)) return 0; if (!can_store_by_pieces (tree_low_cst (len, 1), - builtin_memset_read_str, (PTR) &c, + builtin_memset_read_str, &c, dest_align)) return 0; dest_mem = get_memory_rtx (dest); store_by_pieces (dest_mem, tree_low_cst (len, 1), builtin_memset_read_str, - (PTR) &c, dest_align); + &c, dest_align, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_mem) != ptr_mode) - dest_mem = convert_memory_address (ptr_mode, dest_mem); -#endif + dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; } @@ -2308,10 +3074,7 @@ expand_builtin_memset (exp, target, mode) if (dest_addr == 0) { dest_addr = force_operand (XEXP (dest_mem, 0), NULL_RTX); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dest_addr) != ptr_mode) - dest_addr = convert_memory_address (ptr_mode, dest_addr); -#endif + dest_addr = convert_memory_address (ptr_mode, dest_addr); } return dest_addr; @@ -2322,12 +3085,9 @@ expand_builtin_memset (exp, target, mode) if we failed the caller should emit a normal call. */ static rtx -expand_builtin_bzero (exp) - tree exp; +expand_builtin_bzero (tree arglist) { - tree arglist = TREE_OPERAND (exp, 1); tree dest, size, newarglist; - rtx result; if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; @@ -2344,13 +3104,7 @@ expand_builtin_bzero (exp) newarglist = tree_cons (NULL_TREE, integer_zero_node, newarglist); newarglist = tree_cons (NULL_TREE, dest, newarglist); - TREE_OPERAND (exp, 1) = newarglist; - result = expand_builtin_memset (exp, const0_rtx, VOIDmode); - - /* Always restore the original arguments. */ - TREE_OPERAND (exp, 1) = arglist; - - return result; + return expand_builtin_memset (newarglist, const0_rtx, VOIDmode); } /* Expand expression EXP, which is a call to the memcmp built-in function. @@ -2359,11 +3113,8 @@ expand_builtin_bzero (exp) TARGET, if convenient (and in mode MODE, if that's convenient). */ static rtx -expand_builtin_memcmp (exp, arglist, target, mode) - tree exp ATTRIBUTE_UNUSED; - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, + enum machine_mode mode) { tree arg1, arg2, len; const char *p1, *p2; @@ -2377,7 +3128,7 @@ expand_builtin_memcmp (exp, arglist, target, mode) len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); /* If the len parameter is zero, return zero. */ - if (host_integerp (len, 1) && tree_low_cst (len, 1) == 0) + if (integer_zerop (len)) { /* Evaluate and ignore arg1 and arg2 in case they have side-effects. */ @@ -2386,6 +3137,14 @@ expand_builtin_memcmp (exp, arglist, target, mode) return const0_rtx; } + /* If both arguments are equal (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + { + /* Evaluate and ignore len in case it has side-effects. */ + expand_expr (len, const0_rtx, VOIDmode, EXPAND_NORMAL); + return const0_rtx; + } + p1 = c_getstr (arg1); p2 = c_getstr (arg2); @@ -2402,7 +3161,7 @@ expand_builtin_memcmp (exp, arglist, target, mode) /* If len parameter is one, return an expression corresponding to (*(const unsigned char*)arg1 - (const unsigned char*)arg2). */ - if (host_integerp (len, 1) && tree_low_cst (len, 1) == 1) + if (integer_onep (len)) { tree cst_uchar_node = build_type_variant (unsigned_char_type_node, 1, 0); tree cst_uchar_ptr_node = build_pointer_type (cst_uchar_node); @@ -2418,7 +3177,7 @@ expand_builtin_memcmp (exp, arglist, target, mode) return expand_expr (result, target, mode, EXPAND_NORMAL); } -#ifdef HAVE_cmpstrsi +#if defined HAVE_cmpmemsi || defined HAVE_cmpstrsi { rtx arg1_rtx, arg2_rtx, arg3_rtx; rtx result; @@ -2428,8 +3187,19 @@ expand_builtin_memcmp (exp, arglist, target, mode) = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; int arg2_align = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - enum machine_mode insn_mode - = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + enum machine_mode insn_mode; + +#ifdef HAVE_cmpmemsi + if (HAVE_cmpmemsi) + insn_mode = insn_data[(int) CODE_FOR_cmpmemsi].operand[0].mode; + else +#endif +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) + insn_mode = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + else +#endif + return 0; /* If we don't have POINTER_TYPE, call the function. */ if (arg1_align == 0 || arg2_align == 0) @@ -2445,11 +3215,19 @@ expand_builtin_memcmp (exp, arglist, target, mode) arg1_rtx = get_memory_rtx (arg1); arg2_rtx = get_memory_rtx (arg2); arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); - if (!HAVE_cmpstrsi) - insn = NULL_RTX; +#ifdef HAVE_cmpmemsi + if (HAVE_cmpmemsi) + insn = gen_cmpmemsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); else +#endif +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, GEN_INT (MIN (arg1_align, arg2_align))); + else +#endif + abort (); if (insn) emit_insn (insn); @@ -2484,10 +3262,7 @@ expand_builtin_memcmp (exp, arglist, target, mode) the result in TARGET, if convenient. */ static rtx -expand_builtin_strcmp (exp, target, mode) - tree exp; - rtx target; - enum machine_mode mode; +expand_builtin_strcmp (tree exp, rtx target, enum machine_mode mode) { tree arglist = TREE_OPERAND (exp, 1); tree arg1, arg2; @@ -2499,6 +3274,10 @@ expand_builtin_strcmp (exp, target, mode) arg1 = TREE_VALUE (arglist); arg2 = TREE_VALUE (TREE_CHAIN (arglist)); + /* If both arguments are equal (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + return const0_rtx; + p1 = c_getstr (arg1); p2 = c_getstr (arg2); @@ -2528,85 +3307,97 @@ expand_builtin_strcmp (exp, target, mode) #ifdef HAVE_cmpstrsi if (HAVE_cmpstrsi) - { - tree len, len1, len2; - rtx arg1_rtx, arg2_rtx, arg3_rtx; - rtx result, insn; + { + tree len, len1, len2; + rtx arg1_rtx, arg2_rtx, arg3_rtx; + rtx result, insn; + tree fndecl; - int arg1_align - = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - int arg2_align - = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - enum machine_mode insn_mode - = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + int arg1_align + = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + int arg2_align + = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + enum machine_mode insn_mode + = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; - len1 = c_strlen (arg1); - len2 = c_strlen (arg2); + len1 = c_strlen (arg1, 1); + len2 = c_strlen (arg2, 1); - if (len1) - len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); - if (len2) - len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); + if (len1) + len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); + if (len2) + len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); - /* If we don't have a constant length for the first, use the length - of the second, if we know it. We don't require a constant for - this case; some cost analysis could be done if both are available - but neither is constant. For now, assume they're equally cheap - unless one has side effects. If both strings have constant lengths, - use the smaller. */ + /* If we don't have a constant length for the first, use the length + of the second, if we know it. We don't require a constant for + this case; some cost analysis could be done if both are available + but neither is constant. For now, assume they're equally cheap, + unless one has side effects. If both strings have constant lengths, + use the smaller. */ - if (!len1) - len = len2; - else if (!len2) - len = len1; - else if (TREE_SIDE_EFFECTS (len1)) - len = len2; - else if (TREE_SIDE_EFFECTS (len2)) - len = len1; - else if (TREE_CODE (len1) != INTEGER_CST) - len = len2; - else if (TREE_CODE (len2) != INTEGER_CST) - len = len1; - else if (tree_int_cst_lt (len1, len2)) - len = len1; - else - len = len2; + if (!len1) + len = len2; + else if (!len2) + len = len1; + else if (TREE_SIDE_EFFECTS (len1)) + len = len2; + else if (TREE_SIDE_EFFECTS (len2)) + len = len1; + else if (TREE_CODE (len1) != INTEGER_CST) + len = len2; + else if (TREE_CODE (len2) != INTEGER_CST) + len = len1; + else if (tree_int_cst_lt (len1, len2)) + len = len1; + else + len = len2; - /* If both arguments have side effects, we cannot optimize. */ - if (!len || TREE_SIDE_EFFECTS (len)) - return 0; + /* If both arguments have side effects, we cannot optimize. */ + if (!len || TREE_SIDE_EFFECTS (len)) + return 0; - /* If we don't have POINTER_TYPE, call the function. */ - if (arg1_align == 0 || arg2_align == 0) - return 0; + /* If we don't have POINTER_TYPE, call the function. */ + if (arg1_align == 0 || arg2_align == 0) + return 0; - /* Make a place to write the result of the instruction. */ - result = target; - if (! (result != 0 - && GET_CODE (result) == REG - && GET_MODE (result) == insn_mode - && REGNO (result) >= FIRST_PSEUDO_REGISTER)) - result = gen_reg_rtx (insn_mode); + /* Make a place to write the result of the instruction. */ + result = target; + if (! (result != 0 + && GET_CODE (result) == REG && GET_MODE (result) == insn_mode + && REGNO (result) >= FIRST_PSEUDO_REGISTER)) + result = gen_reg_rtx (insn_mode); - arg1_rtx = get_memory_rtx (arg1); - arg2_rtx = get_memory_rtx (arg2); - arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); - insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, - GEN_INT (MIN (arg1_align, arg2_align))); - if (!insn) - return 0; + /* Stabilize the arguments in case gen_cmpstrsi fails. */ + arg1 = save_expr (arg1); + arg2 = save_expr (arg2); - emit_insn (insn); + arg1_rtx = get_memory_rtx (arg1); + arg2_rtx = get_memory_rtx (arg2); + arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); + insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); + if (insn) + { + emit_insn (insn); - /* Return the value in the proper mode for this function. */ - mode = TYPE_MODE (TREE_TYPE (exp)); - if (GET_MODE (result) == mode) - return result; - if (target == 0) - return convert_to_mode (mode, result, 0); - convert_move (target, result, 0); - return target; - } + /* Return the value in the proper mode for this function. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + if (GET_MODE (result) == mode) + return result; + if (target == 0) + return convert_to_mode (mode, result, 0); + convert_move (target, result, 0); + return target; + } + + /* Expand the library call ourselves using a stabilized argument + list to avoid re-evaluating the function's arguments twice. */ + arglist = build_tree_list (NULL_TREE, arg2); + arglist = tree_cons (NULL_TREE, arg1, arglist); + fndecl = get_callee_fndecl (exp); + exp = build_function_call_expr (fndecl, arglist); + return expand_call (exp, target, target == const0_rtx); + } #endif return 0; } @@ -2616,10 +3407,7 @@ expand_builtin_strcmp (exp, target, mode) the result in TARGET, if convenient. */ static rtx -expand_builtin_strncmp (exp, target, mode) - tree exp; - rtx target; - enum machine_mode mode; +expand_builtin_strncmp (tree exp, rtx target, enum machine_mode mode) { tree arglist = TREE_OPERAND (exp, 1); tree arg1, arg2, arg3; @@ -2634,7 +3422,7 @@ expand_builtin_strncmp (exp, target, mode) arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); /* If the len parameter is zero, return zero. */ - if (host_integerp (arg3, 1) && tree_low_cst (arg3, 1) == 0) + if (integer_zerop (arg3)) { /* Evaluate and ignore arg1 and arg2 in case they have side-effects. */ @@ -2643,6 +3431,14 @@ expand_builtin_strncmp (exp, target, mode) return const0_rtx; } + /* If arg1 and arg2 are equal (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + { + /* Evaluate and ignore arg3 in case it has side-effects. */ + expand_expr (arg3, const0_rtx, VOIDmode, EXPAND_NORMAL); + return const0_rtx; + } + p1 = c_getstr (arg1); p2 = c_getstr (arg2); @@ -2679,88 +3475,102 @@ expand_builtin_strncmp (exp, target, mode) using length MIN(strlen(string)+1, arg3). */ #ifdef HAVE_cmpstrsi if (HAVE_cmpstrsi) - { - tree len, len1, len2; - rtx arg1_rtx, arg2_rtx, arg3_rtx; - rtx result, insn; + { + tree len, len1, len2; + rtx arg1_rtx, arg2_rtx, arg3_rtx; + rtx result, insn; + tree fndecl; - int arg1_align - = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - int arg2_align - = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - enum machine_mode insn_mode - = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + int arg1_align + = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + int arg2_align + = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + enum machine_mode insn_mode + = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; - len1 = c_strlen (arg1); - len2 = c_strlen (arg2); + len1 = c_strlen (arg1, 1); + len2 = c_strlen (arg2, 1); - if (len1) - len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); - if (len2) - len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); + if (len1) + len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); + if (len2) + len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); - /* If we don't have a constant length for the first, use the length - of the second, if we know it. We don't require a constant for - this case; some cost analysis could be done if both are available - but neither is constant. For now, assume they're equally cheap, - unless one has side effects. If both strings have constant lengths, - use the smaller. */ + /* If we don't have a constant length for the first, use the length + of the second, if we know it. We don't require a constant for + this case; some cost analysis could be done if both are available + but neither is constant. For now, assume they're equally cheap, + unless one has side effects. If both strings have constant lengths, + use the smaller. */ - if (!len1) - len = len2; - else if (!len2) - len = len1; - else if (TREE_SIDE_EFFECTS (len1)) - len = len2; - else if (TREE_SIDE_EFFECTS (len2)) - len = len1; - else if (TREE_CODE (len1) != INTEGER_CST) - len = len2; - else if (TREE_CODE (len2) != INTEGER_CST) - len = len1; - else if (tree_int_cst_lt (len1, len2)) - len = len1; - else - len = len2; + if (!len1) + len = len2; + else if (!len2) + len = len1; + else if (TREE_SIDE_EFFECTS (len1)) + len = len2; + else if (TREE_SIDE_EFFECTS (len2)) + len = len1; + else if (TREE_CODE (len1) != INTEGER_CST) + len = len2; + else if (TREE_CODE (len2) != INTEGER_CST) + len = len1; + else if (tree_int_cst_lt (len1, len2)) + len = len1; + else + len = len2; - /* If both arguments have side effects, we cannot optimize. */ - if (!len || TREE_SIDE_EFFECTS (len)) - return 0; + /* If both arguments have side effects, we cannot optimize. */ + if (!len || TREE_SIDE_EFFECTS (len)) + return 0; - /* The actual new length parameter is MIN(len,arg3). */ - len = fold (build (MIN_EXPR, TREE_TYPE (len), len, arg3)); + /* The actual new length parameter is MIN(len,arg3). */ + len = fold (build (MIN_EXPR, TREE_TYPE (len), len, arg3)); - /* If we don't have POINTER_TYPE, call the function. */ - if (arg1_align == 0 || arg2_align == 0) - return 0; + /* If we don't have POINTER_TYPE, call the function. */ + if (arg1_align == 0 || arg2_align == 0) + return 0; - /* Make a place to write the result of the instruction. */ - result = target; - if (! (result != 0 - && GET_CODE (result) == REG - && GET_MODE (result) == insn_mode - && REGNO (result) >= FIRST_PSEUDO_REGISTER)) - result = gen_reg_rtx (insn_mode); + /* Make a place to write the result of the instruction. */ + result = target; + if (! (result != 0 + && GET_CODE (result) == REG && GET_MODE (result) == insn_mode + && REGNO (result) >= FIRST_PSEUDO_REGISTER)) + result = gen_reg_rtx (insn_mode); - arg1_rtx = get_memory_rtx (arg1); - arg2_rtx = get_memory_rtx (arg2); - arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); - insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, - GEN_INT (MIN (arg1_align, arg2_align))); - if (!insn) - return 0; + /* Stabilize the arguments in case gen_cmpstrsi fails. */ + arg1 = save_expr (arg1); + arg2 = save_expr (arg2); + len = save_expr (len); - emit_insn (insn); + arg1_rtx = get_memory_rtx (arg1); + arg2_rtx = get_memory_rtx (arg2); + arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); + insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); + if (insn) + { + emit_insn (insn); - /* Return the value in the proper mode for this function. */ - mode = TYPE_MODE (TREE_TYPE (exp)); - if (GET_MODE (result) == mode) - return result; - if (target == 0) - return convert_to_mode (mode, result, 0); - convert_move (target, result, 0); - return target; - } + /* Return the value in the proper mode for this function. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + if (GET_MODE (result) == mode) + return result; + if (target == 0) + return convert_to_mode (mode, result, 0); + convert_move (target, result, 0); + return target; + } + + /* Expand the library call ourselves using a stabilized argument + list to avoid re-evaluating the function's arguments twice. */ + arglist = build_tree_list (NULL_TREE, len); + arglist = tree_cons (NULL_TREE, arg2, arglist); + arglist = tree_cons (NULL_TREE, arg1, arglist); + fndecl = get_callee_fndecl (exp); + exp = build_function_call_expr (fndecl, arglist); + return expand_call (exp, target, target == const0_rtx); + } #endif return 0; } @@ -2770,10 +3580,7 @@ expand_builtin_strncmp (exp, target, mode) otherwise try to get the result in TARGET, if convenient. */ static rtx -expand_builtin_strcat (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; @@ -2783,9 +3590,52 @@ expand_builtin_strcat (arglist, target, mode) src = TREE_VALUE (TREE_CHAIN (arglist)); const char *p = c_getstr (src); - /* If the string length is zero, return the dst parameter. */ - if (p && *p == '\0') - return expand_expr (dst, target, mode, EXPAND_NORMAL); + if (p) + { + /* If the string length is zero, return the dst parameter. */ + if (*p == '\0') + return expand_expr (dst, target, mode, EXPAND_NORMAL); + else if (!optimize_size) + { + /* Otherwise if !optimize_size, see if we can store by + pieces into (dst + strlen(dst)). */ + tree newdst, arglist, + strlen_fn = implicit_built_in_decls[BUILT_IN_STRLEN]; + + /* This is the length argument. */ + arglist = build_tree_list (NULL_TREE, + fold (size_binop (PLUS_EXPR, + c_strlen (src, 0), + ssize_int (1)))); + /* Prepend src argument. */ + arglist = tree_cons (NULL_TREE, src, arglist); + + /* We're going to use dst more than once. */ + dst = save_expr (dst); + + /* Create strlen (dst). */ + newdst = + fold (build_function_call_expr (strlen_fn, + build_tree_list (NULL_TREE, + dst))); + /* Create (dst + strlen (dst)). */ + newdst = fold (build (PLUS_EXPR, TREE_TYPE (dst), dst, newdst)); + + /* Prepend the new dst argument. */ + arglist = tree_cons (NULL_TREE, newdst, arglist); + + /* We don't want to get turned into a memcpy if the + target is const0_rtx, i.e. when the return value + isn't used. That would produce pessimized code so + pass in a target of zero, it should never actually be + used. If this was successful return the original + dst, not the result of mempcpy. */ + if (expand_builtin_mempcpy (arglist, /*target=*/0, mode, /*endp=*/0)) + return expand_expr (dst, target, mode, EXPAND_NORMAL); + else + return 0; + } + } return 0; } @@ -2796,10 +3646,7 @@ expand_builtin_strcat (arglist, target, mode) otherwise try to get the result in TARGET, if convenient. */ static rtx -expand_builtin_strncat (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strncat (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) @@ -2829,7 +3676,7 @@ expand_builtin_strncat (arglist, target, mode) { tree newarglist = tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src)); - tree fn = built_in_decls[BUILT_IN_STRCAT]; + tree fn = implicit_built_in_decls[BUILT_IN_STRCAT]; /* If the replacement _DECL isn't initialized, don't do the transformation. */ @@ -2848,10 +3695,7 @@ expand_builtin_strncat (arglist, target, mode) otherwise try to get the result in TARGET, if convenient. */ static rtx -expand_builtin_strspn (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strspn (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; @@ -2885,10 +3729,7 @@ expand_builtin_strspn (arglist, target, mode) otherwise try to get the result in TARGET, if convenient. */ static rtx -expand_builtin_strcspn (arglist, target, mode) - tree arglist; - rtx target; - enum machine_mode mode; +expand_builtin_strcspn (tree arglist, rtx target, enum machine_mode mode) { if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return 0; @@ -2917,7 +3758,7 @@ expand_builtin_strcspn (arglist, target, mode) if (p2 && *p2 == '\0') { tree newarglist = build_tree_list (NULL_TREE, s1), - fn = built_in_decls[BUILT_IN_STRLEN]; + fn = implicit_built_in_decls[BUILT_IN_STRLEN]; /* If the replacement _DECL isn't initialized, don't do the transformation. */ @@ -2935,7 +3776,7 @@ expand_builtin_strcspn (arglist, target, mode) if that's convenient. */ rtx -expand_builtin_saveregs () +expand_builtin_saveregs (void) { rtx val, seq; @@ -2950,21 +3791,8 @@ expand_builtin_saveregs () start_sequence (); -#ifdef EXPAND_BUILTIN_SAVEREGS /* Do whatever the machine needs done in this case. */ - val = EXPAND_BUILTIN_SAVEREGS (); -#else - /* ??? We used to try and build up a call to the out of line function, - guessing about what registers needed saving etc. This became much - harder with __builtin_va_start, since we don't have a tree for a - call to __builtin_saveregs to fall back on. There was exactly one - port (i860) that used this code, and I'm unconvinced it could actually - handle the general case. So we no longer try to handle anything - weird and make the backend absorb the evil. */ - - error ("__builtin_saveregs not supported by this target"); - val = const0_rtx; -#endif + val = targetm.calls.expand_builtin_saveregs (); seq = get_insns (); end_sequence (); @@ -2986,17 +3814,10 @@ expand_builtin_saveregs () is controlled by the definition of CUMULATIVE_ARGS. */ static rtx -expand_builtin_args_info (exp) - tree exp; +expand_builtin_args_info (tree arglist) { - tree arglist = TREE_OPERAND (exp, 1); int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int); int *word_ptr = (int *) ¤t_function_args_info; -#if 0 - /* These are used by the code below that is if 0'ed away */ - int i; - tree type, elts, result; -#endif if (sizeof (CUMULATIVE_ARGS) % sizeof (int) != 0) abort (); @@ -3019,27 +3840,12 @@ expand_builtin_args_info (exp) error ("missing argument in `__builtin_args_info'"); return const0_rtx; - -#if 0 - for (i = 0; i < nwords; i++) - elts = tree_cons (NULL_TREE, build_int_2 (word_ptr[i], 0)); - - type = build_array_type (integer_type_node, - build_index_type (build_int_2 (nwords, 0))); - result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (elts)); - TREE_CONSTANT (result) = 1; - TREE_STATIC (result) = 1; - result = build1 (INDIRECT_REF, build_pointer_type (type), result); - TREE_CONSTANT (result) = 1; - return expand_expr (result, NULL_RTX, VOIDmode, 0); -#endif } /* Expand ARGLIST, from a call to __builtin_next_arg. */ static rtx -expand_builtin_next_arg (arglist) - tree arglist; +expand_builtin_next_arg (tree arglist) { tree fntype = TREE_TYPE (current_function_decl); @@ -3083,9 +3889,7 @@ expand_builtin_next_arg (arglist) from multiple evaluations. */ static tree -stabilize_va_list (valist, needs_lvalue) - tree valist; - int needs_lvalue; +stabilize_va_list (tree valist, int needs_lvalue) { if (TREE_CODE (va_list_type_node) == ARRAY_TYPE) { @@ -3128,13 +3932,19 @@ stabilize_va_list (valist, needs_lvalue) return valist; } +/* The "standard" definition of va_list is void*. */ + +tree +std_build_builtin_va_list (void) +{ + return ptr_type_node; +} + /* The "standard" implementation of va_start: just assign `nextarg' to the variable. */ void -std_expand_builtin_va_start (valist, nextarg) - tree valist; - rtx nextarg; +std_expand_builtin_va_start (tree valist, rtx nextarg) { tree t; @@ -3148,8 +3958,7 @@ std_expand_builtin_va_start (valist, nextarg) /* Expand ARGLIST, from a call to __builtin_va_start. */ static rtx -expand_builtin_va_start (arglist) - tree arglist; +expand_builtin_va_start (tree arglist) { rtx nextarg; tree chain, valist; @@ -3175,17 +3984,38 @@ expand_builtin_va_start (arglist) current (padded) address and increment by the (padded) size. */ rtx -std_expand_builtin_va_arg (valist, type) - tree valist, type; +std_expand_builtin_va_arg (tree valist, tree type) { tree addr_tree, t, type_size = NULL; tree align, alignm1; tree rounded_size; rtx addr; + HOST_WIDE_INT boundary; /* Compute the rounded size of the type. */ align = size_int (PARM_BOUNDARY / BITS_PER_UNIT); alignm1 = size_int (PARM_BOUNDARY / BITS_PER_UNIT - 1); + boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type); + + /* va_list pointer is aligned to PARM_BOUNDARY. If argument actually + requires greater alignment, we must perform dynamic alignment. */ + + if (boundary > PARM_BOUNDARY) + { + if (!PAD_VARARGS_DOWN) + { + t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, + build (PLUS_EXPR, TREE_TYPE (valist), valist, + build_int_2 (boundary / BITS_PER_UNIT - 1, 0))); + TREE_SIDE_EFFECTS (t) = 1; + expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); + } + t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, + build (BIT_AND_EXPR, TREE_TYPE (valist), valist, + build_int_2 (~(boundary / BITS_PER_UNIT - 1), -1))); + TREE_SIDE_EFFECTS (t) = 1; + expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); + } if (type == error_mark_node || (type_size = TYPE_SIZE_UNIT (TYPE_MAIN_VARIANT (type))) == NULL || TREE_OVERFLOW (type_size)) @@ -3234,8 +4064,7 @@ std_expand_builtin_va_arg (valist, type) a very special sort of operator. */ rtx -expand_builtin_va_arg (valist, type) - tree valist, type; +expand_builtin_va_arg (tree valist, tree type) { rtx addr, result; tree promoted_type, want_va_type, have_va_type; @@ -3302,6 +4131,7 @@ expand_builtin_va_arg (valist, type) /* We can, however, treat "undefined" any way we please. Call abort to encourage the user to fix the program. */ + inform ("if this code is reached, the program will abort"); expand_builtin_trap (); /* This is dead code, but go ahead and finish so that the @@ -3321,10 +4151,7 @@ expand_builtin_va_arg (valist, type) #endif } -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (addr) != Pmode) - addr = convert_memory_address (Pmode, addr); -#endif + addr = convert_memory_address (Pmode, addr); result = gen_rtx_MEM (TYPE_MODE (type), addr); set_mem_alias_set (result, get_varargs_alias_set ()); @@ -3335,20 +4162,14 @@ expand_builtin_va_arg (valist, type) /* Expand ARGLIST, from a call to __builtin_va_end. */ static rtx -expand_builtin_va_end (arglist) - tree arglist; +expand_builtin_va_end (tree arglist) { tree valist = TREE_VALUE (arglist); -#ifdef EXPAND_BUILTIN_VA_END - valist = stabilize_va_list (valist, 0); - EXPAND_BUILTIN_VA_END (arglist); -#else /* Evaluate for side effects, if needed. I hate macros that don't do that. */ if (TREE_SIDE_EFFECTS (valist)) expand_expr (valist, const0_rtx, VOIDmode, EXPAND_NORMAL); -#endif return const0_rtx; } @@ -3358,8 +4179,7 @@ expand_builtin_va_end (arglist) nastiness of array-type va_list types. */ static rtx -expand_builtin_va_copy (arglist) - tree arglist; +expand_builtin_va_copy (tree arglist) { tree dst, src, t; @@ -3385,13 +4205,8 @@ expand_builtin_va_copy (arglist) size = expand_expr (TYPE_SIZE_UNIT (va_list_type_node), NULL_RTX, VOIDmode, EXPAND_NORMAL); -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (dstb) != Pmode) - dstb = convert_memory_address (Pmode, dstb); - - if (GET_MODE (srcb) != Pmode) - srcb = convert_memory_address (Pmode, srcb); -#endif + dstb = convert_memory_address (Pmode, dstb); + srcb = convert_memory_address (Pmode, srcb); /* "Dereference" to BLKmode memories. */ dstb = gen_rtx_MEM (BLKmode, dstb); @@ -3412,12 +4227,8 @@ expand_builtin_va_copy (arglist) __builtin_return_address. */ static rtx -expand_builtin_frame_address (exp) - tree exp; +expand_builtin_frame_address (tree fndecl, tree arglist) { - tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); - tree arglist = TREE_OPERAND (exp, 1); - /* The argument must be a nonnegative integer constant. It counts the number of frames to scan up the stack. The value is the return address saved in that frame. */ @@ -3465,9 +4276,7 @@ expand_builtin_frame_address (exp) the result in TARGET, if convenient. */ static rtx -expand_builtin_alloca (arglist, target) - tree arglist; - rtx target; +expand_builtin_alloca (tree arglist, rtx target) { rtx op0; rtx result; @@ -3480,24 +4289,19 @@ expand_builtin_alloca (arglist, target) /* Allocate the desired space. */ result = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT); - -#ifdef POINTERS_EXTEND_UNSIGNED - if (GET_MODE (result) != ptr_mode) - result = convert_memory_address (ptr_mode, result); -#endif + result = convert_memory_address (ptr_mode, result); return result; } -/* Expand a call to the ffs builtin. The arguments are in ARGLIST. +/* Expand a call to a unary builtin. The arguments are in ARGLIST. Return 0 if a normal call should be emitted rather than expanding the function in-line. If convenient, the result should be placed in TARGET. SUBTARGET may be used as the target for computing one of EXP's operands. */ static rtx -expand_builtin_ffs (arglist, target, subtarget) - tree arglist; - rtx target, subtarget; +expand_builtin_unop (enum machine_mode target_mode, tree arglist, rtx target, + rtx subtarget, optab op_optab) { rtx op0; if (!validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE)) @@ -3505,33 +4309,31 @@ expand_builtin_ffs (arglist, target, subtarget) /* Compute the argument. */ op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0); - /* Compute ffs, into TARGET if possible. + /* Compute op, into TARGET if possible. Set TARGET to wherever the result comes back. */ target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))), - ffs_optab, op0, target, 1); + op_optab, op0, target, 1); if (target == 0) abort (); - return target; + + return convert_to_mode (target_mode, target, 0); } /* If the string passed to fputs is a constant and is one character long, we attempt to transform this call into __builtin_fputc(). */ static rtx -expand_builtin_fputs (arglist, ignore, unlocked) - tree arglist; - int ignore; - int unlocked; +expand_builtin_fputs (tree arglist, rtx target, bool unlocked) { tree len, fn; - tree fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED] - : built_in_decls[BUILT_IN_FPUTC]; - tree fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED] - : built_in_decls[BUILT_IN_FWRITE]; + tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FPUTC]; + tree fn_fwrite = unlocked ? implicit_built_in_decls[BUILT_IN_FWRITE_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FWRITE]; /* If the return value is used, or the replacement _DECL isn't initialized, don't do the transformation. */ - if (!ignore || !fn_fputc || !fn_fwrite) + if (target != const0_rtx || !fn_fputc || !fn_fwrite) return 0; /* Verify the arguments in the original call. */ @@ -3540,7 +4342,7 @@ expand_builtin_fputs (arglist, ignore, unlocked) /* Get the length of the string passed to fputs. If the length can't be determined, punt. */ - if (!(len = c_strlen (TREE_VALUE (arglist))) + if (!(len = c_strlen (TREE_VALUE (arglist), 1)) || TREE_CODE (len) != INTEGER_CST) return 0; @@ -3570,12 +4372,12 @@ expand_builtin_fputs (arglist, ignore, unlocked) break; } } - /* FALLTHROUGH */ + /* Fall through. */ case 1: /* length is greater than 1, call fwrite. */ { tree string_arg; - /* If optimizing for size keep fputs. */ + /* If optimizing for size keep fputs. */ if (optimize_size) return 0; string_arg = TREE_VALUE (arglist); @@ -3593,8 +4395,7 @@ expand_builtin_fputs (arglist, ignore, unlocked) } return expand_expr (build_function_call_expr (fn, arglist), - (ignore ? const0_rtx : NULL_RTX), - VOIDmode, EXPAND_NORMAL); + const0_rtx, VOIDmode, EXPAND_NORMAL); } /* Expand a call to __builtin_expect. We return our argument and emit a @@ -3602,9 +4403,7 @@ expand_builtin_fputs (arglist, ignore, unlocked) a non-jump context. */ static rtx -expand_builtin_expect (arglist, target) - tree arglist; - rtx target; +expand_builtin_expect (tree arglist, rtx target) { tree exp, c; rtx note, rtx_c; @@ -3633,7 +4432,7 @@ expand_builtin_expect (arglist, target) rtx_c = expand_expr (c, NULL_RTX, GET_MODE (target), EXPAND_NORMAL); - note = emit_note (NULL, NOTE_INSN_EXPECTED_VALUE); + note = emit_note (NOTE_INSN_EXPECTED_VALUE); NOTE_EXPECTED_VALUE (note) = gen_rtx_EQ (VOIDmode, target, rtx_c); } @@ -3648,10 +4447,7 @@ expand_builtin_expect (arglist, target) based on the test being 0/1. */ rtx -expand_builtin_expect_jump (exp, if_false_label, if_true_label) - tree exp; - rtx if_false_label; - rtx if_true_label; +expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx if_true_label) { tree arglist = TREE_OPERAND (exp, 1); tree arg0 = TREE_VALUE (arglist); @@ -3663,111 +4459,106 @@ expand_builtin_expect_jump (exp, if_false_label, if_true_label) if (TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE && (integer_zerop (arg1) || integer_onep (arg1))) { - int num_jumps = 0; - rtx insn; - - /* If we fail to locate an appropriate conditional jump, we'll - fall back to normal evaluation. Ensure that the expression - can be re-evaluated. */ - switch (unsafe_for_reeval (arg0)) - { - case 0: /* Safe. */ - break; - - case 1: /* Mildly unsafe. */ - arg0 = unsave_expr (arg0); - break; - - case 2: /* Wildly unsafe. */ - return NULL_RTX; - } + rtx insn, drop_through_label, temp; /* Expand the jump insns. */ start_sequence (); do_jump (arg0, if_false_label, if_true_label); ret = get_insns (); + + drop_through_label = get_last_insn (); + if (drop_through_label && GET_CODE (drop_through_label) == NOTE) + drop_through_label = prev_nonnote_insn (drop_through_label); + if (drop_through_label && GET_CODE (drop_through_label) != CODE_LABEL) + drop_through_label = NULL_RTX; end_sequence (); - /* Now that the __builtin_expect has been validated, go through and add - the expect's to each of the conditional jumps. If we run into an - error, just give up and generate the 'safe' code of doing a SCC - operation and then doing a branch on that. */ + if (! if_true_label) + if_true_label = drop_through_label; + if (! if_false_label) + if_false_label = drop_through_label; + + /* Go through and add the expect's to each of the conditional jumps. */ insn = ret; while (insn != NULL_RTX) { rtx next = NEXT_INSN (insn); - rtx pattern; - if (GET_CODE (insn) == JUMP_INSN && any_condjump_p (insn) - && (pattern = pc_set (insn)) != NULL_RTX) + if (GET_CODE (insn) == JUMP_INSN && any_condjump_p (insn)) { - rtx ifelse = SET_SRC (pattern); - rtx label; - int taken; + rtx ifelse = SET_SRC (pc_set (insn)); + rtx then_dest = XEXP (ifelse, 1); + rtx else_dest = XEXP (ifelse, 2); + int taken = -1; - if (GET_CODE (ifelse) != IF_THEN_ELSE) - goto do_next_insn; - - if (GET_CODE (XEXP (ifelse, 1)) == LABEL_REF) + /* First check if we recognize any of the labels. */ + if (GET_CODE (then_dest) == LABEL_REF + && XEXP (then_dest, 0) == if_true_label) + taken = 1; + else if (GET_CODE (then_dest) == LABEL_REF + && XEXP (then_dest, 0) == if_false_label) + taken = 0; + else if (GET_CODE (else_dest) == LABEL_REF + && XEXP (else_dest, 0) == if_false_label) + taken = 1; + else if (GET_CODE (else_dest) == LABEL_REF + && XEXP (else_dest, 0) == if_true_label) + taken = 0; + /* Otherwise check where we drop through. */ + else if (else_dest == pc_rtx) { - taken = 1; - label = XEXP (XEXP (ifelse, 1), 0); - } - /* An inverted jump reverses the probabilities. */ - else if (GET_CODE (XEXP (ifelse, 2)) == LABEL_REF) - { - taken = 0; - label = XEXP (XEXP (ifelse, 2), 0); - } - /* We shouldn't have to worry about conditional returns during - the expansion stage, but handle it gracefully anyway. */ - else if (GET_CODE (XEXP (ifelse, 1)) == RETURN) - { - taken = 1; - label = NULL_RTX; - } - /* An inverted return reverses the probabilities. */ - else if (GET_CODE (XEXP (ifelse, 2)) == RETURN) - { - taken = 0; - label = NULL_RTX; - } - else - goto do_next_insn; + if (next && GET_CODE (next) == NOTE) + next = next_nonnote_insn (next); - /* If the test is expected to fail, reverse the - probabilities. */ - if (integer_zerop (arg1)) - taken = 1 - taken; + if (next && GET_CODE (next) == JUMP_INSN + && any_uncondjump_p (next)) + temp = XEXP (SET_SRC (pc_set (next)), 0); + else + temp = next; - /* If we are jumping to the false label, reverse the - probabilities. */ - if (label == NULL_RTX) - ; /* conditional return */ - else if (label == if_false_label) - taken = 1 - taken; - else if (label != if_true_label) - goto do_next_insn; + /* TEMP is either a CODE_LABEL, NULL_RTX or something + else that can't possibly match either target label. */ + if (temp == if_false_label) + taken = 1; + else if (temp == if_true_label) + taken = 0; + } + else if (then_dest == pc_rtx) + { + if (next && GET_CODE (next) == NOTE) + next = next_nonnote_insn (next); - num_jumps++; - predict_insn_def (insn, PRED_BUILTIN_EXPECT, taken); + if (next && GET_CODE (next) == JUMP_INSN + && any_uncondjump_p (next)) + temp = XEXP (SET_SRC (pc_set (next)), 0); + else + temp = next; + + if (temp == if_false_label) + taken = 0; + else if (temp == if_true_label) + taken = 1; + } + + if (taken != -1) + { + /* If the test is expected to fail, reverse the + probabilities. */ + if (integer_zerop (arg1)) + taken = 1 - taken; + predict_insn_def (insn, PRED_BUILTIN_EXPECT, taken); + } } - do_next_insn: insn = next; } - - /* If no jumps were modified, fail and do __builtin_expect the normal - way. */ - if (num_jumps == 0) - ret = NULL_RTX; } return ret; } void -expand_builtin_trap () +expand_builtin_trap (void) { #ifdef HAVE_trap if (HAVE_trap) @@ -3777,6 +4568,358 @@ expand_builtin_trap () emit_library_call (abort_libfunc, LCT_NORETURN, VOIDmode, 0); emit_barrier (); } + +/* Expand a call to fabs, fabsf or fabsl with arguments ARGLIST. + Return 0 if a normal call should be emitted rather than expanding + the function inline. If convenient, the result should be placed + in TARGET. SUBTARGET may be used as the target for computing + the operand. */ + +static rtx +expand_builtin_fabs (tree arglist, rtx target, rtx subtarget) +{ + enum machine_mode mode; + tree arg; + rtx op0; + + if (!validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return 0; + + arg = TREE_VALUE (arglist); + mode = TYPE_MODE (TREE_TYPE (arg)); + op0 = expand_expr (arg, subtarget, VOIDmode, 0); + return expand_abs (mode, op0, target, 0, safe_from_p (target, arg, 1)); +} + +/* Expand a call to cabs, cabsf or cabsl with arguments ARGLIST. + Return 0 if a normal call should be emitted rather than expanding + the function inline. If convenient, the result should be placed + in target. */ + +static rtx +expand_builtin_cabs (tree arglist, rtx target) +{ + enum machine_mode mode; + tree arg; + rtx op0; + + if (arglist == 0 || TREE_CHAIN (arglist)) + return 0; + arg = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (arg)) != COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) != REAL_TYPE) + return 0; + + mode = TYPE_MODE (TREE_TYPE (arg)); + op0 = expand_expr (arg, NULL_RTX, VOIDmode, 0); + return expand_complex_abs (mode, op0, target, 0); +} + +/* Create a new constant string literal and return a char* pointer to it. + The STRING_CST value is the LEN characters at STR. */ +static tree +build_string_literal (int len, const char *str) +{ + tree t, elem, index, type; + + t = build_string (len, str); + elem = build_type_variant (char_type_node, 1, 0); + index = build_index_type (build_int_2 (len - 1, 0)); + type = build_array_type (elem, index); + TREE_TYPE (t) = type; + TREE_CONSTANT (t) = 1; + TREE_READONLY (t) = 1; + TREE_STATIC (t) = 1; + + type = build_pointer_type (type); + t = build1 (ADDR_EXPR, type, t); + + type = build_pointer_type (elem); + t = build1 (NOP_EXPR, type, t); + return t; +} + +/* Expand a call to printf or printf_unlocked with argument list ARGLIST. + Return 0 if a normal call should be emitted rather than transforming + the function inline. If convenient, the result should be placed in + TARGET with mode MODE. UNLOCKED indicates this is a printf_unlocked + call. */ +static rtx +expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode, + bool unlocked) +{ + tree fn_putchar = unlocked + ? implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_PUTCHAR]; + tree fn_puts = unlocked ? implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_PUTS]; + const char *fmt_str; + tree fn, fmt, arg; + + /* If the return value is used, don't do the transformation. */ + if (target != const0_rtx) + return 0; + + /* Verify the required arguments in the original call. */ + if (! arglist) + return 0; + fmt = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (fmt)) != POINTER_TYPE) + return 0; + arglist = TREE_CHAIN (arglist); + + /* Check whether the format is a literal string constant. */ + fmt_str = c_getstr (fmt); + if (fmt_str == NULL) + return 0; + + /* If the format specifier was "%s\n", call __builtin_puts(arg). */ + if (strcmp (fmt_str, "%s\n") == 0) + { + if (! arglist + || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE + || TREE_CHAIN (arglist)) + return 0; + fn = fn_puts; + } + /* If the format specifier was "%c", call __builtin_putchar(arg). */ + else if (strcmp (fmt_str, "%c") == 0) + { + if (! arglist + || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE + || TREE_CHAIN (arglist)) + return 0; + fn = fn_putchar; + } + else + { + /* We can't handle anything else with % args or %% ... yet. */ + if (strchr (fmt_str, '%')) + return 0; + + if (arglist) + return 0; + + /* If the format specifier was "", printf does nothing. */ + if (fmt_str[0] == '\0') + return const0_rtx; + /* If the format specifier has length of 1, call putchar. */ + if (fmt_str[1] == '\0') + { + /* Given printf("c"), (where c is any one character,) + convert "c"[0] to an int and pass that to the replacement + function. */ + arg = build_int_2 (fmt_str[0], 0); + arglist = build_tree_list (NULL_TREE, arg); + fn = fn_putchar; + } + else + { + /* If the format specifier was "string\n", call puts("string"). */ + size_t len = strlen (fmt_str); + if (fmt_str[len - 1] == '\n') + { + /* Create a NUL-terminated string that's one char shorter + than the original, stripping off the trailing '\n'. */ + char *newstr = (char *) alloca (len); + memcpy (newstr, fmt_str, len - 1); + newstr[len - 1] = 0; + + arg = build_string_literal (len, newstr); + arglist = build_tree_list (NULL_TREE, arg); + fn = fn_puts; + } + else + /* We'd like to arrange to call fputs(string,stdout) here, + but we need stdout and don't have a way to get it yet. */ + return 0; + } + } + + if (!fn) + return 0; + return expand_expr (build_function_call_expr (fn, arglist), + target, mode, EXPAND_NORMAL); +} + +/* Expand a call to fprintf or fprintf_unlocked with argument list ARGLIST. + Return 0 if a normal call should be emitted rather than transforming + the function inline. If convenient, the result should be placed in + TARGET with mode MODE. UNLOCKED indicates this is a fprintf_unlocked + call. */ +static rtx +expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode, + bool unlocked) +{ + tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FPUTC]; + tree fn_fputs = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FPUTS]; + const char *fmt_str; + tree fn, fmt, fp, arg; + + /* If the return value is used, don't do the transformation. */ + if (target != const0_rtx) + return 0; + + /* Verify the required arguments in the original call. */ + if (! arglist) + return 0; + fp = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (fp)) != POINTER_TYPE) + return 0; + arglist = TREE_CHAIN (arglist); + if (! arglist) + return 0; + fmt = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (fmt)) != POINTER_TYPE) + return 0; + arglist = TREE_CHAIN (arglist); + + /* Check whether the format is a literal string constant. */ + fmt_str = c_getstr (fmt); + if (fmt_str == NULL) + return 0; + + /* If the format specifier was "%s", call __builtin_fputs(arg,fp). */ + if (strcmp (fmt_str, "%s") == 0) + { + if (! arglist + || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE + || TREE_CHAIN (arglist)) + return 0; + arg = TREE_VALUE (arglist); + arglist = build_tree_list (NULL_TREE, fp); + arglist = tree_cons (NULL_TREE, arg, arglist); + fn = fn_fputs; + } + /* If the format specifier was "%c", call __builtin_fputc(arg,fp). */ + else if (strcmp (fmt_str, "%c") == 0) + { + if (! arglist + || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE + || TREE_CHAIN (arglist)) + return 0; + arg = TREE_VALUE (arglist); + arglist = build_tree_list (NULL_TREE, fp); + arglist = tree_cons (NULL_TREE, arg, arglist); + fn = fn_fputc; + } + else + { + /* We can't handle anything else with % args or %% ... yet. */ + if (strchr (fmt_str, '%')) + return 0; + + if (arglist) + return 0; + + /* If the format specifier was "", fprintf does nothing. */ + if (fmt_str[0] == '\0') + { + /* Evaluate and ignore FILE* argument for side-effects. */ + expand_expr (fp, const0_rtx, VOIDmode, EXPAND_NORMAL); + return const0_rtx; + } + + /* When "string" doesn't contain %, replace all cases of + fprintf(stream,string) with fputs(string,stream). The fputs + builtin will take care of special cases like length == 1. */ + arglist = build_tree_list (NULL_TREE, fp); + arglist = tree_cons (NULL_TREE, fmt, arglist); + fn = fn_fputs; + } + + if (!fn) + return 0; + return expand_expr (build_function_call_expr (fn, arglist), + target, mode, EXPAND_NORMAL); +} + +/* Expand a call to sprintf with argument list ARGLIST. Return 0 if + a normal call should be emitted rather than expanding the function + inline. If convenient, the result should be placed in TARGET with + mode MODE. */ + +static rtx +expand_builtin_sprintf (tree arglist, rtx target, enum machine_mode mode) +{ + tree orig_arglist, dest, fmt; + const char *fmt_str; + + orig_arglist = arglist; + + /* Verify the required arguments in the original call. */ + if (! arglist) + return 0; + dest = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (dest)) != POINTER_TYPE) + return 0; + arglist = TREE_CHAIN (arglist); + if (! arglist) + return 0; + fmt = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (fmt)) != POINTER_TYPE) + return 0; + arglist = TREE_CHAIN (arglist); + + /* Check whether the format is a literal string constant. */ + fmt_str = c_getstr (fmt); + if (fmt_str == NULL) + return 0; + + /* If the format doesn't contain % args or %%, use strcpy. */ + if (strchr (fmt_str, '%') == 0) + { + tree fn = implicit_built_in_decls[BUILT_IN_STRCPY]; + tree exp; + + if (arglist || ! fn) + return 0; + expand_expr (build_function_call_expr (fn, orig_arglist), + const0_rtx, VOIDmode, EXPAND_NORMAL); + if (target == const0_rtx) + return const0_rtx; + exp = build_int_2 (strlen (fmt_str), 0); + exp = fold (build1 (NOP_EXPR, integer_type_node, exp)); + return expand_expr (exp, target, mode, EXPAND_NORMAL); + } + /* If the format is "%s", use strcpy if the result isn't used. */ + else if (strcmp (fmt_str, "%s") == 0) + { + tree fn, arg, len; + fn = implicit_built_in_decls[BUILT_IN_STRCPY]; + + if (! fn) + return 0; + + if (! arglist || TREE_CHAIN (arglist)) + return 0; + arg = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (arg)) != POINTER_TYPE) + return 0; + + if (target != const0_rtx) + { + len = c_strlen (arg, 1); + if (! len || TREE_CODE (len) != INTEGER_CST) + return 0; + } + else + len = NULL_TREE; + + arglist = build_tree_list (NULL_TREE, arg); + arglist = tree_cons (NULL_TREE, dest, arglist); + expand_expr (build_function_call_expr (fn, arglist), + const0_rtx, VOIDmode, EXPAND_NORMAL); + + if (target == const0_rtx) + return const0_rtx; + return expand_expr (len, target, mode, EXPAND_NORMAL); + } + + return 0; +} /* Expand an expression EXP that calls a built-in function, with result going to TARGET if that's convenient @@ -3785,18 +4928,15 @@ expand_builtin_trap () IGNORE is nonzero if the value is to be ignored. */ rtx -expand_builtin (exp, target, subtarget, mode, ignore) - tree exp; - rtx target; - rtx subtarget; - enum machine_mode mode; - int ignore; +expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, + int ignore) { - tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + tree fndecl = get_callee_fndecl (exp); tree arglist = TREE_OPERAND (exp, 1); enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); + enum machine_mode target_mode = TYPE_MODE (TREE_TYPE (exp)); - /* Perform postincrements before expanding builtin functions.  */ + /* Perform postincrements before expanding builtin functions. */ emit_queue (); if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) @@ -3804,59 +4944,41 @@ expand_builtin (exp, target, subtarget, mode, ignore) /* When not optimizing, generate calls to library functions for a certain set of builtins. */ - if (!optimize && !CALLED_AS_BUILT_IN (fndecl)) - switch (fcode) - { - case BUILT_IN_SQRT: - case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: - case BUILT_IN_EXP: - case BUILT_IN_EXPF: - case BUILT_IN_EXPL: - case BUILT_IN_MEMSET: - case BUILT_IN_MEMCPY: - case BUILT_IN_MEMCMP: - case BUILT_IN_BCMP: - case BUILT_IN_BZERO: - case BUILT_IN_INDEX: - case BUILT_IN_RINDEX: - case BUILT_IN_STRCHR: - case BUILT_IN_STRRCHR: - case BUILT_IN_STRLEN: - case BUILT_IN_STRCPY: - case BUILT_IN_STRNCPY: - case BUILT_IN_STRNCMP: - case BUILT_IN_STRSTR: - case BUILT_IN_STRPBRK: - case BUILT_IN_STRCAT: - case BUILT_IN_STRNCAT: - case BUILT_IN_STRSPN: - case BUILT_IN_STRCSPN: - case BUILT_IN_STRCMP: - case BUILT_IN_FFS: - case BUILT_IN_PUTCHAR: - case BUILT_IN_PUTS: - case BUILT_IN_PRINTF: - case BUILT_IN_FPUTC: - case BUILT_IN_FPUTS: - case BUILT_IN_FWRITE: - case BUILT_IN_PUTCHAR_UNLOCKED: - case BUILT_IN_PUTS_UNLOCKED: - case BUILT_IN_PRINTF_UNLOCKED: - case BUILT_IN_FPUTC_UNLOCKED: - case BUILT_IN_FPUTS_UNLOCKED: - case BUILT_IN_FWRITE_UNLOCKED: - return expand_call (exp, target, ignore); + if (!optimize + && !CALLED_AS_BUILT_IN (fndecl) + && DECL_ASSEMBLER_NAME_SET_P (fndecl) + && fcode != BUILT_IN_ALLOCA) + return expand_call (exp, target, ignore); - default: - break; - } + /* The built-in function expanders test for target == const0_rtx + to determine whether the function's result will be ignored. */ + if (ignore) + target = const0_rtx; + + /* If the result of a pure or const built-in function is ignored, and + none of its arguments are volatile, we can avoid expanding the + built-in call and just evaluate the arguments for side-effects. */ + if (target == const0_rtx + && (DECL_IS_PURE (fndecl) || TREE_READONLY (fndecl))) + { + bool volatilep = false; + tree arg; + + for (arg = arglist; arg; arg = TREE_CHAIN (arg)) + if (TREE_THIS_VOLATILE (TREE_VALUE (arg))) + { + volatilep = true; + break; + } + + if (! volatilep) + { + for (arg = arglist; arg; arg = TREE_CHAIN (arg)) + expand_expr (TREE_VALUE (arg), const0_rtx, + VOIDmode, EXPAND_NORMAL); + return const0_rtx; + } + } switch (fcode) { @@ -3864,11 +4986,27 @@ expand_builtin (exp, target, subtarget, mode, ignore) case BUILT_IN_LABS: case BUILT_IN_LLABS: case BUILT_IN_IMAXABS: + /* build_function_call changes these into ABS_EXPR. */ + abort (); + case BUILT_IN_FABS: case BUILT_IN_FABSF: case BUILT_IN_FABSL: - /* build_function_call changes these into ABS_EXPR. */ - abort (); + target = expand_builtin_fabs (arglist, target, subtarget); + if (target) + return target; + break; + + case BUILT_IN_CABS: + case BUILT_IN_CABSF: + case BUILT_IN_CABSL: + if (flag_unsafe_math_optimizations) + { + target = expand_builtin_cabs (arglist, target); + if (target) + return target; + } + break; case BUILT_IN_CONJ: case BUILT_IN_CONJF: @@ -3895,6 +5033,12 @@ expand_builtin (exp, target, subtarget, mode, ignore) case BUILT_IN_LOG: case BUILT_IN_LOGF: case BUILT_IN_LOGL: + case BUILT_IN_TAN: + case BUILT_IN_TANF: + case BUILT_IN_TANL: + case BUILT_IN_ATAN: + case BUILT_IN_ATANF: + case BUILT_IN_ATANL: /* Treat these like sqrt only if unsafe math optimizations are allowed, because of possible accuracy problems. */ if (! flag_unsafe_math_optimizations) @@ -3902,11 +5046,46 @@ expand_builtin (exp, target, subtarget, mode, ignore) case BUILT_IN_SQRT: case BUILT_IN_SQRTF: case BUILT_IN_SQRTL: + case BUILT_IN_FLOOR: + case BUILT_IN_FLOORF: + case BUILT_IN_FLOORL: + case BUILT_IN_CEIL: + case BUILT_IN_CEILF: + case BUILT_IN_CEILL: + case BUILT_IN_TRUNC: + case BUILT_IN_TRUNCF: + case BUILT_IN_TRUNCL: + case BUILT_IN_ROUND: + case BUILT_IN_ROUNDF: + case BUILT_IN_ROUNDL: + case BUILT_IN_NEARBYINT: + case BUILT_IN_NEARBYINTF: + case BUILT_IN_NEARBYINTL: target = expand_builtin_mathfn (exp, target, subtarget); if (target) return target; break; + case BUILT_IN_POW: + case BUILT_IN_POWF: + case BUILT_IN_POWL: + if (! flag_unsafe_math_optimizations) + break; + target = expand_builtin_pow (exp, target, subtarget); + if (target) + return target; + break; + + case BUILT_IN_ATAN2: + case BUILT_IN_ATAN2F: + case BUILT_IN_ATAN2L: + if (! flag_unsafe_math_optimizations) + break; + target = expand_builtin_mathfn_2 (exp, target, subtarget); + if (target) + return target; + break; + case BUILT_IN_APPLY_ARGS: return expand_builtin_apply_args (); @@ -3951,7 +5130,7 @@ expand_builtin (exp, target, subtarget, mode, ignore) return expand_builtin_saveregs (); case BUILT_IN_ARGS_INFO: - return expand_builtin_args_info (exp); + return expand_builtin_args_info (arglist); /* Return the address of the first anonymous stack arg. */ case BUILT_IN_NEXT_ARG: @@ -3961,11 +5140,11 @@ expand_builtin (exp, target, subtarget, mode, ignore) return expand_builtin_classify_type (arglist); case BUILT_IN_CONSTANT_P: - return expand_builtin_constant_p (exp); + return expand_builtin_constant_p (arglist, target_mode); case BUILT_IN_FRAME_ADDRESS: case BUILT_IN_RETURN_ADDRESS: - return expand_builtin_frame_address (exp); + return expand_builtin_frame_address (fndecl, arglist); /* Returns the address of the area where the structure is returned. 0 otherwise. */ @@ -3984,19 +5163,58 @@ expand_builtin (exp, target, subtarget, mode, ignore) break; case BUILT_IN_FFS: - target = expand_builtin_ffs (arglist, target, subtarget); + case BUILT_IN_FFSL: + case BUILT_IN_FFSLL: + target = expand_builtin_unop (target_mode, arglist, target, + subtarget, ffs_optab); + if (target) + return target; + break; + + case BUILT_IN_CLZ: + case BUILT_IN_CLZL: + case BUILT_IN_CLZLL: + target = expand_builtin_unop (target_mode, arglist, target, + subtarget, clz_optab); + if (target) + return target; + break; + + case BUILT_IN_CTZ: + case BUILT_IN_CTZL: + case BUILT_IN_CTZLL: + target = expand_builtin_unop (target_mode, arglist, target, + subtarget, ctz_optab); + if (target) + return target; + break; + + case BUILT_IN_POPCOUNT: + case BUILT_IN_POPCOUNTL: + case BUILT_IN_POPCOUNTLL: + target = expand_builtin_unop (target_mode, arglist, target, + subtarget, popcount_optab); + if (target) + return target; + break; + + case BUILT_IN_PARITY: + case BUILT_IN_PARITYL: + case BUILT_IN_PARITYLL: + target = expand_builtin_unop (target_mode, arglist, target, + subtarget, parity_optab); if (target) return target; break; case BUILT_IN_STRLEN: - target = expand_builtin_strlen (exp, target); + target = expand_builtin_strlen (arglist, target, target_mode); if (target) return target; break; case BUILT_IN_STRCPY: - target = expand_builtin_strcpy (exp, target, mode); + target = expand_builtin_strcpy (arglist, target, mode); if (target) return target; break; @@ -4007,6 +5225,12 @@ expand_builtin (exp, target, subtarget, mode, ignore) return target; break; + case BUILT_IN_STPCPY: + target = expand_builtin_stpcpy (arglist, target, mode); + if (target) + return target; + break; + case BUILT_IN_STRCAT: target = expand_builtin_strcat (arglist, target, mode); if (target) @@ -4063,14 +5287,32 @@ expand_builtin (exp, target, subtarget, mode, ignore) return target; break; + case BUILT_IN_MEMPCPY: + target = expand_builtin_mempcpy (arglist, target, mode, /*endp=*/ 1); + if (target) + return target; + break; + + case BUILT_IN_MEMMOVE: + target = expand_builtin_memmove (arglist, target, mode); + if (target) + return target; + break; + + case BUILT_IN_BCOPY: + target = expand_builtin_bcopy (arglist); + if (target) + return target; + break; + case BUILT_IN_MEMSET: - target = expand_builtin_memset (exp, target, mode); + target = expand_builtin_memset (arglist, target, mode); if (target) return target; break; case BUILT_IN_BZERO: - target = expand_builtin_bzero (exp); + target = expand_builtin_bzero (arglist); if (target) return target; break; @@ -4127,13 +5369,44 @@ expand_builtin (exp, target, subtarget, mode, ignore) expand_builtin_trap (); return const0_rtx; - case BUILT_IN_FPUTS: - target = expand_builtin_fputs (arglist, ignore,/*unlocked=*/ 0); + case BUILT_IN_PRINTF: + target = expand_builtin_printf (arglist, target, mode, false); if (target) return target; break; + + case BUILT_IN_PRINTF_UNLOCKED: + target = expand_builtin_printf (arglist, target, mode, true); + if (target) + return target; + break; + + case BUILT_IN_FPUTS: + target = expand_builtin_fputs (arglist, target, false); + if (target) + return target; + break; + case BUILT_IN_FPUTS_UNLOCKED: - target = expand_builtin_fputs (arglist, ignore,/*unlocked=*/ 1); + target = expand_builtin_fputs (arglist, target, true); + if (target) + return target; + break; + + case BUILT_IN_FPRINTF: + target = expand_builtin_fprintf (arglist, target, mode, false); + if (target) + return target; + break; + + case BUILT_IN_FPRINTF_UNLOCKED: + target = expand_builtin_fprintf (arglist, target, mode, true); + if (target) + return target; + break; + + case BUILT_IN_SPRINTF: + target = expand_builtin_sprintf (arglist, target, mode); if (target) return target; break; @@ -4163,6 +5436,9 @@ expand_builtin (exp, target, subtarget, mode, ignore) case BUILT_IN_EH_RETURN_DATA_REGNO: return expand_builtin_eh_return_data_regno (arglist); #endif + case BUILT_IN_EXTEND_POINTER: + return expand_builtin_extend_pointer (TREE_VALUE (arglist)); + case BUILT_IN_VA_START: case BUILT_IN_STDARG_START: return expand_builtin_va_start (arglist); @@ -4188,12 +5464,83 @@ expand_builtin (exp, target, subtarget, mode, ignore) return expand_call (exp, target, ignore); } +/* Determine whether a tree node represents a call to a built-in + function. If the tree T is a call to a built-in function with + the right number of arguments of the appropriate types, return + the DECL_FUNCTION_CODE of the call, e.g. BUILT_IN_SQRT. + Otherwise the return value is END_BUILTINS. */ + +enum built_in_function +builtin_mathfn_code (tree t) +{ + tree fndecl, arglist, parmlist; + tree argtype, parmtype; + + if (TREE_CODE (t) != CALL_EXPR + || TREE_CODE (TREE_OPERAND (t, 0)) != ADDR_EXPR) + return END_BUILTINS; + + fndecl = get_callee_fndecl (t); + if (fndecl == NULL_TREE + || TREE_CODE (fndecl) != FUNCTION_DECL + || ! DECL_BUILT_IN (fndecl) + || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) + return END_BUILTINS; + + arglist = TREE_OPERAND (t, 1); + parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); + for (; parmlist; parmlist = TREE_CHAIN (parmlist)) + { + /* If a function doesn't take a variable number of arguments, + the last element in the list will have type `void'. */ + parmtype = TREE_VALUE (parmlist); + if (VOID_TYPE_P (parmtype)) + { + if (arglist) + return END_BUILTINS; + return DECL_FUNCTION_CODE (fndecl); + } + + if (! arglist) + return END_BUILTINS; + + argtype = TREE_TYPE (TREE_VALUE (arglist)); + + if (SCALAR_FLOAT_TYPE_P (parmtype)) + { + if (! SCALAR_FLOAT_TYPE_P (argtype)) + return END_BUILTINS; + } + else if (COMPLEX_FLOAT_TYPE_P (parmtype)) + { + if (! COMPLEX_FLOAT_TYPE_P (argtype)) + return END_BUILTINS; + } + else if (POINTER_TYPE_P (parmtype)) + { + if (! POINTER_TYPE_P (argtype)) + return END_BUILTINS; + } + else if (INTEGRAL_TYPE_P (parmtype)) + { + if (! INTEGRAL_TYPE_P (argtype)) + return END_BUILTINS; + } + else + return END_BUILTINS; + + arglist = TREE_CHAIN (arglist); + } + + /* Variable-length argument list. */ + return DECL_FUNCTION_CODE (fndecl); +} + /* Fold a call to __builtin_constant_p, if we know it will evaluate to a constant. ARGLIST is the argument list of the call. */ static tree -fold_builtin_constant_p (arglist) - tree arglist; +fold_builtin_constant_p (tree arglist) { if (arglist == 0) return 0; @@ -4213,15 +5560,14 @@ fold_builtin_constant_p (arglist) && TREE_CODE (TREE_OPERAND (arglist, 0)) == STRING_CST)) return integer_one_node; - /* If we aren't going to be running CSE or this expression - has side effects, show we don't know it to be a constant. - Likewise if it's a pointer or aggregate type since in those - case we only want literals, since those are only optimized + /* If this expression has side effects, show we don't know it to be a + constant. Likewise if it's a pointer or aggregate type since in + those case we only want literals, since those are only optimized when generating RTL, not later. And finally, if we are compiling an initializer, not code, we need to return a definite result now; there's not going to be any more optimization done. */ - if (TREE_SIDE_EFFECTS (arglist) || cse_not_expected + if (TREE_SIDE_EFFECTS (arglist) || AGGREGATE_TYPE_P (TREE_TYPE (arglist)) || POINTER_TYPE_P (TREE_TYPE (arglist)) || cfun == 0) @@ -4233,8 +5579,7 @@ fold_builtin_constant_p (arglist) /* Fold a call to __builtin_classify_type. */ static tree -fold_builtin_classify_type (arglist) - tree arglist; +fold_builtin_classify_type (tree arglist) { if (arglist == 0) return build_int_2 (no_type_class, 0); @@ -4245,9 +5590,7 @@ fold_builtin_classify_type (arglist) /* Fold a call to __builtin_inf or __builtin_huge_val. */ static tree -fold_builtin_inf (type, warn) - tree type; - int warn; +fold_builtin_inf (tree type, int warn) { REAL_VALUE_TYPE real; @@ -4261,9 +5604,7 @@ fold_builtin_inf (type, warn) /* Fold a call to __builtin_nan or __builtin_nans. */ static tree -fold_builtin_nan (arglist, type, quiet) - tree arglist, type; - int quiet; +fold_builtin_nan (tree arglist, tree type, int quiet) { REAL_VALUE_TYPE real; const char *str; @@ -4280,21 +5621,898 @@ fold_builtin_nan (arglist, type, quiet) return build_real (type, real); } +/* Return true if the floating point expression T has an integer value. + We also allow +Inf, -Inf and NaN to be considered integer values. */ + +static bool +integer_valued_real_p (tree t) +{ + switch (TREE_CODE (t)) + { + case FLOAT_EXPR: + return true; + + case ABS_EXPR: + case SAVE_EXPR: + case NON_LVALUE_EXPR: + return integer_valued_real_p (TREE_OPERAND (t, 0)); + + case COMPOUND_EXPR: + case MODIFY_EXPR: + case BIND_EXPR: + return integer_valued_real_p (TREE_OPERAND (t, 1)); + + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + case MIN_EXPR: + case MAX_EXPR: + return integer_valued_real_p (TREE_OPERAND (t, 0)) + && integer_valued_real_p (TREE_OPERAND (t, 1)); + + case COND_EXPR: + return integer_valued_real_p (TREE_OPERAND (t, 1)) + && integer_valued_real_p (TREE_OPERAND (t, 2)); + + case REAL_CST: + if (! TREE_CONSTANT_OVERFLOW (t)) + { + REAL_VALUE_TYPE c, cint; + + c = TREE_REAL_CST (t); + real_trunc (&cint, TYPE_MODE (TREE_TYPE (t)), &c); + return real_identical (&c, &cint); + } + + case NOP_EXPR: + { + tree type = TREE_TYPE (TREE_OPERAND (t, 0)); + if (TREE_CODE (type) == INTEGER_TYPE) + return true; + if (TREE_CODE (type) == REAL_TYPE) + return integer_valued_real_p (TREE_OPERAND (t, 0)); + break; + } + + case CALL_EXPR: + switch (builtin_mathfn_code (t)) + { + case BUILT_IN_CEIL: + case BUILT_IN_CEILF: + case BUILT_IN_CEILL: + case BUILT_IN_FLOOR: + case BUILT_IN_FLOORF: + case BUILT_IN_FLOORL: + case BUILT_IN_NEARBYINT: + case BUILT_IN_NEARBYINTF: + case BUILT_IN_NEARBYINTL: + case BUILT_IN_ROUND: + case BUILT_IN_ROUNDF: + case BUILT_IN_ROUNDL: + case BUILT_IN_TRUNC: + case BUILT_IN_TRUNCF: + case BUILT_IN_TRUNCL: + return true; + + default: + break; + } + break; + + default: + break; + } + return false; +} + +/* EXP is assumed to be builtin call where truncation can be propagated + across (for instance floor((double)f) == (double)floorf (f). + Do the transformation. */ + +static tree +fold_trunc_transparent_mathfn (tree exp) +{ + tree fndecl = get_callee_fndecl (exp); + tree arglist = TREE_OPERAND (exp, 1); + enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); + tree arg; + + if (! validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return 0; + + arg = TREE_VALUE (arglist); + /* Integer rounding functions are idempotent. */ + if (fcode == builtin_mathfn_code (arg)) + return arg; + + /* If argument is already integer valued, and we don't need to worry + about setting errno, there's no need to perform rounding. */ + if (! flag_errno_math && integer_valued_real_p (arg)) + return arg; + + if (optimize) + { + tree arg0 = strip_float_extensions (arg); + tree ftype = TREE_TYPE (exp); + tree newtype = TREE_TYPE (arg0); + tree decl; + + if (TYPE_PRECISION (newtype) < TYPE_PRECISION (ftype) + && (decl = mathfn_built_in (newtype, fcode))) + { + arglist = + build_tree_list (NULL_TREE, fold (convert (newtype, arg0))); + return convert (ftype, + build_function_call_expr (decl, arglist)); + } + } + return 0; +} + +/* Fold function call to builtin cabs, cabsf or cabsl. FNDECL is the + function's DECL, ARGLIST is the argument list and TYPE is the return + type. Return NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_cabs (tree fndecl, tree arglist, tree type) +{ + tree arg; + + if (!arglist || TREE_CHAIN (arglist)) + return NULL_TREE; + + arg = TREE_VALUE (arglist); + if (TREE_CODE (TREE_TYPE (arg)) != COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) != REAL_TYPE) + return NULL_TREE; + + /* Evaluate cabs of a constant at compile-time. */ + if (flag_unsafe_math_optimizations + && TREE_CODE (arg) == COMPLEX_CST + && TREE_CODE (TREE_REALPART (arg)) == REAL_CST + && TREE_CODE (TREE_IMAGPART (arg)) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (TREE_REALPART (arg)) + && ! TREE_CONSTANT_OVERFLOW (TREE_IMAGPART (arg))) + { + REAL_VALUE_TYPE r, i; + + r = TREE_REAL_CST (TREE_REALPART (arg)); + i = TREE_REAL_CST (TREE_IMAGPART (arg)); + + real_arithmetic (&r, MULT_EXPR, &r, &r); + real_arithmetic (&i, MULT_EXPR, &i, &i); + real_arithmetic (&r, PLUS_EXPR, &r, &i); + if (real_sqrt (&r, TYPE_MODE (type), &r) + || ! flag_trapping_math) + return build_real (type, r); + } + + /* If either part is zero, cabs is fabs of the other. */ + if (TREE_CODE (arg) == COMPLEX_EXPR + && real_zerop (TREE_OPERAND (arg, 0))) + return fold (build1 (ABS_EXPR, type, TREE_OPERAND (arg, 1))); + if (TREE_CODE (arg) == COMPLEX_EXPR + && real_zerop (TREE_OPERAND (arg, 1))) + return fold (build1 (ABS_EXPR, type, TREE_OPERAND (arg, 0))); + + if (flag_unsafe_math_optimizations) + { + enum built_in_function fcode; + tree sqrtfn; + + fcode = DECL_FUNCTION_CODE (fndecl); + if (fcode == BUILT_IN_CABS) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRT]; + else if (fcode == BUILT_IN_CABSF) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRTF]; + else if (fcode == BUILT_IN_CABSL) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRTL]; + else + sqrtfn = NULL_TREE; + + if (sqrtfn != NULL_TREE) + { + tree rpart, ipart, result, arglist; + + arg = save_expr (arg); + + rpart = fold (build1 (REALPART_EXPR, type, arg)); + ipart = fold (build1 (IMAGPART_EXPR, type, arg)); + + rpart = save_expr (rpart); + ipart = save_expr (ipart); + + result = fold (build (PLUS_EXPR, type, + fold (build (MULT_EXPR, type, + rpart, rpart)), + fold (build (MULT_EXPR, type, + ipart, ipart)))); + + arglist = build_tree_list (NULL_TREE, result); + return build_function_call_expr (sqrtfn, arglist); + } + } + + return NULL_TREE; +} + +/* Fold function call to builtin trunc, truncf or truncl. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_trunc (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg; + + if (! validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return 0; + + /* Optimize trunc of constant value. */ + arg = TREE_VALUE (arglist); + if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + { + REAL_VALUE_TYPE r, x; + tree type = TREE_TYPE (exp); + + x = TREE_REAL_CST (arg); + real_trunc (&r, TYPE_MODE (type), &x); + return build_real (type, r); + } + + return fold_trunc_transparent_mathfn (exp); +} + +/* Fold function call to builtin floor, floorf or floorl. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_floor (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg; + + if (! validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return 0; + + /* Optimize floor of constant value. */ + arg = TREE_VALUE (arglist); + if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + { + REAL_VALUE_TYPE x; + + x = TREE_REAL_CST (arg); + if (! REAL_VALUE_ISNAN (x) || ! flag_errno_math) + { + tree type = TREE_TYPE (exp); + REAL_VALUE_TYPE r; + + real_floor (&r, TYPE_MODE (type), &x); + return build_real (type, r); + } + } + + return fold_trunc_transparent_mathfn (exp); +} + +/* Fold function call to builtin ceil, ceilf or ceill. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_ceil (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg; + + if (! validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return 0; + + /* Optimize ceil of constant value. */ + arg = TREE_VALUE (arglist); + if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + { + REAL_VALUE_TYPE x; + + x = TREE_REAL_CST (arg); + if (! REAL_VALUE_ISNAN (x) || ! flag_errno_math) + { + tree type = TREE_TYPE (exp); + REAL_VALUE_TYPE r; + + real_ceil (&r, TYPE_MODE (type), &x); + return build_real (type, r); + } + } + + return fold_trunc_transparent_mathfn (exp); +} + +/* Fold function call to builtin ffs, clz, ctz, popcount and parity + and their long and long long variants (i.e. ffsl and ffsll). + Return NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_bitop (tree exp) +{ + tree fndecl = get_callee_fndecl (exp); + tree arglist = TREE_OPERAND (exp, 1); + tree arg; + + if (! validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE)) + return NULL_TREE; + + /* Optimize for constant argument. */ + arg = TREE_VALUE (arglist); + if (TREE_CODE (arg) == INTEGER_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + { + HOST_WIDE_INT hi, width, result; + unsigned HOST_WIDE_INT lo; + tree type, t; + + type = TREE_TYPE (arg); + width = TYPE_PRECISION (type); + lo = TREE_INT_CST_LOW (arg); + + /* Clear all the bits that are beyond the type's precision. */ + if (width > HOST_BITS_PER_WIDE_INT) + { + hi = TREE_INT_CST_HIGH (arg); + if (width < 2 * HOST_BITS_PER_WIDE_INT) + hi &= ~((HOST_WIDE_INT) (-1) >> (width - HOST_BITS_PER_WIDE_INT)); + } + else + { + hi = 0; + if (width < HOST_BITS_PER_WIDE_INT) + lo &= ~((unsigned HOST_WIDE_INT) (-1) << width); + } + + switch (DECL_FUNCTION_CODE (fndecl)) + { + case BUILT_IN_FFS: + case BUILT_IN_FFSL: + case BUILT_IN_FFSLL: + if (lo != 0) + result = exact_log2 (lo & -lo) + 1; + else if (hi != 0) + result = HOST_BITS_PER_WIDE_INT + exact_log2 (hi & -hi) + 1; + else + result = 0; + break; + + case BUILT_IN_CLZ: + case BUILT_IN_CLZL: + case BUILT_IN_CLZLL: + if (hi != 0) + result = width - floor_log2 (hi) - 1 - HOST_BITS_PER_WIDE_INT; + else if (lo != 0) + result = width - floor_log2 (lo) - 1; + else if (! CLZ_DEFINED_VALUE_AT_ZERO (TYPE_MODE (type), result)) + result = width; + break; + + case BUILT_IN_CTZ: + case BUILT_IN_CTZL: + case BUILT_IN_CTZLL: + if (lo != 0) + result = exact_log2 (lo & -lo); + else if (hi != 0) + result = HOST_BITS_PER_WIDE_INT + exact_log2 (hi & -hi); + else if (! CTZ_DEFINED_VALUE_AT_ZERO (TYPE_MODE (type), result)) + result = width; + break; + + case BUILT_IN_POPCOUNT: + case BUILT_IN_POPCOUNTL: + case BUILT_IN_POPCOUNTLL: + result = 0; + while (lo) + result++, lo &= lo - 1; + while (hi) + result++, hi &= hi - 1; + break; + + case BUILT_IN_PARITY: + case BUILT_IN_PARITYL: + case BUILT_IN_PARITYLL: + result = 0; + while (lo) + result++, lo &= lo - 1; + while (hi) + result++, hi &= hi - 1; + result &= 1; + break; + + default: + abort(); + } + + t = build_int_2 (result, 0); + TREE_TYPE (t) = TREE_TYPE (exp); + return t; + } + + return NULL_TREE; +} + +/* Return true if EXPR is the real constant contained in VALUE. */ + +static bool +real_dconstp (tree expr, const REAL_VALUE_TYPE *value) +{ + STRIP_NOPS (expr); + + return ((TREE_CODE (expr) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (expr) + && REAL_VALUES_EQUAL (TREE_REAL_CST (expr), *value)) + || (TREE_CODE (expr) == COMPLEX_CST + && real_dconstp (TREE_REALPART (expr), value) + && real_zerop (TREE_IMAGPART (expr)))); +} + +/* A subroutine of fold_builtin to fold the various logarithmic + functions. EXP is the CALL_EXPR of a call to a builtin log* + function. VALUE is the base of the log* function. */ + +static tree +fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) +{ + tree arglist = TREE_OPERAND (exp, 1); + + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + tree fndecl = get_callee_fndecl (exp); + tree type = TREE_TYPE (TREE_TYPE (fndecl)); + tree arg = TREE_VALUE (arglist); + const enum built_in_function fcode = builtin_mathfn_code (arg); + + /* Optimize log*(1.0) = 0.0. */ + if (real_onep (arg)) + return build_real (type, dconst0); + + /* Optimize logN(N) = 1.0. If N can't be truncated to MODE + exactly, then only do this if flag_unsafe_math_optimizations. */ + if (exact_real_truncate (TYPE_MODE (type), value) + || flag_unsafe_math_optimizations) + { + const REAL_VALUE_TYPE value_truncate = + real_value_truncate (TYPE_MODE (type), *value); + if (real_dconstp (arg, &value_truncate)) + return build_real (type, dconst1); + } + + /* Special case, optimize logN(expN(x)) = x. */ + if (flag_unsafe_math_optimizations + && ((value == &dconste + && (fcode == BUILT_IN_EXP + || fcode == BUILT_IN_EXPF + || fcode == BUILT_IN_EXPL)) + || (value == &dconst2 + && (fcode == BUILT_IN_EXP2 + || fcode == BUILT_IN_EXP2F + || fcode == BUILT_IN_EXP2L)) + || (value == &dconst10 + && (fcode == BUILT_IN_EXP10 + || fcode == BUILT_IN_EXP10F + || fcode == BUILT_IN_EXP10L)))) + return convert (type, TREE_VALUE (TREE_OPERAND (arg, 1))); + + /* Optimize log*(func()) for various exponential functions. We + want to determine the value "x" and the power "exponent" in + order to transform logN(x**exponent) into exponent*logN(x). */ + if (flag_unsafe_math_optimizations) + { + tree exponent = 0, x = 0; + + switch (fcode) + { + case BUILT_IN_EXP: + case BUILT_IN_EXPF: + case BUILT_IN_EXPL: + /* Prepare to do logN(exp(exponent) -> exponent*logN(e). */ + x = build_real (type, + real_value_truncate (TYPE_MODE (type), dconste)); + exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); + break; + case BUILT_IN_EXP2: + case BUILT_IN_EXP2F: + case BUILT_IN_EXP2L: + /* Prepare to do logN(exp2(exponent) -> exponent*logN(2). */ + x = build_real (type, dconst2); + exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); + break; + case BUILT_IN_EXP10: + case BUILT_IN_EXP10F: + case BUILT_IN_EXP10L: + case BUILT_IN_POW10: + case BUILT_IN_POW10F: + case BUILT_IN_POW10L: + /* Prepare to do logN(exp10(exponent) -> exponent*logN(10). */ + x = build_real (type, dconst10); + exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); + break; + case BUILT_IN_SQRT: + case BUILT_IN_SQRTF: + case BUILT_IN_SQRTL: + /* Prepare to do logN(sqrt(x) -> 0.5*logN(x). */ + x = TREE_VALUE (TREE_OPERAND (arg, 1)); + exponent = build_real (type, dconsthalf); + break; + case BUILT_IN_CBRT: + case BUILT_IN_CBRTF: + case BUILT_IN_CBRTL: + /* Prepare to do logN(cbrt(x) -> (1/3)*logN(x). */ + x = TREE_VALUE (TREE_OPERAND (arg, 1)); + exponent = build_real (type, real_value_truncate (TYPE_MODE (type), + dconstthird)); + break; + case BUILT_IN_POW: + case BUILT_IN_POWF: + case BUILT_IN_POWL: + /* Prepare to do logN(pow(x,exponent) -> exponent*logN(x). */ + x = TREE_VALUE (TREE_OPERAND (arg, 1)); + exponent = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1))); + break; + default: + break; + } + + /* Now perform the optimization. */ + if (x && exponent) + { + tree logfn; + arglist = build_tree_list (NULL_TREE, x); + logfn = build_function_call_expr (fndecl, arglist); + return fold (build (MULT_EXPR, type, exponent, logfn)); + } + } + } + + return 0; +} + +/* A subroutine of fold_builtin to fold the various exponent + functions. EXP is the CALL_EXPR of a call to a builtin function. + VALUE is the value which will be raised to a power. */ + +static tree +fold_builtin_exponent (tree exp, const REAL_VALUE_TYPE *value) +{ + tree arglist = TREE_OPERAND (exp, 1); + + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + tree fndecl = get_callee_fndecl (exp); + tree type = TREE_TYPE (TREE_TYPE (fndecl)); + tree arg = TREE_VALUE (arglist); + + /* Optimize exp*(0.0) = 1.0. */ + if (real_zerop (arg)) + return build_real (type, dconst1); + + /* Optimize expN(1.0) = N. */ + if (real_onep (arg)) + { + REAL_VALUE_TYPE cst; + + real_convert (&cst, TYPE_MODE (type), value); + return build_real (type, cst); + } + + /* Attempt to evaluate expN(integer) at compile-time. */ + if (flag_unsafe_math_optimizations + && TREE_CODE (arg) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (arg)) + { + REAL_VALUE_TYPE cint; + REAL_VALUE_TYPE c; + HOST_WIDE_INT n; + + c = TREE_REAL_CST (arg); + n = real_to_integer (&c); + real_from_integer (&cint, VOIDmode, n, + n < 0 ? -1 : 0, 0); + if (real_identical (&c, &cint)) + { + REAL_VALUE_TYPE x; + + real_powi (&x, TYPE_MODE (type), value, n); + return build_real (type, x); + } + } + + /* Optimize expN(logN(x)) = x. */ + if (flag_unsafe_math_optimizations) + { + const enum built_in_function fcode = builtin_mathfn_code (arg); + + if ((value == &dconste + && (fcode == BUILT_IN_LOG + || fcode == BUILT_IN_LOGF + || fcode == BUILT_IN_LOGL)) + || (value == &dconst2 + && (fcode == BUILT_IN_LOG2 + || fcode == BUILT_IN_LOG2F + || fcode == BUILT_IN_LOG2L)) + || (value == &dconst10 + && (fcode == BUILT_IN_LOG10 + || fcode == BUILT_IN_LOG10F + || fcode == BUILT_IN_LOG10L))) + return convert (type, TREE_VALUE (TREE_OPERAND (arg, 1))); + } + } + + return 0; +} + +/* Fold function call to builtin memcpy. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_memcpy (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree dest, src, len; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + dest = TREE_VALUE (arglist); + src = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return DEST. */ + if (integer_zerop (len)) + return omit_one_operand (TREE_TYPE (exp), dest, src); + + /* If SRC and DEST are the same (and not volatile), return DEST. */ + if (operand_equal_p (src, dest, 0)) + return omit_one_operand (TREE_TYPE (exp), dest, len); + + return 0; +} + +/* Fold function call to builtin mempcpy. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_mempcpy (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree dest, src, len; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + dest = TREE_VALUE (arglist); + src = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return DEST. */ + if (integer_zerop (len)) + return omit_one_operand (TREE_TYPE (exp), dest, src); + + /* If SRC and DEST are the same (and not volatile), return DEST+LEN. */ + if (operand_equal_p (src, dest, 0)) + { + tree temp = convert (TREE_TYPE (dest), len); + temp = fold (build (PLUS_EXPR, TREE_TYPE (dest), dest, len)); + return convert (TREE_TYPE (exp), temp); + } + + return 0; +} + +/* Fold function call to builtin memmove. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_memmove (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree dest, src, len; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + dest = TREE_VALUE (arglist); + src = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return DEST. */ + if (integer_zerop (len)) + return omit_one_operand (TREE_TYPE (exp), dest, src); + + /* If SRC and DEST are the same (and not volatile), return DEST. */ + if (operand_equal_p (src, dest, 0)) + return omit_one_operand (TREE_TYPE (exp), dest, len); + + return 0; +} + +/* Fold function call to builtin strcpy. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_strcpy (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree dest, src; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) + return 0; + + dest = TREE_VALUE (arglist); + src = TREE_VALUE (TREE_CHAIN (arglist)); + + /* If SRC and DEST are the same (and not volatile), return DEST. */ + if (operand_equal_p (src, dest, 0)) + return convert (TREE_TYPE (exp), dest); + + return 0; +} + +/* Fold function call to builtin strncpy. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_strncpy (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree dest, src, len; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + dest = TREE_VALUE (arglist); + src = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return DEST. */ + if (integer_zerop (len)) + return omit_one_operand (TREE_TYPE (exp), dest, src); + + return 0; +} + +/* Fold function call to builtin memcmp. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_memcmp (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg1, arg2, len; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + arg1 = TREE_VALUE (arglist); + arg2 = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return zero. */ + if (integer_zerop (len)) + { + tree temp = omit_one_operand (TREE_TYPE (exp), integer_zero_node, arg2); + return omit_one_operand (TREE_TYPE (exp), temp, arg1); + } + + /* If ARG1 and ARG2 are the same (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + return omit_one_operand (TREE_TYPE (exp), integer_zero_node, len); + + return 0; +} + +/* Fold function call to builtin strcmp. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_strcmp (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg1, arg2; + const char *p1, *p2; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) + return 0; + + arg1 = TREE_VALUE (arglist); + arg2 = TREE_VALUE (TREE_CHAIN (arglist)); + + /* If ARG1 and ARG2 are the same (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + return convert (TREE_TYPE (exp), integer_zero_node); + + p1 = c_getstr (arg1); + p2 = c_getstr (arg2); + + if (p1 && p2) + { + tree temp; + const int i = strcmp (p1, p2); + if (i < 0) + temp = integer_minus_one_node; + else if (i > 0) + temp = integer_one_node; + else + temp = integer_zero_node; + return convert (TREE_TYPE (exp), temp); + } + + return 0; +} + +/* Fold function call to builtin strncmp. Return + NULL_TREE if no simplification can be made. */ + +static tree +fold_builtin_strncmp (tree exp) +{ + tree arglist = TREE_OPERAND (exp, 1); + tree arg1, arg2, len; + const char *p1, *p2; + + if (!validate_arglist (arglist, + POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) + return 0; + + arg1 = TREE_VALUE (arglist); + arg2 = TREE_VALUE (TREE_CHAIN (arglist)); + len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + + /* If the LEN parameter is zero, return zero. */ + if (integer_zerop (len)) + { + tree temp = omit_one_operand (TREE_TYPE (exp), integer_zero_node, arg2); + return omit_one_operand (TREE_TYPE (exp), temp, arg1); + } + + /* If ARG1 and ARG2 are the same (and not volatile), return zero. */ + if (operand_equal_p (arg1, arg2, 0)) + return omit_one_operand (TREE_TYPE (exp), integer_zero_node, len); + + p1 = c_getstr (arg1); + p2 = c_getstr (arg2); + + if (host_integerp (len, 1) && p1 && p2) + { + tree temp; + const int i = strncmp (p1, p2, tree_low_cst (len, 1)); + if (i < 0) + temp = integer_minus_one_node; + else if (i > 0) + temp = integer_one_node; + else + temp = integer_zero_node; + return convert (TREE_TYPE (exp), temp); + } + + return 0; +} + /* Used by constant folding to eliminate some builtin calls early. EXP is the CALL_EXPR of a call to a builtin function. */ tree -fold_builtin (exp) - tree exp; +fold_builtin (tree exp) { - tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + tree fndecl = get_callee_fndecl (exp); tree arglist = TREE_OPERAND (exp, 1); - enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); + tree type = TREE_TYPE (TREE_TYPE (fndecl)); if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) return 0; - switch (fcode) + switch (DECL_FUNCTION_CODE (fndecl)) { case BUILT_IN_CONSTANT_P: return fold_builtin_constant_p (arglist); @@ -4305,7 +6523,7 @@ fold_builtin (exp) case BUILT_IN_STRLEN: if (validate_arglist (arglist, POINTER_TYPE, VOID_TYPE)) { - tree len = c_strlen (TREE_VALUE (arglist)); + tree len = c_strlen (TREE_VALUE (arglist), 0); if (len) { /* Convert from the internal "sizetype" type to "size_t". */ @@ -4316,25 +6534,389 @@ fold_builtin (exp) } break; + case BUILT_IN_FABS: + case BUILT_IN_FABSF: + case BUILT_IN_FABSL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + return fold (build1 (ABS_EXPR, type, TREE_VALUE (arglist))); + break; + + case BUILT_IN_CABS: + case BUILT_IN_CABSF: + case BUILT_IN_CABSL: + return fold_builtin_cabs (fndecl, arglist, type); + + case BUILT_IN_SQRT: + case BUILT_IN_SQRTF: + case BUILT_IN_SQRTL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + enum built_in_function fcode; + tree arg = TREE_VALUE (arglist); + + /* Optimize sqrt of constant value. */ + if (TREE_CODE (arg) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (arg)) + { + REAL_VALUE_TYPE r, x; + + x = TREE_REAL_CST (arg); + if (real_sqrt (&r, TYPE_MODE (type), &x) + || (!flag_trapping_math && !flag_errno_math)) + return build_real (type, r); + } + + /* Optimize sqrt(exp(x)) = exp(x*0.5). */ + fcode = builtin_mathfn_code (arg); + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_EXP + || fcode == BUILT_IN_EXPF + || fcode == BUILT_IN_EXPL)) + { + tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0); + arg = fold (build (MULT_EXPR, type, + TREE_VALUE (TREE_OPERAND (arg, 1)), + build_real (type, dconsthalf))); + arglist = build_tree_list (NULL_TREE, arg); + return build_function_call_expr (expfn, arglist); + } + + /* Optimize sqrt(pow(x,y)) = pow(x,y*0.5). */ + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_POW + || fcode == BUILT_IN_POWF + || fcode == BUILT_IN_POWL)) + { + tree powfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0); + tree arg0 = TREE_VALUE (TREE_OPERAND (arg, 1)); + tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1))); + tree narg1 = fold (build (MULT_EXPR, type, arg1, + build_real (type, dconsthalf))); + arglist = tree_cons (NULL_TREE, arg0, + build_tree_list (NULL_TREE, narg1)); + return build_function_call_expr (powfn, arglist); + } + } + break; + + case BUILT_IN_SIN: + case BUILT_IN_SINF: + case BUILT_IN_SINL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + tree arg = TREE_VALUE (arglist); + + /* Optimize sin(0.0) = 0.0. */ + if (real_zerop (arg)) + return arg; + } + break; + + case BUILT_IN_COS: + case BUILT_IN_COSF: + case BUILT_IN_COSL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + tree arg = TREE_VALUE (arglist); + + /* Optimize cos(0.0) = 1.0. */ + if (real_zerop (arg)) + return build_real (type, dconst1); + + /* Optimize cos(-x) into cos(x). */ + if (TREE_CODE (arg) == NEGATE_EXPR) + { + tree arglist = build_tree_list (NULL_TREE, + TREE_OPERAND (arg, 0)); + return build_function_call_expr (fndecl, arglist); + } + } + break; + + case BUILT_IN_EXP: + case BUILT_IN_EXPF: + case BUILT_IN_EXPL: + return fold_builtin_exponent (exp, &dconste); + case BUILT_IN_EXP2: + case BUILT_IN_EXP2F: + case BUILT_IN_EXP2L: + return fold_builtin_exponent (exp, &dconst2); + case BUILT_IN_EXP10: + case BUILT_IN_EXP10F: + case BUILT_IN_EXP10L: + case BUILT_IN_POW10: + case BUILT_IN_POW10F: + case BUILT_IN_POW10L: + return fold_builtin_exponent (exp, &dconst10); + case BUILT_IN_LOG: + case BUILT_IN_LOGF: + case BUILT_IN_LOGL: + return fold_builtin_logarithm (exp, &dconste); + break; + case BUILT_IN_LOG2: + case BUILT_IN_LOG2F: + case BUILT_IN_LOG2L: + return fold_builtin_logarithm (exp, &dconst2); + break; + case BUILT_IN_LOG10: + case BUILT_IN_LOG10F: + case BUILT_IN_LOG10L: + return fold_builtin_logarithm (exp, &dconst10); + break; + + case BUILT_IN_TAN: + case BUILT_IN_TANF: + case BUILT_IN_TANL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + enum built_in_function fcode; + tree arg = TREE_VALUE (arglist); + + /* Optimize tan(0.0) = 0.0. */ + if (real_zerop (arg)) + return arg; + + /* Optimize tan(atan(x)) = x. */ + fcode = builtin_mathfn_code (arg); + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_ATAN + || fcode == BUILT_IN_ATANF + || fcode == BUILT_IN_ATANL)) + return TREE_VALUE (TREE_OPERAND (arg, 1)); + } + break; + + case BUILT_IN_ATAN: + case BUILT_IN_ATANF: + case BUILT_IN_ATANL: + if (validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) + { + tree arg = TREE_VALUE (arglist); + + /* Optimize atan(0.0) = 0.0. */ + if (real_zerop (arg)) + return arg; + + /* Optimize atan(1.0) = pi/4. */ + if (real_onep (arg)) + { + REAL_VALUE_TYPE cst; + + real_convert (&cst, TYPE_MODE (type), &dconstpi); + cst.exp -= 2; + return build_real (type, cst); + } + } + break; + + case BUILT_IN_POW: + case BUILT_IN_POWF: + case BUILT_IN_POWL: + if (validate_arglist (arglist, REAL_TYPE, REAL_TYPE, VOID_TYPE)) + { + enum built_in_function fcode; + tree arg0 = TREE_VALUE (arglist); + tree arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + + /* Optimize pow(1.0,y) = 1.0. */ + if (real_onep (arg0)) + return omit_one_operand (type, build_real (type, dconst1), arg1); + + if (TREE_CODE (arg1) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (arg1)) + { + REAL_VALUE_TYPE c; + c = TREE_REAL_CST (arg1); + + /* Optimize pow(x,0.0) = 1.0. */ + if (REAL_VALUES_EQUAL (c, dconst0)) + return omit_one_operand (type, build_real (type, dconst1), + arg0); + + /* Optimize pow(x,1.0) = x. */ + if (REAL_VALUES_EQUAL (c, dconst1)) + return arg0; + + /* Optimize pow(x,-1.0) = 1.0/x. */ + if (REAL_VALUES_EQUAL (c, dconstm1)) + return fold (build (RDIV_EXPR, type, + build_real (type, dconst1), + arg0)); + + /* Optimize pow(x,0.5) = sqrt(x). */ + if (flag_unsafe_math_optimizations + && REAL_VALUES_EQUAL (c, dconsthalf)) + { + tree sqrtfn; + + fcode = DECL_FUNCTION_CODE (fndecl); + if (fcode == BUILT_IN_POW) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRT]; + else if (fcode == BUILT_IN_POWF) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRTF]; + else if (fcode == BUILT_IN_POWL) + sqrtfn = implicit_built_in_decls[BUILT_IN_SQRTL]; + else + sqrtfn = NULL_TREE; + + if (sqrtfn != NULL_TREE) + { + tree arglist = build_tree_list (NULL_TREE, arg0); + return build_function_call_expr (sqrtfn, arglist); + } + } + + /* Attempt to evaluate pow at compile-time. */ + if (TREE_CODE (arg0) == REAL_CST + && ! TREE_CONSTANT_OVERFLOW (arg0)) + { + REAL_VALUE_TYPE cint; + HOST_WIDE_INT n; + + n = real_to_integer (&c); + real_from_integer (&cint, VOIDmode, n, + n < 0 ? -1 : 0, 0); + if (real_identical (&c, &cint)) + { + REAL_VALUE_TYPE x; + bool inexact; + + x = TREE_REAL_CST (arg0); + inexact = real_powi (&x, TYPE_MODE (type), &x, n); + if (flag_unsafe_math_optimizations || !inexact) + return build_real (type, x); + } + } + } + + /* Optimize pow(exp(x),y) = exp(x*y). */ + fcode = builtin_mathfn_code (arg0); + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_EXP + || fcode == BUILT_IN_EXPF + || fcode == BUILT_IN_EXPL)) + { + tree expfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0); + tree arg = TREE_VALUE (TREE_OPERAND (arg0, 1)); + arg = fold (build (MULT_EXPR, type, arg, arg1)); + arglist = build_tree_list (NULL_TREE, arg); + return build_function_call_expr (expfn, arglist); + } + + /* Optimize pow(sqrt(x),y) = pow(x,y*0.5). */ + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_SQRT + || fcode == BUILT_IN_SQRTF + || fcode == BUILT_IN_SQRTL)) + { + tree narg0 = TREE_VALUE (TREE_OPERAND (arg0, 1)); + tree narg1 = fold (build (MULT_EXPR, type, arg1, + build_real (type, dconsthalf))); + + arglist = tree_cons (NULL_TREE, narg0, + build_tree_list (NULL_TREE, narg1)); + return build_function_call_expr (fndecl, arglist); + } + + /* Optimize pow(pow(x,y),z) = pow(x,y*z). */ + if (flag_unsafe_math_optimizations + && (fcode == BUILT_IN_POW + || fcode == BUILT_IN_POWF + || fcode == BUILT_IN_POWL)) + { + tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1)); + tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0, 1))); + tree narg1 = fold (build (MULT_EXPR, type, arg01, arg1)); + arglist = tree_cons (NULL_TREE, arg00, + build_tree_list (NULL_TREE, narg1)); + return build_function_call_expr (fndecl, arglist); + } + } + break; + case BUILT_IN_INF: case BUILT_IN_INFF: case BUILT_IN_INFL: - return fold_builtin_inf (TREE_TYPE (TREE_TYPE (fndecl)), true); + return fold_builtin_inf (type, true); case BUILT_IN_HUGE_VAL: case BUILT_IN_HUGE_VALF: case BUILT_IN_HUGE_VALL: - return fold_builtin_inf (TREE_TYPE (TREE_TYPE (fndecl)), false); + return fold_builtin_inf (type, false); case BUILT_IN_NAN: case BUILT_IN_NANF: case BUILT_IN_NANL: - return fold_builtin_nan (arglist, TREE_TYPE (TREE_TYPE (fndecl)), true); + return fold_builtin_nan (arglist, type, true); case BUILT_IN_NANS: case BUILT_IN_NANSF: case BUILT_IN_NANSL: - return fold_builtin_nan (arglist, TREE_TYPE (TREE_TYPE (fndecl)), false); + return fold_builtin_nan (arglist, type, false); + + case BUILT_IN_FLOOR: + case BUILT_IN_FLOORF: + case BUILT_IN_FLOORL: + return fold_builtin_floor (exp); + + case BUILT_IN_CEIL: + case BUILT_IN_CEILF: + case BUILT_IN_CEILL: + return fold_builtin_ceil (exp); + + case BUILT_IN_TRUNC: + case BUILT_IN_TRUNCF: + case BUILT_IN_TRUNCL: + return fold_builtin_trunc (exp); + + case BUILT_IN_ROUND: + case BUILT_IN_ROUNDF: + case BUILT_IN_ROUNDL: + case BUILT_IN_NEARBYINT: + case BUILT_IN_NEARBYINTF: + case BUILT_IN_NEARBYINTL: + return fold_trunc_transparent_mathfn (exp); + + case BUILT_IN_FFS: + case BUILT_IN_FFSL: + case BUILT_IN_FFSLL: + case BUILT_IN_CLZ: + case BUILT_IN_CLZL: + case BUILT_IN_CLZLL: + case BUILT_IN_CTZ: + case BUILT_IN_CTZL: + case BUILT_IN_CTZLL: + case BUILT_IN_POPCOUNT: + case BUILT_IN_POPCOUNTL: + case BUILT_IN_POPCOUNTLL: + case BUILT_IN_PARITY: + case BUILT_IN_PARITYL: + case BUILT_IN_PARITYLL: + return fold_builtin_bitop (exp); + + case BUILT_IN_MEMCPY: + return fold_builtin_memcpy (exp); + + case BUILT_IN_MEMPCPY: + return fold_builtin_mempcpy (exp); + + case BUILT_IN_MEMMOVE: + return fold_builtin_memmove (exp); + + case BUILT_IN_STRCPY: + return fold_builtin_strcpy (exp); + + case BUILT_IN_STRNCPY: + return fold_builtin_strncpy (exp); + + case BUILT_IN_MEMCMP: + return fold_builtin_memcmp (exp); + + case BUILT_IN_STRCMP: + return fold_builtin_strcmp (exp); + + case BUILT_IN_STRNCMP: + return fold_builtin_strncmp (exp); default: break; @@ -4343,16 +6925,16 @@ fold_builtin (exp) return 0; } -static tree -build_function_call_expr (fn, arglist) - tree fn, arglist; +/* Conveniently construct a function call expression. */ + +tree +build_function_call_expr (tree fn, tree arglist) { tree call_expr; call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), call_expr, arglist); - TREE_SIDE_EFFECTS (call_expr) = 1; return fold (call_expr); } @@ -4362,13 +6944,13 @@ build_function_call_expr (fn, arglist) ellipses, otherwise the last specifier must be a VOID_TYPE. */ static int -validate_arglist VPARAMS ((tree arglist, ...)) +validate_arglist (tree arglist, ...) { enum tree_code code; int res = 0; + va_list ap; - VA_OPEN (ap, arglist); - VA_FIXEDARG (ap, tree, arglist); + va_start (ap, arglist); do { @@ -4400,27 +6982,58 @@ validate_arglist VPARAMS ((tree arglist, ...)) /* We need gotos here since we can only have one VA_CLOSE in a function. */ end: ; - VA_CLOSE (ap); + va_end (ap); return res; } -/* Default version of target-specific builtin setup that does nothing. */ - -void -default_init_builtins () -{ -} - /* Default target-specific builtin expander that does nothing. */ rtx -default_expand_builtin (exp, target, subtarget, mode, ignore) - tree exp ATTRIBUTE_UNUSED; - rtx target ATTRIBUTE_UNUSED; - rtx subtarget ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; - int ignore ATTRIBUTE_UNUSED; +default_expand_builtin (tree exp ATTRIBUTE_UNUSED, + rtx target ATTRIBUTE_UNUSED, + rtx subtarget ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + int ignore ATTRIBUTE_UNUSED) { return NULL_RTX; } + +/* Instantiate all remaining CONSTANT_P_RTX nodes. */ + +void +purge_builtin_constant_p (void) +{ + rtx insn, set, arg, new, note; + + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + if (INSN_P (insn) + && (set = single_set (insn)) != NULL_RTX + && (GET_CODE (arg = SET_SRC (set)) == CONSTANT_P_RTX + || (GET_CODE (arg) == SUBREG + && (GET_CODE (arg = SUBREG_REG (arg)) + == CONSTANT_P_RTX)))) + { + arg = XEXP (arg, 0); + new = CONSTANT_P (arg) ? const1_rtx : const0_rtx; + validate_change (insn, &SET_SRC (set), new, 0); + + /* Remove the REG_EQUAL note from the insn. */ + if ((note = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0) + remove_note (insn, note); + } +} + +/* Returns true is EXP represents data that would potentially reside + in a readonly section. */ + +static bool +readonly_data_expr (tree exp) +{ + STRIP_NOPS (exp); + + if (TREE_CODE (exp) == ADDR_EXPR) + return decl_readonly_section (TREE_OPERAND (exp, 0), 0); + else + return false; +} diff --git a/contrib/gcc/c-lex.c b/contrib/gcc/c-lex.c index c852e311cb99..aba571fab9a2 100644 --- a/contrib/gcc/c-lex.c +++ b/contrib/gcc/c-lex.c @@ -1,6 +1,6 @@ /* Mainly the interface between cpplib and the C front ends. Copyright (C) 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997 - 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -21,6 +21,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "real.h" #include "rtl.h" @@ -40,24 +42,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "splay-tree.h" #include "debug.h" -#ifdef MULTIBYTE_CHARS -#include "mbchar.h" -#include -#endif /* MULTIBYTE_CHARS */ - /* The current line map. */ static const struct line_map *map; -/* The line used to refresh the lineno global variable after each token. */ -static unsigned int src_lineno; - /* We may keep statistics about how long which files took to compile. */ static int header_time, body_time; static splay_tree file_info_tree; -/* File used for outputting assembler code. */ -extern FILE *asm_out_file; - #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node) @@ -67,33 +58,24 @@ extern FILE *asm_out_file; int pending_lang_change; /* If we need to switch languages - C++ only */ int c_header_level; /* depth in C headers - C++ only */ -/* Nonzero tells yylex to ignore \ in string constants. */ -static int ignore_escape_flag; - -static tree interpret_integer PARAMS ((const cpp_token *, unsigned int)); -static tree interpret_float PARAMS ((const cpp_token *, unsigned int)); +static tree interpret_integer (const cpp_token *, unsigned int); +static tree interpret_float (const cpp_token *, unsigned int); static enum integer_type_kind - narrowest_unsigned_type PARAMS ((tree, unsigned int)); + narrowest_unsigned_type (tree, unsigned int); static enum integer_type_kind - narrowest_signed_type PARAMS ((tree, unsigned int)); -static tree lex_string PARAMS ((const unsigned char *, unsigned int, - int)); -static tree lex_charconst PARAMS ((const cpp_token *)); -static void update_header_times PARAMS ((const char *)); -static int dump_one_header PARAMS ((splay_tree_node, void *)); -static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int)); -static void cb_ident PARAMS ((cpp_reader *, unsigned int, - const cpp_string *)); -static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *)); -static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int)); -static void cb_define PARAMS ((cpp_reader *, unsigned int, - cpp_hashnode *)); -static void cb_undef PARAMS ((cpp_reader *, unsigned int, - cpp_hashnode *)); + narrowest_signed_type (tree, unsigned int); +static enum cpp_ttype lex_string (const cpp_token *, tree *, bool); +static tree lex_charconst (const cpp_token *); +static void update_header_times (const char *); +static int dump_one_header (splay_tree_node, void *); +static void cb_line_change (cpp_reader *, const cpp_token *, int); +static void cb_ident (cpp_reader *, unsigned int, const cpp_string *); +static void cb_def_pragma (cpp_reader *, unsigned int); +static void cb_define (cpp_reader *, unsigned int, cpp_hashnode *); +static void cb_undef (cpp_reader *, unsigned int, cpp_hashnode *); -const char * -init_c_lex (filename) - const char *filename; +void +init_c_lex (void) { struct cpp_callbacks *cb; struct c_fileinfo *toplevel; @@ -109,19 +91,14 @@ init_c_lex (filename) body_time = get_run_time (); toplevel->time = body_time; } - -#ifdef MULTIBYTE_CHARS - /* Change to the native locale for multibyte conversions. */ - setlocale (LC_CTYPE, ""); - GET_ENVIRONMENT (literal_codeset, "LANG"); -#endif cb = cpp_get_callbacks (parse_in); cb->line_change = cb_line_change; cb->ident = cb_ident; - cb->file_change = cb_file_change; cb->def_pragma = cb_def_pragma; + cb->valid_pch = c_common_valid_pch; + cb->read_pch = c_common_read_pch; /* Set the debug callbacks if we can use them. */ if (debug_info_level == DINFO_LEVEL_VERBOSE @@ -131,38 +108,10 @@ init_c_lex (filename) cb->define = cb_define; cb->undef = cb_undef; } - - /* Start it at 0. */ - lineno = 0; - - return cpp_read_main_file (parse_in, filename, ident_hash); -} - -/* A thin wrapper around the real parser that initializes the - integrated preprocessor after debug output has been initialized. - Also, make sure the start_source_file debug hook gets called for - the primary source file. */ - -void -c_common_parse_file (set_yydebug) - int set_yydebug ATTRIBUTE_UNUSED; -{ -#if YYDEBUG != 0 - yydebug = set_yydebug; -#else - warning ("YYDEBUG not defined"); -#endif - - (*debug_hooks->start_source_file) (lineno, input_filename); - cpp_finish_options (parse_in); - - yyparse (); - free_parser_stacks (); } struct c_fileinfo * -get_fileinfo (name) - const char *name; +get_fileinfo (const char *name) { splay_tree_node n; struct c_fileinfo *fi; @@ -171,7 +120,7 @@ get_fileinfo (name) if (n) return (struct c_fileinfo *) n->value; - fi = (struct c_fileinfo *) xmalloc (sizeof (struct c_fileinfo)); + fi = xmalloc (sizeof (struct c_fileinfo)); fi->time = 0; fi->interface_only = 0; fi->interface_unknown = 1; @@ -181,8 +130,7 @@ get_fileinfo (name) } static void -update_header_times (name) - const char *name; +update_header_times (const char *name) { /* Changing files again. This means currently collected time is charged against header time, and body time starts back at 0. */ @@ -197,9 +145,7 @@ update_header_times (name) } static int -dump_one_header (n, dummy) - splay_tree_node n; - void *dummy ATTRIBUTE_UNUSED; +dump_one_header (splay_tree_node n, void *dummy ATTRIBUTE_UNUSED) { print_time ((const char *) n->key, ((struct c_fileinfo *) n->value)->time); @@ -207,7 +153,7 @@ dump_one_header (n, dummy) } void -dump_time_statistics () +dump_time_statistics (void) { struct c_fileinfo *file = get_fileinfo (input_filename); int this_time = get_run_time (); @@ -224,17 +170,20 @@ dump_time_statistics () } static void -cb_ident (pfile, line, str) - cpp_reader *pfile ATTRIBUTE_UNUSED; - unsigned int line ATTRIBUTE_UNUSED; - const cpp_string *str ATTRIBUTE_UNUSED; +cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, + unsigned int line ATTRIBUTE_UNUSED, + const cpp_string *str ATTRIBUTE_UNUSED) { #ifdef ASM_OUTPUT_IDENT if (! flag_no_ident) { /* Convert escapes in the string. */ - tree value = lex_string (str->text, str->len, 0); - ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (value)); + cpp_string cstr = { 0, 0 }; + if (cpp_interpret_string (pfile, str, 1, &cstr, false)) + { + ASM_OUTPUT_IDENT (asm_out_file, (const char *) cstr.text); + free ((void *)cstr.text); + } } #endif } @@ -242,35 +191,33 @@ cb_ident (pfile, line, str) /* Called at the start of every non-empty line. TOKEN is the first lexed token on the line. Used for diagnostic line numbers. */ static void -cb_line_change (pfile, token, parsing_args) - cpp_reader *pfile ATTRIBUTE_UNUSED; - const cpp_token *token; - int parsing_args; +cb_line_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const cpp_token *token, + int parsing_args) { if (token->type == CPP_EOF || parsing_args) return; - src_lineno = SOURCE_LINE (map, token->line); + input_line = SOURCE_LINE (map, token->line); } -static void -cb_file_change (pfile, new_map) - cpp_reader *pfile ATTRIBUTE_UNUSED; - const struct line_map *new_map; +void +fe_file_change (const struct line_map *new_map) { - unsigned int to_line = SOURCE_LINE (new_map, new_map->to_line); + if (new_map == NULL) + { + map = NULL; + return; + } if (new_map->reason == LC_ENTER) { /* Don't stack the main buffer on the input stack; we already did in compile_file. */ - if (map == NULL) - main_input_filename = new_map->to_file; - else + if (map != NULL) { int included_at = SOURCE_LINE (new_map - 1, new_map->from_line - 1); - lineno = included_at; + input_line = included_at; push_srcloc (new_map->to_file, 1); (*debug_hooks->start_source_file) (included_at, new_map->to_file); #ifndef NO_IMPLICIT_EXTERN_C @@ -295,14 +242,14 @@ cb_file_change (pfile, new_map) } #endif pop_srcloc (); - - (*debug_hooks->end_source_file) (to_line); + + (*debug_hooks->end_source_file) (new_map->to_line); } update_header_times (new_map->to_file); in_system_header = new_map->sysp != 0; input_filename = new_map->to_file; - lineno = to_line; + input_line = new_map->to_line; map = new_map; /* Hook for C++. */ @@ -310,9 +257,7 @@ cb_file_change (pfile, new_map) } static void -cb_def_pragma (pfile, line) - cpp_reader *pfile; - unsigned int line; +cb_def_pragma (cpp_reader *pfile, unsigned int line) { /* Issue a warning message if we have been asked to do so. Ignore unknown pragmas in system headers unless an explicit @@ -332,17 +277,14 @@ cb_def_pragma (pfile, line) name = cpp_token_as_text (pfile, s); } - lineno = SOURCE_LINE (map, line); + input_line = SOURCE_LINE (map, line); warning ("ignoring #pragma %s %s", space, name); } } /* #define callback for DWARF and DWARF2 debug info. */ static void -cb_define (pfile, line, node) - cpp_reader *pfile; - unsigned int line; - cpp_hashnode *node; +cb_define (cpp_reader *pfile, unsigned int line, cpp_hashnode *node) { (*debug_hooks->define) (SOURCE_LINE (map, line), (const char *) cpp_macro_definition (pfile, node)); @@ -350,353 +292,39 @@ cb_define (pfile, line, node) /* #undef callback for DWARF and DWARF2 debug info. */ static void -cb_undef (pfile, line, node) - cpp_reader *pfile ATTRIBUTE_UNUSED; - unsigned int line; - cpp_hashnode *node; +cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, unsigned int line, + cpp_hashnode *node) { (*debug_hooks->undef) (SOURCE_LINE (map, line), (const char *) NODE_NAME (node)); } - -#if 0 /* not yet */ -/* Returns nonzero if C is a universal-character-name. Give an error if it - is not one which may appear in an identifier, as per [extendid]. - - Note that extended character support in identifiers has not yet been - implemented. It is my personal opinion that this is not a desirable - feature. Portable code cannot count on support for more than the basic - identifier character set. */ - -static inline int -is_extended_char (c) - int c; -{ -#ifdef TARGET_EBCDIC - return 0; -#else - /* ASCII. */ - if (c < 0x7f) - return 0; - - /* None of the valid chars are outside the Basic Multilingual Plane (the - low 16 bits). */ - if (c > 0xffff) - { - error ("universal-character-name '\\U%08x' not valid in identifier", c); - return 1; - } - - /* Latin */ - if ((c >= 0x00c0 && c <= 0x00d6) - || (c >= 0x00d8 && c <= 0x00f6) - || (c >= 0x00f8 && c <= 0x01f5) - || (c >= 0x01fa && c <= 0x0217) - || (c >= 0x0250 && c <= 0x02a8) - || (c >= 0x1e00 && c <= 0x1e9a) - || (c >= 0x1ea0 && c <= 0x1ef9)) - return 1; - - /* Greek */ - if ((c == 0x0384) - || (c >= 0x0388 && c <= 0x038a) - || (c == 0x038c) - || (c >= 0x038e && c <= 0x03a1) - || (c >= 0x03a3 && c <= 0x03ce) - || (c >= 0x03d0 && c <= 0x03d6) - || (c == 0x03da) - || (c == 0x03dc) - || (c == 0x03de) - || (c == 0x03e0) - || (c >= 0x03e2 && c <= 0x03f3) - || (c >= 0x1f00 && c <= 0x1f15) - || (c >= 0x1f18 && c <= 0x1f1d) - || (c >= 0x1f20 && c <= 0x1f45) - || (c >= 0x1f48 && c <= 0x1f4d) - || (c >= 0x1f50 && c <= 0x1f57) - || (c == 0x1f59) - || (c == 0x1f5b) - || (c == 0x1f5d) - || (c >= 0x1f5f && c <= 0x1f7d) - || (c >= 0x1f80 && c <= 0x1fb4) - || (c >= 0x1fb6 && c <= 0x1fbc) - || (c >= 0x1fc2 && c <= 0x1fc4) - || (c >= 0x1fc6 && c <= 0x1fcc) - || (c >= 0x1fd0 && c <= 0x1fd3) - || (c >= 0x1fd6 && c <= 0x1fdb) - || (c >= 0x1fe0 && c <= 0x1fec) - || (c >= 0x1ff2 && c <= 0x1ff4) - || (c >= 0x1ff6 && c <= 0x1ffc)) - return 1; - - /* Cyrillic */ - if ((c >= 0x0401 && c <= 0x040d) - || (c >= 0x040f && c <= 0x044f) - || (c >= 0x0451 && c <= 0x045c) - || (c >= 0x045e && c <= 0x0481) - || (c >= 0x0490 && c <= 0x04c4) - || (c >= 0x04c7 && c <= 0x04c8) - || (c >= 0x04cb && c <= 0x04cc) - || (c >= 0x04d0 && c <= 0x04eb) - || (c >= 0x04ee && c <= 0x04f5) - || (c >= 0x04f8 && c <= 0x04f9)) - return 1; - - /* Armenian */ - if ((c >= 0x0531 && c <= 0x0556) - || (c >= 0x0561 && c <= 0x0587)) - return 1; - - /* Hebrew */ - if ((c >= 0x05d0 && c <= 0x05ea) - || (c >= 0x05f0 && c <= 0x05f4)) - return 1; - - /* Arabic */ - if ((c >= 0x0621 && c <= 0x063a) - || (c >= 0x0640 && c <= 0x0652) - || (c >= 0x0670 && c <= 0x06b7) - || (c >= 0x06ba && c <= 0x06be) - || (c >= 0x06c0 && c <= 0x06ce) - || (c >= 0x06e5 && c <= 0x06e7)) - return 1; - - /* Devanagari */ - if ((c >= 0x0905 && c <= 0x0939) - || (c >= 0x0958 && c <= 0x0962)) - return 1; - - /* Bengali */ - if ((c >= 0x0985 && c <= 0x098c) - || (c >= 0x098f && c <= 0x0990) - || (c >= 0x0993 && c <= 0x09a8) - || (c >= 0x09aa && c <= 0x09b0) - || (c == 0x09b2) - || (c >= 0x09b6 && c <= 0x09b9) - || (c >= 0x09dc && c <= 0x09dd) - || (c >= 0x09df && c <= 0x09e1) - || (c >= 0x09f0 && c <= 0x09f1)) - return 1; - - /* Gurmukhi */ - if ((c >= 0x0a05 && c <= 0x0a0a) - || (c >= 0x0a0f && c <= 0x0a10) - || (c >= 0x0a13 && c <= 0x0a28) - || (c >= 0x0a2a && c <= 0x0a30) - || (c >= 0x0a32 && c <= 0x0a33) - || (c >= 0x0a35 && c <= 0x0a36) - || (c >= 0x0a38 && c <= 0x0a39) - || (c >= 0x0a59 && c <= 0x0a5c) - || (c == 0x0a5e)) - return 1; - - /* Gujarati */ - if ((c >= 0x0a85 && c <= 0x0a8b) - || (c == 0x0a8d) - || (c >= 0x0a8f && c <= 0x0a91) - || (c >= 0x0a93 && c <= 0x0aa8) - || (c >= 0x0aaa && c <= 0x0ab0) - || (c >= 0x0ab2 && c <= 0x0ab3) - || (c >= 0x0ab5 && c <= 0x0ab9) - || (c == 0x0ae0)) - return 1; - - /* Oriya */ - if ((c >= 0x0b05 && c <= 0x0b0c) - || (c >= 0x0b0f && c <= 0x0b10) - || (c >= 0x0b13 && c <= 0x0b28) - || (c >= 0x0b2a && c <= 0x0b30) - || (c >= 0x0b32 && c <= 0x0b33) - || (c >= 0x0b36 && c <= 0x0b39) - || (c >= 0x0b5c && c <= 0x0b5d) - || (c >= 0x0b5f && c <= 0x0b61)) - return 1; - - /* Tamil */ - if ((c >= 0x0b85 && c <= 0x0b8a) - || (c >= 0x0b8e && c <= 0x0b90) - || (c >= 0x0b92 && c <= 0x0b95) - || (c >= 0x0b99 && c <= 0x0b9a) - || (c == 0x0b9c) - || (c >= 0x0b9e && c <= 0x0b9f) - || (c >= 0x0ba3 && c <= 0x0ba4) - || (c >= 0x0ba8 && c <= 0x0baa) - || (c >= 0x0bae && c <= 0x0bb5) - || (c >= 0x0bb7 && c <= 0x0bb9)) - return 1; - - /* Telugu */ - if ((c >= 0x0c05 && c <= 0x0c0c) - || (c >= 0x0c0e && c <= 0x0c10) - || (c >= 0x0c12 && c <= 0x0c28) - || (c >= 0x0c2a && c <= 0x0c33) - || (c >= 0x0c35 && c <= 0x0c39) - || (c >= 0x0c60 && c <= 0x0c61)) - return 1; - - /* Kannada */ - if ((c >= 0x0c85 && c <= 0x0c8c) - || (c >= 0x0c8e && c <= 0x0c90) - || (c >= 0x0c92 && c <= 0x0ca8) - || (c >= 0x0caa && c <= 0x0cb3) - || (c >= 0x0cb5 && c <= 0x0cb9) - || (c >= 0x0ce0 && c <= 0x0ce1)) - return 1; - - /* Malayalam */ - if ((c >= 0x0d05 && c <= 0x0d0c) - || (c >= 0x0d0e && c <= 0x0d10) - || (c >= 0x0d12 && c <= 0x0d28) - || (c >= 0x0d2a && c <= 0x0d39) - || (c >= 0x0d60 && c <= 0x0d61)) - return 1; - - /* Thai */ - if ((c >= 0x0e01 && c <= 0x0e30) - || (c >= 0x0e32 && c <= 0x0e33) - || (c >= 0x0e40 && c <= 0x0e46) - || (c >= 0x0e4f && c <= 0x0e5b)) - return 1; - - /* Lao */ - if ((c >= 0x0e81 && c <= 0x0e82) - || (c == 0x0e84) - || (c == 0x0e87) - || (c == 0x0e88) - || (c == 0x0e8a) - || (c == 0x0e0d) - || (c >= 0x0e94 && c <= 0x0e97) - || (c >= 0x0e99 && c <= 0x0e9f) - || (c >= 0x0ea1 && c <= 0x0ea3) - || (c == 0x0ea5) - || (c == 0x0ea7) - || (c == 0x0eaa) - || (c == 0x0eab) - || (c >= 0x0ead && c <= 0x0eb0) - || (c == 0x0eb2) - || (c == 0x0eb3) - || (c == 0x0ebd) - || (c >= 0x0ec0 && c <= 0x0ec4) - || (c == 0x0ec6)) - return 1; - - /* Georgian */ - if ((c >= 0x10a0 && c <= 0x10c5) - || (c >= 0x10d0 && c <= 0x10f6)) - return 1; - - /* Hiragana */ - if ((c >= 0x3041 && c <= 0x3094) - || (c >= 0x309b && c <= 0x309e)) - return 1; - - /* Katakana */ - if ((c >= 0x30a1 && c <= 0x30fe)) - return 1; - - /* Bopmofo */ - if ((c >= 0x3105 && c <= 0x312c)) - return 1; - - /* Hangul */ - if ((c >= 0x1100 && c <= 0x1159) - || (c >= 0x1161 && c <= 0x11a2) - || (c >= 0x11a8 && c <= 0x11f9)) - return 1; - - /* CJK Unified Ideographs */ - if ((c >= 0xf900 && c <= 0xfa2d) - || (c >= 0xfb1f && c <= 0xfb36) - || (c >= 0xfb38 && c <= 0xfb3c) - || (c == 0xfb3e) - || (c >= 0xfb40 && c <= 0xfb41) - || (c >= 0xfb42 && c <= 0xfb44) - || (c >= 0xfb46 && c <= 0xfbb1) - || (c >= 0xfbd3 && c <= 0xfd3f) - || (c >= 0xfd50 && c <= 0xfd8f) - || (c >= 0xfd92 && c <= 0xfdc7) - || (c >= 0xfdf0 && c <= 0xfdfb) - || (c >= 0xfe70 && c <= 0xfe72) - || (c == 0xfe74) - || (c >= 0xfe76 && c <= 0xfefc) - || (c >= 0xff21 && c <= 0xff3a) - || (c >= 0xff41 && c <= 0xff5a) - || (c >= 0xff66 && c <= 0xffbe) - || (c >= 0xffc2 && c <= 0xffc7) - || (c >= 0xffca && c <= 0xffcf) - || (c >= 0xffd2 && c <= 0xffd7) - || (c >= 0xffda && c <= 0xffdc) - || (c >= 0x4e00 && c <= 0x9fa5)) - return 1; - - error ("universal-character-name '\\u%04x' not valid in identifier", c); - return 1; -#endif -} - -/* Add the UTF-8 representation of C to the token_buffer. */ - -static void -utf8_extend_token (c) - int c; -{ - int shift, mask; - - if (c <= 0x0000007f) - { - extend_token (c); - return; - } - else if (c <= 0x000007ff) - shift = 6, mask = 0xc0; - else if (c <= 0x0000ffff) - shift = 12, mask = 0xe0; - else if (c <= 0x001fffff) - shift = 18, mask = 0xf0; - else if (c <= 0x03ffffff) - shift = 24, mask = 0xf8; - else - shift = 30, mask = 0xfc; - - extend_token (mask | (c >> shift)); - do - { - shift -= 6; - extend_token ((unsigned char) (0x80 | (c >> shift))); - } - while (shift); -} -#endif -int -c_lex (value) - tree *value; +static inline const cpp_token * +get_nonpadding_token (void) { const cpp_token *tok; - - retry: timevar_push (TV_CPP); do tok = cpp_get_token (parse_in); while (tok->type == CPP_PADDING); timevar_pop (TV_CPP); - /* The C++ front end does horrible things with the current line - number. To ensure an accurate line number, we must reset it - every time we return a token. */ - lineno = src_lineno; + return tok; +} - *value = NULL_TREE; +int +c_lex_with_flags (tree *value, unsigned char *cpp_flags) +{ + const cpp_token *tok; + location_t atloc; + static bool no_more_pch; + + retry: + tok = get_nonpadding_token (); + + retry_after_at: switch (tok->type) { - /* Issue this error here, where we can get at tok->val.c. */ - case CPP_OTHER: - if (ISGRAPH (tok->val.c)) - error ("stray '%c' in program", tok->val.c); - else - error ("stray '\\%o' in program", tok->val.c); - goto retry; - case CPP_NAME: *value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node)); break; @@ -726,6 +354,50 @@ c_lex (value) } break; + case CPP_ATSIGN: + /* An @ may give the next token special significance in Objective-C. */ + atloc = input_location; + tok = get_nonpadding_token (); + if (c_dialect_objc ()) + { + tree val; + switch (tok->type) + { + case CPP_NAME: + val = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node)); + if (C_IS_RESERVED_WORD (val) + && OBJC_IS_AT_KEYWORD (C_RID_CODE (val))) + { + *value = val; + return CPP_AT_NAME; + } + break; + + case CPP_STRING: + case CPP_WSTRING: + return lex_string (tok, value, true); + + default: break; + } + } + + /* ... or not. */ + error ("%Hstray '@' in program", &atloc); + goto retry_after_at; + + case CPP_OTHER: + { + cppchar_t c = tok->val.str.text[0]; + + if (c == '"' || c == '\'') + error ("missing terminating %c character", (int) c); + else if (ISGRAPH (c)) + error ("stray '%c' in program", (int) c); + else + error ("stray '\\%o' in program", (int) c); + } + goto retry; + case CPP_CHAR: case CPP_WCHAR: *value = lex_charconst (tok); @@ -733,8 +405,7 @@ c_lex (value) case CPP_STRING: case CPP_WSTRING: - *value = lex_string (tok->val.str.text, tok->val.str.len, - tok->type == CPP_WSTRING); + return lex_string (tok, value, false); break; /* These tokens should not be visible outside cpplib. */ @@ -743,19 +414,33 @@ c_lex (value) case CPP_MACRO_ARG: abort (); - default: break; + default: + *value = NULL_TREE; + break; } + if (! no_more_pch) + { + no_more_pch = true; + c_common_no_more_pch (); + } + + if (cpp_flags) + *cpp_flags = tok->flags; return tok->type; } +int +c_lex (tree *value) +{ + return c_lex_with_flags (value, NULL); +} + /* Returns the narrowest C-visible unsigned type, starting with the minimum specified by FLAGS, that can fit VALUE, or itk_none if there isn't one. */ static enum integer_type_kind -narrowest_unsigned_type (value, flags) - tree value; - unsigned int flags; +narrowest_unsigned_type (tree value, unsigned int flags) { enum integer_type_kind itk; @@ -779,9 +464,7 @@ narrowest_unsigned_type (value, flags) /* Ditto, but narrowest signed type. */ static enum integer_type_kind -narrowest_signed_type (value, flags) - tree value; - unsigned int flags; +narrowest_signed_type (tree value, unsigned int flags) { enum integer_type_kind itk; @@ -805,9 +488,7 @@ narrowest_signed_type (value, flags) /* Interpret TOKEN, an integer with FLAGS as classified by cpplib. */ static tree -interpret_integer (token, flags) - const cpp_token *token; - unsigned int flags; +interpret_integer (const cpp_token *token, unsigned int flags) { tree value, type; enum integer_type_kind itk; @@ -885,9 +566,7 @@ interpret_integer (token, flags) /* Interpret TOKEN, a floating point number with FLAGS as classified by cpplib. */ static tree -interpret_float (token, flags) - const cpp_token *token; - unsigned int flags; +interpret_float (const cpp_token *token, unsigned int flags) { tree type; tree value; @@ -948,112 +627,105 @@ interpret_float (token, flags) return value; } -static tree -lex_string (str, len, wide) - const unsigned char *str; - unsigned int len; - int wide; +/* Convert a series of STRING and/or WSTRING tokens into a tree, + performing string constant concatenation. TOK is the first of + these. VALP is the location to write the string into. OBJC_STRING + indicates whether an '@' token preceded the incoming token. + Returns the CPP token type of the result (CPP_STRING, CPP_WSTRING, + or CPP_OBJC_STRING). + + This is unfortunately more work than it should be. If any of the + strings in the series has an L prefix, the result is a wide string + (6.4.5p4). Whether or not the result is a wide string affects the + meaning of octal and hexadecimal escapes (6.4.4.4p6,9). But escape + sequences do not continue across the boundary between two strings in + a series (6.4.5p7), so we must not lose the boundaries. Therefore + cpp_interpret_string takes a vector of cpp_string structures, which + we must arrange to provide. */ + +static enum cpp_ttype +lex_string (const cpp_token *tok, tree *valp, bool objc_string) { tree value; - char *buf = alloca ((len + 1) * (wide ? WCHAR_BYTES : 1)); - char *q = buf; - const unsigned char *p = str, *limit = str + len; - cppchar_t c; + bool wide = false; + size_t count = 1; + struct obstack str_ob; + cpp_string istr; -#ifdef MULTIBYTE_CHARS - /* Reset multibyte conversion state. */ - (void) local_mbtowc (NULL, NULL, 0); -#endif + /* Try to avoid the overhead of creating and destroying an obstack + for the common case of just one string. */ + cpp_string str = tok->val.str; + cpp_string *strs = &str; - while (p < limit) + if (tok->type == CPP_WSTRING) + wide = true; + + tok = get_nonpadding_token (); + if (c_dialect_objc () && tok->type == CPP_ATSIGN) { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int char_len; + objc_string = true; + tok = get_nonpadding_token (); + } + if (tok->type == CPP_STRING || tok->type == CPP_WSTRING) + { + gcc_obstack_init (&str_ob); + obstack_grow (&str_ob, &str, sizeof (cpp_string)); - char_len = local_mbtowc (&wc, (const char *) p, limit - p); - if (char_len == -1) + do { - warning ("ignoring invalid multibyte character"); - char_len = 1; - c = *p++; + count++; + if (tok->type == CPP_WSTRING) + wide = true; + obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string)); + + tok = get_nonpadding_token (); + if (c_dialect_objc () && tok->type == CPP_ATSIGN) + { + objc_string = true; + tok = get_nonpadding_token (); + } } - else - { - p += char_len; - c = wc; - } -#else - c = *p++; -#endif + while (tok->type == CPP_STRING || tok->type == CPP_WSTRING); + strs = obstack_finish (&str_ob); + } - if (c == '\\' && !ignore_escape_flag) - c = cpp_parse_escape (parse_in, &p, limit, wide); - - /* Add this single character into the buffer either as a wchar_t, - a multibyte sequence, or as a single byte. */ + /* We have read one more token than we want. */ + _cpp_backup_tokens (parse_in, 1); + + if (count > 1 && !objc_string && warn_traditional && !in_system_header) + warning ("traditional C rejects string constant concatenation"); + + if (cpp_interpret_string (parse_in, strs, count, &istr, wide)) + { + value = build_string (istr.len, (char *)istr.text); + free ((void *)istr.text); + } + else + { + /* Callers cannot generally handle error_mark_node in this context, + so return the empty string instead. cpp_interpret_string has + issued an error. */ if (wide) - { - unsigned charwidth = TYPE_PRECISION (char_type_node); - unsigned bytemask = (1 << charwidth) - 1; - int byte; - - for (byte = 0; byte < WCHAR_BYTES; ++byte) - { - int n; - if (byte >= (int) sizeof (c)) - n = 0; - else - n = (c >> (byte * charwidth)) & bytemask; - if (BYTES_BIG_ENDIAN) - q[WCHAR_BYTES - byte - 1] = n; - else - q[byte] = n; - } - q += WCHAR_BYTES; - } -#ifdef MULTIBYTE_CHARS - else if (char_len > 1) - { - /* We're dealing with a multibyte character. */ - for ( ; char_len >0; --char_len) - { - *q++ = *(p - char_len); - } - } -#endif + value = build_string (TYPE_PRECISION (wchar_type_node) + / TYPE_PRECISION (char_type_node), + "\0\0\0"); /* widest supported wchar_t + is 32 bits */ else - { - *q++ = c; - } + value = build_string (1, ""); } - /* Terminate the string value, either with a single byte zero - or with a wide zero. */ + TREE_TYPE (value) = wide ? wchar_array_type_node : char_array_type_node; + *valp = fix_string_type (value); - if (wide) - { - memset (q, 0, WCHAR_BYTES); - q += WCHAR_BYTES; - } - else - { - *q++ = '\0'; - } + if (strs != &str) + obstack_free (&str_ob, 0); - value = build_string (q - buf, buf); - - if (wide) - TREE_TYPE (value) = wchar_array_type_node; - else - TREE_TYPE (value) = char_array_type_node; - return value; + return objc_string ? CPP_OBJC_STRING : wide ? CPP_WSTRING : CPP_STRING; } /* Converts a (possibly wide) character constant token into a tree. */ static tree -lex_charconst (token) - const cpp_token *token; +lex_charconst (const cpp_token *token) { cppchar_t result; tree type, value; @@ -1061,7 +733,7 @@ lex_charconst (token) int unsignedp; result = cpp_interpret_charconst (parse_in, token, - &chars_seen, &unsignedp); + &chars_seen, &unsignedp); /* Cast to cppchar_signed_t to get correct sign-extension of RESULT before possibly widening to HOST_WIDE_INT for build_int_2. */ @@ -1074,7 +746,7 @@ lex_charconst (token) type = wchar_type_node; /* In C, a character constant has type 'int'. In C++ 'char', but multi-char charconsts have type 'int'. */ - else if ((c_language == clk_c) || chars_seen > 1) + else if (!c_dialect_cxx () || chars_seen > 1) type = integer_type_node; else type = char_type_node; diff --git a/contrib/gcc/c-tree.h b/contrib/gcc/c-tree.h index 159c235224e2..0500f81a3d8c 100644 --- a/contrib/gcc/c-tree.h +++ b/contrib/gcc/c-tree.h @@ -1,6 +1,6 @@ /* Definitions for C parsing and type checking. Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -37,22 +37,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct lang_identifier GTY(()) { struct c_common_identifier common_id; - tree global_value; - tree local_value; + tree symbol_value; + tree tag_value; tree label_value; - tree implicit_decl; - tree error_locus; - tree limbo_value; }; /* The resulting tree type. */ -union lang_tree_node +union lang_tree_node GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), - chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) + chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *)TYPE_NEXT_VARIANT (&%h.generic) : (union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { - union tree_node GTY ((tag ("0"), - desc ("tree_node_structure (&%h)"))) + union tree_node GTY ((tag ("0"), + desc ("tree_node_structure (&%h)"))) generic; struct lang_identifier GTY ((tag ("1"))) identifier; }; @@ -61,7 +58,6 @@ union lang_tree_node struct lang_decl GTY(()) { - struct c_lang_decl base; /* The return types and parameter types may have variable size. This is a list of any SAVE_EXPRs that need to be evaluated to compute those sizes. */ @@ -71,30 +67,17 @@ struct lang_decl GTY(()) /* Macros for access to language-specific slots in an identifier. */ /* Each of these slots contains a DECL node or null. */ -/* This represents the value which the identifier has in the - file-scope namespace. */ -#define IDENTIFIER_GLOBAL_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->global_value) -/* This represents the value which the identifier has in the current - scope. */ -#define IDENTIFIER_LOCAL_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->local_value) -/* This represents the value which the identifier has as a label in - the current label scope. */ +/* The value of the identifier in the namespace of "ordinary identifiers" + (data objects, enum constants, functions, typedefs). */ +#define IDENTIFIER_SYMBOL_VALUE(NODE) \ + (((struct lang_identifier *) (NODE))->symbol_value) +/* The value of the identifier in the namespace of struct, union, + and enum tags. */ +#define IDENTIFIER_TAG_VALUE(NODE) \ + (((struct lang_identifier *) (NODE))->tag_value) +/* The value of the identifier in the namespace of labels. */ #define IDENTIFIER_LABEL_VALUE(NODE) \ (((struct lang_identifier *) (NODE))->label_value) -/* This records the extern decl of this identifier, if it has had one - at any point in this compilation. */ -#define IDENTIFIER_LIMBO_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->limbo_value) -/* This records the implicit function decl of this identifier, if it - has had one at any point in this compilation. */ -#define IDENTIFIER_IMPLICIT_DECL(NODE) \ - (((struct lang_identifier *) (NODE))->implicit_decl) -/* This is the last function in which we printed an "undefined variable" - message for this identifier. Value is a FUNCTION_DECL or null. */ -#define IDENTIFIER_ERROR_LOCUS(NODE) \ - (((struct lang_identifier *) (NODE))->error_locus) /* In identifiers, C uses the following fields in a special way: TREE_PUBLIC to record that there was a previous local extern decl. @@ -111,22 +94,19 @@ struct lang_decl GTY(()) nonzero if the definition of the type has already started. */ #define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE) +/* In an incomplete RECORD_TYPE or UNION_TYPE, a list of variable + declarations whose type would be completed by completing that type. */ +#define C_TYPE_INCOMPLETE_VARS(TYPE) TYPE_VFIELD (TYPE) + /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a keyword. C_RID_CODE (node) is then the RID_* value of the keyword, and C_RID_YYCODE is the token number wanted by Yacc. */ #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID) -/* This function was declared inline. This flag controls the linkage - semantics of 'inline'; whether or not the function is inlined is - controlled by DECL_INLINE. */ -#define DECL_DECLARED_INLINE_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->base.declared_inline) - /* In a RECORD_TYPE, a sorted array of the fields of the type. */ struct lang_type GTY(()) { - int len; - tree GTY((length ("%h.len"))) elts[1]; + struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields"))) s; }; /* Record whether a type or decl was written with nonconstant size. @@ -134,13 +114,6 @@ struct lang_type GTY(()) #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE) #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE) -#if 0 /* Not used. */ -/* Record whether a decl for a function or function pointer has - already been mentioned (in a warning) because it was called - but didn't have a prototype. */ -#define C_MISSING_PROTOTYPE_WARNED(DECL) DECL_LANG_FLAG_2 (DECL) -#endif - /* Store a value in that field. */ #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \ (TREE_COMPLEXITY (EXP) = (int) (CODE)) @@ -152,103 +125,122 @@ struct lang_type GTY(()) return type. */ #define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP) -/* Nonzero for a declaration of a built in function if there has been no - occasion that would declare the function in ordinary C. - Using the function draws a pedantic warning in this case. */ -#define C_DECL_ANTICIPATED(EXP) DECL_LANG_FLAG_3 (EXP) +/* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */ +#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP) + +/* Nonzero for a declaration of an external object which is not + currently in scope. This is either a built-in declaration of + a library function, before a real declaration has been seen, + or a declaration that appeared in an inner scope that has ended. */ +#define C_DECL_INVISIBLE(EXP) DECL_LANG_FLAG_3 (EXP) + +/* Nonzero for a decl which either doesn't exist or isn't a prototype. + N.B. Could be simplified if all built-in decls had complete prototypes + (but this is presently difficult because some of them need FILE*). */ +#define C_DECL_ISNT_PROTOTYPE(EXP) \ + (EXP == 0 \ + || (TYPE_ARG_TYPES (TREE_TYPE (EXP)) == 0 \ + && !DECL_BUILT_IN (EXP))) /* For FUNCTION_TYPE, a hidden list of types of arguments. The same as TYPE_ARG_TYPES for functions with prototypes, but created for functions without prototypes. */ #define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE) - -/* in c-lang.c and objc-act.c */ -extern tree lookup_interface PARAMS ((tree)); -extern tree is_class_name PARAMS ((tree)); -extern tree objc_is_id PARAMS ((tree)); -extern void objc_check_decl PARAMS ((tree)); -extern void finish_file PARAMS ((void)); -extern int objc_comptypes PARAMS ((tree, tree, int)); -extern tree objc_message_selector PARAMS ((void)); -extern tree lookup_objc_ivar PARAMS ((tree)); +/* Values for the first parameter to poplevel. */ +#define KEEP_NO 0 +#define KEEP_YES 1 +#define KEEP_MAYBE 2 + +/* Save and restore the variables in this file and elsewhere + that keep track of the progress of compilation of the current function. + Used for nested functions. */ + +struct language_function GTY(()) +{ + struct c_language_function base; + int returns_value; + int returns_null; + int returns_abnormally; + int warn_about_return_type; + int extern_inline; + int x_in_iteration_stmt; + int x_in_case_stmt; +}; /* in c-parse.in */ -extern void c_parse_init PARAMS ((void)); +extern void c_parse_init (void); /* in c-aux-info.c */ -extern void gen_aux_info_record PARAMS ((tree, int, int, int)); +extern void gen_aux_info_record (tree, int, int, int); /* in c-decl.c */ -extern int global_bindings_p PARAMS ((void)); -extern int kept_level_p PARAMS ((void)); -extern tree getdecls PARAMS ((void)); -extern void pushlevel PARAMS ((int)); -extern tree poplevel PARAMS ((int,int, int)); -extern void insert_block PARAMS ((tree)); -extern void set_block PARAMS ((tree)); -extern tree pushdecl PARAMS ((tree)); +extern int c_in_iteration_stmt; +extern int c_in_case_stmt; -extern void c_insert_default_attributes PARAMS ((tree)); -extern void c_init_decl_processing PARAMS ((void)); -extern void c_dup_lang_specific_decl PARAMS ((tree)); -extern void c_print_identifier PARAMS ((FILE *, tree, int)); -extern tree build_array_declarator PARAMS ((tree, tree, int, int)); -extern tree build_enumerator PARAMS ((tree, tree)); -extern void check_for_loop_decls PARAMS ((void)); -extern void clear_parm_order PARAMS ((void)); -extern int complete_array_type PARAMS ((tree, tree, int)); -extern void declare_parm_level PARAMS ((int)); -extern tree define_label PARAMS ((const char *, int, - tree)); -extern void finish_decl PARAMS ((tree, tree, tree)); -extern tree finish_enum PARAMS ((tree, tree, tree)); -extern void finish_function PARAMS ((int, int)); -extern tree finish_struct PARAMS ((tree, tree, tree)); -extern tree get_parm_info PARAMS ((int)); -extern tree grokfield PARAMS ((const char *, int, tree, tree, tree)); -extern tree groktypename PARAMS ((tree)); -extern tree groktypename_in_parm_context PARAMS ((tree)); -extern tree implicitly_declare PARAMS ((tree)); -extern void implicit_decl_warning PARAMS ((tree)); -extern int in_parm_level_p PARAMS ((void)); -extern void keep_next_level PARAMS ((void)); -extern tree lookup_name PARAMS ((tree)); -extern tree lookup_name_current_level PARAMS ((tree)); -extern void parmlist_tags_warning PARAMS ((void)); -extern void pending_xref_error PARAMS ((void)); -extern void c_push_function_context PARAMS ((struct function *)); -extern void c_pop_function_context PARAMS ((struct function *)); -extern void pop_label_level PARAMS ((void)); -extern void push_label_level PARAMS ((void)); -extern void push_parm_decl PARAMS ((tree)); -extern tree pushdecl_top_level PARAMS ((tree)); -extern void pushtag PARAMS ((tree, tree)); -extern tree set_array_declarator_type PARAMS ((tree, tree, int)); -extern tree shadow_label PARAMS ((tree)); -extern void shadow_tag PARAMS ((tree)); -extern void shadow_tag_warned PARAMS ((tree, int)); -extern tree start_enum PARAMS ((tree)); -extern int start_function PARAMS ((tree, tree, tree)); -extern tree start_decl PARAMS ((tree, tree, int, - tree)); -extern tree start_struct PARAMS ((enum tree_code, tree)); -extern void store_parm_decls PARAMS ((void)); -extern tree xref_tag PARAMS ((enum tree_code, tree)); -extern tree c_begin_compound_stmt PARAMS ((void)); -extern void c_expand_deferred_function PARAMS ((tree)); -extern void c_expand_decl_stmt PARAMS ((tree)); -extern tree make_pointer_declarator PARAMS ((tree, tree)); +extern int global_bindings_p (void); +extern tree getdecls (void); +extern void pushlevel (int); +extern void insert_block (tree); +extern void set_block (tree); +extern tree pushdecl (tree); +extern void c_expand_body (tree); + +extern void c_init_decl_processing (void); +extern void c_dup_lang_specific_decl (tree); +extern void c_print_identifier (FILE *, tree, int); +extern tree build_array_declarator (tree, tree, int, int); +extern tree build_enumerator (tree, tree); +extern void check_for_loop_decls (void); +extern void mark_forward_parm_decls (void); +extern int complete_array_type (tree, tree, int); +extern void declare_parm_level (void); +extern void undeclared_variable (tree); +extern tree declare_label (tree); +extern tree define_label (location_t, tree); +extern void finish_decl (tree, tree, tree); +extern tree finish_enum (tree, tree, tree); +extern void finish_function (void); +extern tree finish_struct (tree, tree, tree); +extern tree get_parm_info (int); +extern tree grokfield (tree, tree, tree); +extern tree groktypename (tree); +extern tree groktypename_in_parm_context (tree); +extern tree implicitly_declare (tree); +extern int in_parm_level_p (void); +extern void keep_next_level (void); +extern tree lookup_name (tree); +extern void pending_xref_error (void); +extern void c_push_function_context (struct function *); +extern void c_pop_function_context (struct function *); +extern void push_parm_decl (tree); +extern tree pushdecl_top_level (tree); +extern void pushtag (tree, tree); +extern tree set_array_declarator_type (tree, tree, int); +extern void shadow_tag (tree); +extern void shadow_tag_warned (tree, int); +extern tree start_enum (tree); +extern int start_function (tree, tree, tree); +extern tree start_decl (tree, tree, int, tree); +extern tree start_struct (enum tree_code, tree); +extern void store_parm_decls (void); +extern tree xref_tag (enum tree_code, tree); +extern tree c_begin_compound_stmt (void); +extern void c_expand_deferred_function (tree); +extern void c_expand_decl_stmt (tree); +extern void c_static_assembler_name (tree); +extern tree make_pointer_declarator (tree, tree); +extern void merge_translation_unit_decls (void); /* in c-objc-common.c */ -extern int c_disregard_inline_limits PARAMS ((tree)); -extern int c_cannot_inline_tree_fn PARAMS ((tree *)); -extern const char *c_objc_common_init PARAMS ((const char *)); -extern int c_missing_noreturn_ok_p PARAMS ((tree)); -extern void c_objc_common_finish_file PARAMS ((void)); -extern int defer_fn PARAMS ((tree)); -extern bool c_warn_unused_global_decl PARAMS ((tree)); +extern int c_disregard_inline_limits (tree); +extern int c_cannot_inline_tree_fn (tree *); +extern bool c_objc_common_init (void); +extern int c_missing_noreturn_ok_p (tree); +extern void c_objc_common_finish_file (void); +extern int defer_fn (tree); +extern bool c_warn_unused_global_decl (tree); #define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \ c_build_qualified_type ((TYPE), \ @@ -256,47 +248,51 @@ extern bool c_warn_unused_global_decl PARAMS ((tree)); ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0)) #define c_sizeof_nowarn(T) c_sizeof_or_alignof_type (T, SIZEOF_EXPR, 0) + /* in c-typeck.c */ -extern tree require_complete_type PARAMS ((tree)); -extern int comptypes PARAMS ((tree, tree)); -extern tree c_size_in_bytes PARAMS ((tree)); -extern bool c_mark_addressable PARAMS ((tree)); -extern void c_incomplete_type_error PARAMS ((tree, tree)); -extern tree c_type_promotes_to PARAMS ((tree)); -extern tree build_component_ref PARAMS ((tree, tree)); -extern tree build_indirect_ref PARAMS ((tree, const char *)); -extern tree build_array_ref PARAMS ((tree, tree)); -extern tree build_external_ref PARAMS ((tree, int)); -extern tree parser_build_binary_op PARAMS ((enum tree_code, - tree, tree)); -extern int c_tree_expr_nonnegative_p PARAMS ((tree)); -extern void readonly_warning PARAMS ((tree, const char *)); -extern tree build_conditional_expr PARAMS ((tree, tree, tree)); -extern tree build_compound_expr PARAMS ((tree)); -extern tree c_cast_expr PARAMS ((tree, tree)); -extern tree build_c_cast PARAMS ((tree, tree)); -extern tree build_modify_expr PARAMS ((tree, enum tree_code, - tree)); -extern void store_init_value PARAMS ((tree, tree)); -extern void error_init PARAMS ((const char *)); -extern void pedwarn_init PARAMS ((const char *)); -extern void start_init PARAMS ((tree, tree, int)); -extern void finish_init PARAMS ((void)); -extern void really_start_incremental_init PARAMS ((tree)); -extern void push_init_level PARAMS ((int)); -extern tree pop_init_level PARAMS ((int)); -extern void set_init_index PARAMS ((tree, tree)); -extern void set_init_label PARAMS ((tree)); -extern void process_init_element PARAMS ((tree)); -extern tree build_compound_literal PARAMS ((tree, tree)); -extern void pedwarn_c99 PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1; -extern tree c_start_case PARAMS ((tree)); -extern void c_finish_case PARAMS ((void)); -extern tree simple_asm_stmt PARAMS ((tree)); -extern tree build_asm_stmt PARAMS ((tree, tree, tree, - tree, tree)); -extern tree c_convert_parm_for_inlining PARAMS ((tree, tree, tree)); + +/* For use with comptypes. */ +enum { + COMPARE_STRICT = 0 +}; + +extern tree require_complete_type (tree); +extern int comptypes (tree, tree, int); +extern tree c_size_in_bytes (tree); +extern bool c_mark_addressable (tree); +extern void c_incomplete_type_error (tree, tree); +extern tree c_type_promotes_to (tree); +extern tree build_component_ref (tree, tree); +extern tree build_indirect_ref (tree, const char *); +extern tree build_array_ref (tree, tree); +extern tree build_external_ref (tree, int); +extern tree parser_build_binary_op (enum tree_code, tree, tree); +extern int c_tree_expr_nonnegative_p (tree); +extern void readonly_error (tree, const char *); +extern tree build_conditional_expr (tree, tree, tree); +extern tree build_compound_expr (tree); +extern tree c_cast_expr (tree, tree); +extern tree build_c_cast (tree, tree); +extern tree build_modify_expr (tree, enum tree_code, tree); +extern void store_init_value (tree, tree); +extern void error_init (const char *); +extern void pedwarn_init (const char *); +extern void start_init (tree, tree, int); +extern void finish_init (void); +extern void really_start_incremental_init (tree); +extern void push_init_level (int); +extern tree pop_init_level (int); +extern void set_init_index (tree, tree); +extern void set_init_label (tree); +extern void process_init_element (tree); +extern tree build_compound_literal (tree, tree); +extern void pedwarn_c90 (const char *, ...) ATTRIBUTE_PRINTF_1; +extern void pedwarn_c99 (const char *, ...) ATTRIBUTE_PRINTF_1; +extern tree c_start_case (tree); +extern void c_finish_case (void); +extern tree simple_asm_stmt (tree); +extern tree build_asm_stmt (tree, tree, tree, tree, tree); +extern tree c_convert_parm_for_inlining (tree, tree, tree, int); /* Set to 0 at beginning of a function definition, set to 1 if a return statement that specifies a return value is seen. */ @@ -318,9 +314,17 @@ extern int current_function_returns_abnormally; extern int system_header_p; /* In c-decl.c */ -extern void c_finish_incomplete_decl PARAMS ((tree)); +extern void c_finish_incomplete_decl (tree); +extern void *get_current_scope (void); +extern void objc_mark_locals_volatile (void *); +extern void c_write_global_declarations (void); extern GTY(()) tree static_ctors; extern GTY(()) tree static_dtors; +/* In order for the format checking to accept the C frontend + diagnostic framework extensions, you must include this file before + toplev.h, not after. */ +#define GCC_DIAG_STYLE __gcc_cdiag__ + #endif /* ! GCC_C_TREE_H */ diff --git a/contrib/gcc/config/alpha/alpha.c b/contrib/gcc/config/alpha/alpha.c index 42b57e18a21a..0086968afb7a 100644 --- a/contrib/gcc/config/alpha/alpha.c +++ b/contrib/gcc/config/alpha/alpha.c @@ -1,28 +1,30 @@ /* Subroutines used for code generation on the DEC Alpha. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. -GNU CC is distributed in the hope that it will be useful, +GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tree.h" #include "regs.h" @@ -48,6 +50,8 @@ Boston, MA 02111-1307, USA. */ #include "target-def.h" #include "debug.h" #include "langhooks.h" +#include +#include "cfglayout.h" /* Specify which cpu to schedule for. */ @@ -103,110 +107,70 @@ static int alpha_function_needs_gp; /* The alias set for prologue/epilogue register save/restore. */ -static int alpha_sr_alias_set; +static GTY(()) int alpha_sr_alias_set; /* The assembler name of the current function. */ static const char *alpha_fnname; /* The next explicit relocation sequence number. */ +extern GTY(()) int alpha_next_sequence_number; int alpha_next_sequence_number = 1; /* The literal and gpdisp sequence numbers for this insn, as printed by %# and %* respectively. */ +extern GTY(()) int alpha_this_literal_sequence_number; +extern GTY(()) int alpha_this_gpdisp_sequence_number; int alpha_this_literal_sequence_number; int alpha_this_gpdisp_sequence_number; -/* Declarations of static functions. */ -static int tls_symbolic_operand_1 - PARAMS ((rtx, enum machine_mode, int, int)); -static enum tls_model tls_symbolic_operand_type - PARAMS ((rtx)); -static bool decl_in_text_section - PARAMS ((tree)); -static bool alpha_in_small_data_p - PARAMS ((tree)); -static void alpha_encode_section_info - PARAMS ((tree, int)); -static const char *alpha_strip_name_encoding - PARAMS ((const char *)); -static int some_small_symbolic_operand_1 - PARAMS ((rtx *, void *)); -static int split_small_symbolic_operand_1 - PARAMS ((rtx *, void *)); -static void alpha_set_memflags_1 - PARAMS ((rtx, int, int, int)); -static rtx alpha_emit_set_const_1 - PARAMS ((rtx, enum machine_mode, HOST_WIDE_INT, int)); -static void alpha_expand_unaligned_load_words - PARAMS ((rtx *out_regs, rtx smem, HOST_WIDE_INT words, HOST_WIDE_INT ofs)); -static void alpha_expand_unaligned_store_words - PARAMS ((rtx *out_regs, rtx smem, HOST_WIDE_INT words, HOST_WIDE_INT ofs)); -static void alpha_init_builtins - PARAMS ((void)); -static rtx alpha_expand_builtin - PARAMS ((tree, rtx, rtx, enum machine_mode, int)); -static void alpha_sa_mask - PARAMS ((unsigned long *imaskP, unsigned long *fmaskP)); -static int find_lo_sum_using_gp - PARAMS ((rtx *, void *)); -static int alpha_does_function_need_gp - PARAMS ((void)); -static int alpha_ra_ever_killed - PARAMS ((void)); -static const char *get_trap_mode_suffix - PARAMS ((void)); -static const char *get_round_mode_suffix - PARAMS ((void)); -static const char *get_some_local_dynamic_name - PARAMS ((void)); -static int get_some_local_dynamic_name_1 - PARAMS ((rtx *, void *)); -static rtx set_frame_related_p - PARAMS ((void)); -static const char *alpha_lookup_xfloating_lib_func - PARAMS ((enum rtx_code)); -static int alpha_compute_xfloating_mode_arg - PARAMS ((enum rtx_code, enum alpha_fp_rounding_mode)); -static void alpha_emit_xfloating_libcall - PARAMS ((const char *, rtx, rtx[], int, rtx)); -static rtx alpha_emit_xfloating_compare - PARAMS ((enum rtx_code, rtx, rtx)); -static void alpha_output_function_end_prologue - PARAMS ((FILE *)); -static int alpha_adjust_cost - PARAMS ((rtx, rtx, rtx, int)); -static int alpha_issue_rate - PARAMS ((void)); -static int alpha_use_dfa_pipeline_interface - PARAMS ((void)); -static int alpha_multipass_dfa_lookahead - PARAMS ((void)); +/* Costs of various operations on the different architectures. */ -#ifdef OBJECT_FORMAT_ELF -static void alpha_elf_select_rtx_section - PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); -#endif +struct alpha_rtx_cost_data +{ + unsigned char fp_add; + unsigned char fp_mult; + unsigned char fp_div_sf; + unsigned char fp_div_df; + unsigned char int_mult_si; + unsigned char int_mult_di; + unsigned char int_shift; + unsigned char int_cmov; +}; -#if TARGET_ABI_OPEN_VMS -static bool alpha_linkage_symbol_p - PARAMS ((const char *symname)); -static void alpha_write_linkage - PARAMS ((FILE *, const char *, tree)); -#endif - -#if TARGET_ABI_OSF -static void alpha_output_mi_thunk_osf - PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); -#endif - -static struct machine_function * alpha_init_machine_status - PARAMS ((void)); - -static void unicosmk_output_deferred_case_vectors PARAMS ((FILE *)); -static void unicosmk_gen_dsib PARAMS ((unsigned long *imaskP)); -static void unicosmk_output_ssib PARAMS ((FILE *, const char *)); -static int unicosmk_need_dex PARAMS ((rtx)); +static struct alpha_rtx_cost_data const alpha_rtx_cost_data[PROCESSOR_MAX] = +{ + { /* EV4 */ + COSTS_N_INSNS (6), /* fp_add */ + COSTS_N_INSNS (6), /* fp_mult */ + COSTS_N_INSNS (34), /* fp_div_sf */ + COSTS_N_INSNS (63), /* fp_div_df */ + COSTS_N_INSNS (23), /* int_mult_si */ + COSTS_N_INSNS (23), /* int_mult_di */ + COSTS_N_INSNS (2), /* int_shift */ + COSTS_N_INSNS (2), /* int_cmov */ + }, + { /* EV5 */ + COSTS_N_INSNS (4), /* fp_add */ + COSTS_N_INSNS (4), /* fp_mult */ + COSTS_N_INSNS (15), /* fp_div_sf */ + COSTS_N_INSNS (22), /* fp_div_df */ + COSTS_N_INSNS (8), /* int_mult_si */ + COSTS_N_INSNS (12), /* int_mult_di */ + COSTS_N_INSNS (1) + 1, /* int_shift */ + COSTS_N_INSNS (1), /* int_cmov */ + }, + { /* EV6 */ + COSTS_N_INSNS (4), /* fp_add */ + COSTS_N_INSNS (4), /* fp_mult */ + COSTS_N_INSNS (12), /* fp_div_sf */ + COSTS_N_INSNS (15), /* fp_div_df */ + COSTS_N_INSNS (7), /* int_mult_si */ + COSTS_N_INSNS (7), /* int_mult_di */ + COSTS_N_INSNS (1), /* int_shift */ + COSTS_N_INSNS (2), /* int_cmov */ + }, +}; /* Get the number of args of a function in one of two ways. */ #if TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK @@ -217,99 +181,24 @@ static int unicosmk_need_dex PARAMS ((rtx)); #define REG_PV 27 #define REG_RA 26 - -/* Initialize the GCC target structure. */ + +/* Declarations of static functions. */ +static struct machine_function *alpha_init_machine_status (void); +static rtx alpha_emit_xfloating_compare (enum rtx_code, rtx, rtx); + #if TARGET_ABI_OPEN_VMS -const struct attribute_spec vms_attribute_table[]; -static unsigned int vms_section_type_flags PARAMS ((tree, const char *, int)); -static void vms_asm_named_section PARAMS ((const char *, unsigned int)); -static void vms_asm_out_constructor PARAMS ((rtx, int)); -static void vms_asm_out_destructor PARAMS ((rtx, int)); -# undef TARGET_ATTRIBUTE_TABLE -# define TARGET_ATTRIBUTE_TABLE vms_attribute_table -# undef TARGET_SECTION_TYPE_FLAGS -# define TARGET_SECTION_TYPE_FLAGS vms_section_type_flags +static void alpha_write_linkage (FILE *, const char *, tree); #endif -#undef TARGET_IN_SMALL_DATA_P -#define TARGET_IN_SMALL_DATA_P alpha_in_small_data_p -#undef TARGET_ENCODE_SECTION_INFO -#define TARGET_ENCODE_SECTION_INFO alpha_encode_section_info -#undef TARGET_STRIP_NAME_ENCODING -#define TARGET_STRIP_NAME_ENCODING alpha_strip_name_encoding - -#if TARGET_ABI_UNICOSMK -static void unicosmk_asm_named_section PARAMS ((const char *, unsigned int)); -static void unicosmk_insert_attributes PARAMS ((tree, tree *)); -static unsigned int unicosmk_section_type_flags PARAMS ((tree, const char *, - int)); -static void unicosmk_unique_section PARAMS ((tree, int)); -# undef TARGET_INSERT_ATTRIBUTES -# define TARGET_INSERT_ATTRIBUTES unicosmk_insert_attributes -# undef TARGET_SECTION_TYPE_FLAGS -# define TARGET_SECTION_TYPE_FLAGS unicosmk_section_type_flags -# undef TARGET_ASM_UNIQUE_SECTION -# define TARGET_ASM_UNIQUE_SECTION unicosmk_unique_section -# undef TARGET_ASM_GLOBALIZE_LABEL -# define TARGET_ASM_GLOBALIZE_LABEL hook_FILEptr_constcharptr_void -#endif - -#undef TARGET_ASM_ALIGNED_HI_OP -#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" -#undef TARGET_ASM_ALIGNED_DI_OP -#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t" - -/* Default unaligned ops are provided for ELF systems. To get unaligned - data for non-ELF systems, we have to turn off auto alignment. */ -#ifndef OBJECT_FORMAT_ELF -#undef TARGET_ASM_UNALIGNED_HI_OP -#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.word\t" -#undef TARGET_ASM_UNALIGNED_SI_OP -#define TARGET_ASM_UNALIGNED_SI_OP "\t.align 0\n\t.long\t" -#undef TARGET_ASM_UNALIGNED_DI_OP -#define TARGET_ASM_UNALIGNED_DI_OP "\t.align 0\n\t.quad\t" -#endif - -#ifdef OBJECT_FORMAT_ELF -#undef TARGET_ASM_SELECT_RTX_SECTION -#define TARGET_ASM_SELECT_RTX_SECTION alpha_elf_select_rtx_section -#endif - -#undef TARGET_ASM_FUNCTION_END_PROLOGUE -#define TARGET_ASM_FUNCTION_END_PROLOGUE alpha_output_function_end_prologue - -#undef TARGET_SCHED_ADJUST_COST -#define TARGET_SCHED_ADJUST_COST alpha_adjust_cost -#undef TARGET_SCHED_ISSUE_RATE -#define TARGET_SCHED_ISSUE_RATE alpha_issue_rate -#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE -#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \ - alpha_use_dfa_pipeline_interface -#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD -#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD \ - alpha_multipass_dfa_lookahead - -#undef TARGET_HAVE_TLS -#define TARGET_HAVE_TLS HAVE_AS_TLS - -#undef TARGET_INIT_BUILTINS -#define TARGET_INIT_BUILTINS alpha_init_builtins -#undef TARGET_EXPAND_BUILTIN -#define TARGET_EXPAND_BUILTIN alpha_expand_builtin - -#if TARGET_ABI_OSF -#undef TARGET_ASM_OUTPUT_MI_THUNK -#define TARGET_ASM_OUTPUT_MI_THUNK alpha_output_mi_thunk_osf -#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK -#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true -#endif - -struct gcc_target targetm = TARGET_INITIALIZER; +static void unicosmk_output_deferred_case_vectors (FILE *); +static void unicosmk_gen_dsib (unsigned long *); +static void unicosmk_output_ssib (FILE *, const char *); +static int unicosmk_need_dex (rtx); /* Parse target option strings. */ void -override_options () +override_options (void) { int i; static const struct cpu_table { @@ -344,7 +233,7 @@ override_options () flag_pic = 0; } - /* On Unicos/Mk, the native compiler consistenly generates /d suffices for + /* On Unicos/Mk, the native compiler consistently generates /d suffices for floating-point instructions. Make that the default for this target. */ if (TARGET_ABI_UNICOSMK) alpha_fprm = ALPHA_FPRM_DYN; @@ -501,6 +390,9 @@ override_options () warning ("trap mode not supported for VAX floats"); alpha_fptm = ALPHA_FPTM_SU; } + if (target_flags_explicit & MASK_LONG_DOUBLE_128) + warning ("128-bit long double not supported for VAX floats"); + target_flags &= ~MASK_LONG_DOUBLE_128; } { @@ -583,17 +475,16 @@ override_options () /* Tell the compiler when we're using VAX floating point. */ if (TARGET_FLOAT_VAX) { - real_format_for_mode[SFmode - QFmode] = &vax_f_format; - real_format_for_mode[DFmode - QFmode] = &vax_g_format; - real_format_for_mode[TFmode - QFmode] = NULL; + REAL_MODE_FORMAT (SFmode) = &vax_f_format; + REAL_MODE_FORMAT (DFmode) = &vax_g_format; + REAL_MODE_FORMAT (TFmode) = NULL; } } /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */ int -zap_mask (value) - HOST_WIDE_INT value; +zap_mask (HOST_WIDE_INT value) { int i; @@ -609,9 +500,7 @@ zap_mask (value) register, it must be in the proper mode unless MODE is VOIDmode. */ int -reg_or_0_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_or_0_operand (rtx op, enum machine_mode mode) { return op == CONST0_RTX (mode) || register_operand (op, mode); } @@ -620,9 +509,7 @@ reg_or_0_operand (op, mode) any register. */ int -reg_or_6bit_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_or_6bit_operand (rtx op, enum machine_mode mode) { return ((GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 64) @@ -633,9 +520,7 @@ reg_or_6bit_operand (op, mode) /* Return 1 if OP is an 8-bit constant or any register. */ int -reg_or_8bit_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_or_8bit_operand (rtx op, enum machine_mode mode) { return ((GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100) @@ -645,9 +530,7 @@ reg_or_8bit_operand (op, mode) /* Return 1 if OP is a constant or any register. */ int -reg_or_const_int_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_or_const_int_operand (rtx op, enum machine_mode mode) { return GET_CODE (op) == CONST_INT || register_operand (op, mode); } @@ -655,9 +538,7 @@ reg_or_const_int_operand (op, mode) /* Return 1 if OP is an 8-bit constant. */ int -cint8_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +cint8_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return ((GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100)); @@ -666,9 +547,7 @@ cint8_operand (op, mode) /* Return 1 if the operand is a valid second operand to an add insn. */ int -add_operand (op, mode) - register rtx op; - enum machine_mode mode; +add_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) /* Constraints I, J, O and P are covered by K. */ @@ -682,9 +561,7 @@ add_operand (op, mode) add insn. */ int -sext_add_operand (op, mode) - register rtx op; - enum machine_mode mode; +sext_add_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I') @@ -696,9 +573,7 @@ sext_add_operand (op, mode) /* Return 1 if OP is the constant 4 or 8. */ int -const48_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +const48_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && (INTVAL (op) == 4 || INTVAL (op) == 8)); @@ -707,9 +582,7 @@ const48_operand (op, mode) /* Return 1 if OP is a valid first operand to an AND insn. */ int -and_operand (op, mode) - register rtx op; - enum machine_mode mode; +and_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode) return (zap_mask (CONST_DOUBLE_LOW (op)) @@ -726,9 +599,7 @@ and_operand (op, mode) /* Return 1 if OP is a valid first operand to an IOR or XOR insn. */ int -or_operand (op, mode) - register rtx op; - enum machine_mode mode; +or_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100 @@ -741,9 +612,7 @@ or_operand (op, mode) mode smaller than DImode. */ int -mode_width_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mode_width_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && (INTVAL (op) == 8 || INTVAL (op) == 16 @@ -754,9 +623,7 @@ mode_width_operand (op, mode) smaller than an integer. */ int -mode_mask_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mode_mask_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) == CONST_INT) { @@ -783,9 +650,7 @@ mode_mask_operand (op, mode) /* Return 1 if OP is a multiple of 8 less than 64. */ int -mul8_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mul8_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 64 @@ -795,9 +660,7 @@ mul8_operand (op, mode) /* Return 1 if OP is the zero constant for MODE. */ int -const0_operand (op, mode) - register rtx op; - enum machine_mode mode; +const0_operand (rtx op, enum machine_mode mode) { return op == CONST0_RTX (mode); } @@ -805,9 +668,7 @@ const0_operand (op, mode) /* Return 1 if OP is a hard floating-point register. */ int -hard_fp_register_operand (op, mode) - register rtx op; - enum machine_mode mode; +hard_fp_register_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -820,9 +681,7 @@ hard_fp_register_operand (op, mode) /* Return 1 if OP is a hard general register. */ int -hard_int_register_operand (op, mode) - register rtx op; - enum machine_mode mode; +hard_int_register_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -836,9 +695,7 @@ hard_int_register_operand (op, mode) int -reg_or_cint_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_or_cint_operand (rtx op, enum machine_mode mode) { return (GET_CODE (op) == CONST_INT || register_operand (op, mode)); @@ -848,9 +705,7 @@ reg_or_cint_operand (op, mode) if it is a MEM, it need not be valid. */ int -some_operand (op, mode) - register rtx op; - enum machine_mode mode; +some_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -881,9 +736,7 @@ some_operand (op, mode) /* Likewise, but don't accept constants. */ int -some_ni_operand (op, mode) - register rtx op; - enum machine_mode mode; +some_ni_operand (rtx op, enum machine_mode mode) { if (GET_MODE (op) != mode && mode != VOIDmode) return 0; @@ -897,9 +750,7 @@ some_ni_operand (op, mode) /* Return 1 if OP is a valid operand for the source of a move insn. */ int -input_operand (op, mode) - register rtx op; - enum machine_mode mode; +input_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -964,60 +815,89 @@ input_operand (op, mode) file, and in the same section as the current function. */ int -current_file_function_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +samegp_function_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) != SYMBOL_REF) - return 0; + return false; /* Easy test for recursion. */ if (op == XEXP (DECL_RTL (current_function_decl), 0)) - return 1; + return true; - /* Otherwise, we need the DECL for the SYMBOL_REF, which we can't get. - So SYMBOL_REF_FLAG has been declared to imply that the function is - in the default text section. So we must also check that the current - function is also in the text section. */ - if (SYMBOL_REF_FLAG (op) && decl_in_text_section (current_function_decl)) - return 1; + /* Functions that are not local can be overridden, and thus may + not share the same gp. */ + if (! SYMBOL_REF_LOCAL_P (op)) + return false; - return 0; + /* If -msmall-data is in effect, assume that there is only one GP + for the module, and so any local symbol has this property. We + need explicit relocations to be able to enforce this for symbols + not defined in this unit of translation, however. */ + if (TARGET_EXPLICIT_RELOCS && TARGET_SMALL_DATA) + return true; + + /* Functions that are not external are defined in this UoT, + and thus must share the same gp. */ + return ! SYMBOL_REF_EXTERNAL_P (op); } /* Return 1 if OP is a SYMBOL_REF for which we can make a call via bsr. */ int -direct_call_operand (op, mode) - rtx op; - enum machine_mode mode; +direct_call_operand (rtx op, enum machine_mode mode) { - /* Must be defined in this file. */ - if (! current_file_function_operand (op, mode)) - return 0; + tree op_decl, cfun_sec, op_sec; + + /* Must share the same GP. */ + if (!samegp_function_operand (op, mode)) + return false; /* If profiling is implemented via linker tricks, we can't jump - to the nogp alternate entry point. */ + to the nogp alternate entry point. Note that current_function_profile + would not be correct, since that doesn't indicate if the target + function uses profiling. */ /* ??? TARGET_PROFILING_NEEDS_GP isn't really the right test, but is approximately correct for the OSF ABIs. Don't know what to do for VMS, NT, or UMK. */ - if (! TARGET_PROFILING_NEEDS_GP - && ! current_function_profile) - return 0; + if (!TARGET_PROFILING_NEEDS_GP && profile_flag) + return false; - return 1; + /* Must be a function. In some cases folks create thunks in static + data structures and then make calls to them. If we allow the + direct call, we'll get an error from the linker about !samegp reloc + against a symbol without a .prologue directive. */ + if (!SYMBOL_REF_FUNCTION_P (op)) + return false; + + /* Must be "near" so that the branch is assumed to reach. With + -msmall-text, this is assumed true of all local symbols. Since + we've already checked samegp, locality is already assured. */ + if (TARGET_SMALL_TEXT) + return true; + + /* Otherwise, a decl is "near" if it is defined in the same section. */ + if (flag_function_sections) + return false; + + op_decl = SYMBOL_REF_DECL (op); + if (DECL_ONE_ONLY (current_function_decl) + || (op_decl && DECL_ONE_ONLY (op_decl))) + return false; + + cfun_sec = DECL_SECTION_NAME (current_function_decl); + op_sec = op_decl ? DECL_SECTION_NAME (op_decl) : NULL; + return ((!cfun_sec && !op_sec) + || (cfun_sec && op_sec + && strcmp (TREE_STRING_POINTER (cfun_sec), + TREE_STRING_POINTER (op_sec)) == 0)); } /* Return true if OP is a LABEL_REF, or SYMBOL_REF or CONST referencing a (non-tls) variable known to be defined in this file. */ int -local_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +local_symbolic_operand (rtx op, enum machine_mode mode) { - const char *str; - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -1032,38 +912,15 @@ local_symbolic_operand (op, mode) if (GET_CODE (op) != SYMBOL_REF) return 0; - /* Easy pickings. */ - if (CONSTANT_POOL_ADDRESS_P (op) || STRING_POOL_ADDRESS_P (op)) - return 1; - - /* ??? SYMBOL_REF_FLAG is set for local function symbols, but we - run into problems with the rtl inliner in that the symbol was - once external, but is local after inlining, which results in - unrecognizable insns. */ - - str = XSTR (op, 0); - - /* If @[LS], then alpha_encode_section_info sez it's local. */ - if (str[0] == '@' && (str[1] == 'L' || str[1] == 'S')) - return 1; - - /* If *$, then ASM_GENERATE_INTERNAL_LABEL sez it's local. */ - if (str[0] == '*' && str[1] == '$') - return 1; - - return 0; + return SYMBOL_REF_LOCAL_P (op) && !SYMBOL_REF_TLS_MODEL (op); } /* Return true if OP is a SYMBOL_REF or CONST referencing a variable known to be defined in this file in the small data area. */ int -small_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +small_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { - const char *str; - if (! TARGET_SMALL_DATA) return 0; @@ -1078,25 +935,22 @@ small_symbolic_operand (op, mode) if (GET_CODE (op) != SYMBOL_REF) return 0; + /* ??? There's no encode_section_info equivalent for the rtl + constant pool, so SYMBOL_FLAG_SMALL never gets set. */ if (CONSTANT_POOL_ADDRESS_P (op)) - return GET_MODE_SIZE (get_pool_mode (op)) <= (unsigned) g_switch_value; - else - { - str = XSTR (op, 0); - return str[0] == '@' && str[1] == 'S'; - } + return GET_MODE_SIZE (get_pool_mode (op)) <= g_switch_value; + + return (SYMBOL_REF_LOCAL_P (op) + && SYMBOL_REF_SMALL_P (op) + && SYMBOL_REF_TLS_MODEL (op) == 0); } /* Return true if OP is a SYMBOL_REF or CONST referencing a variable not known (or known not) to be defined in this file. */ int -global_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +global_symbolic_operand (rtx op, enum machine_mode mode) { - const char *str; - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -1108,20 +962,13 @@ global_symbolic_operand (op, mode) if (GET_CODE (op) != SYMBOL_REF) return 0; - if (local_symbolic_operand (op, mode)) - return 0; - - /* Also verify that it's not a TLS symbol. */ - str = XSTR (op, 0); - return str[0] != '%' && str[0] != '@'; + return !SYMBOL_REF_LOCAL_P (op) && !SYMBOL_REF_TLS_MODEL (op); } /* Return 1 if OP is a valid operand for the MEM of a CALL insn. */ int -call_operand (op, mode) - rtx op; - enum machine_mode mode; +call_operand (rtx op, enum machine_mode mode) { if (mode != Pmode) return 0; @@ -1130,7 +977,7 @@ call_operand (op, mode) { if (TARGET_ABI_OSF) { - /* Disallow virtual registers to cope with pathalogical test cases + /* Disallow virtual registers to cope with pathological test cases such as compile/930117-1.c in which the virtual reg decomposes to the frame pointer. Which is a hard reg that is not $27. */ return (REGNO (op) == 27 || REGNO (op) > LAST_VIRTUAL_REGISTER); @@ -1150,9 +997,7 @@ call_operand (op, mode) possibly with an offset. */ int -symbolic_operand (op, mode) - register rtx op; - enum machine_mode mode; +symbolic_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -1169,14 +1014,8 @@ symbolic_operand (op, mode) /* Return true if OP is valid for a particular TLS relocation. */ static int -tls_symbolic_operand_1 (op, mode, size, unspec) - rtx op; - enum machine_mode mode; - int size, unspec; +tls_symbolic_operand_1 (rtx op, enum machine_mode mode, int size, int unspec) { - const char *str; - int letter; - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; @@ -1190,32 +1029,35 @@ tls_symbolic_operand_1 (op, mode, size, unspec) if (GET_CODE (op) != SYMBOL_REF) return 0; - str = XSTR (op, 0); - if (str[0] == '%') - { - if (size != 64) - return 0; - } - else if (str[0] == '@') + if (SYMBOL_REF_LOCAL_P (op)) { if (alpha_tls_size > size) return 0; } else - return 0; + { + if (size != 64) + return 0; + } - letter = (unspec == UNSPEC_DTPREL ? 'D' : 'T'); - - return str[1] == letter; + switch (SYMBOL_REF_TLS_MODEL (op)) + { + case TLS_MODEL_LOCAL_DYNAMIC: + return unspec == UNSPEC_DTPREL; + case TLS_MODEL_INITIAL_EXEC: + return unspec == UNSPEC_TPREL && size == 64; + case TLS_MODEL_LOCAL_EXEC: + return unspec == UNSPEC_TPREL; + default: + abort (); + } } /* Return true if OP is valid for 16-bit DTP relative relocations. */ int -dtp16_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +dtp16_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 16, UNSPEC_DTPREL); } @@ -1223,9 +1065,7 @@ dtp16_symbolic_operand (op, mode) /* Return true if OP is valid for 32-bit DTP relative relocations. */ int -dtp32_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +dtp32_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 32, UNSPEC_DTPREL); } @@ -1233,9 +1073,7 @@ dtp32_symbolic_operand (op, mode) /* Return true if OP is valid for 64-bit DTP relative relocations. */ int -gotdtp_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +gotdtp_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 64, UNSPEC_DTPREL); } @@ -1243,9 +1081,7 @@ gotdtp_symbolic_operand (op, mode) /* Return true if OP is valid for 16-bit TP relative relocations. */ int -tp16_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +tp16_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 16, UNSPEC_TPREL); } @@ -1253,9 +1089,7 @@ tp16_symbolic_operand (op, mode) /* Return true if OP is valid for 32-bit TP relative relocations. */ int -tp32_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +tp32_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 32, UNSPEC_TPREL); } @@ -1263,9 +1097,7 @@ tp32_symbolic_operand (op, mode) /* Return true if OP is valid for 64-bit TP relative relocations. */ int -gottp_symbolic_operand (op, mode) - rtx op; - enum machine_mode mode; +gottp_symbolic_operand (rtx op, enum machine_mode mode) { return tls_symbolic_operand_1 (op, mode, 64, UNSPEC_TPREL); } @@ -1274,9 +1106,7 @@ gottp_symbolic_operand (op, mode) comparisons are valid in which insn. */ int -alpha_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; +alpha_comparison_operator (rtx op, enum machine_mode mode) { enum rtx_code code = GET_CODE (op); @@ -1291,9 +1121,7 @@ alpha_comparison_operator (op, mode) Here we know which comparisons are valid in which insn. */ int -alpha_zero_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; +alpha_zero_comparison_operator (rtx op, enum machine_mode mode) { enum rtx_code code = GET_CODE (op); @@ -1307,9 +1135,7 @@ alpha_zero_comparison_operator (op, mode) /* Return 1 if OP is a valid Alpha swapped comparison operator. */ int -alpha_swapped_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; +alpha_swapped_comparison_operator (rtx op, enum machine_mode mode) { enum rtx_code code = GET_CODE (op); @@ -1325,9 +1151,7 @@ alpha_swapped_comparison_operator (op, mode) /* Return 1 if OP is a signed comparison operation. */ int -signed_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +signed_comparison_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (op); @@ -1343,9 +1167,7 @@ signed_comparison_operator (op, mode) Here we know which comparisons are valid in which insn. */ int -alpha_fp_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; +alpha_fp_comparison_operator (rtx op, enum machine_mode mode) { enum rtx_code code = GET_CODE (op); @@ -1358,20 +1180,21 @@ alpha_fp_comparison_operator (op, mode) /* Return 1 if this is a divide or modulus operator. */ int -divmod_operator (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +divmod_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { - switch (GET_CODE (op)) - { - case DIV: case MOD: case UDIV: case UMOD: - return 1; + enum rtx_code code = GET_CODE (op); - default: - break; - } + return (code == DIV || code == MOD || code == UDIV || code == UMOD); +} - return 0; +/* Return 1 if this is a float->int conversion operator. */ + +int +fix_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) +{ + enum rtx_code code = GET_CODE (op); + + return (code == FIX || code == UNSIGNED_FIX); } /* Return 1 if this memory address is a known aligned register plus @@ -1381,9 +1204,7 @@ divmod_operator (op, mode) Take into account what reload will do. */ int -aligned_memory_operand (op, mode) - register rtx op; - enum machine_mode mode; +aligned_memory_operand (rtx op, enum machine_mode mode) { rtx base; @@ -1401,9 +1222,10 @@ aligned_memory_operand (op, mode) } } - if (GET_CODE (op) != MEM - || GET_MODE (op) != mode) + if (GET_CODE (op) != MEM) return 0; + if (MEM_ALIGN (op) >= 32) + return 1; op = XEXP (op, 0); /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo) @@ -1425,9 +1247,7 @@ aligned_memory_operand (op, mode) /* Similar, but return 1 if OP is a MEM which is not alignable. */ int -unaligned_memory_operand (op, mode) - register rtx op; - enum machine_mode mode; +unaligned_memory_operand (rtx op, enum machine_mode mode) { rtx base; @@ -1445,8 +1265,9 @@ unaligned_memory_operand (op, mode) } } - if (GET_CODE (op) != MEM - || GET_MODE (op) != mode) + if (GET_CODE (op) != MEM) + return 0; + if (MEM_ALIGN (op) >= 32) return 0; op = XEXP (op, 0); @@ -1469,9 +1290,7 @@ unaligned_memory_operand (op, mode) /* Return 1 if OP is either a register or an unaligned memory location. */ int -reg_or_unaligned_mem_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_unaligned_mem_operand (rtx op, enum machine_mode mode) { return register_operand (op, mode) || unaligned_memory_operand (op, mode); } @@ -1479,9 +1298,7 @@ reg_or_unaligned_mem_operand (op, mode) /* Return 1 if OP is any memory location. During reload a pseudo matches. */ int -any_memory_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +any_memory_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == MEM || (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG) @@ -1504,9 +1321,7 @@ any_memory_operand (op, mode) preventing combine from making the optimization. */ int -reg_not_elim_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_not_elim_operand (rtx op, enum machine_mode mode) { rtx inner = op; if (GET_CODE (op) == SUBREG) @@ -1522,9 +1337,7 @@ reg_not_elim_operand (op, mode) will do. */ int -normal_memory_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +normal_memory_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (reload_in_progress) { @@ -1551,9 +1364,7 @@ normal_memory_operand (op, mode) int->fp conversion. */ int -reg_no_subreg_operand (op, mode) - register rtx op; - enum machine_mode mode; +reg_no_subreg_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) != REG) return 0; @@ -1565,9 +1376,7 @@ reg_no_subreg_operand (op, mode) elimination. */ int -addition_operation (op, mode) - register rtx op; - enum machine_mode mode; +addition_operation (rtx op, enum machine_mode mode) { if (GET_MODE (op) != mode && mode != VOIDmode) return 0; @@ -1583,9 +1392,7 @@ addition_operation (op, mode) the range defined for C in [I-P]. */ bool -alpha_const_ok_for_letter_p (value, c) - HOST_WIDE_INT value; - int c; +alpha_const_ok_for_letter_p (HOST_WIDE_INT value, int c) { switch (c) { @@ -1624,9 +1431,7 @@ alpha_const_ok_for_letter_p (value, c) matches for C in [GH]. */ bool -alpha_const_double_ok_for_letter_p (value, c) - rtx value; - int c; +alpha_const_double_ok_for_letter_p (rtx value, int c) { switch (c) { @@ -1650,9 +1455,7 @@ alpha_const_double_ok_for_letter_p (value, c) matches for C. */ bool -alpha_extra_constraint (value, c) - rtx value; - int c; +alpha_extra_constraint (rtx value, int c) { switch (c) { @@ -1678,7 +1481,7 @@ alpha_extra_constraint (value, c) /* Return 1 if this function can directly return via $26. */ int -direct_return () +direct_return (void) { return (! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK && reload_completed @@ -1691,8 +1494,7 @@ direct_return () /* Return the ADDR_VEC associated with a tablejump insn. */ rtx -alpha_tablejump_addr_vec (insn) - rtx insn; +alpha_tablejump_addr_vec (rtx insn) { rtx tmp; @@ -1711,8 +1513,7 @@ alpha_tablejump_addr_vec (insn) /* Return the label of the predicted edge, or CONST0_RTX if we don't know. */ rtx -alpha_tablejump_best_label (insn) - rtx insn; +alpha_tablejump_best_label (rtx insn) { rtx jump_table = alpha_tablejump_addr_vec (insn); rtx best_label = NULL_RTX; @@ -1746,77 +1547,58 @@ alpha_tablejump_best_label (insn) /* Return the TLS model to use for SYMBOL. */ static enum tls_model -tls_symbolic_operand_type (symbol) - rtx symbol; +tls_symbolic_operand_type (rtx symbol) { - const char *str; + enum tls_model model; if (GET_CODE (symbol) != SYMBOL_REF) return 0; - str = XSTR (symbol, 0); + model = SYMBOL_REF_TLS_MODEL (symbol); - if (str[0] == '%') - { - /* ??? Be prepared for -ftls-model=local-dynamic. Perhaps we shouldn't - have separately encoded local-ness. On well, maybe the user will use - attribute visibility next time. At least we don't crash... */ - if (str[1] == 'G' || str[1] == 'D') - return TLS_MODEL_GLOBAL_DYNAMIC; - if (str[1] == 'T') - return TLS_MODEL_INITIAL_EXEC; - } - else if (str[0] == '@') - { - if (str[1] == 'D') - { - /* Local dynamic is a waste if we're not going to combine - the __tls_get_addr calls. So avoid it if not optimizing. */ - if (optimize) - return TLS_MODEL_LOCAL_DYNAMIC; - else - return TLS_MODEL_GLOBAL_DYNAMIC; - } - if (str[1] == 'T') - { - /* 64-bit local exec is the same as initial exec except without - the dynamic relocation. In either case we use a got entry. */ - if (alpha_tls_size == 64) - return TLS_MODEL_INITIAL_EXEC; - else - return TLS_MODEL_LOCAL_EXEC; - } - } + /* Local-exec with a 64-bit size is the same code as initial-exec. */ + if (model == TLS_MODEL_LOCAL_EXEC && alpha_tls_size == 64) + model = TLS_MODEL_INITIAL_EXEC; - return 0; + return model; } - -/* Return true if the function DECL will be placed in the default text - section. */ -/* ??? Ideally we'd be able to always move from a SYMBOL_REF back to the - decl, as that would allow us to determine if two functions are in the - same section, which is what we really want to know. */ +/* Return true if the function DECL will share the same GP as any + function in the current unit of translation. */ static bool -decl_in_text_section (decl) - tree decl; +decl_has_samegp (tree decl) { - return (DECL_SECTION_NAME (decl) == NULL_TREE - && ! (flag_function_sections - || (targetm.have_named_sections - && DECL_ONE_ONLY (decl)))); + /* Functions that are not local can be overridden, and thus may + not share the same gp. */ + if (!(*targetm.binds_local_p) (decl)) + return false; + + /* If -msmall-data is in effect, assume that there is only one GP + for the module, and so any local symbol has this property. We + need explicit relocations to be able to enforce this for symbols + not defined in this unit of translation, however. */ + if (TARGET_EXPLICIT_RELOCS && TARGET_SMALL_DATA) + return true; + + /* Functions that are not external are defined in this UoT. */ + /* ??? Irritatingly, static functions not yet emitted are still + marked "external". Apply this to non-static functions only. */ + return !TREE_PUBLIC (decl) || !DECL_EXTERNAL (decl); } /* Return true if EXP should be placed in the small data section. */ static bool -alpha_in_small_data_p (exp) - tree exp; +alpha_in_small_data_p (tree exp) { /* We want to merge strings, so we never consider them small data. */ if (TREE_CODE (exp) == STRING_CST) return false; + /* Functions are never in the small data area. Duh. */ + if (TREE_CODE (exp) == FUNCTION_DECL) + return false; + if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) { const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (exp)); @@ -1830,136 +1612,16 @@ alpha_in_small_data_p (exp) /* If this is an incomplete type with size 0, then we can't put it in sdata because it might be too big when completed. */ - if (size > 0 && size <= g_switch_value) + if (size > 0 && (unsigned HOST_WIDE_INT) size <= g_switch_value) return true; } return false; } -/* If we are referencing a function that is static, make the SYMBOL_REF - special. We use this to see indicate we can branch to this function - without setting PV or restoring GP. - - If this is a variable that is known to be defined locally, add "@v" - to the name. If in addition the variable is to go in .sdata/.sbss, - then add "@s" instead. */ - -static void -alpha_encode_section_info (decl, first) - tree decl; - int first ATTRIBUTE_UNUSED; -{ - const char *symbol_str; - bool is_local; - char encoding = 0; - rtx rtl, symbol; - - rtl = DECL_P (decl) ? DECL_RTL (decl) : TREE_CST_RTL (decl); - - /* Careful not to prod global register variables. */ - if (GET_CODE (rtl) != MEM) - return; - symbol = XEXP (rtl, 0); - if (GET_CODE (symbol) != SYMBOL_REF) - return; - - if (TREE_CODE (decl) == FUNCTION_DECL) - { - /* We mark public functions once they are emitted; otherwise we - don't know that they exist in this unit of translation. */ - if (TREE_PUBLIC (decl)) - return; - - /* Do not mark functions that are not in .text; otherwise we - don't know that they are near enough for a direct branch. */ - if (! decl_in_text_section (decl)) - return; - - SYMBOL_REF_FLAG (symbol) = 1; - return; - } - - /* Early out if we're not going to do anything with this data. */ - if (! TARGET_EXPLICIT_RELOCS) - return; - - symbol_str = XSTR (symbol, 0); - - /* A variable is considered "local" if it is defined in this module. */ - is_local = (*targetm.binds_local_p) (decl); - - /* Care for TLS variables. */ - if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) - { - switch (decl_tls_model (decl)) - { - case TLS_MODEL_GLOBAL_DYNAMIC: - encoding = 'G'; - break; - case TLS_MODEL_LOCAL_DYNAMIC: - encoding = 'D'; - break; - case TLS_MODEL_INITIAL_EXEC: - case TLS_MODEL_LOCAL_EXEC: - encoding = 'T'; - break; - } - } - else if (is_local) - { - /* Determine if DECL will wind up in .sdata/.sbss. */ - if (alpha_in_small_data_p (decl)) - encoding = 'S'; - else - encoding = 'L'; - } - - /* Finally, encode this into the symbol string. */ - if (encoding) - { - char *newstr; - size_t len; - char want_prefix = (is_local ? '@' : '%'); - char other_prefix = (is_local ? '%' : '@'); - - if (symbol_str[0] == want_prefix) - { - if (symbol_str[1] == encoding) - return; - symbol_str += 2; - } - else if (symbol_str[0] == other_prefix) - symbol_str += 2; - - len = strlen (symbol_str) + 1; - newstr = alloca (len + 2); - - newstr[0] = want_prefix; - newstr[1] = encoding; - memcpy (newstr + 2, symbol_str, len); - - XSTR (symbol, 0) = ggc_alloc_string (newstr, len + 2 - 1); - } -} - -/* Undo the effects of the above. */ - -static const char * -alpha_strip_name_encoding (str) - const char *str; -{ - if (str[0] == '@' || str[0] == '%') - str += 2; - if (str[0] == '*') - str++; - return str; -} - #if TARGET_ABI_OPEN_VMS static bool -alpha_linkage_symbol_p (symname) - const char *symname; +alpha_linkage_symbol_p (const char *symname) { int symlen = strlen (symname); @@ -1988,10 +1650,7 @@ alpha_linkage_symbol_p (symname) low-order three bits; this is an "unaligned" access. */ bool -alpha_legitimate_address_p (mode, x, strict) - enum machine_mode mode; - rtx x; - int strict; +alpha_legitimate_address_p (enum machine_mode mode, rtx x, int strict) { /* If this is an ldq_u type address, discard the outer AND. */ if (mode == DImode @@ -2087,14 +1746,24 @@ alpha_legitimate_address_p (mode, x, strict) return false; } +/* Build the SYMBOL_REF for __tls_get_addr. */ + +static GTY(()) rtx tls_get_addr_libfunc; + +static rtx +get_tls_get_addr (void) +{ + if (!tls_get_addr_libfunc) + tls_get_addr_libfunc = init_one_libfunc ("__tls_get_addr"); + return tls_get_addr_libfunc; +} + /* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. */ rtx -alpha_legitimize_address (x, scratch, mode) - rtx x; - rtx scratch; - enum machine_mode mode ATTRIBUTE_UNUSED; +alpha_legitimize_address (rtx x, rtx scratch, + enum machine_mode mode ATTRIBUTE_UNUSED) { HOST_WIDE_INT addend; @@ -2154,7 +1823,7 @@ alpha_legitimize_address (x, scratch, mode) r0 = gen_rtx_REG (Pmode, 0); r16 = gen_rtx_REG (Pmode, 16); - tga = gen_rtx_SYMBOL_REF (Pmode, "__tls_get_addr"); + tga = get_tls_get_addr (); dest = gen_reg_rtx (Pmode); seq = GEN_INT (alpha_next_sequence_number++); @@ -2175,7 +1844,7 @@ alpha_legitimize_address (x, scratch, mode) r0 = gen_rtx_REG (Pmode, 0); r16 = gen_rtx_REG (Pmode, 16); - tga = gen_rtx_SYMBOL_REF (Pmode, "__tls_get_addr"); + tga = get_tls_get_addr (); scratch = gen_reg_rtx (Pmode); seq = GEN_INT (alpha_next_sequence_number++); @@ -2278,23 +1947,30 @@ alpha_legitimize_address (x, scratch, mode) } } +/* We do not allow indirect calls to be optimized into sibling calls, nor + can we allow a call to a function with a different GP to be optimized + into a sibcall. */ + +static bool +alpha_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) +{ + /* Can't do indirect tail calls, since we don't know if the target + uses the same GP. */ + if (!decl) + return false; + + /* Otherwise, we can make a tail call if the target function shares + the same GP. */ + return decl_has_samegp (decl); +} + /* For TARGET_EXPLICIT_RELOCS, we don't obfuscate a SYMBOL_REF to a small symbolic operand until after reload. At which point we need to replace (mem (symbol_ref)) with (mem (lo_sum $29 symbol_ref)) so that sched2 has the proper dependency information. */ -int -some_small_symbolic_operand (x, mode) - rtx x; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return for_each_rtx (&x, some_small_symbolic_operand_1, NULL); -} - static int -some_small_symbolic_operand_1 (px, data) - rtx *px; - void *data ATTRIBUTE_UNUSED; +some_small_symbolic_operand_1 (rtx *px, void *data ATTRIBUTE_UNUSED) { rtx x = *px; @@ -2305,19 +1981,14 @@ some_small_symbolic_operand_1 (px, data) return small_symbolic_operand (x, Pmode) != 0; } -rtx -split_small_symbolic_operand (x) - rtx x; +int +some_small_symbolic_operand (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED) { - x = copy_insn (x); - for_each_rtx (&x, split_small_symbolic_operand_1, NULL); - return x; + return for_each_rtx (&x, some_small_symbolic_operand_1, NULL); } static int -split_small_symbolic_operand_1 (px, data) - rtx *px; - void *data ATTRIBUTE_UNUSED; +split_small_symbolic_operand_1 (rtx *px, void *data ATTRIBUTE_UNUSED) { rtx x = *px; @@ -2335,16 +2006,48 @@ split_small_symbolic_operand_1 (px, data) return 0; } +rtx +split_small_symbolic_operand (rtx x) +{ + x = copy_insn (x); + for_each_rtx (&x, split_small_symbolic_operand_1, NULL); + return x; +} + +/* Indicate that INSN cannot be duplicated. This is true for any insn + that we've marked with gpdisp relocs, since those have to stay in + 1-1 correspondence with one another. + + Technically we could copy them if we could set up a mapping from one + sequence number to another, across the set of insns to be duplicated. + This seems overly complicated and error-prone since interblock motion + from sched-ebb could move one of the pair of insns to a different block. + + Also cannot allow jsr insns to be duplicated. If they throw exceptions, + then they'll be in a different block from their ldgp. Which could lead + the bb reorder code to think that it would be ok to copy just the block + containing the call and branch to the block containing the ldgp. */ + +static bool +alpha_cannot_copy_insn_p (rtx insn) +{ + if (!reload_completed || !TARGET_EXPLICIT_RELOCS) + return false; + if (recog_memoized (insn) >= 0) + return get_attr_cannot_copy (insn); + else + return false; +} + + /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and return the new rtx. */ rtx -alpha_legitimize_reload_address (x, mode, opnum, type, ind_levels) - rtx x; - enum machine_mode mode ATTRIBUTE_UNUSED; - int opnum; - int type; - int ind_levels ATTRIBUTE_UNUSED; +alpha_legitimize_reload_address (rtx x, + enum machine_mode mode ATTRIBUTE_UNUSED, + int opnum, int type, + int ind_levels ATTRIBUTE_UNUSED) { /* We must recognize output that we have already generated ourselves. */ if (GET_CODE (x) == PLUS @@ -2393,15 +2096,154 @@ alpha_legitimize_reload_address (x, mode, opnum, type, ind_levels) return NULL_RTX; } +/* Compute a (partial) cost for rtx X. Return true if the complete + cost has been computed, and false if subexpressions should be + scanned. In either case, *TOTAL contains the cost result. */ + +static bool +alpha_rtx_costs (rtx x, int code, int outer_code, int *total) +{ + enum machine_mode mode = GET_MODE (x); + bool float_mode_p = FLOAT_MODE_P (mode); + + switch (code) + { + /* If this is an 8-bit constant, return zero since it can be used + nearly anywhere with no cost. If it is a valid operand for an + ADD or AND, likewise return 0 if we know it will be used in that + context. Otherwise, return 2 since it might be used there later. + All other constants take at least two insns. */ + case CONST_INT: + if (INTVAL (x) >= 0 && INTVAL (x) < 256) + { + *total = 0; + return true; + } + /* FALLTHRU */ + + case CONST_DOUBLE: + if (x == CONST0_RTX (mode)) + *total = 0; + else if ((outer_code == PLUS && add_operand (x, VOIDmode)) + || (outer_code == AND && and_operand (x, VOIDmode))) + *total = 0; + else if (add_operand (x, VOIDmode) || and_operand (x, VOIDmode)) + *total = 2; + else + *total = COSTS_N_INSNS (2); + return true; + + case CONST: + case SYMBOL_REF: + case LABEL_REF: + if (TARGET_EXPLICIT_RELOCS && small_symbolic_operand (x, VOIDmode)) + *total = COSTS_N_INSNS (outer_code != MEM); + else if (TARGET_EXPLICIT_RELOCS && local_symbolic_operand (x, VOIDmode)) + *total = COSTS_N_INSNS (1 + (outer_code != MEM)); + else if (tls_symbolic_operand_type (x)) + /* Estimate of cost for call_pal rduniq. */ + *total = COSTS_N_INSNS (15); + else + /* Otherwise we do a load from the GOT. */ + *total = COSTS_N_INSNS (alpha_memory_latency); + return true; + + case PLUS: + case MINUS: + if (float_mode_p) + *total = alpha_rtx_cost_data[alpha_cpu].fp_add; + else if (GET_CODE (XEXP (x, 0)) == MULT + && const48_operand (XEXP (XEXP (x, 0), 1), VOIDmode)) + { + *total = (rtx_cost (XEXP (XEXP (x, 0), 0), outer_code) + + rtx_cost (XEXP (x, 1), outer_code) + 2); + return true; + } + return false; + + case MULT: + if (float_mode_p) + *total = alpha_rtx_cost_data[alpha_cpu].fp_mult; + else if (mode == DImode) + *total = alpha_rtx_cost_data[alpha_cpu].int_mult_di; + else + *total = alpha_rtx_cost_data[alpha_cpu].int_mult_si; + return false; + + case ASHIFT: + if (GET_CODE (XEXP (x, 1)) == CONST_INT + && INTVAL (XEXP (x, 1)) <= 3) + { + *total = COSTS_N_INSNS (1); + return false; + } + /* FALLTHRU */ + + case ASHIFTRT: + case LSHIFTRT: + *total = alpha_rtx_cost_data[alpha_cpu].int_shift; + return false; + + case IF_THEN_ELSE: + if (float_mode_p) + *total = alpha_rtx_cost_data[alpha_cpu].fp_add; + else + *total = alpha_rtx_cost_data[alpha_cpu].int_cmov; + return false; + + case DIV: + case UDIV: + case MOD: + case UMOD: + if (!float_mode_p) + *total = COSTS_N_INSNS (70); /* ??? */ + else if (mode == SFmode) + *total = alpha_rtx_cost_data[alpha_cpu].fp_div_sf; + else + *total = alpha_rtx_cost_data[alpha_cpu].fp_div_df; + return false; + + case MEM: + *total = COSTS_N_INSNS (alpha_memory_latency); + return true; + + case NEG: + if (! float_mode_p) + { + *total = COSTS_N_INSNS (1); + return false; + } + /* FALLTHRU */ + + case ABS: + if (! float_mode_p) + { + *total = COSTS_N_INSNS (1) + alpha_rtx_cost_data[alpha_cpu].int_cmov; + return false; + } + /* FALLTHRU */ + + case FLOAT: + case UNSIGNED_FLOAT: + case FIX: + case UNSIGNED_FIX: + case FLOAT_EXTEND: + case FLOAT_TRUNCATE: + *total = alpha_rtx_cost_data[alpha_cpu].fp_add; + return false; + + default: + return false; + } +} + /* REF is an alignable memory location. Place an aligned SImode reference into *PALIGNED_MEM and the number of bits to shift into *PBITNUM. SCRATCH is a free register for use in reloading out of range stack slots. */ void -get_aligned_mem (ref, paligned_mem, pbitnum) - rtx ref; - rtx *paligned_mem, *pbitnum; +get_aligned_mem (rtx ref, rtx *paligned_mem, rtx *pbitnum) { rtx base; HOST_WIDE_INT offset = 0; @@ -2439,9 +2281,7 @@ get_aligned_mem (ref, paligned_mem, pbitnum) Add EXTRA_OFFSET to the address we return. */ rtx -get_unaligned_address (ref, extra_offset) - rtx ref; - int extra_offset; +get_unaligned_address (rtx ref, int extra_offset) { rtx base; HOST_WIDE_INT offset = 0; @@ -2474,9 +2314,7 @@ get_unaligned_address (ref, extra_offset) symbolic constants cannot be dropped to memory. */ enum reg_class -alpha_preferred_reload_class(x, class) - rtx x; - enum reg_class class; +alpha_preferred_reload_class(rtx x, enum reg_class class) { /* Zero is present in any register class. */ if (x == CONST0_RTX (GET_MODE (x))) @@ -2513,11 +2351,8 @@ alpha_preferred_reload_class(x, class) from register elimination into a DImode fp register. */ enum reg_class -secondary_reload_class (class, mode, x, in) - enum reg_class class; - enum machine_mode mode; - rtx x; - int in; +secondary_reload_class (enum reg_class class, enum machine_mode mode, + rtx x, int in) { if ((mode == QImode || mode == HImode) && ! TARGET_BWX) { @@ -2555,9 +2390,7 @@ secondary_reload_class (class, mode, x, in) found in part of X. */ static void -alpha_set_memflags_1 (x, in_struct_p, volatile_p, unchanging_p) - rtx x; - int in_struct_p, volatile_p, unchanging_p; +alpha_set_memflags_1 (rtx x, int in_struct_p, int volatile_p, int unchanging_p) { int i; @@ -2607,9 +2440,7 @@ alpha_set_memflags_1 (x, in_struct_p, volatile_p, unchanging_p) a MEM, don't do anything. */ void -alpha_set_memflags (insn, ref) - rtx insn; - rtx ref; +alpha_set_memflags (rtx insn, rtx ref) { int in_struct_p, volatile_p, unchanging_p; @@ -2629,62 +2460,11 @@ alpha_set_memflags (insn, ref) alpha_set_memflags_1 (insn, in_struct_p, volatile_p, unchanging_p); } -/* Try to output insns to set TARGET equal to the constant C if it can be - done in less than N insns. Do all computations in MODE. Returns the place - where the output has been placed if it can be done and the insns have been - emitted. If it would take more than N insns, zero is returned and no - insns and emitted. */ - -rtx -alpha_emit_set_const (target, mode, c, n) - rtx target; - enum machine_mode mode; - HOST_WIDE_INT c; - int n; -{ - rtx result = 0; - rtx orig_target = target; - int i; - - /* If we can't make any pseudos, TARGET is an SImode hard register, we - can't load this constant in one insn, do this in DImode. */ - if (no_new_pseudos && mode == SImode - && GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER - && (result = alpha_emit_set_const_1 (target, mode, c, 1)) == 0) - { - target = gen_lowpart (DImode, target); - mode = DImode; - } - - /* Try 1 insn, then 2, then up to N. */ - for (i = 1; i <= n; i++) - { - result = alpha_emit_set_const_1 (target, mode, c, i); - if (result) - { - rtx insn = get_last_insn (); - rtx set = single_set (insn); - if (! CONSTANT_P (SET_SRC (set))) - set_unique_reg_note (get_last_insn (), REG_EQUAL, GEN_INT (c)); - break; - } - } - - /* Allow for the case where we changed the mode of TARGET. */ - if (result == target) - result = orig_target; - - return result; -} - -/* Internal routine for the above to check for N or below insns. */ +/* Internal routine for alpha_emit_set_const to check for N or below insns. */ static rtx -alpha_emit_set_const_1 (target, mode, c, n) - rtx target; - enum machine_mode mode; - HOST_WIDE_INT c; - int n; +alpha_emit_set_const_1 (rtx target, enum machine_mode mode, + HOST_WIDE_INT c, int n) { HOST_WIDE_INT new; int i, bits; @@ -2730,7 +2510,14 @@ alpha_emit_set_const_1 (target, mode, c, n) } else if (n >= 2 + (extra != 0)) { - temp = copy_to_suggested_reg (GEN_INT (high << 16), subtarget, mode); + if (no_new_pseudos) + { + emit_insn (gen_rtx_SET (VOIDmode, target, GEN_INT (high << 16))); + temp = target; + } + else + temp = copy_to_suggested_reg (GEN_INT (high << 16), + subtarget, mode); /* As of 2002-02-23, addsi3 is only available when not optimizing. This means that if we go through expand_binop, we'll try to @@ -2866,15 +2653,58 @@ alpha_emit_set_const_1 (target, mode, c, n) return 0; } +/* Try to output insns to set TARGET equal to the constant C if it can be + done in less than N insns. Do all computations in MODE. Returns the place + where the output has been placed if it can be done and the insns have been + emitted. If it would take more than N insns, zero is returned and no + insns and emitted. */ + +rtx +alpha_emit_set_const (rtx target, enum machine_mode mode, + HOST_WIDE_INT c, int n) +{ + rtx result = 0; + rtx orig_target = target; + int i; + + /* If we can't make any pseudos, TARGET is an SImode hard register, we + can't load this constant in one insn, do this in DImode. */ + if (no_new_pseudos && mode == SImode + && GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER + && (result = alpha_emit_set_const_1 (target, mode, c, 1)) == 0) + { + target = gen_lowpart (DImode, target); + mode = DImode; + } + + /* Try 1 insn, then 2, then up to N. */ + for (i = 1; i <= n; i++) + { + result = alpha_emit_set_const_1 (target, mode, c, i); + if (result) + { + rtx insn = get_last_insn (); + rtx set = single_set (insn); + if (! CONSTANT_P (SET_SRC (set))) + set_unique_reg_note (get_last_insn (), REG_EQUAL, GEN_INT (c)); + break; + } + } + + /* Allow for the case where we changed the mode of TARGET. */ + if (result == target) + result = orig_target; + + return result; +} + /* Having failed to find a 3 insn sequence in alpha_emit_set_const, fall back to a straight forward decomposition. We do this to avoid exponential run times encountered when looking for longer sequences with alpha_emit_set_const. */ rtx -alpha_emit_set_long_const (target, c1, c2) - rtx target; - HOST_WIDE_INT c1, c2; +alpha_emit_set_long_const (rtx target, HOST_WIDE_INT c1, HOST_WIDE_INT c2) { HOST_WIDE_INT d1, d2, d3, d4; @@ -2931,9 +2761,7 @@ alpha_emit_set_long_const (target, c1, c2) We don't handle non-bwx subword loads here. */ bool -alpha_expand_mov (mode, operands) - enum machine_mode mode; - rtx *operands; +alpha_expand_mov (enum machine_mode mode, rtx *operands) { /* If the output is not a register, the input must be. */ if (GET_CODE (operands[0]) == MEM @@ -2949,8 +2777,12 @@ alpha_expand_mov (mode, operands) compiled at the end of compilation. In the meantime, someone can re-encode-section-info on some symbol changing it e.g. from global to local-not-small. If this happens, we'd have emitted a plain - load rather than a high+losum load and not recognize the insn. */ - if (TARGET_EXPLICIT_RELOCS + load rather than a high+losum load and not recognize the insn. + + So if rtl inlining is in effect, we delay the global/not-global + decision until rest_of_compilation by wrapping it in an + UNSPEC_SYMBOL. */ + if (TARGET_EXPLICIT_RELOCS && flag_inline_functions && rtx_equal_function_value_matters && global_symbolic_operand (operands[1], mode)) { @@ -3027,9 +2859,7 @@ alpha_expand_mov (mode, operands) return true if all work is done. */ bool -alpha_expand_mov_nobwx (mode, operands) - enum machine_mode mode; - rtx *operands; +alpha_expand_mov_nobwx (enum machine_mode mode, rtx *operands) { /* If the output is not a register, the input must be. */ if (GET_CODE (operands[0]) == MEM) @@ -3062,13 +2892,24 @@ alpha_expand_mov_nobwx (mode, operands) { rtx aligned_mem, bitnum; rtx scratch = gen_reg_rtx (SImode); + rtx subtarget; + bool copyout; get_aligned_mem (operands[1], &aligned_mem, &bitnum); + subtarget = operands[0]; + if (GET_CODE (subtarget) == REG) + subtarget = gen_lowpart (DImode, subtarget), copyout = false; + else + subtarget = gen_reg_rtx (DImode), copyout = true; + emit_insn ((mode == QImode ? gen_aligned_loadqi : gen_aligned_loadhi) - (operands[0], aligned_mem, bitnum, scratch)); + (subtarget, aligned_mem, bitnum, scratch)); + + if (copyout) + emit_move_insn (operands[0], gen_lowpart (mode, subtarget)); } } else @@ -3077,16 +2918,28 @@ alpha_expand_mov_nobwx (mode, operands) code depend on parameter evaluation order which will cause bootstrap failures. */ - rtx temp1 = gen_reg_rtx (DImode); - rtx temp2 = gen_reg_rtx (DImode); - rtx seq = ((mode == QImode - ? gen_unaligned_loadqi - : gen_unaligned_loadhi) - (operands[0], get_unaligned_address (operands[1], 0), - temp1, temp2)); + rtx temp1, temp2, seq, subtarget; + bool copyout; + temp1 = gen_reg_rtx (DImode); + temp2 = gen_reg_rtx (DImode); + + subtarget = operands[0]; + if (GET_CODE (subtarget) == REG) + subtarget = gen_lowpart (DImode, subtarget), copyout = false; + else + subtarget = gen_reg_rtx (DImode), copyout = true; + + seq = ((mode == QImode + ? gen_unaligned_loadqi + : gen_unaligned_loadhi) + (subtarget, get_unaligned_address (operands[1], 0), + temp1, temp2)); alpha_set_memflags (seq, operands[1]); emit_insn (seq); + + if (copyout) + emit_move_insn (operands[0], gen_lowpart (mode, subtarget)); } return true; } @@ -3182,8 +3035,7 @@ alpha_expand_mov_nobwx (mode, operands) much lower minimum execution time. */ void -alpha_emit_floatuns (operands) - rtx operands[2]; +alpha_emit_floatuns (rtx operands[2]) { rtx neglab, donelab, i0, i1, f0, in, out; enum machine_mode mode; @@ -3217,8 +3069,7 @@ alpha_emit_floatuns (operands) /* Generate the comparison for a conditional branch. */ rtx -alpha_emit_conditional_branch (code) - enum rtx_code code; +alpha_emit_conditional_branch (enum rtx_code code) { enum rtx_code cmp_code, branch_code; enum machine_mode cmp_mode, branch_mode = VOIDmode; @@ -3374,8 +3225,7 @@ alpha_emit_conditional_branch (code) valid. Return the final comparison, or NULL if we can't work. */ rtx -alpha_emit_setcc (code) - enum rtx_code code; +alpha_emit_setcc (enum rtx_code code) { enum rtx_code cmp_code; rtx op0 = alpha_compare.op0, op1 = alpha_compare.op1; @@ -3486,10 +3336,9 @@ alpha_emit_setcc (code) If both of the operands that set cc0 are nonzero we must emit an insn to perform the compare (it can't be done within the conditional move). */ + rtx -alpha_emit_conditional_move (cmp, mode) - rtx cmp; - enum machine_mode mode; +alpha_emit_conditional_move (rtx cmp, enum machine_mode mode) { enum rtx_code code = GET_CODE (cmp); enum rtx_code cmov_code = NE; @@ -3624,9 +3473,8 @@ alpha_emit_conditional_move (cmp, mode) cases we wouldn't have before cse. */ int -alpha_split_conditional_move (code, dest, cond, t_rtx, f_rtx) - enum rtx_code code; - rtx dest, cond, t_rtx, f_rtx; +alpha_split_conditional_move (enum rtx_code code, rtx dest, rtx cond, + rtx t_rtx, rtx f_rtx) { HOST_WIDE_INT t, f, diff; enum machine_mode mode; @@ -3659,7 +3507,7 @@ alpha_split_conditional_move (code, dest, cond, t_rtx, f_rtx) be shared. */ if (f == 0 && exact_log2 (diff) > 0 - /* On EV6, we've got enough shifters to make non-arithmatic shifts + /* On EV6, we've got enough shifters to make non-arithmetic shifts viable over a longer latency cmove. On EV5, the E0 slot is a scarce resource, and on EV4 shift has the same latency as a cmove. */ && (diff <= 8 || alpha_cpu == PROCESSOR_EV6)) @@ -3711,8 +3559,7 @@ alpha_split_conditional_move (code, dest, cond, t_rtx, f_rtx) given operation. */ static const char * -alpha_lookup_xfloating_lib_func (code) - enum rtx_code code; +alpha_lookup_xfloating_lib_func (enum rtx_code code) { struct xfloating_op { @@ -3798,9 +3645,8 @@ alpha_lookup_xfloating_lib_func (code) Compute that here. */ static int -alpha_compute_xfloating_mode_arg (code, round) - enum rtx_code code; - enum alpha_fp_rounding_mode round; +alpha_compute_xfloating_mode_arg (enum rtx_code code, + enum alpha_fp_rounding_mode round) { int mode; @@ -3844,12 +3690,8 @@ alpha_compute_xfloating_mode_arg (code, round) */ static void -alpha_emit_xfloating_libcall (func, target, operands, noperands, equiv) - const char *func; - rtx target; - rtx operands[]; - int noperands; - rtx equiv; +alpha_emit_xfloating_libcall (const char *func, rtx target, rtx operands[], + int noperands, rtx equiv) { rtx usage = NULL_RTX, tmp, reg; int regno = 16, i; @@ -3902,7 +3744,7 @@ alpha_emit_xfloating_libcall (func, target, operands, noperands, equiv) abort (); } - tmp = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, (char *) func)); + tmp = gen_rtx_MEM (QImode, init_one_libfunc (func)); tmp = emit_call_insn (GEN_CALL_VALUE (reg, tmp, const0_rtx, const0_rtx, const0_rtx)); CALL_INSN_FUNCTION_USAGE (tmp) = usage; @@ -3916,9 +3758,7 @@ alpha_emit_xfloating_libcall (func, target, operands, noperands, equiv) /* Emit an X_floating library function call for arithmetic (+,-,*,/). */ void -alpha_emit_xfloating_arith (code, operands) - enum rtx_code code; - rtx operands[]; +alpha_emit_xfloating_arith (enum rtx_code code, rtx operands[]) { const char *func; int mode; @@ -3938,9 +3778,7 @@ alpha_emit_xfloating_arith (code, operands) /* Emit an X_floating library function call for a comparison. */ static rtx -alpha_emit_xfloating_compare (code, op0, op1) - enum rtx_code code; - rtx op0, op1; +alpha_emit_xfloating_compare (enum rtx_code code, rtx op0, rtx op1) { const char *func; rtx out, operands[2]; @@ -3962,13 +3800,15 @@ alpha_emit_xfloating_compare (code, op0, op1) /* Emit an X_floating library function call for a conversion. */ void -alpha_emit_xfloating_cvt (code, operands) - enum rtx_code code; - rtx operands[]; +alpha_emit_xfloating_cvt (enum rtx_code orig_code, rtx operands[]) { int noperands = 1, mode; rtx out_operands[2]; const char *func; + enum rtx_code code = orig_code; + + if (code == UNSIGNED_FIX) + code = FIX; func = alpha_lookup_xfloating_lib_func (code); @@ -3991,7 +3831,8 @@ alpha_emit_xfloating_cvt (code, operands) } alpha_emit_xfloating_libcall (func, operands[0], out_operands, noperands, - gen_rtx_fmt_e (code, GET_MODE (operands[0]), + gen_rtx_fmt_e (orig_code, + GET_MODE (operands[0]), operands[1])); } @@ -4000,8 +3841,7 @@ alpha_emit_xfloating_cvt (code, operands) little-endian. */ void -alpha_split_tfmode_pair (operands) - rtx operands[4]; +alpha_split_tfmode_pair (rtx operands[4]) { if (GET_CODE (operands[1]) == REG) { @@ -4037,9 +3877,7 @@ alpha_split_tfmode_pair (operands) logical operation to be performed. */ void -alpha_split_tfmode_frobsign (operands, operation) - rtx operands[3]; - rtx (*operation) PARAMS ((rtx, rtx, rtx)); +alpha_split_tfmode_frobsign (rtx operands[3], rtx (*operation) (rtx, rtx, rtx)) { rtx high_bit = operands[2]; rtx scratch; @@ -4106,10 +3944,8 @@ alpha_split_tfmode_frobsign (operands, operation) */ void -alpha_expand_unaligned_load (tgt, mem, size, ofs, sign) - rtx tgt, mem; - HOST_WIDE_INT size, ofs; - int sign; +alpha_expand_unaligned_load (rtx tgt, rtx mem, HOST_WIDE_INT size, + HOST_WIDE_INT ofs, int sign) { rtx meml, memh, addr, extl, exth, tmp, mema; enum machine_mode mode; @@ -4232,9 +4068,8 @@ alpha_expand_unaligned_load (tgt, mem, size, ofs, sign) /* Similarly, use ins and msk instructions to perform unaligned stores. */ void -alpha_expand_unaligned_store (dst, src, size, ofs) - rtx dst, src; - HOST_WIDE_INT size, ofs; +alpha_expand_unaligned_store (rtx dst, rtx src, + HOST_WIDE_INT size, HOST_WIDE_INT ofs) { rtx dstl, dsth, addr, insl, insh, meml, memh, dsta; @@ -4377,10 +4212,8 @@ alpha_expand_unaligned_store (dst, src, size, ofs) /* Load an integral number of consecutive unaligned quadwords. */ static void -alpha_expand_unaligned_load_words (out_regs, smem, words, ofs) - rtx *out_regs; - rtx smem; - HOST_WIDE_INT words, ofs; +alpha_expand_unaligned_load_words (rtx *out_regs, rtx smem, + HOST_WIDE_INT words, HOST_WIDE_INT ofs) { rtx const im8 = GEN_INT (-8); rtx const i64 = GEN_INT (64); @@ -4461,10 +4294,8 @@ alpha_expand_unaligned_load_words (out_regs, smem, words, ofs) may be NULL to store zeros. */ static void -alpha_expand_unaligned_store_words (data_regs, dmem, words, ofs) - rtx *data_regs; - rtx dmem; - HOST_WIDE_INT words, ofs; +alpha_expand_unaligned_store_words (rtx *data_regs, rtx dmem, + HOST_WIDE_INT words, HOST_WIDE_INT ofs) { rtx const im8 = GEN_INT (-8); rtx const i64 = GEN_INT (64); @@ -4578,8 +4409,7 @@ alpha_expand_unaligned_store_words (data_regs, dmem, words, ofs) operands[3] is the alignment. */ int -alpha_expand_block_move (operands) - rtx operands[]; +alpha_expand_block_move (rtx operands[]) { rtx bytes_rtx = operands[2]; rtx align_rtx = operands[3]; @@ -4653,7 +4483,8 @@ alpha_expand_block_move (operands) is held in the register. Nor if there is not a mode that handles the exact size. */ mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 1); - if (mode != BLKmode + if (GET_CODE (tmp) == REG + && mode != BLKmode && GET_MODE_SIZE (GET_MODE (tmp)) >= bytes) { if (mode == TImode) @@ -4773,7 +4604,7 @@ alpha_expand_block_move (operands) tmp = XEXP (XEXP (orig_dst, 0), 0); mode = mode_for_size (orig_bytes * BITS_PER_UNIT, MODE_INT, 1); - if (GET_MODE (tmp) == mode) + if (GET_CODE (tmp) == REG && GET_MODE (tmp) == mode) { if (nregs == 1) { @@ -4915,8 +4746,7 @@ alpha_expand_block_move (operands) } int -alpha_expand_block_clear (operands) - rtx operands[]; +alpha_expand_block_clear (rtx operands[]) { rtx bytes_rtx = operands[1]; rtx align_rtx = operands[2]; @@ -5206,8 +5036,7 @@ alpha_expand_block_clear (operands) /* Returns a mask so that zap(x, value) == x & mask. */ rtx -alpha_expand_zap_mask (value) - HOST_WIDE_INT value; +alpha_expand_zap_mask (HOST_WIDE_INT value) { rtx result; int i; @@ -5252,10 +5081,9 @@ alpha_expand_zap_mask (value) } void -alpha_expand_builtin_vector_binop (gen, mode, op0, op1, op2) - rtx (*gen) PARAMS ((rtx, rtx, rtx)); - enum machine_mode mode; - rtx op0, op1, op2; +alpha_expand_builtin_vector_binop (rtx (*gen) (rtx, rtx, rtx), + enum machine_mode mode, + rtx op0, rtx op1, rtx op2) { op0 = gen_lowpart (mode, op0); @@ -5276,11 +5104,7 @@ alpha_expand_builtin_vector_binop (gen, mode, op0, op1, op2) a dependency LINK or INSN on DEP_INSN. COST is the current cost. */ static int -alpha_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn; - int cost; +alpha_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost) { enum attr_type insn_type, dep_insn_type; @@ -5311,13 +5135,13 @@ alpha_adjust_cost (insn, link, dep_insn, cost) /* The number of instructions that can be issued per cycle. */ static int -alpha_issue_rate () +alpha_issue_rate (void) { return (alpha_cpu == PROCESSOR_EV4 ? 2 : 4); } static int -alpha_use_dfa_pipeline_interface () +alpha_use_dfa_pipeline_interface (void) { return true; } @@ -5328,10 +5152,10 @@ alpha_use_dfa_pipeline_interface () For EV4, loads can be issued to either IB0 or IB1, thus we have 2 alternative schedules. For EV5, we can choose between E0/E1 and - FA/FM. For EV6, an arithmatic insn can be issued to U0/U1/L0/L1. */ + FA/FM. For EV6, an arithmetic insn can be issued to U0/U1/L0/L1. */ static int -alpha_multipass_dfa_lookahead () +alpha_multipass_dfa_lookahead (void) { return (alpha_cpu == PROCESSOR_EV6 ? 4 : 2); } @@ -5340,7 +5164,7 @@ alpha_multipass_dfa_lookahead () struct machine_function GTY(()) { - /* For unicosmk. */ + /* For unicosmk. */ /* List of call information words for calls from this function. */ struct rtx_def *first_ciw; struct rtx_def *last_ciw; @@ -5349,14 +5173,14 @@ struct machine_function GTY(()) /* List of deferred case vectors. */ struct rtx_def *addr_list; - /* For OSF. */ + /* For OSF. */ const char *some_ld_name; }; /* How to allocate a 'struct machine_function'. */ static struct machine_function * -alpha_init_machine_status () +alpha_init_machine_status (void) { return ((struct machine_function *) ggc_alloc_cleared (sizeof (struct machine_function))); @@ -5367,9 +5191,7 @@ alpha_init_machine_status () /* Start the ball rolling with RETURN_ADDR_RTX. */ rtx -alpha_return_addr (count, frame) - int count; - rtx frame ATTRIBUTE_UNUSED; +alpha_return_addr (int count, rtx frame ATTRIBUTE_UNUSED) { if (count != 0) return const0_rtx; @@ -5381,7 +5203,7 @@ alpha_return_addr (count, frame) function. Needed only if TARGET_LD_BUGGY_LDGP. */ rtx -alpha_gp_save_rtx () +alpha_gp_save_rtx (void) { rtx r = get_hard_reg_initial_val (DImode, 29); if (GET_CODE (r) != MEM) @@ -5390,7 +5212,7 @@ alpha_gp_save_rtx () } static int -alpha_ra_ever_killed () +alpha_ra_ever_killed (void) { rtx top; @@ -5409,7 +5231,7 @@ alpha_ra_ever_killed () instruction, or NULL. */ static const char * -get_trap_mode_suffix () +get_trap_mode_suffix (void) { enum attr_trap_suffix s = get_attr_trap_suffix (current_output_insn); @@ -5476,7 +5298,7 @@ get_trap_mode_suffix () instruction, or NULL. */ static const char * -get_round_mode_suffix () +get_round_mode_suffix (void) { enum attr_round_suffix s = get_attr_round_suffix (current_output_insn); @@ -5507,8 +5329,23 @@ get_round_mode_suffix () /* Locate some local-dynamic symbol still in use by this function so that we can print its name in some movdi_er_tlsldm pattern. */ +static int +get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED) +{ + rtx x = *px; + + if (GET_CODE (x) == SYMBOL_REF + && SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC) + { + cfun->machine->some_ld_name = XSTR (x, 0); + return 1; + } + + return 0; +} + static const char * -get_some_local_dynamic_name () +get_some_local_dynamic_name (void) { rtx insn; @@ -5523,33 +5360,10 @@ get_some_local_dynamic_name () abort (); } -static int -get_some_local_dynamic_name_1 (px, data) - rtx *px; - void *data ATTRIBUTE_UNUSED; -{ - rtx x = *px; - - if (GET_CODE (x) == SYMBOL_REF) - { - const char *str = XSTR (x, 0); - if (str[0] == '@' && str[1] == 'D') - { - cfun->machine->some_ld_name = str; - return 1; - } - } - - return 0; -} - /* Print an operand. Recognize special options, documented below. */ void -print_operand (file, x, code) - FILE *file; - rtx x; - int code; +print_operand (FILE *file, rtx x, int code) { int i; @@ -5585,6 +5399,13 @@ print_operand (file, x, code) fputc ((TARGET_FLOAT_VAX ? 'g' : 't'), file); break; + case '+': + /* Generates a nop after a noreturn call at the very end of the + function. */ + if (next_real_insn (current_output_insn) == 0) + fprintf (file, "\n\tnop"); + break; + case '#': if (alpha_this_literal_sequence_number == 0) alpha_this_literal_sequence_number = alpha_next_sequence_number++; @@ -5894,9 +5715,7 @@ print_operand (file, x, code) } void -print_operand_address (file, addr) - FILE *file; - rtx addr; +print_operand_address (FILE *file, rtx addr) { int basereg = 31; HOST_WIDE_INT offset = 0; @@ -5944,10 +5763,7 @@ print_operand_address (file, addr) } if (offset) - { - fputc ('+', file); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, offset); - } + fprintf (file, "+" HOST_WIDE_INT_PRINT_DEC, offset); addr = XEXP (addr, 0); if (GET_CODE (addr) == REG) @@ -5981,7 +5797,7 @@ print_operand_address (file, addr) && GET_CODE (XEXP (addr, 0)) == PLUS && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF) { - fprintf (file, "%s+%d", + fprintf (file, "%s+" HOST_WIDE_INT_PRINT_DEC, XSTR (XEXP (XEXP (addr, 0), 0), 0), INTVAL (XEXP (XEXP (addr, 0), 1))); return; @@ -5991,8 +5807,7 @@ print_operand_address (file, addr) else abort (); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, offset); - fprintf (file, "($%d)", basereg); + fprintf (file, HOST_WIDE_INT_PRINT_DEC "($%d)", offset, basereg); } /* Emit RTL insns to initialize the variable parts of a trampoline at @@ -6009,9 +5824,8 @@ print_operand_address (file, addr) Note that the hint field is PC (new) + 4 * bits 13:0. */ void -alpha_initialize_trampoline (tramp, fnaddr, cxt, fnofs, cxtofs, jmpofs) - rtx tramp, fnaddr, cxt; - int fnofs, cxtofs, jmpofs; +alpha_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt, + int fnofs, int cxtofs, int jmpofs) { rtx temp, temp1, addr; /* VMS really uses DImode pointers in memory at this point. */ @@ -6050,8 +5864,8 @@ alpha_initialize_trampoline (tramp, fnaddr, cxt, fnofs, cxtofs, jmpofs) emit_move_insn (gen_rtx_MEM (SImode, addr), temp1); } -#ifdef TRANSFER_FROM_TRAMPOLINE - emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), +#ifdef ENABLE_EXECUTE_STACK + emit_library_call (init_one_libfunc ("__enable_execute_stack"), 0, VOIDmode, 1, tramp, Pmode); #endif @@ -6076,23 +5890,31 @@ alpha_initialize_trampoline (tramp, fnaddr, cxt, fnofs, cxtofs, jmpofs) and the rest are pushed. */ rtx -function_arg (cum, mode, type, named) - CUMULATIVE_ARGS cum; - enum machine_mode mode; - tree type; - int named ATTRIBUTE_UNUSED; +function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type, + int named ATTRIBUTE_UNUSED) { int basereg; int num_args; - /* Set up defaults for FP operands passed in FP registers, and - integral operands passed in integer registers. */ - if (TARGET_FPREGS - && (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT - || GET_MODE_CLASS (mode) == MODE_FLOAT)) - basereg = 32 + 16; - else + /* Don't get confused and pass small structures in FP registers. */ + if (type && AGGREGATE_TYPE_P (type)) basereg = 16; + else + { +#ifdef ENABLE_CHECKING + /* With alpha_split_complex_arg, we shouldn't see any raw complex + values here. */ + if (COMPLEX_MODE_P (mode)) + abort (); +#endif + + /* Set up defaults for FP operands passed in FP registers, and + integral operands passed in integer registers. */ + if (TARGET_FPREGS && GET_MODE_CLASS (mode) == MODE_FLOAT) + basereg = 32 + 16; + else + basereg = 16; + } /* ??? Irritatingly, the definition of CUMULATIVE_ARGS is different for the three platforms, so we can't avoid conditional compilation. */ @@ -6105,8 +5927,7 @@ function_arg (cum, mode, type, named) if (num_args >= 6 || MUST_PASS_IN_STACK (mode, type)) return NULL_RTX; } -#else -#if TARGET_ABI_UNICOSMK +#elif TARGET_ABI_UNICOSMK { int size; @@ -6170,7 +5991,7 @@ function_arg (cum, mode, type, named) } } } -#else +#elif TARGET_ABI_OSF { if (cum >= 6) return NULL_RTX; @@ -6184,16 +6005,133 @@ function_arg (cum, mode, type, named) else if (FUNCTION_ARG_PASS_BY_REFERENCE (cum, mode, type, named)) basereg = 16; } -#endif /* TARGET_ABI_UNICOSMK */ -#endif /* TARGET_ABI_OPEN_VMS */ +#else +#error Unhandled ABI +#endif return gen_rtx_REG (mode, num_args + basereg); } -tree -alpha_build_va_list () +/* Return true if TYPE must be returned in memory, instead of in registers. */ + +static bool +alpha_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED) { - tree base, ofs, record, type_decl; + enum machine_mode mode = VOIDmode; + int size; + + if (type) + { + mode = TYPE_MODE (type); + + /* All aggregates are returned in memory. */ + if (AGGREGATE_TYPE_P (type)) + return true; + } + + size = GET_MODE_SIZE (mode); + switch (GET_MODE_CLASS (mode)) + { + case MODE_VECTOR_FLOAT: + /* Pass all float vectors in memory, like an aggregate. */ + return true; + + case MODE_COMPLEX_FLOAT: + /* We judge complex floats on the size of their element, + not the size of the whole type. */ + size = GET_MODE_UNIT_SIZE (mode); + break; + + case MODE_INT: + case MODE_FLOAT: + case MODE_COMPLEX_INT: + case MODE_VECTOR_INT: + break; + + default: + /* ??? We get called on all sorts of random stuff from + aggregate_value_p. We can't abort, but it's not clear + what's safe to return. Pretend it's a struct I guess. */ + return true; + } + + /* Otherwise types must fit in one register. */ + return size > UNITS_PER_WORD; +} + +/* Define how to find the value returned by a function. VALTYPE is the + data type of the value (as a tree). If the precise function being + called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. + MODE is set instead of VALTYPE for libcalls. + + On Alpha the value is found in $0 for integer functions and + $f0 for floating-point functions. */ + +rtx +function_value (tree valtype, tree func ATTRIBUTE_UNUSED, + enum machine_mode mode) +{ + unsigned int regnum; + enum mode_class class; + +#ifdef ENABLE_CHECKING + if (valtype && alpha_return_in_memory (valtype, func)) + abort (); +#endif + + if (valtype) + mode = TYPE_MODE (valtype); + + class = GET_MODE_CLASS (mode); + switch (class) + { + case MODE_INT: + /* Do the same thing as PROMOTE_MODE. */ + mode = DImode; + /* FALLTHRU */ + + case MODE_COMPLEX_INT: + case MODE_VECTOR_INT: + regnum = 0; + break; + + case MODE_FLOAT: + regnum = 32; + break; + + case MODE_COMPLEX_FLOAT: + { + enum machine_mode cmode = GET_MODE_INNER (mode); + + return gen_rtx_PARALLEL + (VOIDmode, + gen_rtvec (2, + gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (cmode, 32), + GEN_INT (0)), + gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (cmode, 33), + GEN_INT (GET_MODE_SIZE (cmode))))); + } + + default: + abort (); + } + + return gen_rtx_REG (mode, regnum); +} + +/* TCmode complex values are passed by invisible reference. We + should not split these values. */ + +static bool +alpha_split_complex_arg (tree type) +{ + return TYPE_MODE (type) != TCmode; +} + +static tree +alpha_build_builtin_va_list (void) +{ + tree base, ofs, space, record, type_decl; if (TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK) return ptr_type_node; @@ -6205,9 +6143,16 @@ alpha_build_va_list () /* C++? SET_IS_AGGR_TYPE (record, 1); */ + /* Dummy field to prevent alignment warnings. */ + space = build_decl (FIELD_DECL, NULL_TREE, integer_type_node); + DECL_FIELD_CONTEXT (space) = record; + DECL_ARTIFICIAL (space) = 1; + DECL_IGNORED_P (space) = 1; + ofs = build_decl (FIELD_DECL, get_identifier ("__offset"), integer_type_node); DECL_FIELD_CONTEXT (ofs) = record; + TREE_CHAIN (ofs) = space; base = build_decl (FIELD_DECL, get_identifier ("__base"), ptr_type_node); @@ -6220,10 +6165,87 @@ alpha_build_va_list () return record; } +/* Perform any needed actions needed for a function that is receiving a + variable number of arguments. */ + +static void +alpha_setup_incoming_varargs (CUMULATIVE_ARGS *pcum, + enum machine_mode mode ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + int *pretend_size, int no_rtl) +{ +#if TARGET_ABI_UNICOSMK + /* On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register + arguments on the stack. Unfortunately, it doesn't always store the first + one (i.e. the one that arrives in $16 or $f16). This is not a problem + with stdargs as we always have at least one named argument there. */ + int num_reg_words = pcum->num_reg_words; + if (num_reg_words < 6) + { + if (!no_rtl) + { + emit_insn (gen_umk_mismatch_args (GEN_INT (num_reg_words + 1))); + emit_insn (gen_arg_home_umk ()); + } + *pretend_size = 0; + } +#elif TARGET_ABI_OPEN_VMS + /* For VMS, we allocate space for all 6 arg registers plus a count. + + However, if NO registers need to be saved, don't allocate any space. + This is not only because we won't need the space, but because AP + includes the current_pretend_args_size and we don't want to mess up + any ap-relative addresses already made. */ + if (pcum->num_args < 6) + { + if (!no_rtl) + { + emit_move_insn (gen_rtx_REG (DImode, 1), virtual_incoming_args_rtx); + emit_insn (gen_arg_home ()); + } + *pretend_size = 7 * UNITS_PER_WORD; + } +#else + /* On OSF/1 and friends, we allocate space for all 12 arg registers, but + only push those that are remaining. However, if NO registers need to + be saved, don't allocate any space. This is not only because we won't + need the space, but because AP includes the current_pretend_args_size + and we don't want to mess up any ap-relative addresses already made. + + If we are not to use the floating-point registers, save the integer + registers where we would put the floating-point registers. This is + not the most efficient way to implement varargs with just one register + class, but it isn't worth doing anything more efficient in this rare + case. */ + CUMULATIVE_ARGS cum = *pcum; + + if (cum >= 6) + return; + + if (!no_rtl) + { + int set = get_varargs_alias_set (); + rtx tmp; + + tmp = gen_rtx_MEM (BLKmode, + plus_constant (virtual_incoming_args_rtx, + (cum + 6) * UNITS_PER_WORD)); + set_mem_alias_set (tmp, set); + move_block_from_reg (16 + cum, tmp, 6 - cum); + + tmp = gen_rtx_MEM (BLKmode, + plus_constant (virtual_incoming_args_rtx, + cum * UNITS_PER_WORD)); + set_mem_alias_set (tmp, set); + move_block_from_reg (16 + (TARGET_FPREGS ? 32 : 0) + cum, tmp, + 6 - cum); + } + *pretend_size = 12 * UNITS_PER_WORD; +#endif +} + void -alpha_va_start (valist, nextarg) - tree valist; - rtx nextarg ATTRIBUTE_UNUSED; +alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) { HOST_WIDE_INT offset; tree t, offset_field, base_field; @@ -6285,8 +6307,7 @@ alpha_va_start (valist, nextarg) } rtx -alpha_va_arg (valist, type) - tree valist, type; +alpha_va_arg (tree valist, tree type) { rtx addr; tree t, type_size, rounded_size; @@ -6339,7 +6360,27 @@ alpha_va_arg (valist, type) indirect = 1; rounded_size = size_int (UNITS_PER_WORD); } - else if (FLOAT_TYPE_P (type)) + else if (TREE_CODE (type) == COMPLEX_TYPE) + { + rtx real_part, imag_part, value, tmp; + + real_part = alpha_va_arg (valist, TREE_TYPE (type)); + imag_part = alpha_va_arg (valist, TREE_TYPE (type)); + + /* ??? Most irritatingly, we're not returning the value here, + but the address. Since real_part and imag_part are not + necessarily contiguous, we must copy to local storage. */ + + real_part = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (type)), real_part); + imag_part = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (type)), imag_part); + value = gen_rtx_CONCAT (TYPE_MODE (type), real_part, imag_part); + + tmp = assign_temp (type, 0, 1, 0); + emit_move_insn (tmp, value); + + return XEXP (tmp, 0); + } + else if (TREE_CODE (type) == REAL_TYPE) { tree fpaddend, cond; @@ -6546,7 +6587,7 @@ static struct alpha_builtin_def const two_arg_builtins[] = { }; static void -alpha_init_builtins () +alpha_init_builtins (void) { const struct alpha_builtin_def *p; tree ftype; @@ -6597,12 +6638,10 @@ alpha_init_builtins () IGNORE is nonzero if the value is to be ignored. */ static rtx -alpha_expand_builtin (exp, target, subtarget, mode, ignore) - tree exp; - rtx target; - rtx subtarget ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; - int ignore ATTRIBUTE_UNUSED; +alpha_expand_builtin (tree exp, rtx target, + rtx subtarget ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + int ignore ATTRIBUTE_UNUSED) { #define MAX_ARGS 2 @@ -6686,7 +6725,7 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) /* These variables are used for communication between the following functions. They indicate various things about the current function being compiled that are used to tell what kind of prologue, epilogue and procedure - descriptior to generate. */ + descriptor to generate. */ /* Nonzero if we need a stack procedure. */ enum alpha_procedure_types {PT_NULL = 0, PT_REGISTER = 1, PT_STACK = 2}; @@ -6706,21 +6745,16 @@ static int vms_base_regno; /* Compute register masks for saved registers. */ static void -alpha_sa_mask (imaskP, fmaskP) - unsigned long *imaskP; - unsigned long *fmaskP; +alpha_sa_mask (unsigned long *imaskP, unsigned long *fmaskP) { unsigned long imask = 0; unsigned long fmask = 0; unsigned int i; - /* Irritatingly, there are two kinds of thunks -- those created with - TARGET_ASM_OUTPUT_MI_THUNK and those with DECL_THUNK_P that go - through the regular part of the compiler. In the - TARGET_ASM_OUTPUT_MI_THUNK case we don't have valid register life - info, but assemble_start_function wants to output .frame and - .mask directives. */ - if (current_function_is_thunk && !no_new_pseudos) + /* When outputting a thunk, we don't have valid register life info, + but assemble_start_function wants to output .frame and .mask + directives. */ + if (current_function_is_thunk) { *imaskP = 0; *fmaskP = 0; @@ -6728,7 +6762,7 @@ alpha_sa_mask (imaskP, fmaskP) } if (TARGET_ABI_OPEN_VMS && alpha_procedure_type == PT_STACK) - imask |= (1L << HARD_FRAME_POINTER_REGNUM); + imask |= (1UL << HARD_FRAME_POINTER_REGNUM); /* One for every register we have to save. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) @@ -6737,9 +6771,9 @@ alpha_sa_mask (imaskP, fmaskP) && (!TARGET_ABI_UNICOSMK || i != HARD_FRAME_POINTER_REGNUM)) { if (i < 32) - imask |= (1L << i); + imask |= (1UL << i); else - fmask |= (1L << (i - 32)); + fmask |= (1UL << (i - 32)); } /* We need to restore these for the handler. */ @@ -6750,7 +6784,7 @@ alpha_sa_mask (imaskP, fmaskP) unsigned regno = EH_RETURN_DATA_REGNO (i); if (regno == INVALID_REGNUM) break; - imask |= 1L << regno; + imask |= 1UL << regno; } /* Glibc likes to use $31 as an unwind stopper for crt0. To @@ -6758,19 +6792,19 @@ alpha_sa_mask (imaskP, fmaskP) zero in the prologue of _Unwind_RaiseException et al. */ imask |= 1UL << 31; } - + /* If any register spilled, then spill the return address also. */ /* ??? This is required by the Digital stack unwind specification and isn't needed if we're doing Dwarf2 unwinding. */ if (imask || fmask || alpha_ra_ever_killed ()) - imask |= (1L << REG_RA); + imask |= (1UL << REG_RA); *imaskP = imask; *fmaskP = fmask; } int -alpha_sa_size () +alpha_sa_size (void) { unsigned long mask[2]; int sa_size = 0; @@ -6872,15 +6906,39 @@ alpha_sa_size () return sa_size * 8; } +/* Define the offset between two registers, one to be eliminated, + and the other its replacement, at the start of a routine. */ + +HOST_WIDE_INT +alpha_initial_elimination_offset (unsigned int from, + unsigned int to ATTRIBUTE_UNUSED) +{ + HOST_WIDE_INT ret; + + ret = alpha_sa_size (); + ret += ALPHA_ROUND (current_function_outgoing_args_size); + + if (from == FRAME_POINTER_REGNUM) + ; + else if (from == ARG_POINTER_REGNUM) + ret += (ALPHA_ROUND (get_frame_size () + + current_function_pretend_args_size) + - current_function_pretend_args_size); + else + abort (); + + return ret; +} + int -alpha_pv_save_size () +alpha_pv_save_size (void) { alpha_sa_size (); return alpha_procedure_type == PT_STACK ? 8 : 0; } int -alpha_using_fp () +alpha_using_fp (void) { alpha_sa_size (); return vms_unwind_regno == HARD_FRAME_POINTER_REGNUM; @@ -6900,22 +6958,19 @@ const struct attribute_spec vms_attribute_table[] = #endif static int -find_lo_sum_using_gp (px, data) - rtx *px; - void *data ATTRIBUTE_UNUSED; +find_lo_sum_using_gp (rtx *px, void *data ATTRIBUTE_UNUSED) { return GET_CODE (*px) == LO_SUM && XEXP (*px, 0) == pic_offset_table_rtx; } int -alpha_find_lo_sum_using_gp (insn) - rtx insn; +alpha_find_lo_sum_using_gp (rtx insn) { return for_each_rtx (&PATTERN (insn), find_lo_sum_using_gp, NULL) > 0; } static int -alpha_does_function_need_gp () +alpha_does_function_need_gp (void) { rtx insn; @@ -6923,12 +6978,21 @@ alpha_does_function_need_gp () if (! TARGET_ABI_OSF) return 0; + /* We need the gp to load the address of __mcount. */ if (TARGET_PROFILING_NEEDS_GP && current_function_profile) return 1; + /* The code emitted by alpha_output_mi_thunk_osf uses the gp. */ if (current_function_is_thunk) return 1; + /* The nonlocal receiver pattern assumes that the gp is valid for + the nested function. Reasonable because it's almost always set + correctly already. For the cases where that's wrong, make sure + the nested function loads its gp on entry. */ + if (current_function_has_nonlocal_goto) + return 1; + /* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first. Even if we are a static function, we still need to do this in case our address is taken and passed to something like qsort. */ @@ -6947,27 +7011,12 @@ alpha_does_function_need_gp () return 0; } -/* Write a version stamp. Don't write anything if we are running as a - cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */ - -#ifdef HAVE_STAMP_H -#include -#endif - -void -alpha_write_verstamp (file) - FILE *file ATTRIBUTE_UNUSED; -{ -#ifdef MS_STAMP - fprintf (file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP); -#endif -} /* Helper function to set RTX_FRAME_RELATED_P on instructions, including sequences. */ static rtx -set_frame_related_p () +set_frame_related_p (void) { rtx seq = get_insns (); rtx insn; @@ -7015,7 +7064,7 @@ set_frame_related_p () simply allocate stack without saving registers. */ void -alpha_expand_prologue () +alpha_expand_prologue (void) { /* Registers to save. */ unsigned long imask = 0; @@ -7143,15 +7192,14 @@ alpha_expand_prologue () and subtract it to sp. Yes, that's correct -- we have to reload the whole constant - into a temporary via ldah+lda then subtract from sp. To - ensure we get ldah+lda, we use a special pattern. */ + into a temporary via ldah+lda then subtract from sp. */ HOST_WIDE_INT lo, hi; lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000; hi = frame_size - lo; emit_move_insn (ptr, GEN_INT (hi)); - emit_insn (gen_nt_lda (ptr, GEN_INT (lo))); + emit_insn (gen_adddi3 (ptr, ptr, GEN_INT (lo))); seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx, ptr)); } @@ -7203,18 +7251,18 @@ alpha_expand_prologue () } /* Save register RA next. */ - if (imask & (1L << REG_RA)) + if (imask & (1UL << REG_RA)) { mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); set_mem_alias_set (mem, alpha_sr_alias_set); FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_RA))); - imask &= ~(1L << REG_RA); + imask &= ~(1UL << REG_RA); reg_offset += 8; } /* Now save any other registers required to be saved. */ for (i = 0; i < 31; i++) - if (imask & (1L << i)) + if (imask & (1UL << i)) { mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); set_mem_alias_set (mem, alpha_sr_alias_set); @@ -7224,24 +7272,24 @@ alpha_expand_prologue () /* Store a zero if requested for unwinding. */ if (imask & (1UL << 31)) - { - rtx insn, t; - - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - insn = emit_move_insn (mem, const0_rtx); - - RTX_FRAME_RELATED_P (insn) = 1; - t = gen_rtx_REG (Pmode, 31); - t = gen_rtx_SET (VOIDmode, mem, t); - t = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, t, REG_NOTES (insn)); - REG_NOTES (insn) = t; - - reg_offset += 8; - } - + { + rtx insn, t; + + mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); + set_mem_alias_set (mem, alpha_sr_alias_set); + insn = emit_move_insn (mem, const0_rtx); + + RTX_FRAME_RELATED_P (insn) = 1; + t = gen_rtx_REG (Pmode, 31); + t = gen_rtx_SET (VOIDmode, mem, t); + t = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, t, REG_NOTES (insn)); + REG_NOTES (insn) = t; + + reg_offset += 8; + } + for (i = 0; i < 31; i++) - if (fmask & (1L << i)) + if (fmask & (1UL << i)) { mem = gen_rtx_MEM (DFmode, plus_constant (sa_reg, reg_offset)); set_mem_alias_set (mem, alpha_sr_alias_set); @@ -7257,7 +7305,7 @@ alpha_expand_prologue () reg_offset = -56; for (i = 9; i < 15; i++) - if (imask & (1L << i)) + if (imask & (1UL << i)) { mem = gen_rtx_MEM (DImode, plus_constant(hard_frame_pointer_rtx, reg_offset)); @@ -7266,7 +7314,7 @@ alpha_expand_prologue () reg_offset -= 8; } for (i = 2; i < 10; i++) - if (fmask & (1L << i)) + if (fmask & (1UL << i)) { mem = gen_rtx_MEM (DFmode, plus_constant (hard_frame_pointer_rtx, reg_offset)); @@ -7294,11 +7342,31 @@ alpha_expand_prologue () /* If we have to allocate space for outgoing args, do it now. */ if (current_function_outgoing_args_size != 0) - FRP (emit_move_insn - (stack_pointer_rtx, - plus_constant (hard_frame_pointer_rtx, - - (ALPHA_ROUND - (current_function_outgoing_args_size))))); + { + rtx seq + = emit_move_insn (stack_pointer_rtx, + plus_constant + (hard_frame_pointer_rtx, + - (ALPHA_ROUND + (current_function_outgoing_args_size)))); + + /* Only set FRAME_RELATED_P on the stack adjustment we just emitted + if ! frame_pointer_needed. Setting the bit will change the CFA + computation rule to use sp again, which would be wrong if we had + frame_pointer_needed, as this means sp might move unpredictably + later on. + + Also, note that + frame_pointer_needed + => vms_unwind_regno == HARD_FRAME_POINTER_REGNUM + and + current_function_outgoing_args_size != 0 + => alpha_procedure_type != PT_NULL, + + so when we are not setting the bit here, we are guaranteed to + have emitted an FRP frame pointer update just before. */ + RTX_FRAME_RELATED_P (seq) = ! frame_pointer_needed; + } } else if (!TARGET_ABI_UNICOSMK) { @@ -7332,17 +7400,15 @@ alpha_expand_prologue () /* Output the textual info surrounding the prologue. */ void -alpha_start_function (file, fnname, decl) - FILE *file; - const char *fnname; - tree decl ATTRIBUTE_UNUSED; +alpha_start_function (FILE *file, const char *fnname, + tree decl ATTRIBUTE_UNUSED) { unsigned long imask = 0; unsigned long fmask = 0; /* Stack space needed for pushing registers clobbered by us. */ HOST_WIDE_INT sa_size; /* Complete stack size needed. */ - HOST_WIDE_INT frame_size; + unsigned HOST_WIDE_INT frame_size; /* Offset from base reg to register save area. */ HOST_WIDE_INT reg_offset; char *entry_label = (char *) alloca (strlen (fnname) + 6); @@ -7400,7 +7466,7 @@ alpha_start_function (file, fnname, decl) #ifdef ASM_OUTPUT_SOURCE_LINE if (debug_info_level != DINFO_LEVEL_TERSE) ASM_OUTPUT_SOURCE_LINE (file, - DECL_SOURCE_LINE (current_function_decl)); + DECL_SOURCE_LINE (current_function_decl), 0); #endif } @@ -7458,23 +7524,17 @@ alpha_start_function (file, fnname, decl) if (TARGET_ABI_UNICOSMK) ; else if (TARGET_ABI_OPEN_VMS) - { - fprintf (file, "\t.frame $%d,", vms_unwind_regno); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= ((HOST_WIDE_INT) 1 << 31) ? 0 : frame_size); - fputs (",$26,", file); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset); - fputs ("\n", file); - } + fprintf (file, "\t.frame $%d," HOST_WIDE_INT_PRINT_DEC ",$26," + HOST_WIDE_INT_PRINT_DEC "\n", + vms_unwind_regno, + frame_size >= (1UL << 31) ? 0 : frame_size, + reg_offset); else if (!flag_inhibit_size_directive) - { - fprintf (file, "\t.frame $%d,", - (frame_pointer_needed - ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM)); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : frame_size); - fprintf (file, ",$26,%d\n", current_function_pretend_args_size); - } + fprintf (file, "\t.frame $%d," HOST_WIDE_INT_PRINT_DEC ",$26,%d\n", + (frame_pointer_needed + ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM), + frame_size >= (1UL << 31) ? 0 : frame_size, + current_function_pretend_args_size); /* Describe which registers were spilled. */ if (TARGET_ABI_UNICOSMK) @@ -7484,7 +7544,7 @@ alpha_start_function (file, fnname, decl) if (imask) /* ??? Does VMS care if mask contains ra? The old code didn't set it, so I don't here. */ - fprintf (file, "\t.mask 0x%lx,0\n", imask & ~(1L << REG_RA)); + fprintf (file, "\t.mask 0x%lx,0\n", imask & ~(1UL << REG_RA)); if (fmask) fprintf (file, "\t.fmask 0x%lx,0\n", fmask); if (alpha_procedure_type == PT_REGISTER) @@ -7494,23 +7554,17 @@ alpha_start_function (file, fnname, decl) { if (imask) { - fprintf (file, "\t.mask 0x%lx,", imask); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : reg_offset - frame_size); - putc ('\n', file); + fprintf (file, "\t.mask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", imask, + frame_size >= (1UL << 31) ? 0 : reg_offset - frame_size); for (i = 0; i < 32; ++i) - if (imask & (1L << i)) + if (imask & (1UL << i)) reg_offset += 8; } if (fmask) - { - fprintf (file, "\t.fmask 0x%lx,", fmask); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : reg_offset - frame_size); - putc ('\n', file); - } + fprintf (file, "\t.fmask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", fmask, + frame_size >= (1UL << 31) ? 0 : reg_offset - frame_size); } #if TARGET_ABI_OPEN_VMS @@ -7529,8 +7583,7 @@ alpha_start_function (file, fnname, decl) /* Emit the .prologue note at the scheduled end of the prologue. */ static void -alpha_output_function_end_prologue (file) - FILE *file; +alpha_output_function_end_prologue (FILE *file) { if (TARGET_ABI_UNICOSMK) ; @@ -7552,7 +7605,7 @@ alpha_output_function_end_prologue (file) #define FRP(exp) exp void -alpha_expand_epilogue () +alpha_expand_epilogue (void) { /* Registers to save. */ unsigned long imask = 0; @@ -7644,10 +7697,10 @@ alpha_expand_epilogue () FRP (emit_move_insn (gen_rtx_REG (DImode, REG_RA), mem)); reg_offset += 8; - imask &= ~(1L << REG_RA); + imask &= ~(1UL << REG_RA); for (i = 0; i < 31; ++i) - if (imask & (1L << i)) + if (imask & (1UL << i)) { if (i == HARD_FRAME_POINTER_REGNUM && fp_is_frame_pointer) fp_offset = reg_offset; @@ -7664,7 +7717,7 @@ alpha_expand_epilogue () reg_offset += 8; for (i = 0; i < 31; ++i) - if (fmask & (1L << i)) + if (fmask & (1UL << i)) { mem = gen_rtx_MEM (DFmode, plus_constant(sa_reg, reg_offset)); set_mem_alias_set (mem, alpha_sr_alias_set); @@ -7679,7 +7732,7 @@ alpha_expand_epilogue () reg_offset = -56; for (i = 9; i < 15; i++) - if (imask & (1L << i)) + if (imask & (1UL << i)) { mem = gen_rtx_MEM (DImode, plus_constant(hard_frame_pointer_rtx, reg_offset)); @@ -7689,7 +7742,7 @@ alpha_expand_epilogue () } for (i = 2; i < 10; i++) - if (fmask & (1L << i)) + if (fmask & (1UL << i)) { mem = gen_rtx_MEM (DFmode, plus_constant(hard_frame_pointer_rtx, reg_offset)); @@ -7810,46 +7863,10 @@ alpha_expand_epilogue () } } -#if TARGET_ABI_OPEN_VMS -#include - -/* Structure to collect function names for final output - in link section. */ - -enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN}; -enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR}; - -struct alpha_funcs -{ - int num; - splay_tree links; -}; - -struct alpha_links -{ - int num; - rtx linkage; - enum links_kind lkind; - enum reloc_kind rkind; -}; - -static splay_tree alpha_funcs_tree; -static splay_tree alpha_links_tree; - -static int mark_alpha_links_node PARAMS ((splay_tree_node, void *)); -static void mark_alpha_links PARAMS ((void *)); -static int alpha_write_one_linkage PARAMS ((splay_tree_node, void *)); - -static int alpha_funcs_num; -#endif - /* Output the rest of the textual info surrounding the epilogue. */ void -alpha_end_function (file, fnname, decl) - FILE *file; - const char *fnname; - tree decl; +alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED) { /* End the function. */ if (!TARGET_ABI_UNICOSMK && !flag_inhibit_size_directive) @@ -7864,17 +7881,6 @@ alpha_end_function (file, fnname, decl) alpha_write_linkage (file, fnname, decl); #endif - /* Show that we know this function if it is called again. - - Do this only for functions whose symbols bind locally. - - Don't do this for functions not defined in the .text section, as - otherwise it's not unlikely that the destination is out of range - for a direct branch. */ - - if ((*targetm.binds_local_p) (decl) && decl_in_text_section (decl)) - SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; - /* Output jump tables and the static subroutine information block. */ if (TARGET_ABI_UNICOSMK) { @@ -7894,23 +7900,20 @@ alpha_end_function (file, fnname, decl) Not sure why this idea hasn't been explored before... */ static void -alpha_output_mi_thunk_osf (file, thunk_fndecl, delta, vcall_offset, function) - FILE *file; - tree thunk_fndecl ATTRIBUTE_UNUSED; - HOST_WIDE_INT delta; - HOST_WIDE_INT vcall_offset; - tree function; +alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, + HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, + tree function) { HOST_WIDE_INT hi, lo; rtx this, insn, funexp; /* We always require a valid GP. */ emit_insn (gen_prologue_ldgp ()); - emit_note (NULL, NOTE_INSN_PROLOGUE_END); + emit_note (NOTE_INSN_PROLOGUE_END); /* Find the "this" pointer. If the function returns a structure, the structure return pointer is in $16. */ - if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)))) + if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) this = gen_rtx_REG (Pmode, 17); else this = gen_rtx_REG (Pmode, 16); @@ -7980,6 +7983,7 @@ alpha_output_mi_thunk_osf (file, thunk_fndecl, delta, vcall_offset, function) instruction scheduling worth while. Note that use_thunk calls assemble_start_function and assemble_end_function. */ insn = get_insns (); + insn_locators_initialize (); shorten_branches (insn); final_start_function (insn, file, 1); final (insn, file, 1, 0); @@ -8016,9 +8020,7 @@ long alpha_auto_offset; /* Emit a new filename to a stream. */ void -alpha_output_filename (stream, name) - FILE *stream; - const char *name; +alpha_output_filename (FILE *stream, const char *name) { static int first_time = TRUE; char ltext_label_name[100]; @@ -8059,13 +8061,11 @@ alpha_output_filename (stream, name) fprintf (stream, "\n"); } } - + /* Emit a linenumber to a stream. */ void -alpha_output_lineno (stream, line) - FILE *stream; - int line; +alpha_output_lineno (FILE *stream, int line) { if (write_symbols == DBX_DEBUG) { @@ -8089,18 +8089,12 @@ struct shadow_summary } used, defd; }; -static void summarize_insn PARAMS ((rtx, struct shadow_summary *, int)); -static void alpha_handle_trap_shadows PARAMS ((rtx)); - /* Summary the effects of expression X on the machine. Update SUM, a pointer to the summary structure. SET is nonzero if the insn is setting the object, otherwise zero. */ static void -summarize_insn (x, sum, set) - rtx x; - struct shadow_summary *sum; - int set; +summarize_insn (rtx x, struct shadow_summary *sum, int set) { const char *format_ptr; int i, j; @@ -8254,8 +8248,7 @@ summarize_insn (x, sum, set) (d) The trap shadow may not include any branch instructions. */ static void -alpha_handle_trap_shadows (insns) - rtx insns; +alpha_handle_trap_shadows (void) { struct shadow_summary shadow; int trap_pending, exception_nesting; @@ -8268,7 +8261,7 @@ alpha_handle_trap_shadows (insns) shadow.used.mem = 0; shadow.defd = shadow.used; - for (i = insns; i ; i = NEXT_INSN (i)) + for (i = get_insns (); i ; i = NEXT_INSN (i)) { if (GET_CODE (i) == NOTE) { @@ -8388,7 +8381,7 @@ alpha_handle_trap_shadows (insns) } /* Alpha can only issue instruction groups simultaneously if they are - suitibly aligned. This is very processor-specific. */ + suitably aligned. This is very processor-specific. */ enum alphaev4_pipe { EV4_STOP = 0, @@ -8408,19 +8401,8 @@ enum alphaev5_pipe { EV5_FM = 64 }; -static enum alphaev4_pipe alphaev4_insn_pipe PARAMS ((rtx)); -static enum alphaev5_pipe alphaev5_insn_pipe PARAMS ((rtx)); -static rtx alphaev4_next_group PARAMS ((rtx, int *, int *)); -static rtx alphaev5_next_group PARAMS ((rtx, int *, int *)); -static rtx alphaev4_next_nop PARAMS ((int *)); -static rtx alphaev5_next_nop PARAMS ((int *)); - -static void alpha_align_insns - PARAMS ((rtx, unsigned int, rtx (*)(rtx, int *, int *), rtx (*)(int *))); - static enum alphaev4_pipe -alphaev4_insn_pipe (insn) - rtx insn; +alphaev4_insn_pipe (rtx insn) { if (recog_memoized (insn) < 0) return EV4_STOP; @@ -8462,8 +8444,7 @@ alphaev4_insn_pipe (insn) } static enum alphaev5_pipe -alphaev5_insn_pipe (insn) - rtx insn; +alphaev5_insn_pipe (rtx insn) { if (recog_memoized (insn) < 0) return EV5_STOP; @@ -8518,9 +8499,7 @@ alphaev5_insn_pipe (insn) LEN is, of course, the length of the group in bytes. */ static rtx -alphaev4_next_group (insn, pin_use, plen) - rtx insn; - int *pin_use, *plen; +alphaev4_next_group (rtx insn, int *pin_use, int *plen) { int len, in_use; @@ -8618,9 +8597,7 @@ alphaev4_next_group (insn, pin_use, plen) LEN is, of course, the length of the group in bytes. */ static rtx -alphaev5_next_group (insn, pin_use, plen) - rtx insn; - int *pin_use, *plen; +alphaev5_next_group (rtx insn, int *pin_use, int *plen) { int len, in_use; @@ -8745,8 +8722,7 @@ alphaev5_next_group (insn, pin_use, plen) } static rtx -alphaev4_next_nop (pin_use) - int *pin_use; +alphaev4_next_nop (int *pin_use) { int in_use = *pin_use; rtx nop; @@ -8774,8 +8750,7 @@ alphaev4_next_nop (pin_use) } static rtx -alphaev5_next_nop (pin_use) - int *pin_use; +alphaev5_next_nop (int *pin_use) { int in_use = *pin_use; rtx nop; @@ -8805,11 +8780,9 @@ alphaev5_next_nop (pin_use) /* The instruction group alignment main loop. */ static void -alpha_align_insns (insns, max_align, next_group, next_nop) - rtx insns; - unsigned int max_align; - rtx (*next_group) PARAMS ((rtx, int *, int *)); - rtx (*next_nop) PARAMS ((int *)); +alpha_align_insns (unsigned int max_align, + rtx (*next_group) (rtx, int *, int *), + rtx (*next_nop) (int *)) { /* ALIGN is the known alignment for the insn group. */ unsigned int align; @@ -8819,7 +8792,7 @@ alpha_align_insns (insns, max_align, next_group, next_nop) rtx i, next; /* Let shorten branches care for assigning alignments to code labels. */ - shorten_branches (insns); + shorten_branches (get_insns ()); if (align_functions < 4) align = 4; @@ -8829,7 +8802,7 @@ alpha_align_insns (insns, max_align, next_group, next_nop) align = max_align; ofs = prev_in_use = 0; - i = insns; + i = get_insns (); if (GET_CODE (i) == NOTE) i = next_nonnote_insn (i); @@ -8900,7 +8873,7 @@ alpha_align_insns (insns, max_align, next_group, next_nop) int nop_count = (align - ofs) / 4; rtx where; - /* Insert nops before labels, branches, and calls to truely merge + /* Insert nops before labels, branches, and calls to truly merge the execution of the nops with the previous instruction group. */ where = prev_nonnote_insn (i); if (where) @@ -8931,12 +8904,11 @@ alpha_align_insns (insns, max_align, next_group, next_nop) /* Machine dependent reorg pass. */ -void -alpha_reorg (insns) - rtx insns; +static void +alpha_reorg (void) { if (alpha_tp != ALPHA_TP_PROG || flag_exceptions) - alpha_handle_trap_shadows (insns); + alpha_handle_trap_shadows (); /* Due to the number of extra trapb insns, don't bother fixing up alignment when trap precision is instruction. Moreover, we can @@ -8946,25 +8918,60 @@ alpha_reorg (insns) && flag_schedule_insns_after_reload) { if (alpha_cpu == PROCESSOR_EV4) - alpha_align_insns (insns, 8, alphaev4_next_group, alphaev4_next_nop); + alpha_align_insns (8, alphaev4_next_group, alphaev4_next_nop); else if (alpha_cpu == PROCESSOR_EV5) - alpha_align_insns (insns, 16, alphaev5_next_group, alphaev5_next_nop); + alpha_align_insns (16, alphaev5_next_group, alphaev5_next_nop); } } +#if !TARGET_ABI_UNICOSMK + +#ifdef HAVE_STAMP_H +#include +#endif + +static void +alpha_file_start (void) +{ +#ifdef OBJECT_FORMAT_ELF + /* If emitting dwarf2 debug information, we cannot generate a .file + directive to start the file, as it will conflict with dwarf2out + file numbers. So it's only useful when emitting mdebug output. */ + targetm.file_start_file_directive = (write_symbols == DBX_DEBUG); +#endif + + default_file_start (); +#ifdef MS_STAMP + fprintf (asm_out_file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP); +#endif + + fputs ("\t.set noreorder\n", asm_out_file); + fputs ("\t.set volatile\n", asm_out_file); + if (!TARGET_ABI_OPEN_VMS) + fputs ("\t.set noat\n", asm_out_file); + if (TARGET_EXPLICIT_RELOCS) + fputs ("\t.set nomacro\n", asm_out_file); + if (TARGET_SUPPORT_ARCH | TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX) + fprintf (asm_out_file, + "\t.arch %s\n", + TARGET_CPU_EV6 ? "ev6" + : (TARGET_CPU_EV5 + ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") + : "ev4")); +} +#endif + #ifdef OBJECT_FORMAT_ELF /* Switch to the section to which we should output X. The only thing special we do here is to honor small data. */ static void -alpha_elf_select_rtx_section (mode, x, align) - enum machine_mode mode; - rtx x; - unsigned HOST_WIDE_INT align; +alpha_elf_select_rtx_section (enum machine_mode mode, rtx x, + unsigned HOST_WIDE_INT align) { if (TARGET_SMALL_DATA && GET_MODE_SIZE (mode) <= g_switch_value) - /* ??? Consider using mergable sdata sections. */ + /* ??? Consider using mergeable sdata sections. */ sdata_section (); else default_elf_select_rtx_section (mode, x, align); @@ -8972,13 +8979,40 @@ alpha_elf_select_rtx_section (mode, x, align) #endif /* OBJECT_FORMAT_ELF */ +/* Structure to collect function names for final output in link section. */ +/* Note that items marked with GTY can't be ifdef'ed out. */ + +enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN}; +enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR}; + +struct alpha_links GTY(()) +{ + int num; + rtx linkage; + enum links_kind lkind; + enum reloc_kind rkind; +}; + +struct alpha_funcs GTY(()) +{ + int num; + splay_tree GTY ((param1_is (char *), param2_is (struct alpha_links *))) + links; +}; + +static GTY ((param1_is (char *), param2_is (struct alpha_links *))) + splay_tree alpha_links_tree; +static GTY ((param1_is (tree), param2_is (struct alpha_funcs *))) + splay_tree alpha_funcs_tree; + +static GTY(()) int alpha_funcs_num; + #if TARGET_ABI_OPEN_VMS /* Return the VMS argument type corresponding to MODE. */ enum avms_arg_type -alpha_arg_type (mode) - enum machine_mode mode; +alpha_arg_type (enum machine_mode mode) { switch (mode) { @@ -8995,8 +9029,7 @@ alpha_arg_type (mode) register value. */ rtx -alpha_arg_info_reg_val (cum) - CUMULATIVE_ARGS cum; +alpha_arg_info_reg_val (CUMULATIVE_ARGS cum) { unsigned HOST_WIDE_INT regval = cum.num_args; int i; @@ -9007,26 +9040,6 @@ alpha_arg_info_reg_val (cum) return GEN_INT (regval); } -/* Protect alpha_links from garbage collection. */ - -static int -mark_alpha_links_node (node, data) - splay_tree_node node; - void *data ATTRIBUTE_UNUSED; -{ - struct alpha_links *links = (struct alpha_links *) node->value; - ggc_mark_rtx (links->linkage); - return 0; -} - -static void -mark_alpha_links (ptr) - void *ptr; -{ - splay_tree tree = *(splay_tree *) ptr; - splay_tree_foreach (tree, mark_alpha_links_node, NULL); -} - /* Make (or fake) .linkage entry for function call. IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. @@ -9034,25 +9047,23 @@ mark_alpha_links (ptr) Return an SYMBOL_REF rtx for the linkage. */ rtx -alpha_need_linkage (name, is_local) - const char *name; - int is_local; +alpha_need_linkage (const char *name, int is_local) { splay_tree_node node; struct alpha_links *al; - struct alpha_funcs *cfaf; if (name[0] == '*') name++; if (is_local) { - alpha_funcs_tree = splay_tree_new - ((splay_tree_compare_fn) splay_tree_compare_pointers, - (splay_tree_delete_key_fn) free, - (splay_tree_delete_key_fn) free); + struct alpha_funcs *cfaf; + + if (!alpha_funcs_tree) + alpha_funcs_tree = splay_tree_new_ggc ((splay_tree_compare_fn) + splay_tree_compare_pointers); - cfaf = (struct alpha_funcs *) xmalloc (sizeof (struct alpha_funcs)); + cfaf = (struct alpha_funcs *) ggc_alloc (sizeof (struct alpha_funcs)); cfaf->links = 0; cfaf->num = ++alpha_funcs_num; @@ -9060,7 +9071,6 @@ alpha_need_linkage (name, is_local) splay_tree_insert (alpha_funcs_tree, (splay_tree_key) current_function_decl, (splay_tree_value) cfaf); - } if (alpha_links_tree) @@ -9087,17 +9097,10 @@ alpha_need_linkage (name, is_local) } } else - { - alpha_links_tree = splay_tree_new - ((splay_tree_compare_fn) strcmp, - (splay_tree_delete_key_fn) free, - (splay_tree_delete_key_fn) free); + alpha_links_tree = splay_tree_new_ggc ((splay_tree_compare_fn) strcmp); - ggc_add_root (&alpha_links_tree, 1, 1, mark_alpha_links); - } - - al = (struct alpha_links *) xmalloc (sizeof (struct alpha_links)); - name = xstrdup (name); + al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links)); + name = ggc_strdup (name); /* Assume external if no definition. */ al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN); @@ -9123,11 +9126,7 @@ alpha_need_linkage (name, is_local) } rtx -alpha_use_linkage (linkage, cfundecl, lflag, rflag) - rtx linkage; - tree cfundecl; - int lflag; - int rflag; +alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag) { splay_tree_node cfunnode; struct alpha_funcs *cfaf; @@ -9151,13 +9150,7 @@ alpha_use_linkage (linkage, cfundecl, lflag, rflag) al = (struct alpha_links *) lnode->value; } else - { - cfaf->links = splay_tree_new - ((splay_tree_compare_fn) strcmp, - (splay_tree_delete_key_fn) free, - (splay_tree_delete_key_fn) free); - ggc_add_root (&cfaf->links, 1, 1, mark_alpha_links); - } + cfaf->links = splay_tree_new_ggc ((splay_tree_compare_fn) strcmp); if (!al) { @@ -9173,7 +9166,7 @@ alpha_use_linkage (linkage, cfundecl, lflag, rflag) name_len = strlen (name); - al = (struct alpha_links *) xmalloc (sizeof (struct alpha_links)); + al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links)); al->num = cfaf->num; node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name); @@ -9207,9 +9200,7 @@ alpha_use_linkage (linkage, cfundecl, lflag, rflag) } static int -alpha_write_one_linkage (node, data) - splay_tree_node node; - void *data; +alpha_write_one_linkage (splay_tree_node node, void *data) { const char *const name = (const char *) node->key; struct alpha_links *link = (struct alpha_links *) node->value; @@ -9248,10 +9239,7 @@ alpha_write_one_linkage (node, data) } static void -alpha_write_linkage (stream, funname, fundecl) - FILE *stream; - const char *funname; - tree fundecl; +alpha_write_linkage (FILE *stream, const char *funname, tree fundecl) { splay_tree_node node; struct alpha_funcs *func; @@ -9286,10 +9274,7 @@ alpha_write_linkage (stream, funname, fundecl) #define SECTION_VMS_INITIALIZE (SECTION_VMS_GLOBAL << 1) static unsigned int -vms_section_type_flags (decl, name, reloc) - tree decl; - const char *name; - int reloc; +vms_section_type_flags (tree decl, const char *name, int reloc) { unsigned int flags = default_section_type_flags (decl, name, reloc); @@ -9311,9 +9296,7 @@ vms_section_type_flags (decl, name, reloc) the section; 0 if the default should be used. */ static void -vms_asm_named_section (name, flags) - const char *name; - unsigned int flags; +vms_asm_named_section (const char *name, unsigned int flags) { fputc ('\n', asm_out_file); fprintf (asm_out_file, ".section\t%s", name); @@ -9339,9 +9322,7 @@ vms_asm_named_section (name, flags) used by a normal pointer. */ static void -vms_asm_out_constructor (symbol, priority) - rtx symbol; - int priority ATTRIBUTE_UNUSED; +vms_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED) { ctors_section (); assemble_align (BITS_PER_WORD); @@ -9349,9 +9330,7 @@ vms_asm_out_constructor (symbol, priority) } static void -vms_asm_out_destructor (symbol, priority) - rtx symbol; - int priority ATTRIBUTE_UNUSED; +vms_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED) { dtors_section (); assemble_align (BITS_PER_WORD); @@ -9360,19 +9339,17 @@ vms_asm_out_destructor (symbol, priority) #else rtx -alpha_need_linkage (name, is_local) - const char *name ATTRIBUTE_UNUSED; - int is_local ATTRIBUTE_UNUSED; +alpha_need_linkage (const char *name ATTRIBUTE_UNUSED, + int is_local ATTRIBUTE_UNUSED) { return NULL_RTX; } rtx -alpha_use_linkage (linkage, cfundecl, lflag, rflag) - rtx linkage ATTRIBUTE_UNUSED; - tree cfundecl ATTRIBUTE_UNUSED; - int lflag ATTRIBUTE_UNUSED; - int rflag ATTRIBUTE_UNUSED; +alpha_use_linkage (rtx linkage ATTRIBUTE_UNUSED, + tree cfundecl ATTRIBUTE_UNUSED, + int lflag ATTRIBUTE_UNUSED, + int rflag ATTRIBUTE_UNUSED) { return NULL_RTX; } @@ -9381,21 +9358,11 @@ alpha_use_linkage (linkage, cfundecl, lflag, rflag) #if TARGET_ABI_UNICOSMK -static void unicosmk_output_module_name PARAMS ((FILE *)); -static void unicosmk_output_default_externs PARAMS ((FILE *)); -static void unicosmk_output_dex PARAMS ((FILE *)); -static void unicosmk_output_externs PARAMS ((FILE *)); -static void unicosmk_output_addr_vec PARAMS ((FILE *, rtx)); -static const char *unicosmk_ssib_name PARAMS ((void)); -static int unicosmk_special_name PARAMS ((const char *)); - /* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */ int -unicosmk_initial_elimination_offset (from, to) - int from; - int to; +unicosmk_initial_elimination_offset (int from, int to) { int fixed_size; @@ -9423,112 +9390,27 @@ unicosmk_initial_elimination_offset (from, to) or '$'. */ static void -unicosmk_output_module_name (file) - FILE *file; +unicosmk_output_module_name (FILE *file) { - const char *name; - - /* Strip directories. */ - - name = strrchr (main_input_filename, '/'); - if (name) - ++name; - else - name = main_input_filename; - + const char *name = lbasename (main_input_filename); + unsigned len = strlen (name); + char *clean_name = alloca (len + 2); + char *ptr = clean_name; + /* CAM only accepts module names that start with a letter or '$'. We prefix the module name with a '$' if necessary. */ if (!ISALPHA (*name)) - putc ('$', file); - output_clean_symbol_name (file, name); -} - -/* Output text that to appear at the beginning of an assembler file. */ - -void -unicosmk_asm_file_start (file) - FILE *file; -{ - int i; - - fputs ("\t.ident\t", file); - unicosmk_output_module_name (file); - fputs ("\n\n", file); - - /* The Unicos/Mk assembler uses different register names. Instead of trying - to support them, we simply use micro definitions. */ - - /* CAM has different register names: rN for the integer register N and fN - for the floating-point register N. Instead of trying to use these in - alpha.md, we define the symbols $N and $fN to refer to the appropriate - register. */ - - for (i = 0; i < 32; ++i) - fprintf (file, "$%d <- r%d\n", i, i); - - for (i = 0; i < 32; ++i) - fprintf (file, "$f%d <- f%d\n", i, i); - - putc ('\n', file); - - /* The .align directive fill unused space with zeroes which does not work - in code sections. We define the macro 'gcc@code@align' which uses nops - instead. Note that it assumes that code sections always have the - biggest possible alignment since . refers to the current offset from - the beginning of the section. */ - - fputs ("\t.macro gcc@code@align n\n", file); - fputs ("gcc@n@bytes = 1 << n\n", file); - fputs ("gcc@here = . % gcc@n@bytes\n", file); - fputs ("\t.if ne, gcc@here, 0\n", file); - fputs ("\t.repeat (gcc@n@bytes - gcc@here) / 4\n", file); - fputs ("\tbis r31,r31,r31\n", file); - fputs ("\t.endr\n", file); - fputs ("\t.endif\n", file); - fputs ("\t.endm gcc@code@align\n\n", file); - - /* Output extern declarations which should always be visible. */ - unicosmk_output_default_externs (file); - - /* Open a dummy section. We always need to be inside a section for the - section-switching code to work correctly. - ??? This should be a module id or something like that. I still have to - figure out what the rules for those are. */ - fputs ("\n\t.psect\t$SG00000,data\n", file); -} - -/* Output text to appear at the end of an assembler file. This includes all - pending extern declarations and DEX expressions. */ - -void -unicosmk_asm_file_end (file) - FILE *file; -{ - fputs ("\t.endp\n\n", file); - - /* Output all pending externs. */ - - unicosmk_output_externs (file); - - /* Output dex definitions used for functions whose names conflict with - register names. */ - - unicosmk_output_dex (file); - - fputs ("\t.end\t", file); - unicosmk_output_module_name (file); - putc ('\n', file); + *ptr++ = '$'; + memcpy (ptr, name, len + 1); + clean_symbol_name (clean_name); + fputs (clean_name, file); } /* Output the definition of a common variable. */ void -unicosmk_output_common (file, name, size, align) - FILE *file; - const char *name; - int size; - int align; +unicosmk_output_common (FILE *file, const char *name, int size, int align) { tree name_tree; printf ("T3E__: common %s\n", name); @@ -9549,10 +9431,8 @@ unicosmk_output_common (file, name, size, align) static int current_section_align; static unsigned int -unicosmk_section_type_flags (decl, name, reloc) - tree decl; - const char *name; - int reloc ATTRIBUTE_UNUSED; +unicosmk_section_type_flags (tree decl, const char *name, + int reloc ATTRIBUTE_UNUSED) { unsigned int flags = default_section_type_flags (decl, name, reloc); @@ -9581,9 +9461,7 @@ unicosmk_section_type_flags (decl, name, reloc) declaration. */ static void -unicosmk_unique_section (decl, reloc) - tree decl; - int reloc ATTRIBUTE_UNUSED; +unicosmk_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED) { const char *name; int len; @@ -9592,7 +9470,7 @@ unicosmk_unique_section (decl, reloc) abort (); name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - name = alpha_strip_name_encoding (name); + name = default_strip_name_encoding (name); len = strlen (name); if (TREE_CODE (decl) == FUNCTION_DECL) @@ -9624,9 +9502,7 @@ unicosmk_unique_section (decl, reloc) the section; 0 if the default should be used. */ static void -unicosmk_asm_named_section (name, flags) - const char *name; - unsigned int flags; +unicosmk_asm_named_section (const char *name, unsigned int flags) { const char *kind; @@ -9654,9 +9530,7 @@ unicosmk_asm_named_section (name, flags) } static void -unicosmk_insert_attributes (decl, attr_ptr) - tree decl; - tree *attr_ptr ATTRIBUTE_UNUSED; +unicosmk_insert_attributes (tree decl, tree *attr_ptr ATTRIBUTE_UNUSED) { if (DECL_P (decl) && (TREE_PUBLIC (decl) || TREE_CODE (decl) == FUNCTION_DECL)) @@ -9667,9 +9541,7 @@ unicosmk_insert_attributes (decl, attr_ptr) in code sections because .align fill unused space with zeroes. */ void -unicosmk_output_align (file, align) - FILE *file; - int align; +unicosmk_output_align (FILE *file, int align) { if (inside_function) fprintf (file, "\tgcc@code@align\t%d\n", align); @@ -9682,9 +9554,7 @@ unicosmk_output_align (file, align) does not allow data definitions in code sections. */ void -unicosmk_defer_case_vector (lab, vec) - rtx lab; - rtx vec; +unicosmk_defer_case_vector (rtx lab, rtx vec) { struct machine_function *machine = cfun->machine; @@ -9696,16 +9566,14 @@ unicosmk_defer_case_vector (lab, vec) /* Output a case vector. */ static void -unicosmk_output_addr_vec (file, vec) - FILE *file; - rtx vec; +unicosmk_output_addr_vec (FILE *file, rtx vec) { rtx lab = XEXP (vec, 0); rtx body = XEXP (vec, 1); int vlen = XVECLEN (body, 0); int idx; - ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (lab)); + (*targetm.asm_out.internal_label) (file, "L", CODE_LABEL_NUMBER (lab)); for (idx = 0; idx < vlen; idx++) { @@ -9717,8 +9585,7 @@ unicosmk_output_addr_vec (file, vec) /* Output current function's deferred case vectors. */ static void -unicosmk_output_deferred_case_vectors (file) - FILE *file; +unicosmk_output_deferred_case_vectors (FILE *file) { struct machine_function *machine = cfun->machine; rtx t; @@ -9731,13 +9598,48 @@ unicosmk_output_deferred_case_vectors (file) unicosmk_output_addr_vec (file, XEXP (t, 0)); } +/* Generate the name of the SSIB section for the current function. */ + +#define SSIB_PREFIX "__SSIB_" +#define SSIB_PREFIX_LEN 7 + +static const char * +unicosmk_ssib_name (void) +{ + /* This is ok since CAM won't be able to deal with names longer than that + anyway. */ + + static char name[256]; + + rtx x; + const char *fnname; + int len; + + x = DECL_RTL (cfun->decl); + if (GET_CODE (x) != MEM) + abort (); + x = XEXP (x, 0); + if (GET_CODE (x) != SYMBOL_REF) + abort (); + fnname = XSTR (x, 0); + + len = strlen (fnname); + if (len + SSIB_PREFIX_LEN > 255) + len = 255 - SSIB_PREFIX_LEN; + + strcpy (name, SSIB_PREFIX); + strncpy (name + SSIB_PREFIX_LEN, fnname, len); + name[len + SSIB_PREFIX_LEN] = 0; + + return name; +} + /* Set up the dynamic subprogram information block (DSIB) and update the frame pointer register ($15) for subroutines which have a frame. If the subroutine doesn't have a frame, simply increment $15. */ static void -unicosmk_gen_dsib (imaskP) - unsigned long * imaskP; +unicosmk_gen_dsib (unsigned long *imaskP) { if (alpha_procedure_type == PT_STACK) { @@ -9755,14 +9657,14 @@ unicosmk_gen_dsib (imaskP) mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 56)); set_mem_alias_set (mem, alpha_sr_alias_set); FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_RA))); - (*imaskP) &= ~(1L << REG_RA); + (*imaskP) &= ~(1UL << REG_RA); /* Save the old frame pointer. */ mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 48)); set_mem_alias_set (mem, alpha_sr_alias_set); FRP (emit_move_insn (mem, hard_frame_pointer_rtx)); - (*imaskP) &= ~(1L << HARD_FRAME_POINTER_REGNUM); + (*imaskP) &= ~(1UL << HARD_FRAME_POINTER_REGNUM); emit_insn (gen_blockage ()); @@ -9800,49 +9702,11 @@ unicosmk_gen_dsib (imaskP) } } -#define SSIB_PREFIX "__SSIB_" -#define SSIB_PREFIX_LEN 7 - -/* Generate the name of the SSIB section for the current function. */ - -static const char * -unicosmk_ssib_name () -{ - /* This is ok since CAM won't be able to deal with names longer than that - anyway. */ - - static char name[256]; - - rtx x; - const char *fnname; - int len; - - x = DECL_RTL (cfun->decl); - if (GET_CODE (x) != MEM) - abort (); - x = XEXP (x, 0); - if (GET_CODE (x) != SYMBOL_REF) - abort (); - fnname = alpha_strip_name_encoding (XSTR (x, 0)); - - len = strlen (fnname); - if (len + SSIB_PREFIX_LEN > 255) - len = 255 - SSIB_PREFIX_LEN; - - strcpy (name, SSIB_PREFIX); - strncpy (name + SSIB_PREFIX_LEN, fnname, len); - name[len + SSIB_PREFIX_LEN] = 0; - - return name; -} - /* Output the static subroutine information block for the current function. */ static void -unicosmk_output_ssib (file, fnname) - FILE *file; - const char *fnname; +unicosmk_output_ssib (FILE *file, const char *fnname) { int len; int i; @@ -9889,14 +9753,12 @@ unicosmk_output_ssib (file, fnname) for (x = machine->first_ciw; x; x = XEXP (x, 1)) { ciw = XEXP (x, 0); - fprintf (file, "\t.quad\t"); #if HOST_BITS_PER_WIDE_INT == 32 - fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, + fprintf (file, "\t.quad\t" HOST_WIDE_INT_PRINT_DOUBLE_HEX "\n", CONST_DOUBLE_HIGH (ciw), CONST_DOUBLE_LOW (ciw)); #else - fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (ciw)); + fprintf (file, "\t.quad\t" HOST_WIDE_INT_PRINT_HEX "\n", INTVAL (ciw)); #endif - fprintf (file, "\n"); } } @@ -9906,8 +9768,7 @@ unicosmk_output_ssib (file, fnname) X is a CONST_INT or CONST_DOUBLE representing the CIW. */ rtx -unicosmk_add_call_info_word (x) - rtx x; +unicosmk_add_call_info_word (rtx x) { rtx node; struct machine_function *machine = cfun->machine; @@ -9922,13 +9783,13 @@ unicosmk_add_call_info_word (x) ++machine->ciw_count; return GEN_INT (machine->ciw_count - + strlen (current_function_name)/8 + 5); + + strlen (current_function_name ())/8 + 5); } static char unicosmk_section_buf[100]; char * -unicosmk_text_section () +unicosmk_text_section (void) { static int count = 0; sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@text___%d,code", @@ -9937,7 +9798,7 @@ unicosmk_text_section () } char * -unicosmk_data_section () +unicosmk_data_section (void) { static int count = 1; sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@data___%d,data", @@ -9953,6 +9814,7 @@ unicosmk_data_section () /* List of identifiers for which an extern declaration might have to be emitted. */ +/* FIXME: needs to use GC, so it can be saved and restored for PCH. */ struct unicosmk_extern_list { @@ -9965,8 +9827,7 @@ static struct unicosmk_extern_list *unicosmk_extern_head = 0; /* Output extern declarations which are required for every asm file. */ static void -unicosmk_output_default_externs (file) - FILE *file; +unicosmk_output_default_externs (FILE *file) { static const char *const externs[] = { "__T3E_MISMATCH" }; @@ -9984,8 +9845,7 @@ unicosmk_output_default_externs (file) referenced but not defined. */ static void -unicosmk_output_externs (file) - FILE *file; +unicosmk_output_externs (FILE *file) { struct unicosmk_extern_list *p; const char *real_name; @@ -9998,7 +9858,7 @@ unicosmk_output_externs (file) /* We have to strip the encoding and possibly remove user_label_prefix from the identifier in order to handle -fleading-underscore and explicit asm names correctly (cf. gcc.dg/asm-names-1.c). */ - real_name = alpha_strip_name_encoding (p->name); + real_name = default_strip_name_encoding (p->name); if (len && p->name[0] == '*' && !memcmp (real_name, user_label_prefix, len)) real_name += len; @@ -10017,8 +9877,7 @@ unicosmk_output_externs (file) /* Record an extern. */ void -unicosmk_add_extern (name) - const char *name; +unicosmk_add_extern (const char *name) { struct unicosmk_extern_list *p; @@ -10035,6 +9894,7 @@ unicosmk_add_extern (name) /* Structure to collect identifiers which have been replaced by DEX expressions. */ +/* FIXME: needs to use GC, so it can be saved and restored for PCH. */ struct unicosmk_dex { struct unicosmk_dex *next; @@ -10053,8 +9913,7 @@ static int unicosmk_dex_count = 0; /* Check if NAME must be replaced by a DEX expression. */ static int -unicosmk_special_name (name) - const char *name; +unicosmk_special_name (const char *name) { if (name[0] == '*') ++name; @@ -10083,8 +9942,7 @@ unicosmk_special_name (name) otherwise. */ static int -unicosmk_need_dex (x) - rtx x; +unicosmk_need_dex (rtx x) { struct unicosmk_dex *dex; const char *name; @@ -10117,8 +9975,7 @@ unicosmk_need_dex (x) /* Output the DEX definitions for this file. */ static void -unicosmk_output_dex (file) - FILE *file; +unicosmk_output_dex (FILE *file) { struct unicosmk_dex *dex; int i; @@ -10140,39 +9997,264 @@ unicosmk_output_dex (file) fprintf (file, "\t.dexend\n"); } +/* Output text that to appear at the beginning of an assembler file. */ + +static void +unicosmk_file_start (void) +{ + int i; + + fputs ("\t.ident\t", asm_out_file); + unicosmk_output_module_name (asm_out_file); + fputs ("\n\n", asm_out_file); + + /* The Unicos/Mk assembler uses different register names. Instead of trying + to support them, we simply use micro definitions. */ + + /* CAM has different register names: rN for the integer register N and fN + for the floating-point register N. Instead of trying to use these in + alpha.md, we define the symbols $N and $fN to refer to the appropriate + register. */ + + for (i = 0; i < 32; ++i) + fprintf (asm_out_file, "$%d <- r%d\n", i, i); + + for (i = 0; i < 32; ++i) + fprintf (asm_out_file, "$f%d <- f%d\n", i, i); + + putc ('\n', asm_out_file); + + /* The .align directive fill unused space with zeroes which does not work + in code sections. We define the macro 'gcc@code@align' which uses nops + instead. Note that it assumes that code sections always have the + biggest possible alignment since . refers to the current offset from + the beginning of the section. */ + + fputs ("\t.macro gcc@code@align n\n", asm_out_file); + fputs ("gcc@n@bytes = 1 << n\n", asm_out_file); + fputs ("gcc@here = . % gcc@n@bytes\n", asm_out_file); + fputs ("\t.if ne, gcc@here, 0\n", asm_out_file); + fputs ("\t.repeat (gcc@n@bytes - gcc@here) / 4\n", asm_out_file); + fputs ("\tbis r31,r31,r31\n", asm_out_file); + fputs ("\t.endr\n", asm_out_file); + fputs ("\t.endif\n", asm_out_file); + fputs ("\t.endm gcc@code@align\n\n", asm_out_file); + + /* Output extern declarations which should always be visible. */ + unicosmk_output_default_externs (asm_out_file); + + /* Open a dummy section. We always need to be inside a section for the + section-switching code to work correctly. + ??? This should be a module id or something like that. I still have to + figure out what the rules for those are. */ + fputs ("\n\t.psect\t$SG00000,data\n", asm_out_file); +} + +/* Output text to appear at the end of an assembler file. This includes all + pending extern declarations and DEX expressions. */ + +static void +unicosmk_file_end (void) +{ + fputs ("\t.endp\n\n", asm_out_file); + + /* Output all pending externs. */ + + unicosmk_output_externs (asm_out_file); + + /* Output dex definitions used for functions whose names conflict with + register names. */ + + unicosmk_output_dex (asm_out_file); + + fputs ("\t.end\t", asm_out_file); + unicosmk_output_module_name (asm_out_file); + putc ('\n', asm_out_file); +} + #else static void -unicosmk_output_deferred_case_vectors (file) - FILE *file ATTRIBUTE_UNUSED; +unicosmk_output_deferred_case_vectors (FILE *file ATTRIBUTE_UNUSED) {} static void -unicosmk_gen_dsib (imaskP) - unsigned long * imaskP ATTRIBUTE_UNUSED; +unicosmk_gen_dsib (unsigned long *imaskP ATTRIBUTE_UNUSED) {} static void -unicosmk_output_ssib (file, fnname) - FILE * file ATTRIBUTE_UNUSED; - const char * fnname ATTRIBUTE_UNUSED; +unicosmk_output_ssib (FILE * file ATTRIBUTE_UNUSED, + const char * fnname ATTRIBUTE_UNUSED) {} rtx -unicosmk_add_call_info_word (x) - rtx x ATTRIBUTE_UNUSED; +unicosmk_add_call_info_word (rtx x ATTRIBUTE_UNUSED) { return NULL_RTX; } static int -unicosmk_need_dex (x) - rtx x ATTRIBUTE_UNUSED; +unicosmk_need_dex (rtx x ATTRIBUTE_UNUSED) { return 0; } #endif /* TARGET_ABI_UNICOSMK */ +static void +alpha_init_libfuncs (void) +{ + if (TARGET_ABI_UNICOSMK) + { + /* Prevent gcc from generating calls to __divsi3. */ + set_optab_libfunc (sdiv_optab, SImode, 0); + set_optab_libfunc (udiv_optab, SImode, 0); + + /* Use the functions provided by the system library + for DImode integer division. */ + set_optab_libfunc (sdiv_optab, DImode, "$sldiv"); + set_optab_libfunc (udiv_optab, DImode, "$uldiv"); + } + else if (TARGET_ABI_OPEN_VMS) + { + /* Use the VMS runtime library functions for division and + remainder. */ + set_optab_libfunc (sdiv_optab, SImode, "OTS$DIV_I"); + set_optab_libfunc (sdiv_optab, DImode, "OTS$DIV_L"); + set_optab_libfunc (udiv_optab, SImode, "OTS$DIV_UI"); + set_optab_libfunc (udiv_optab, DImode, "OTS$DIV_UL"); + set_optab_libfunc (smod_optab, SImode, "OTS$REM_I"); + set_optab_libfunc (smod_optab, DImode, "OTS$REM_L"); + set_optab_libfunc (umod_optab, SImode, "OTS$REM_UI"); + set_optab_libfunc (umod_optab, DImode, "OTS$REM_UL"); + } +} + + +/* Initialize the GCC target structure. */ +#if TARGET_ABI_OPEN_VMS +# undef TARGET_ATTRIBUTE_TABLE +# define TARGET_ATTRIBUTE_TABLE vms_attribute_table +# undef TARGET_SECTION_TYPE_FLAGS +# define TARGET_SECTION_TYPE_FLAGS vms_section_type_flags +#endif + +#undef TARGET_IN_SMALL_DATA_P +#define TARGET_IN_SMALL_DATA_P alpha_in_small_data_p + +#if TARGET_ABI_UNICOSMK +# undef TARGET_INSERT_ATTRIBUTES +# define TARGET_INSERT_ATTRIBUTES unicosmk_insert_attributes +# undef TARGET_SECTION_TYPE_FLAGS +# define TARGET_SECTION_TYPE_FLAGS unicosmk_section_type_flags +# undef TARGET_ASM_UNIQUE_SECTION +# define TARGET_ASM_UNIQUE_SECTION unicosmk_unique_section +# undef TARGET_ASM_GLOBALIZE_LABEL +# define TARGET_ASM_GLOBALIZE_LABEL hook_void_FILEptr_constcharptr +#endif + +#undef TARGET_ASM_ALIGNED_HI_OP +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.quad\t" + +/* Default unaligned ops are provided for ELF systems. To get unaligned + data for non-ELF systems, we have to turn off auto alignment. */ +#ifndef OBJECT_FORMAT_ELF +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.word\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.align 0\n\t.long\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.align 0\n\t.quad\t" +#endif + +#ifdef OBJECT_FORMAT_ELF +#undef TARGET_ASM_SELECT_RTX_SECTION +#define TARGET_ASM_SELECT_RTX_SECTION alpha_elf_select_rtx_section +#endif + +#undef TARGET_ASM_FUNCTION_END_PROLOGUE +#define TARGET_ASM_FUNCTION_END_PROLOGUE alpha_output_function_end_prologue + +#undef TARGET_INIT_LIBFUNCS +#define TARGET_INIT_LIBFUNCS alpha_init_libfuncs + +#if TARGET_ABI_UNICOSMK +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START unicosmk_file_start +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END unicosmk_file_end +#else +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START alpha_file_start +#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true +#endif + +#undef TARGET_SCHED_ADJUST_COST +#define TARGET_SCHED_ADJUST_COST alpha_adjust_cost +#undef TARGET_SCHED_ISSUE_RATE +#define TARGET_SCHED_ISSUE_RATE alpha_issue_rate +#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE +#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \ + alpha_use_dfa_pipeline_interface +#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD +#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD \ + alpha_multipass_dfa_lookahead + +#undef TARGET_HAVE_TLS +#define TARGET_HAVE_TLS HAVE_AS_TLS + +#undef TARGET_INIT_BUILTINS +#define TARGET_INIT_BUILTINS alpha_init_builtins +#undef TARGET_EXPAND_BUILTIN +#define TARGET_EXPAND_BUILTIN alpha_expand_builtin + +#undef TARGET_FUNCTION_OK_FOR_SIBCALL +#define TARGET_FUNCTION_OK_FOR_SIBCALL alpha_function_ok_for_sibcall +#undef TARGET_CANNOT_COPY_INSN_P +#define TARGET_CANNOT_COPY_INSN_P alpha_cannot_copy_insn_p + +#if TARGET_ABI_OSF +#undef TARGET_ASM_OUTPUT_MI_THUNK +#define TARGET_ASM_OUTPUT_MI_THUNK alpha_output_mi_thunk_osf +#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK +#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true +#endif + +#undef TARGET_RTX_COSTS +#define TARGET_RTX_COSTS alpha_rtx_costs +#undef TARGET_ADDRESS_COST +#define TARGET_ADDRESS_COST hook_int_rtx_0 + +#undef TARGET_MACHINE_DEPENDENT_REORG +#define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg + +#undef TARGET_PROMOTE_FUNCTION_ARGS +#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true +#undef TARGET_PROMOTE_FUNCTION_RETURN +#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true +#undef TARGET_PROMOTE_PROTOTYPES +#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false +#undef TARGET_STRUCT_VALUE_RTX +#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null +#undef TARGET_RETURN_IN_MEMORY +#define TARGET_RETURN_IN_MEMORY alpha_return_in_memory +#undef TARGET_SETUP_INCOMING_VARARGS +#define TARGET_SETUP_INCOMING_VARARGS alpha_setup_incoming_varargs +#undef TARGET_STRICT_ARGUMENT_NAMING +#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true +#undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED +#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED hook_bool_CUMULATIVE_ARGS_true +#undef TARGET_SPLIT_COMPLEX_ARG +#define TARGET_SPLIT_COMPLEX_ARG alpha_split_complex_arg + +#undef TARGET_BUILD_BUILTIN_VA_LIST +#define TARGET_BUILD_BUILTIN_VA_LIST alpha_build_builtin_va_list + +struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-alpha.h" diff --git a/contrib/gcc/config/i386/i386.md b/contrib/gcc/config/i386/i386.md index e4377a5b0a57..a190d23378f0 100644 --- a/contrib/gcc/config/i386/i386.md +++ b/contrib/gcc/config/i386/i386.md @@ -1,24 +1,24 @@ ;; GCC machine description for IA-32 and x86-64. ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -;; 2001, 2002, 2003 +;; 2001, 2002, 2003, 2004 ;; Free Software Foundation, Inc. ;; Mostly by William Schelter. ;; x86_64 support added by Jan Hubicka ;; -;; This file is part of GNU CC. +;; This file is part of GCC. ;; -;; GNU CC is free software; you can redistribute it and/or modify +;; GCC is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; -;; GNU CC is distributed in the hope that it will be useful, +;; GCC is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License -;; along with GNU CC; see the file COPYING. If not, write to +;; along with GCC; see the file COPYING. If not, write to ;; the Free Software Foundation, 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. */ ;; @@ -27,9 +27,6 @@ ;; ;; See file "rtl.def" for documentation on define_insn, match_*, et. al. ;; -;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code -;; updates for most instructions. -;; ;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register ;; constraint letters. ;; @@ -66,7 +63,6 @@ (UNSPEC_INDNTPOFF 8) ; Prologue support - (UNSPEC_STACK_PROBE 10) (UNSPEC_STACK_ALLOC 11) (UNSPEC_SET_GOT 12) (UNSPEC_SSE_PROLOGUE_SAVE 13) @@ -80,7 +76,6 @@ (UNSPEC_SCAS 20) (UNSPEC_SIN 21) (UNSPEC_COS 22) - (UNSPEC_BSF 23) (UNSPEC_FNSTSW 24) (UNSPEC_SAHF 25) (UNSPEC_FSTCW 26) @@ -117,16 +112,28 @@ (UNSPEC_MOVSLDUP 75) (UNSPEC_LDQQU 76) (UNSPEC_MOVDDUP 77) + + ; x87 Floating point + (UNSPEC_FPATAN 65) + (UNSPEC_FYL2X 66) + (UNSPEC_FSCALE 67) + (UNSPEC_FRNDINT 68) + (UNSPEC_F2XM1 69) + + ; REP instruction + (UNSPEC_REP 75) ]) (define_constants [(UNSPECV_BLOCKAGE 0) + (UNSPECV_STACK_PROBE 10) (UNSPECV_EH_RETURN 13) (UNSPECV_EMMS 31) (UNSPECV_LDMXCSR 37) (UNSPECV_STMXCSR 40) (UNSPECV_FEMMS 46) (UNSPECV_CLFLUSH 57) + (UNSPECV_ALIGN 68) (UNSPECV_MONITOR 69) (UNSPECV_MWAIT 70) ]) @@ -142,8 +149,8 @@ ;; Processor type. This attribute must exactly match the processor_type ;; enumeration in i386.h. -(define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4" - (const (symbol_ref "ix86_cpu"))) +(define_attr "cpu" "i386,i486,pentium,pentiumpro,k6,athlon,pentium4,k8" + (const (symbol_ref "ix86_tune"))) ;; A basic instruction type. Refinements due to arguments to be ;; provided in other attributes. @@ -152,17 +159,17 @@ alu,alu1,negnot,imov,imovx,lea, incdec,ishift,ishift1,rotate,rotate1,imul,idiv, icmp,test,ibr,setcc,icmov, - push,pop,call,callv, + push,pop,call,callv,leave, str,cld, fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp, sselog,sseiadd,sseishft,sseimul, - sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv, + sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv, mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft" (const_string "other")) ;; Main data type used by the insn (define_attr "mode" - "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF" + "unknown,none,QI,HI,SI,DI,SF,DF,XF,TI,V4SF,V2DF,V2SF" (const_string "unknown")) ;; The CPU unit operations uses. @@ -170,7 +177,7 @@ (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp") (const_string "i387") (eq_attr "type" "sselog,sseiadd,sseishft,sseimul, - sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv") + sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,sseicvt,ssediv") (const_string "sse") (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft") (const_string "mmx") @@ -180,7 +187,7 @@ ;; The (bounding maximum) length of an instruction immediate. (define_attr "length_immediate" "" - (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv") + (cond [(eq_attr "type" "incdec,setcc,icmov,str,cld,lea,other,multi,idiv,leave") (const_int 0) (eq_attr "unit" "i387,sse,mmx") (const_int 0) @@ -234,17 +241,29 @@ ;; Set when 0f opcode prefix is used. (define_attr "prefix_0f" "" (if_then_else - (eq_attr "type" - "imovx,setcc,icmov, - sselog,sseiadd,sseishft,sseimul, - sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv, - mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft") + (ior (eq_attr "type" "imovx,setcc,icmov") + (eq_attr "unit" "sse,mmx")) (const_int 1) (const_int 0))) +;; Set when 0f opcode prefix is used. +(define_attr "prefix_rex" "" + (cond [(and (eq_attr "mode" "DI") + (eq_attr "type" "!push,pop,call,callv,leave,ibr")) + (const_int 1) + (and (eq_attr "mode" "QI") + (ne (symbol_ref "x86_extended_QIreg_mentioned_p (insn)") + (const_int 0))) + (const_int 1) + (ne (symbol_ref "x86_extended_reg_mentioned_p (insn)") + (const_int 0)) + (const_int 1) + ] + (const_int 0))) + ;; Set when modrm byte is used. (define_attr "modrm" "" - (cond [(eq_attr "type" "str,cld") + (cond [(eq_attr "type" "str,cld,leave") (const_int 0) (eq_attr "unit" "i387") (const_int 0) @@ -285,7 +304,8 @@ (attr "length_address")))] (plus (plus (attr "modrm") (plus (attr "prefix_0f") - (const_int 1))) + (plus (attr "prefix_rex") + (const_int 1)))) (plus (attr "prefix_rep") (plus (attr "prefix_data16") (plus (attr "length_immediate") @@ -300,17 +320,21 @@ (const_string "unknown") (eq_attr "type" "lea,fcmov,fpspc,cld") (const_string "none") - (eq_attr "type" "fistp") + (eq_attr "type" "fistp,leave") (const_string "both") (eq_attr "type" "push") (if_then_else (match_operand 1 "memory_operand" "") (const_string "both") (const_string "store")) - (eq_attr "type" "pop,setcc") + (eq_attr "type" "pop") (if_then_else (match_operand 0 "memory_operand" "") (const_string "both") (const_string "load")) - (eq_attr "type" "icmp,test,ssecmp,mmxcmp,fcmp") + (eq_attr "type" "setcc") + (if_then_else (match_operand 0 "memory_operand" "") + (const_string "store") + (const_string "none")) + (eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp") (if_then_else (ior (match_operand 0 "memory_operand" "") (match_operand 1 "memory_operand" "")) (const_string "load") @@ -327,7 +351,7 @@ (if_then_else (match_operand 1 "constant_call_address_operand" "") (const_string "none") (const_string "load")) - (and (eq_attr "type" "alu1,negnot") + (and (eq_attr "type" "alu1,negnot,ishift1") (match_operand 1 "memory_operand" "")) (const_string "both") (and (match_operand 0 "memory_operand" "") @@ -338,10 +362,10 @@ (match_operand 1 "memory_operand" "") (const_string "load") (and (eq_attr "type" - "!alu1,negnot, + "!alu1,negnot,ishift1, imov,imovx,icmp,test, fmov,fcmp,fsgn, - sse,ssemov,ssecmp,ssecvt, + sse,ssemov,ssecmp,ssecomi,ssecvt,sseicvt, mmx,mmxmov,mmxcmp,mmxcvt") (match_operand 2 "memory_operand" "")) (const_string "load") @@ -692,17 +716,6 @@ [(set (reg:CC 17) (compare:CC (match_operand:XF 0 "cmp_fp_expander_operand" "") (match_operand:XF 1 "cmp_fp_expander_operand" "")))] - "!TARGET_64BIT && TARGET_80387" -{ - ix86_compare_op0 = operands[0]; - ix86_compare_op1 = operands[1]; - DONE; -}) - -(define_expand "cmptf" - [(set (reg:CC 17) - (compare:CC (match_operand:TF 0 "cmp_fp_expander_operand" "") - (match_operand:TF 1 "cmp_fp_expander_operand" "")))] "TARGET_80387" { ix86_compare_op0 = operands[0]; @@ -766,7 +779,13 @@ return "ftst\;fnstsw\t%0"; } [(set_attr "type" "multi") - (set_attr "mode" "unknownfp")]) + (set (attr "mode") + (cond [(match_operand:SF 1 "" "") + (const_string "SF") + (match_operand:DF 1 "" "") + (const_string "DF") + ] + (const_string "XF")))]) ;; We may not use "#" to split and emit these, since the REG_DEAD notes ;; used to manage the reg stack popping would not be preserved. @@ -820,16 +839,6 @@ (compare:CCFP (match_operand:XF 0 "register_operand" "f") (match_operand:XF 1 "register_operand" "f")))] - "!TARGET_64BIT && TARGET_80387" - "* return output_fp_compare (insn, operands, 0, 0);" - [(set_attr "type" "fcmp") - (set_attr "mode" "XF")]) - -(define_insn "*cmpfp_2_tf" - [(set (reg:CCFP 18) - (compare:CCFP - (match_operand:TF 0 "register_operand" "f") - (match_operand:TF 1 "register_operand" "f")))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "fcmp") @@ -842,18 +851,6 @@ (match_operand:XF 1 "register_operand" "f") (match_operand:XF 2 "register_operand" "f"))] UNSPEC_FNSTSW))] - "!TARGET_64BIT && TARGET_80387" - "* return output_fp_compare (insn, operands, 2, 0);" - [(set_attr "type" "multi") - (set_attr "mode" "XF")]) - -(define_insn "*cmpfp_2_tf_1" - [(set (match_operand:HI 0 "register_operand" "=a") - (unspec:HI - [(compare:CCFP - (match_operand:TF 1 "register_operand" "f") - (match_operand:TF 2 "register_operand" "f"))] - UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 2, 0);" [(set_attr "type" "multi") @@ -869,7 +866,13 @@ && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 0, 1);" [(set_attr "type" "fcmp") - (set_attr "mode" "unknownfp")]) + (set (attr "mode") + (cond [(match_operand:SF 1 "" "") + (const_string "SF") + (match_operand:DF 1 "" "") + (const_string "DF") + ] + (const_string "XF")))]) (define_insn "*cmpfp_2u_1" [(set (match_operand:HI 0 "register_operand" "=a") @@ -883,7 +886,13 @@ && GET_MODE (operands[1]) == GET_MODE (operands[2])" "* return output_fp_compare (insn, operands, 2, 1);" [(set_attr "type" "multi") - (set_attr "mode" "unknownfp")]) + (set (attr "mode") + (cond [(match_operand:SF 1 "" "") + (const_string "SF") + (match_operand:DF 1 "" "") + (const_string "DF") + ] + (const_string "XF")))]) ;; Patterns to match the SImode-in-memory ficom instructions. ;; @@ -923,7 +932,7 @@ ;; FP compares, step 2 ;; Move the fpsw to ax. -(define_insn "x86_fnstsw_1" +(define_insn "*x86_fnstsw_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(reg 18)] UNSPEC_FNSTSW))] "TARGET_80387" @@ -958,7 +967,13 @@ && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "fcmp") - (set_attr "mode" "unknownfp") + (set (attr "mode") + (cond [(match_operand:SF 1 "" "") + (const_string "SF") + (match_operand:DF 1 "" "") + (const_string "DF") + ] + (const_string "XF"))) (set_attr "athlon_decode" "vector")]) (define_insn "*cmpfp_i_sse" @@ -969,8 +984,11 @@ && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" - [(set_attr "type" "fcmp,ssecmp") - (set_attr "mode" "unknownfp") + [(set_attr "type" "fcmp,ssecomi") + (set (attr "mode") + (if_then_else (match_operand:SF 1 "" "") + (const_string "SF") + (const_string "DF"))) (set_attr "athlon_decode" "vector")]) (define_insn "*cmpfp_i_sse_only" @@ -980,8 +998,11 @@ "SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" - [(set_attr "type" "ssecmp") - (set_attr "mode" "unknownfp") + [(set_attr "type" "ssecomi") + (set (attr "mode") + (if_then_else (match_operand:SF 1 "" "") + (const_string "SF") + (const_string "DF"))) (set_attr "athlon_decode" "vector")]) (define_insn "*cmpfp_iu" @@ -994,7 +1015,13 @@ && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 1);" [(set_attr "type" "fcmp") - (set_attr "mode" "unknownfp") + (set (attr "mode") + (cond [(match_operand:SF 1 "" "") + (const_string "SF") + (match_operand:DF 1 "" "") + (const_string "DF") + ] + (const_string "XF"))) (set_attr "athlon_decode" "vector")]) (define_insn "*cmpfp_iu_sse" @@ -1005,8 +1032,11 @@ && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 1);" - [(set_attr "type" "fcmp,ssecmp") - (set_attr "mode" "unknownfp") + [(set_attr "type" "fcmp,ssecomi") + (set (attr "mode") + (if_then_else (match_operand:SF 1 "" "") + (const_string "SF") + (const_string "DF"))) (set_attr "athlon_decode" "vector")]) (define_insn "*cmpfp_iu_sse_only" @@ -1016,8 +1046,11 @@ "SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 1);" - [(set_attr "type" "ssecmp") - (set_attr "mode" "unknownfp") + [(set_attr "type" "ssecomi") + (set (attr "mode") + (if_then_else (match_operand:SF 1 "" "") + (const_string "SF") + (const_string "DF"))) (set_attr "athlon_decode" "vector")]) ;; Move instructions. @@ -1095,13 +1128,13 @@ [(set_attr "type" "alu1") (set_attr "mode" "SI") (set_attr "length_immediate" "0")]) - + (define_insn "*movsi_or" [(set (match_operand:SI 0 "register_operand" "=r") (match_operand:SI 1 "immediate_operand" "i")) (clobber (reg:CC 17))] - "reload_completed && GET_CODE (operands[1]) == CONST_INT - && INTVAL (operands[1]) == -1 + "reload_completed + && operands[1] == constm1_rtx && (TARGET_PENTIUM || optimize_size)" { operands[1] = constm1_rtx; @@ -1112,9 +1145,10 @@ (set_attr "length_immediate" "1")]) (define_insn "*movsi_1" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!rm,!*y,!*Y,!*Y,!rm") - (match_operand:SI 1 "general_operand" "rinm,rin,rm,*y,*y,*Y,rm,*Y"))] - "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM" + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!rm,!*y,!*Y,!rm,!*Y") + (match_operand:SI 1 "general_operand" "rinm,rin,*y,*y,rm,*Y,*Y,rm"))] + "(TARGET_INTER_UNIT_MOVES || optimize_size) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { switch (get_attr_type (insn)) { @@ -1147,9 +1181,48 @@ (const_string "lea") ] (const_string "imov"))) - (set_attr "mode" "SI,SI,SI,SI,DI,TI,SI,SI")]) + (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")]) -;; Stores and loads of ax to arbitary constant address. +(define_insn "*movsi_1_nointernunit" + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,!*y,!m,!*y,!*Y,!m,!*Y") + (match_operand:SI 1 "general_operand" "rinm,rin,*y,*y,m,*Y,*Y,m"))] + "(!TARGET_INTER_UNIT_MOVES && !optimize_size) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" +{ + switch (get_attr_type (insn)) + { + case TYPE_SSEMOV: + if (get_attr_mode (insn) == MODE_TI) + return "movdqa\t{%1, %0|%0, %1}"; + return "movd\t{%1, %0|%0, %1}"; + + case TYPE_MMXMOV: + if (get_attr_mode (insn) == MODE_DI) + return "movq\t{%1, %0|%0, %1}"; + return "movd\t{%1, %0|%0, %1}"; + + case TYPE_LEA: + return "lea{l}\t{%1, %0|%0, %1}"; + + default: + if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1])) + abort(); + return "mov{l}\t{%1, %0|%0, %1}"; + } +} + [(set (attr "type") + (cond [(eq_attr "alternative" "2,3,4") + (const_string "mmxmov") + (eq_attr "alternative" "5,6,7") + (const_string "ssemov") + (and (ne (symbol_ref "flag_pic") (const_int 0)) + (match_operand:SI 1 "symbolic_operand" "")) + (const_string "lea") + ] + (const_string "imov"))) + (set_attr "mode" "SI,SI,DI,SI,SI,TI,SI,SI")]) + +;; Stores and loads of ax to arbitrary constant address. ;; We fake an second form of instruction to force reload to load address ;; into register when rax is not available (define_insn "*movabssi_1_rex64" @@ -1268,7 +1341,7 @@ ] (const_string "HI")))]) -;; Stores and loads of ax to arbitary constant address. +;; Stores and loads of ax to arbitrary constant address. ;; We fake an second form of instruction to force reload to load address ;; into register when rax is not available (define_insn "*movabshi_1_rex64" @@ -1586,7 +1659,7 @@ (const_string "SI") (const_string "QI")))]) -;; Stores and loads of ax to arbitary constant address. +;; Stores and loads of ax to arbitrary constant address. ;; We fake an second form of instruction to force reload to load address ;; into register when rax is not available (define_insn "*movabsqi_1_rex64" @@ -1690,11 +1763,11 @@ [(set_attr "type" "imov") (set_attr "mode" "QI")]) -(define_insn "*movsi_insv_1_rex64" - [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q") +(define_insn "movdi_insv_1_rex64" + [(set (zero_extract:DI (match_operand 0 "ext_register_operand" "+Q") (const_int 8) (const_int 8)) - (match_operand:SI 1 "nonmemory_operand" "Qn"))] + (match_operand:DI 1 "nonmemory_operand" "Qn"))] "TARGET_64BIT" "mov{b}\t{%b1, %h0|%h0, %b1}" [(set_attr "type" "imov") @@ -1704,9 +1777,8 @@ [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q") (const_int 8) (const_int 8)) - (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q") - (const_int 8)) - (const_int 255)))] + (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q") + (const_int 8)))] "" "mov{b}\t{%h1, %h0|%h0, %h1}" [(set_attr "type" "imov") @@ -1824,8 +1896,7 @@ (clobber (reg:CC 17))] "TARGET_64BIT && (TARGET_PENTIUM || optimize_size) && reload_completed - && GET_CODE (operands[1]) == CONST_INT - && INTVAL (operands[1]) == -1" + && operands[1] == constm1_rtx" { operands[1] = constm1_rtx; return "or{q}\t{%1, %0|%0, %1}"; @@ -1869,16 +1940,66 @@ "ix86_split_long_move (operands); DONE;") (define_insn "*movdi_1_rex64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!m*y,!*y,!*Y,!m,!*Y") - (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,m,*Y,*Y,*m"))] + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!rm,!*y,!*Y,!rm,!*Y") + (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,rm,*Y,*Y,rm"))] "TARGET_64BIT + && (TARGET_INTER_UNIT_MOVES || optimize_size) && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { switch (get_attr_type (insn)) { case TYPE_SSEMOV: - if (register_operand (operands[0], DImode) - && register_operand (operands[1], DImode)) + if (get_attr_mode (insn) == MODE_TI) + return "movdqa\t{%1, %0|%0, %1}"; + /* FALLTHRU */ + case TYPE_MMXMOV: + /* Moves from and into integer register is done using movd opcode with + REX prefix. */ + if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) + return "movd\t{%1, %0|%0, %1}"; + return "movq\t{%1, %0|%0, %1}"; + case TYPE_MULTI: + return "#"; + case TYPE_LEA: + return "lea{q}\t{%a1, %0|%0, %a1}"; + default: + if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1])) + abort (); + if (get_attr_mode (insn) == MODE_SI) + return "mov{l}\t{%k1, %k0|%k0, %k1}"; + else if (which_alternative == 2) + return "movabs{q}\t{%1, %0|%0, %1}"; + else + return "mov{q}\t{%1, %0|%0, %1}"; + } +} + [(set (attr "type") + (cond [(eq_attr "alternative" "5,6,7") + (const_string "mmxmov") + (eq_attr "alternative" "8,9,10") + (const_string "ssemov") + (eq_attr "alternative" "4") + (const_string "multi") + (and (ne (symbol_ref "flag_pic") (const_int 0)) + (match_operand:DI 1 "symbolic_operand" "")) + (const_string "lea") + ] + (const_string "imov"))) + (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*") + (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*") + (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")]) + +(define_insn "*movdi_1_rex64_nointerunit" + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,mr,!mr,!*y,!m,!*y,!*Y,!m,!*Y") + (match_operand:DI 1 "general_operand" "Z,rem,i,re,n,*y,*y,m,*Y,*Y,m"))] + "TARGET_64BIT + && (!TARGET_INTER_UNIT_MOVES && !optimize_size) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" +{ + switch (get_attr_type (insn)) + { + case TYPE_SSEMOV: + if (get_attr_mode (insn) == MODE_TI) return "movdqa\t{%1, %0|%0, %1}"; /* FALLTHRU */ case TYPE_MMXMOV: @@ -1899,9 +2020,9 @@ } } [(set (attr "type") - (cond [(eq_attr "alternative" "5,6") + (cond [(eq_attr "alternative" "5,6,7") (const_string "mmxmov") - (eq_attr "alternative" "7,8,9") + (eq_attr "alternative" "8,9,10") (const_string "ssemov") (eq_attr "alternative" "4") (const_string "multi") @@ -1910,11 +2031,11 @@ (const_string "lea") ] (const_string "imov"))) - (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*") - (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*") - (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI")]) + (set_attr "modrm" "*,0,0,*,*,*,*,*,*,*,*") + (set_attr "length_immediate" "*,4,8,*,*,*,*,*,*,*,*") + (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,TI,DI,DI")]) -;; Stores and loads of ax to arbitary constant address. +;; Stores and loads of ax to arbitrary constant address. ;; We fake an second form of instruction to force reload to load address ;; into register when rax is not available (define_insn "*movabsdi_1_rex64" @@ -2007,22 +2128,11 @@ { switch (which_alternative) { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (4); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - case 1: return "push{l}\t%1"; - case 2: - return "#"; default: + /* This insn should be already split before reg-stack. */ abort (); } } @@ -2036,23 +2146,11 @@ { switch (which_alternative) { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (8); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - case 1: return "push{q}\t%q1"; - case 2: - return "#"; - default: + /* This insn should be already split before reg-stack. */ abort (); } } @@ -2089,7 +2187,8 @@ (define_insn "*movsf_1" [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!rm,!*y") (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,rm,*y,*y"))] - "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) + "(TARGET_INTER_UNIT_MOVES || optimize_size) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE @@ -2113,25 +2212,18 @@ return "fst%z0\t%y0"; case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - abort(); + return standard_80387_constant_opcode (operands[1]); case 3: case 4: return "mov{l}\t{%1, %0|%0, %1}"; case 5: - if (TARGET_SSE2 && !TARGET_ATHLON) + if (get_attr_mode (insn) == MODE_TI) return "pxor\t%0, %0"; else return "xorps\t%0, %0"; case 6: - if (TARGET_PARTIAL_REG_DEPENDENCY) + if (get_attr_mode (insn) == MODE_V4SF) return "movaps\t{%1, %0|%0, %1}"; else return "movss\t{%1, %0|%0, %1}"; @@ -2151,7 +2243,139 @@ } } [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov") - (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI,DI")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "3,4,9,10") + (const_string "SI") + (eq_attr "alternative" "5") + (if_then_else + (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR") + (const_int 0)) + (ne (symbol_ref "TARGET_SSE2") + (const_int 0))) + (eq (symbol_ref "optimize_size") + (const_int 0))) + (const_string "TI") + (const_string "V4SF")) + /* For architectures resolving dependencies on + whole SSE registers use APS move to break dependency + chains, otherwise use short move to avoid extra work. + + Do the same for architectures resolving dependencies on + the parts. While in DF mode it is better to always handle + just register parts, the SF mode is different due to lack + of instructions to load just part of the register. It is + better to maintain the whole registers in single format + to avoid problems on using packed logical operations. */ + (eq_attr "alternative" "6") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY") + (const_int 0)) + (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS") + (const_int 0))) + (const_string "V4SF") + (const_string "SF")) + (eq_attr "alternative" "11") + (const_string "DI")] + (const_string "SF")))]) + +(define_insn "*movsf_1_nointerunit" + [(set (match_operand:SF 0 "nonimmediate_operand" "=f#xr,m,f#xr,r#xf,m,x#rf,x#rf,x#rf,m,!*y,!m,!*y") + (match_operand:SF 1 "general_operand" "fm#rx,f#rx,G,rmF#fx,Fr#fx,C,x,xm#rf,x#rf,m,*y,*y"))] + "(!TARGET_INTER_UNIT_MOVES && !optimize_size) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) + && (reload_in_progress || reload_completed + || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) + || GET_CODE (operands[1]) != CONST_DOUBLE + || memory_operand (operands[0], SFmode))" +{ + switch (which_alternative) + { + case 0: + if (REG_P (operands[1]) + && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + { + if (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } + else if (STACK_TOP_P (operands[0])) + return "fld%z1\t%y1"; + else + return "fst\t%y0"; + + case 1: + if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + return "fstp%z0\t%y0"; + else + return "fst%z0\t%y0"; + + case 2: + return standard_80387_constant_opcode (operands[1]); + + case 3: + case 4: + return "mov{l}\t{%1, %0|%0, %1}"; + case 5: + if (get_attr_mode (insn) == MODE_TI) + return "pxor\t%0, %0"; + else + return "xorps\t%0, %0"; + case 6: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movss\t{%1, %0|%0, %1}"; + case 7: + case 8: + return "movss\t{%1, %0|%0, %1}"; + + case 9: + case 10: + return "movd\t{%1, %0|%0, %1}"; + + case 11: + return "movq\t{%1, %0|%0, %1}"; + + default: + abort(); + } +} + [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov") + (set (attr "mode") + (cond [(eq_attr "alternative" "3,4,9,10") + (const_string "SI") + (eq_attr "alternative" "5") + (if_then_else + (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR") + (const_int 0)) + (ne (symbol_ref "TARGET_SSE2") + (const_int 0))) + (eq (symbol_ref "optimize_size") + (const_int 0))) + (const_string "TI") + (const_string "V4SF")) + /* For architectures resolving dependencies on + whole SSE registers use APS move to break dependency + chains, otherwise use short move to avoid extra work. + + Do the same for architectures resolving dependencies on + the parts. While in DF mode it is better to always handle + just register parts, the SF mode is different due to lack + of instructions to load just part of the register. It is + better to maintain the whole registers in single format + to avoid problems on using packed logical operations. */ + (eq_attr "alternative" "6") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY") + (const_int 0)) + (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS") + (const_int 0))) + (const_string "V4SF") + (const_string "SF")) + (eq_attr "alternative" "11") + (const_string "DI")] + (const_string "SF")))]) (define_insn "*swapsf" [(set (match_operand:SF 0 "register_operand" "+f") @@ -2175,7 +2399,7 @@ "ix86_expand_move (DFmode, operands); DONE;") ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size. -;; Size of pushdf using integer insturctions is 2+2*memory operand size +;; Size of pushdf using integer instructions is 2+2*memory operand size ;; On the average, pushdf using integers can be still shorter. Allow this ;; pattern for optimize_size too. @@ -2184,26 +2408,8 @@ (match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))] "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES" { - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (8); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - case 1: - case 2: - case 3: - return "#"; - - default: - abort (); - } + /* This insn should be already split before reg-stack. */ + abort (); } [(set_attr "type" "multi") (set_attr "mode" "DF,SI,SI,DF")]) @@ -2213,32 +2419,8 @@ (match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))] "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES" { - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (8); - if (TARGET_64BIT) - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - else - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - - case 1: - case 2: - return "#"; - - default: - abort (); - } + /* This insn should be already split before reg-stack. */ + abort (); } [(set_attr "type" "multi") (set_attr "mode" "DF,SI,DF")]) @@ -2275,7 +2457,7 @@ [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Y,m,f#Y,*r,o,Y#f,Y#f,Y#f,m") (match_operand:DF 1 "general_operand" "fm#Y,f#Y,G,*roF,F*r,C,Y#f,YHm#f,Y#f"))] "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && (optimize_size || !TARGET_INTEGER_DFMODE_MOVES) + && ((optimize_size || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT) && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE @@ -2286,7 +2468,12 @@ case 0: if (REG_P (operands[1]) && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; + { + if (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } else if (STACK_TOP_P (operands[0])) return "fld%z1\t%y1"; else @@ -2299,91 +2486,40 @@ return "fst%z0\t%y0"; case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - abort(); + return standard_80387_constant_opcode (operands[1]); case 3: case 4: return "#"; case 5: - if (TARGET_ATHLON) - return "xorpd\t%0, %0"; - else - return "pxor\t%0, %0"; - case 6: - if (TARGET_PARTIAL_REG_DEPENDENCY) - return "movapd\t{%1, %0|%0, %1}"; - else - return "movsd\t{%1, %0|%0, %1}"; - case 7: - case 8: - return "movsd\t{%1, %0|%0, %1}"; - - default: - abort(); - } -} - [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov") - (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")]) - -(define_insn "*movdf_integer" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Yr,m,f#Yr,r#Yf,o,Y#rf,Y#rf,Y#rf,m") - (match_operand:DF 1 "general_operand" "fm#Yr,f#Yr,G,roF#Yf,Fr#Yf,C,Y#rf,Ym#rf,Y#rf"))] - "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && !optimize_size && TARGET_INTEGER_DFMODE_MOVES - && (reload_in_progress || reload_completed - || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) - || GET_CODE (operands[1]) != CONST_DOUBLE - || memory_operand (operands[0], DFmode))" -{ - switch (which_alternative) - { - case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; - - case 1: - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0"; - else - return "fst%z0\t%y0"; - - case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; + switch (get_attr_mode (insn)) + { + case MODE_V4SF: + return "xorps\t%0, %0"; + case MODE_V2DF: + return "xorpd\t%0, %0"; + case MODE_TI: + return "pxor\t%0, %0"; + default: + abort (); } - abort(); - - case 3: - case 4: - return "#"; - - case 5: - if (TARGET_ATHLON) - return "xorpd\t%0, %0"; - else - return "pxor\t%0, %0"; case 6: - if (TARGET_PARTIAL_REG_DEPENDENCY) - return "movapd\t{%1, %0|%0, %1}"; + switch (get_attr_mode (insn)) + { + case MODE_V4SF: + return "movaps\t{%1, %0|%0, %1}"; + case MODE_V2DF: + return "movapd\t{%1, %0|%0, %1}"; + case MODE_DF: + return "movsd\t{%1, %0|%0, %1}"; + default: + abort (); + } + case 7: + if (get_attr_mode (insn) == MODE_V2DF) + return "movlpd\t{%1, %0|%0, %1}"; else return "movsd\t{%1, %0|%0, %1}"; - case 7: case 8: return "movsd\t{%1, %0|%0, %1}"; @@ -2392,7 +2528,155 @@ } } [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov") - (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "3,4") + (const_string "SI") + /* xorps is one byte shorter. */ + (eq_attr "alternative" "5") + (cond [(ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR") + (const_int 0)) + (const_string "TI")] + (const_string "V2DF")) + /* For architectures resolving dependencies on + whole SSE registers use APD move to break dependency + chains, otherwise use short move to avoid extra work. + + movaps encodes one byte shorter. */ + (eq_attr "alternative" "6") + (cond + [(ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY") + (const_int 0)) + (const_string "V2DF")] + (const_string "DF")) + /* For architectures resolving dependencies on register + parts we may avoid extra work to zero out upper part + of register. */ + (eq_attr "alternative" "7") + (if_then_else + (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS") + (const_int 0)) + (const_string "V2DF") + (const_string "DF"))] + (const_string "DF")))]) + +(define_insn "*movdf_integer" + [(set (match_operand:DF 0 "nonimmediate_operand" "=f#Yr,m,f#Yr,r#Yf,o,Y#rf,Y#rf,Y#rf,m") + (match_operand:DF 1 "general_operand" "fm#Yr,f#Yr,G,roF#Yf,Fr#Yf,C,Y#rf,Ym#rf,Y#rf"))] + "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) + && ((!optimize_size && TARGET_INTEGER_DFMODE_MOVES) || TARGET_64BIT) + && (reload_in_progress || reload_completed + || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) + || GET_CODE (operands[1]) != CONST_DOUBLE + || memory_operand (operands[0], DFmode))" +{ + switch (which_alternative) + { + case 0: + if (REG_P (operands[1]) + && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + { + if (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } + else if (STACK_TOP_P (operands[0])) + return "fld%z1\t%y1"; + else + return "fst\t%y0"; + + case 1: + if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + return "fstp%z0\t%y0"; + else + return "fst%z0\t%y0"; + + case 2: + return standard_80387_constant_opcode (operands[1]); + + case 3: + case 4: + return "#"; + + case 5: + switch (get_attr_mode (insn)) + { + case MODE_V4SF: + return "xorps\t%0, %0"; + case MODE_V2DF: + return "xorpd\t%0, %0"; + case MODE_TI: + return "pxor\t%0, %0"; + default: + abort (); + } + case 6: + switch (get_attr_mode (insn)) + { + case MODE_V4SF: + return "movaps\t{%1, %0|%0, %1}"; + case MODE_V2DF: + return "movapd\t{%1, %0|%0, %1}"; + case MODE_DF: + return "movsd\t{%1, %0|%0, %1}"; + default: + abort (); + } + case 7: + if (get_attr_mode (insn) == MODE_V2DF) + return "movlpd\t{%1, %0|%0, %1}"; + else + return "movsd\t{%1, %0|%0, %1}"; + case 8: + return "movsd\t{%1, %0|%0, %1}"; + + default: + abort(); + } +} + [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov") + (set (attr "mode") + (cond [(eq_attr "alternative" "3,4") + (const_string "SI") + /* xorps is one byte shorter. */ + (eq_attr "alternative" "5") + (cond [(ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR") + (const_int 0)) + (const_string "TI")] + (const_string "V2DF")) + /* For architectures resolving dependencies on + whole SSE registers use APD move to break dependency + chains, otherwise use short move to avoid extra work. + + movaps encodes one byte shorter. */ + (eq_attr "alternative" "6") + (cond + [(ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (ne (symbol_ref "TARGET_SSE_PARTIAL_REG_DEPENDENCY") + (const_int 0)) + (const_string "V2DF")] + (const_string "DF")) + /* For architectures resolving dependencies on register + parts we may avoid extra work to zero out upper part + of register. */ + (eq_attr "alternative" "7") + (if_then_else + (ne (symbol_ref "TARGET_SSE_PARTIAL_REGS") + (const_int 0)) + (const_string "V2DF") + (const_string "DF"))] + (const_string "DF")))]) (define_split [(set (match_operand:DF 0 "nonimmediate_operand" "") @@ -2426,17 +2710,11 @@ (define_expand "movxf" [(set (match_operand:XF 0 "nonimmediate_operand" "") (match_operand:XF 1 "general_operand" ""))] - "!TARGET_64BIT" + "" "ix86_expand_move (XFmode, operands); DONE;") -(define_expand "movtf" - [(set (match_operand:TF 0 "nonimmediate_operand" "") - (match_operand:TF 1 "general_operand" ""))] - "" - "ix86_expand_move (TFmode, operands); DONE;") - ;; Size of pushdf is 3 (for sub) + 2 (for fstp) + memory operand size. -;; Size of pushdf using integer insturctions is 3+3*memory operand size +;; Size of pushdf using integer instructions is 3+3*memory operand size ;; Pushing using integer instructions is longer except for constants ;; and direct memory references. ;; (assuming that any given constant is pushed only once, but this ought to be @@ -2445,55 +2723,10 @@ (define_insn "*pushxf_nointeger" [(set (match_operand:XF 0 "push_operand" "=X,X,X") (match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))] - "!TARGET_64BIT && optimize_size" -{ - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (12); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - case 1: - case 2: - return "#"; - - default: - abort (); - } -} - [(set_attr "type" "multi") - (set_attr "mode" "XF,SI,SI")]) - -(define_insn "*pushtf_nointeger" - [(set (match_operand:TF 0 "push_operand" "=<,<,<") - (match_operand:TF 1 "general_no_elim_operand" "f,Fo,*r"))] "optimize_size" { - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (16); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - case 1: - case 2: - return "#"; - - default: - abort (); - } + /* This insn should be already split before reg-stack. */ + abort (); } [(set_attr "type" "multi") (set_attr "mode" "XF,SI,SI")]) @@ -2501,59 +2734,10 @@ (define_insn "*pushxf_integer" [(set (match_operand:XF 0 "push_operand" "=<,<") (match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))] - "!TARGET_64BIT && !optimize_size" -{ - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (12); - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - case 1: - return "#"; - - default: - abort (); - } -} - [(set_attr "type" "multi") - (set_attr "mode" "XF,SI")]) - -(define_insn "*pushtf_integer" - [(set (match_operand:TF 0 "push_operand" "=<,<") - (match_operand:TF 1 "general_no_elim_operand" "f#r,rFo#f"))] "!optimize_size" { - switch (which_alternative) - { - case 0: - /* %%% We loose REG_DEAD notes for controling pops if we split late. */ - operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx); - operands[2] = stack_pointer_rtx; - operands[3] = GEN_INT (16); - if (TARGET_64BIT) - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - else - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0"; - else - return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0"; - - case 1: - return "#"; - - default: - abort (); - } + /* This insn should be already split before reg-stack. */ + abort (); } [(set_attr "type" "multi") (set_attr "mode" "XF,SI")]) @@ -2563,7 +2747,6 @@ (match_operand 1 "general_operand" ""))] "reload_completed && (GET_MODE (operands[0]) == XFmode - || GET_MODE (operands[0]) == TFmode || GET_MODE (operands[0]) == DFmode) && !ANY_FP_REG_P (operands[1])" [(const_int 0)] @@ -2573,29 +2756,23 @@ [(set (match_operand:XF 0 "push_operand" "") (match_operand:XF 1 "any_fp_register_operand" ""))] "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12))) - (set (mem:XF (reg:SI 7)) (match_dup 1))]) + [(set (reg:SI 7) (plus:SI (reg:SI 7) (match_dup 2))) + (set (mem:XF (reg:SI 7)) (match_dup 1))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") (define_split - [(set (match_operand:TF 0 "push_operand" "") - (match_operand:TF 1 "any_fp_register_operand" ""))] - "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:TF (reg:SI 7)) (match_dup 1))]) - -(define_split - [(set (match_operand:TF 0 "push_operand" "") - (match_operand:TF 1 "any_fp_register_operand" ""))] + [(set (match_operand:XF 0 "push_operand" "") + (match_operand:XF 1 "any_fp_register_operand" ""))] "TARGET_64BIT" - [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16))) - (set (mem:TF (reg:DI 7)) (match_dup 1))]) + [(set (reg:DI 7) (plus:DI (reg:DI 7) (match_dup 2))) + (set (mem:XF (reg:DI 7)) (match_dup 1))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") ;; Do not use integer registers when optimizing for size (define_insn "*movxf_nointeger" [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,*r,o") (match_operand:XF 1 "general_operand" "fm,f,G,*roF,F*r"))] - "!TARGET_64BIT - && optimize_size + "optimize_size && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && (reload_in_progress || reload_completed || GET_CODE (operands[1]) != CONST_DOUBLE @@ -2606,7 +2783,12 @@ case 0: if (REG_P (operands[1]) && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; + { + if (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } else if (STACK_TOP_P (operands[0])) return "fld%z1\t%y1"; else @@ -2621,61 +2803,7 @@ return "fstp%z0\t%y0"; case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - break; - - case 3: case 4: - return "#"; - } - abort(); -} - [(set_attr "type" "fmov,fmov,fmov,multi,multi") - (set_attr "mode" "XF,XF,XF,SI,SI")]) - -(define_insn "*movtf_nointeger" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m,f,*r,o") - (match_operand:TF 1 "general_operand" "fm,f,G,*roF,F*r"))] - "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && optimize_size - && (reload_in_progress || reload_completed - || GET_CODE (operands[1]) != CONST_DOUBLE - || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) - || memory_operand (operands[0], TFmode))" -{ - switch (which_alternative) - { - case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; - - case 1: - /* There is no non-popping store to memory for XFmode. So if - we need one, follow the store with a load. */ - if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0\;fld%z0\t%y0"; - else - return "fstp%z0\t%y0"; - - case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - break; + return standard_80387_constant_opcode (operands[1]); case 3: case 4: return "#"; @@ -2688,8 +2816,7 @@ (define_insn "*movxf_integer" [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o") (match_operand:XF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))] - "!TARGET_64BIT - && !optimize_size + "!optimize_size && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && (reload_in_progress || reload_completed || GET_CODE (operands[1]) != CONST_DOUBLE @@ -2700,7 +2827,12 @@ case 0: if (REG_P (operands[1]) && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; + { + if (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } else if (STACK_TOP_P (operands[0])) return "fld%z1\t%y1"; else @@ -2715,61 +2847,7 @@ return "fstp%z0\t%y0"; case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - break; - - case 3: case 4: - return "#"; - } - abort(); -} - [(set_attr "type" "fmov,fmov,fmov,multi,multi") - (set_attr "mode" "XF,XF,XF,SI,SI")]) - -(define_insn "*movtf_integer" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,m,f#r,r#f,o") - (match_operand:TF 1 "general_operand" "fm#r,f#r,G,roF#f,Fr#f"))] - "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && !optimize_size - && (reload_in_progress || reload_completed - || GET_CODE (operands[1]) != CONST_DOUBLE - || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) - || memory_operand (operands[0], TFmode))" -{ - switch (which_alternative) - { - case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; - - case 1: - /* There is no non-popping store to memory for XFmode. So if - we need one, follow the store with a load. */ - if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0\;fld%z0\t%y0"; - else - return "fstp%z0\t%y0"; - - case 2: - switch (standard_80387_constant_p (operands[1])) - { - case 1: - return "fldz"; - case 2: - return "fld1"; - } - break; + return standard_80387_constant_opcode (operands[1]); case 3: case 4: return "#"; @@ -2784,7 +2862,7 @@ (match_operand 1 "general_operand" ""))] "reload_completed && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode) + && GET_MODE (operands[0]) == XFmode && ! (ANY_FP_REG_P (operands[0]) || (GET_CODE (operands[0]) == SUBREG && ANY_FP_REG_P (SUBREG_REG (operands[0])))) @@ -2799,21 +2877,33 @@ (match_operand 1 "memory_operand" ""))] "reload_completed && GET_CODE (operands[1]) == MEM - && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == TFmode + && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode) && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF - && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0)) - && (!(SSE_REG_P (operands[0]) || - (GET_CODE (operands[0]) == SUBREG - && SSE_REG_P (SUBREG_REG (operands[0])))) - || standard_sse_constant_p (get_pool_constant (XEXP (operands[1], 0)))) - && (!(FP_REG_P (operands[0]) || - (GET_CODE (operands[0]) == SUBREG - && FP_REG_P (SUBREG_REG (operands[0])))) - || standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0))))" - [(set (match_dup 0) - (match_dup 1))] - "operands[1] = get_pool_constant (XEXP (operands[1], 0));") + && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))" + [(set (match_dup 0) (match_dup 1))] +{ + rtx c = get_pool_constant (XEXP (operands[1], 0)); + rtx r = operands[0]; + + if (GET_CODE (r) == SUBREG) + r = SUBREG_REG (r); + + if (SSE_REG_P (r)) + { + if (!standard_sse_constant_p (c)) + FAIL; + } + else if (FP_REG_P (r)) + { + if (!standard_80387_constant_p (c)) + FAIL; + } + else if (MMX_REG_P (r)) + FAIL; + + operands[1] = c; +}) (define_insn "swapxf" [(set (match_operand:XF 0 "register_operand" "+f") @@ -2829,21 +2919,6 @@ } [(set_attr "type" "fxch") (set_attr "mode" "XF")]) - -(define_insn "swaptf" - [(set (match_operand:TF 0 "register_operand" "+f") - (match_operand:TF 1 "register_operand" "+f")) - (set (match_dup 1) - (match_dup 0))] - "" -{ - if (STACK_TOP_P (operands[0])) - return "fxch\t%1"; - else - return "fxch\t%0"; -} - [(set_attr "type" "fxch") - (set_attr "mode" "XF")]) ;; Zero extension instructions @@ -3040,22 +3115,56 @@ ") (define_insn "zero_extendsidi2_32" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o") - (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r"))) + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,m,m"))) (clobber (reg:CC 17))] - "!TARGET_64BIT" - "#" - [(set_attr "mode" "SI")]) + "!TARGET_64BIT && !TARGET_INTER_UNIT_MOVES" + "@ + # + # + # + movd\t{%1, %0|%0, %1} + movd\t{%1, %0|%0, %1}" + [(set_attr "mode" "SI,SI,SI,DI,TI") + (set_attr "type" "multi,multi,multi,mmxmov,ssemov")]) + +(define_insn "*zero_extendsidi2_32_1" + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o,!?y,!?Y") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "0,rm,r,rm,rm"))) + (clobber (reg:CC 17))] + "!TARGET_64BIT && TARGET_INTER_UNIT_MOVES" + "@ + # + # + # + movd\t{%1, %0|%0, %1} + movd\t{%1, %0|%0, %1}" + [(set_attr "mode" "SI,SI,SI,DI,TI") + (set_attr "type" "multi,multi,multi,mmxmov,ssemov")]) (define_insn "zero_extendsidi2_rex64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o") - (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0")))] - "TARGET_64BIT" + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!?Y") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,m,m")))] + "TARGET_64BIT && !TARGET_INTER_UNIT_MOVES" "@ mov\t{%k1, %k0|%k0, %k1} - #" - [(set_attr "type" "imovx,imov") - (set_attr "mode" "SI,DI")]) + # + movd\t{%1, %0|%0, %1} + movd\t{%1, %0|%0, %1}" + [(set_attr "type" "imovx,imov,mmxmov,ssemov") + (set_attr "mode" "SI,DI,DI,TI")]) + +(define_insn "*zero_extendsidi2_rex64_1" + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,!?y,!*?") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "rm,0,rm,rm")))] + "TARGET_64BIT && TARGET_INTER_UNIT_MOVES" + "@ + mov\t{%k1, %k0|%k0, %k1} + # + movd\t{%1, %0|%0, %1} + movd\t{%1, %0|%0, %1}" + [(set_attr "type" "imovx,imov,mmxmov,ssemov") + (set_attr "mode" "SI,DI,SI,SI")]) (define_split [(set (match_operand:DI 0 "memory_operand" "") @@ -3077,7 +3186,8 @@ [(set (match_operand:DI 0 "nonimmediate_operand" "") (zero_extend:DI (match_operand:SI 1 "general_operand" ""))) (clobber (reg:CC 17))] - "!TARGET_64BIT && reload_completed" + "!TARGET_64BIT && reload_completed + && !SSE_REG_P (operands[0]) && !MMX_REG_P (operands[0])" [(set (match_dup 3) (match_dup 1)) (set (match_dup 4) (const_int 0))] "split_di (&operands[0], 1, &operands[3], &operands[4]);") @@ -3359,62 +3469,34 @@ (define_split [(set (match_operand:XF 0 "push_operand" "") (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))] - "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12))) - (set (mem:XF (reg:SI 7)) (float_extend:XF (match_dup 1)))]) - -(define_insn "*dummy_extendsftf2" - [(set (match_operand:TF 0 "push_operand" "=<") - (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f")))] - "0" - "#") + "" + [(set (reg:SI 7) (plus:SI (reg:SI 7) (match_dup 2))) + (set (mem:XF (reg:SI 7)) (float_extend:XF (match_dup 1)))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") (define_split - [(set (match_operand:TF 0 "push_operand" "") - (float_extend:TF (match_operand:SF 1 "fp_register_operand" "")))] - "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:TF (reg:SI 7)) (float_extend:TF (match_dup 1)))]) - -(define_split - [(set (match_operand:TF 0 "push_operand" "") - (float_extend:TF (match_operand:SF 1 "fp_register_operand" "")))] + [(set (match_operand:XF 0 "push_operand" "") + (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))] "TARGET_64BIT" - [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16))) - (set (mem:DF (reg:DI 7)) (float_extend:TF (match_dup 1)))]) - -(define_insn "*dummy_extenddfxf2" - [(set (match_operand:XF 0 "push_operand" "=<") - (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "f")))] - "0" - "#") + [(set (reg:DI 7) (plus:DI (reg:DI 7) (match_dup 2))) + (set (mem:DF (reg:DI 7)) (float_extend:XF (match_dup 1)))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") (define_split [(set (match_operand:XF 0 "push_operand" "") (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))] - "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -12))) - (set (mem:DF (reg:SI 7)) (float_extend:XF (match_dup 1)))]) - -(define_insn "*dummy_extenddftf2" - [(set (match_operand:TF 0 "push_operand" "=<") - (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f")))] - "0" - "#") + "" + [(set (reg:SI 7) (plus:SI (reg:SI 7) (match_dup 2))) + (set (mem:DF (reg:SI 7)) (float_extend:XF (match_dup 1)))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") (define_split - [(set (match_operand:TF 0 "push_operand" "") - (float_extend:TF (match_operand:DF 1 "fp_register_operand" "")))] - "!TARGET_64BIT" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:TF (reg:SI 7)) (float_extend:XF (match_dup 1)))]) - -(define_split - [(set (match_operand:TF 0 "push_operand" "") - (float_extend:TF (match_operand:DF 1 "fp_register_operand" "")))] + [(set (match_operand:XF 0 "push_operand" "") + (float_extend:XF (match_operand:DF 1 "fp_register_operand" "")))] "TARGET_64BIT" - [(set (reg:DI 7) (plus:DI (reg:DI 7) (const_int -16))) - (set (mem:TF (reg:DI 7)) (float_extend:TF (match_dup 1)))]) + [(set (reg:DI 7) (plus:DI (reg:DI 7) (match_dup 2))) + (set (mem:XF (reg:DI 7)) (float_extend:XF (match_dup 1)))] + "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);") (define_expand "extendsfdf2" [(set (match_operand:DF 0 "nonimmediate_operand" "") @@ -3474,7 +3556,7 @@ (define_expand "extendsfxf2" [(set (match_operand:XF 0 "nonimmediate_operand" "") (float_extend:XF (match_operand:SF 1 "general_operand" "")))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { /* ??? Needed for compress_float_constant since all fp constants are LEGITIMATE_CONSTANT_P. */ @@ -3487,51 +3569,6 @@ (define_insn "*extendsfxf2_1" [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m") (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))] - "!TARGET_64BIT && TARGET_80387 - && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" -{ - switch (which_alternative) - { - case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; - - case 1: - /* There is no non-popping store to memory for XFmode. So if - we need one, follow the store with a load. */ - if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0\n\tfld%z0\t%y0"; - else - return "fstp%z0\t%y0"; - - default: - abort (); - } -} - [(set_attr "type" "fmov") - (set_attr "mode" "SF,XF")]) - -(define_expand "extendsftf2" - [(set (match_operand:TF 0 "nonimmediate_operand" "") - (float_extend:TF (match_operand:SF 1 "general_operand" "")))] - "TARGET_80387" -{ - /* ??? Needed for compress_float_constant since all fp constants - are LEGITIMATE_CONSTANT_P. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE) - operands[1] = validize_mem (force_const_mem (SFmode, operands[1])); - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (SFmode, operands[1]); -}) - -(define_insn "*extendsftf2_1" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m") - (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))] "TARGET_80387 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { @@ -3564,7 +3601,7 @@ (define_expand "extenddfxf2" [(set (match_operand:XF 0 "nonimmediate_operand" "") (float_extend:XF (match_operand:DF 1 "general_operand" "")))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { /* ??? Needed for compress_float_constant since all fp constants are LEGITIMATE_CONSTANT_P. */ @@ -3577,51 +3614,6 @@ (define_insn "*extenddfxf2_1" [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m") (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))] - "!TARGET_64BIT && TARGET_80387 - && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" -{ - switch (which_alternative) - { - case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; - - case 1: - /* There is no non-popping store to memory for XFmode. So if - we need one, follow the store with a load. */ - if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0\n\tfld%z0\t%y0"; - else - return "fstp%z0\t%y0"; - - default: - abort (); - } -} - [(set_attr "type" "fmov") - (set_attr "mode" "DF,XF")]) - -(define_expand "extenddftf2" - [(set (match_operand:TF 0 "nonimmediate_operand" "") - (float_extend:TF (match_operand:DF 1 "general_operand" "")))] - "TARGET_80387" -{ - /* ??? Needed for compress_float_constant since all fp constants - are LEGITIMATE_CONSTANT_P. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE) - operands[1] = validize_mem (force_const_mem (DFmode, operands[1])); - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (DFmode, operands[1]); -}) - -(define_insn "*extenddftf2_1" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f,m") - (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))] "TARGET_80387 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { @@ -3695,11 +3687,11 @@ (set_attr "mode" "SF,SF,SF,SF")]) (define_insn "*truncdfsf2_1_sse" - [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m,?f#rx,?r#fx,?x#rf,Y") + [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m#fxr,?f#xr,?r#fx,?x#fr,Y#fr") (float_truncate:SF - (match_operand:DF 1 "nonimmediate_operand" "f,f,f,f,mY"))) + (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f"))) (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))] - "TARGET_80387 && TARGET_SSE2" + "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS" { switch (which_alternative) { @@ -3709,7 +3701,30 @@ else return "fst%z0\t%y0"; case 4: - return "cvtsd2ss\t{%1, %0|%0, %1}"; + return "#"; + default: + abort (); + } +} + [(set_attr "type" "fmov,multi,multi,multi,ssecvt") + (set_attr "mode" "SF,SF,SF,SF,DF")]) + +(define_insn "*truncdfsf2_1_sse_nooverlap" + [(set (match_operand:SF 0 "nonimmediate_operand" "=*!m,?f#rx,?r#fx,?x#rf,&Y") + (float_truncate:SF + (match_operand:DF 1 "nonimmediate_operand" "f#Y,f#Y,f#Y,f#Y,mY#f"))) + (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m,X"))] + "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS" +{ + switch (which_alternative) + { + case 0: + if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + return "fstp%z0\t%y0"; + else + return "fst%z0\t%y0"; + case 4: + return "#"; default: abort (); } @@ -3718,16 +3733,41 @@ (set_attr "mode" "SF,SF,SF,SF,DF")]) (define_insn "*truncdfsf2_2" - [(set (match_operand:SF 0 "nonimmediate_operand" "=Y,!m") + [(set (match_operand:SF 0 "nonimmediate_operand" "=Y,Y,!m") (float_truncate:SF - (match_operand:DF 1 "nonimmediate_operand" "mY,f")))] - "TARGET_80387 && TARGET_SSE2 + (match_operand:DF 1 "nonimmediate_operand" "Y,mY,f#Y")))] + "TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { switch (which_alternative) { case 0: + case 1: return "cvtsd2ss\t{%1, %0|%0, %1}"; + case 2: + if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) + return "fstp%z0\t%y0"; + else + return "fst%z0\t%y0"; + default: + abort (); + } +} + [(set_attr "type" "ssecvt,ssecvt,fmov") + (set_attr "athlon_decode" "vector,double,*") + (set_attr "mode" "SF,SF,SF")]) + +(define_insn "*truncdfsf2_2_nooverlap" + [(set (match_operand:SF 0 "nonimmediate_operand" "=&Y,!m") + (float_truncate:SF + (match_operand:DF 1 "nonimmediate_operand" "mY,f")))] + "TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" +{ + switch (which_alternative) + { + case 0: + return "#"; case 1: if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) return "fstp%z0\t%y0"; @@ -3740,7 +3780,7 @@ [(set_attr "type" "ssecvt,fmov") (set_attr "mode" "DF,SF")]) -(define_insn "truncdfsf2_3" +(define_insn "*truncdfsf2_3" [(set (match_operand:SF 0 "memory_operand" "=m") (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))] @@ -3755,11 +3795,21 @@ (set_attr "mode" "SF")]) (define_insn "truncdfsf2_sse_only" - [(set (match_operand:SF 0 "register_operand" "=Y") + [(set (match_operand:SF 0 "register_operand" "=Y,Y") + (float_truncate:SF + (match_operand:DF 1 "nonimmediate_operand" "Y,mY")))] + "!TARGET_80387 && TARGET_SSE2 && !TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS" + "cvtsd2ss\t{%1, %0|%0, %1}" + [(set_attr "type" "ssecvt") + (set_attr "athlon_decode" "vector,double") + (set_attr "mode" "SF")]) + +(define_insn "*truncdfsf2_sse_only_nooverlap" + [(set (match_operand:SF 0 "register_operand" "=&Y") (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "mY")))] - "!TARGET_80387 && TARGET_SSE2" - "cvtsd2ss\t{%1, %0|%0, %1}" + "!TARGET_80387 && TARGET_SSE2 && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS" + "#" [(set_attr "type" "ssecvt") (set_attr "mode" "DF")]) @@ -3772,15 +3822,56 @@ [(set (match_dup 0) (float_truncate:SF (match_dup 1)))] "") +; Avoid possible reformatting penalty on the destination by first +; zeroing it out (define_split - [(set (match_operand:SF 0 "nonimmediate_operand" "") + [(set (match_operand:SF 0 "register_operand" "") (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" ""))) (clobber (match_operand 2 "" ""))] "TARGET_80387 && reload_completed - && !FP_REG_P (operands[0]) && !FP_REG_P (operands[1])" - [(set (match_dup 0) (float_truncate:SF (match_dup 1)))] - "") + && SSE_REG_P (operands[0]) + && !STACK_REG_P (operands[1])" + [(const_int 0)] +{ + rtx src, dest; + if (!TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS) + emit_insn (gen_truncdfsf2_sse_only (operands[0], operands[1])); + else + { + dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0); + src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0); + /* simplify_gen_subreg refuses to widen memory references. */ + if (GET_CODE (src) == SUBREG) + alter_subreg (&src); + if (reg_overlap_mentioned_p (operands[0], operands[1])) + abort (); + emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode))); + emit_insn (gen_cvtsd2ss (dest, dest, src)); + } + DONE; +}) + +(define_split + [(set (match_operand:SF 0 "register_operand" "") + (float_truncate:SF + (match_operand:DF 1 "nonimmediate_operand" "")))] + "TARGET_80387 && reload_completed + && SSE_REG_P (operands[0]) && TARGET_SSE_PARTIAL_REGS_FOR_CVTSD2SS" + [(const_int 0)] +{ + rtx src, dest; + dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0); + src = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0); + /* simplify_gen_subreg refuses to widen memory references. */ + if (GET_CODE (src) == SUBREG) + alter_subreg (&src); + if (reg_overlap_mentioned_p (operands[0], operands[1])) + abort (); + emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode))); + emit_insn (gen_cvtsd2ss (dest, dest, src)); + DONE; +}) (define_split [(set (match_operand:SF 0 "register_operand" "") @@ -3797,7 +3888,7 @@ (float_truncate:SF (match_operand:XF 1 "register_operand" ""))) (clobber (match_dup 2))])] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" "operands[2] = assign_386_stack_local (SFmode, 0);") (define_insn "*truncxfsf2_1" @@ -3805,7 +3896,7 @@ (float_truncate:SF (match_operand:XF 1 "register_operand" "f,f,f,f"))) (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { switch (which_alternative) { @@ -3825,7 +3916,7 @@ [(set (match_operand:SF 0 "memory_operand" "=m") (float_truncate:SF (match_operand:XF 1 "register_operand" "f")))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) return "fstp%z0\t%y0"; @@ -3854,75 +3945,12 @@ (set (match_dup 0) (match_dup 2))] "") -(define_expand "trunctfsf2" - [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "") - (float_truncate:SF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (SFmode, 0);") - -(define_insn "*trunctfsf2_1" - [(set (match_operand:SF 0 "nonimmediate_operand" "=m,?f#rx,?r#fx,?x#rf") - (float_truncate:SF - (match_operand:TF 1 "register_operand" "f,f,f,f"))) - (clobber (match_operand:SF 2 "memory_operand" "=X,m,m,m"))] - "TARGET_80387" -{ - switch (which_alternative) - { - case 0: - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0"; - else - return "fst%z0\t%y0"; - default: - abort(); - } -} - [(set_attr "type" "fmov,multi,multi,multi") - (set_attr "mode" "SF")]) - -(define_insn "*trunctfsf2_2" - [(set (match_operand:SF 0 "memory_operand" "=m") - (float_truncate:SF - (match_operand:TF 1 "register_operand" "f")))] - "TARGET_80387" -{ - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0"; - else - return "fst%z0\t%y0"; -} - [(set_attr "type" "fmov") - (set_attr "mode" "SF")]) - -(define_split - [(set (match_operand:SF 0 "memory_operand" "") - (float_truncate:SF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387" - [(set (match_dup 0) (float_truncate:SF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float_truncate:SF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) (float_truncate:SF (match_dup 1))) - (set (match_dup 0) (match_dup 2))] - "") - - (define_expand "truncxfdf2" [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "") (float_truncate:DF (match_operand:XF 1 "register_operand" ""))) (clobber (match_dup 2))])] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" "operands[2] = assign_386_stack_local (DFmode, 0);") (define_insn "*truncxfdf2_1" @@ -3930,7 +3958,7 @@ (float_truncate:DF (match_operand:XF 1 "register_operand" "f,f,f,f"))) (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { switch (which_alternative) { @@ -3951,7 +3979,7 @@ [(set (match_operand:DF 0 "memory_operand" "=m") (float_truncate:DF (match_operand:XF 1 "register_operand" "f")))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" { if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) return "fstp%z0\t%y0"; @@ -3980,69 +4008,6 @@ (set (match_dup 0) (match_dup 2))] "") -(define_expand "trunctfdf2" - [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "") - (float_truncate:DF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (DFmode, 0);") - -(define_insn "*trunctfdf2_1" - [(set (match_operand:DF 0 "nonimmediate_operand" "=m,?f#rY,?r#fY,?Y#rf") - (float_truncate:DF - (match_operand:TF 1 "register_operand" "f,f,f,f"))) - (clobber (match_operand:DF 2 "memory_operand" "=X,m,m,m"))] - "TARGET_80387" -{ - switch (which_alternative) - { - case 0: - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0"; - else - return "fst%z0\t%y0"; - default: - abort(); - } - abort (); -} - [(set_attr "type" "fmov,multi,multi,multi") - (set_attr "mode" "DF")]) - - (define_insn "*trunctfdf2_2" - [(set (match_operand:DF 0 "memory_operand" "=m") - (float_truncate:DF - (match_operand:TF 1 "register_operand" "f")))] - "TARGET_80387" -{ - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp%z0\t%y0"; - else - return "fst%z0\t%y0"; -} - [(set_attr "type" "fmov") - (set_attr "mode" "DF")]) - -(define_split - [(set (match_operand:DF 0 "memory_operand" "") - (float_truncate:DF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" ""))] - "TARGET_80387" - [(set (match_dup 0) (float_truncate:DF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float_truncate:DF - (match_operand:TF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) (float_truncate:DF (match_dup 1))) - (set (match_dup 0) (match_dup 2))] - "") - ;; %%% Break up all these bad boys. @@ -4051,12 +4016,6 @@ (define_expand "fix_truncxfdi2" [(set (match_operand:DI 0 "nonimmediate_operand" "") (fix:DI (match_operand:XF 1 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "fix_trunctfdi2" - [(set (match_operand:DI 0 "nonimmediate_operand" "") - (fix:DI (match_operand:TF 1 "register_operand" "")))] "TARGET_80387" "") @@ -4102,6 +4061,7 @@ "&& 1" [(const_int 0)] { + ix86_optimize_mode_switching = 1; operands[2] = assign_386_stack_local (HImode, 1); operands[3] = assign_386_stack_local (HImode, 2); if (memory_operand (operands[0], VOIDmode)) @@ -4116,7 +4076,8 @@ } DONE; } - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "DI")]) (define_insn "fix_truncdi_nomemory" [(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r") @@ -4128,7 +4089,8 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)" "#" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "DI")]) (define_insn "fix_truncdi_memory" [(set (match_operand:DI 0 "memory_operand" "=m") @@ -4139,7 +4101,8 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && (!SSE_FLOAT_MODE_P (GET_MODE (operands[1])) || !TARGET_64BIT)" "* operands[5] = operands[4]; return output_fix_trunc (insn, operands);" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "DI")]) (define_split [(set (match_operand:DI 0 "register_operand" "") @@ -4172,30 +4135,48 @@ ;; When SSE available, it is always faster to use it! (define_insn "fix_truncsfdi_sse" - [(set (match_operand:DI 0 "register_operand" "=r") - (fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))] + [(set (match_operand:DI 0 "register_operand" "=r,r") + (fix:DI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))] "TARGET_64BIT && TARGET_SSE" "cvttss2si{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "SF") + (set_attr "athlon_decode" "double,vector")]) + +;; Avoid vector decoded form of the instruction. +(define_peephole2 + [(match_scratch:SF 2 "x") + (set (match_operand:DI 0 "register_operand" "") + (fix:DI (match_operand:SF 1 "memory_operand" "")))] + "TARGET_K8 && !optimize_size" + [(set (match_dup 2) (match_dup 1)) + (set (match_dup 0) (fix:DI (match_dup 2)))] + "") (define_insn "fix_truncdfdi_sse" - [(set (match_operand:DI 0 "register_operand" "=r") - (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))] + [(set (match_operand:DI 0 "register_operand" "=r,r") + (fix:DI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))] "TARGET_64BIT && TARGET_SSE2" "cvttsd2si{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt")]) + [(set_attr "type" "sseicvt,sseicvt") + (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,vector")]) + +;; Avoid vector decoded form of the instruction. +(define_peephole2 + [(match_scratch:DF 2 "Y") + (set (match_operand:DI 0 "register_operand" "") + (fix:DI (match_operand:DF 1 "memory_operand" "")))] + "TARGET_K8 && !optimize_size" + [(set (match_dup 2) (match_dup 1)) + (set (match_dup 0) (fix:DI (match_dup 2)))] + "") ;; Signed conversion to SImode. (define_expand "fix_truncxfsi2" [(set (match_operand:SI 0 "nonimmediate_operand" "") (fix:SI (match_operand:XF 1 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "fix_trunctfsi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "") - (fix:SI (match_operand:TF 1 "register_operand" "")))] "TARGET_80387" "") @@ -4241,6 +4222,7 @@ "&& 1" [(const_int 0)] { + ix86_optimize_mode_switching = 1; operands[2] = assign_386_stack_local (HImode, 1); operands[3] = assign_386_stack_local (HImode, 2); if (memory_operand (operands[0], VOIDmode)) @@ -4255,7 +4237,8 @@ } DONE; } - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "SI")]) (define_insn "fix_truncsi_nomemory" [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?r") @@ -4266,7 +4249,8 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))" "#" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "SI")]) (define_insn "fix_truncsi_memory" [(set (match_operand:SI 0 "memory_operand" "=m") @@ -4276,22 +4260,47 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))" "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "SI")]) ;; When SSE available, it is always faster to use it! (define_insn "fix_truncsfsi_sse" - [(set (match_operand:SI 0 "register_operand" "=r") - (fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))] + [(set (match_operand:SI 0 "register_operand" "=r,r") + (fix:SI (match_operand:SF 1 "nonimmediate_operand" "x,xm")))] "TARGET_SSE" "cvttss2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,vector")]) + +;; Avoid vector decoded form of the instruction. +(define_peephole2 + [(match_scratch:SF 2 "x") + (set (match_operand:SI 0 "register_operand" "") + (fix:SI (match_operand:SF 1 "memory_operand" "")))] + "TARGET_K8 && !optimize_size" + [(set (match_dup 2) (match_dup 1)) + (set (match_dup 0) (fix:SI (match_dup 2)))] + "") (define_insn "fix_truncdfsi_sse" - [(set (match_operand:SI 0 "register_operand" "=r") - (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))] + [(set (match_operand:SI 0 "register_operand" "=r,r") + (fix:SI (match_operand:DF 1 "nonimmediate_operand" "Y,Ym")))] "TARGET_SSE2" "cvttsd2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,vector")]) + +;; Avoid vector decoded form of the instruction. +(define_peephole2 + [(match_scratch:DF 2 "Y") + (set (match_operand:SI 0 "register_operand" "") + (fix:SI (match_operand:DF 1 "memory_operand" "")))] + "TARGET_K8 && !optimize_size" + [(set (match_dup 2) (match_dup 1)) + (set (match_dup 0) (fix:SI (match_dup 2)))] + "") (define_split [(set (match_operand:SI 0 "register_operand" "") @@ -4323,12 +4332,6 @@ (define_expand "fix_truncxfhi2" [(set (match_operand:HI 0 "nonimmediate_operand" "") (fix:HI (match_operand:XF 1 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "fix_trunctfhi2" - [(set (match_operand:HI 0 "nonimmediate_operand" "") - (fix:HI (match_operand:TF 1 "register_operand" "")))] "TARGET_80387" "") @@ -4356,6 +4359,7 @@ "" [(const_int 0)] { + ix86_optimize_mode_switching = 1; operands[2] = assign_386_stack_local (HImode, 1); operands[3] = assign_386_stack_local (HImode, 2); if (memory_operand (operands[0], VOIDmode)) @@ -4370,7 +4374,8 @@ } DONE; } - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "HI")]) (define_insn "fix_trunchi_nomemory" [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r") @@ -4381,7 +4386,8 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))" "#" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "HI")]) (define_insn "fix_trunchi_memory" [(set (match_operand:HI 0 "memory_operand" "=m") @@ -4391,7 +4397,8 @@ "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))" "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fistp")]) + [(set_attr "type" "fistp") + (set_attr "mode" "HI")]) (define_split [(set (match_operand:HI 0 "memory_operand" "") @@ -4446,10 +4453,23 @@ ;; Even though we only accept memory inputs, the backend _really_ ;; wants to be able to do this between registers. -(define_insn "floathisf2" +(define_expand "floathisf2" + [(set (match_operand:SF 0 "register_operand" "") + (float:SF (match_operand:HI 1 "nonimmediate_operand" "")))] + "TARGET_SSE || TARGET_80387" +{ + if (TARGET_SSE && TARGET_SSE_MATH) + { + emit_insn (gen_floatsisf2 (operands[0], + convert_to_mode (SImode, operands[1], 0))); + DONE; + } +}) + +(define_insn "*floathisf2_1" [(set (match_operand:SF 0 "register_operand" "=f,f") (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,r")))] - "TARGET_80387 && !TARGET_SSE" + "TARGET_80387 && (!TARGET_SSE || !TARGET_SSE_MATH)" "@ fild%z1\t%1 #" @@ -4464,26 +4484,45 @@ "") (define_insn "*floatsisf2_i387" - [(set (match_operand:SF 0 "register_operand" "=f,?f,x") - (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,mr")))] + [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f") + (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))] "TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)" "@ fild%z1\t%1 # + cvtsi2ss\t{%1, %0|%0, %1} cvtsi2ss\t{%1, %0|%0, %1}" - [(set_attr "type" "fmov,multi,ssecvt") + [(set_attr "type" "fmov,multi,sseicvt,sseicvt") (set_attr "mode" "SF") + (set_attr "athlon_decode" "*,*,vector,double") (set_attr "fp_int_src" "true")]) (define_insn "*floatsisf2_sse" - [(set (match_operand:SF 0 "register_operand" "=x") - (float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))] + [(set (match_operand:SF 0 "register_operand" "=x,x") + (float:SF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))] "TARGET_SSE" "cvtsi2ss\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "SF") + (set_attr "athlon_decode" "vector,double") (set_attr "fp_int_src" "true")]) +; Avoid possible reformatting penalty on the destination by first +; zeroing it out +(define_split + [(set (match_operand:SF 0 "register_operand" "") + (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))] + "TARGET_80387 && reload_completed && TARGET_SSE_PARTIAL_REGS + && SSE_REG_P (operands[0])" + [(const_int 0)] +{ + rtx dest; + dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0); + emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode))); + emit_insn (gen_cvtsi2ss (dest, dest, operands[1])); + DONE; +}) + (define_expand "floatdisf2" [(set (match_operand:SF 0 "register_operand" "") (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))] @@ -4502,30 +4541,62 @@ (set_attr "fp_int_src" "true")]) (define_insn "*floatdisf2_i387" - [(set (match_operand:SF 0 "register_operand" "=f,?f,x") - (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,mr")))] + [(set (match_operand:SF 0 "register_operand" "=f#x,?f#x,x#f,x#f") + (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))] "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE || TARGET_MIX_SSE_I387)" "@ fild%z1\t%1 # + cvtsi2ss{q}\t{%1, %0|%0, %1} cvtsi2ss{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "fmov,multi,ssecvt") + [(set_attr "type" "fmov,multi,sseicvt,sseicvt") (set_attr "mode" "SF") + (set_attr "athlon_decode" "*,*,vector,double") (set_attr "fp_int_src" "true")]) (define_insn "*floatdisf2_sse" - [(set (match_operand:SF 0 "register_operand" "=x") - (float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))] + [(set (match_operand:SF 0 "register_operand" "=x,x") + (float:SF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))] "TARGET_64BIT && TARGET_SSE" "cvtsi2ss{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "SF") + (set_attr "athlon_decode" "vector,double") (set_attr "fp_int_src" "true")]) -(define_insn "floathidf2" +; Avoid possible reformatting penalty on the destination by first +; zeroing it out +(define_split + [(set (match_operand:SF 0 "register_operand" "") + (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))] + "TARGET_80387 && reload_completed && TARGET_SSE_PARTIAL_REGS + && SSE_REG_P (operands[0])" + [(const_int 0)] +{ + rtx dest; + dest = simplify_gen_subreg (V4SFmode, operands[0], SFmode, 0); + emit_insn (gen_sse_clrv4sf (dest, CONST0_RTX (V4SFmode))); + emit_insn (gen_cvtsi2ssq (dest, dest, operands[1])); + DONE; +}) + +(define_expand "floathidf2" + [(set (match_operand:DF 0 "register_operand" "") + (float:DF (match_operand:HI 1 "nonimmediate_operand" "")))] + "TARGET_SSE2 || TARGET_80387" +{ + if (TARGET_SSE && TARGET_SSE_MATH) + { + emit_insn (gen_floatsidf2 (operands[0], + convert_to_mode (SImode, operands[1], 0))); + DONE; + } +}) + +(define_insn "*floathidf2_1" [(set (match_operand:DF 0 "register_operand" "=f,f") (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,r")))] - "TARGET_80387 && !TARGET_SSE2" + "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)" "@ fild%z1\t%1 #" @@ -4540,24 +4611,27 @@ "") (define_insn "*floatsidf2_i387" - [(set (match_operand:DF 0 "register_operand" "=f,?f,Y") - (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,mr")))] + [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f") + (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,r,r,mr")))] "TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)" "@ fild%z1\t%1 # + cvtsi2sd\t{%1, %0|%0, %1} cvtsi2sd\t{%1, %0|%0, %1}" - [(set_attr "type" "fmov,multi,ssecvt") + [(set_attr "type" "fmov,multi,sseicvt,sseicvt") (set_attr "mode" "DF") + (set_attr "athlon_decode" "*,*,double,direct") (set_attr "fp_int_src" "true")]) (define_insn "*floatsidf2_sse" - [(set (match_operand:DF 0 "register_operand" "=Y") - (float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))] + [(set (match_operand:DF 0 "register_operand" "=Y,Y") + (float:DF (match_operand:SI 1 "nonimmediate_operand" "r,mr")))] "TARGET_SSE2" "cvtsi2sd\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,direct") (set_attr "fp_int_src" "true")]) (define_expand "floatdidf2" @@ -4578,40 +4652,32 @@ (set_attr "fp_int_src" "true")]) (define_insn "*floatdidf2_i387" - [(set (match_operand:DF 0 "register_operand" "=f,?f,Y") - (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,mr")))] + [(set (match_operand:DF 0 "register_operand" "=f#Y,?f#Y,Y#f,Y#f") + (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,r,r,mr")))] "TARGET_64BIT && TARGET_80387 && (!TARGET_SSE2 || TARGET_MIX_SSE_I387)" "@ fild%z1\t%1 # + cvtsi2sd{q}\t{%1, %0|%0, %1} cvtsi2sd{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "fmov,multi,ssecvt") + [(set_attr "type" "fmov,multi,sseicvt,sseicvt") (set_attr "mode" "DF") + (set_attr "athlon_decode" "*,*,double,direct") (set_attr "fp_int_src" "true")]) (define_insn "*floatdidf2_sse" - [(set (match_operand:DF 0 "register_operand" "=Y") - (float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))] + [(set (match_operand:DF 0 "register_operand" "=Y,Y") + (float:DF (match_operand:DI 1 "nonimmediate_operand" "r,mr")))] "TARGET_SSE2" "cvtsi2sd{q}\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,direct") (set_attr "fp_int_src" "true")]) (define_insn "floathixf2" [(set (match_operand:XF 0 "register_operand" "=f,f") (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,r")))] - "!TARGET_64BIT && TARGET_80387" - "@ - fild%z1\t%1 - #" - [(set_attr "type" "fmov,multi") - (set_attr "mode" "XF") - (set_attr "fp_int_src" "true")]) - -(define_insn "floathitf2" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (float:TF (match_operand:HI 1 "nonimmediate_operand" "m,r")))] "TARGET_80387" "@ fild%z1\t%1 @@ -4623,17 +4689,6 @@ (define_insn "floatsixf2" [(set (match_operand:XF 0 "register_operand" "=f,f") (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,r")))] - "!TARGET_64BIT && TARGET_80387" - "@ - fild%z1\t%1 - #" - [(set_attr "type" "fmov,multi") - (set_attr "mode" "XF") - (set_attr "fp_int_src" "true")]) - -(define_insn "floatsitf2" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (float:TF (match_operand:SI 1 "nonimmediate_operand" "m,r")))] "TARGET_80387" "@ fild%z1\t%1 @@ -4645,17 +4700,6 @@ (define_insn "floatdixf2" [(set (match_operand:XF 0 "register_operand" "=f,f") (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,r")))] - "!TARGET_64BIT && TARGET_80387" - "@ - fild%z1\t%1 - #" - [(set_attr "type" "fmov,multi") - (set_attr "mode" "XF") - (set_attr "fp_int_src" "true")]) - -(define_insn "floatditf2" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (float:TF (match_operand:DI 1 "nonimmediate_operand" "m,r")))] "TARGET_80387" "@ fild%z1\t%1 @@ -4677,6 +4721,189 @@ ix86_free_from_memory (GET_MODE (operands[1])); DONE; }) + +(define_expand "floatunssisf2" + [(use (match_operand:SF 0 "register_operand" "")) + (use (match_operand:SI 1 "register_operand" ""))] + "TARGET_SSE && TARGET_SSE_MATH && !TARGET_64BIT" + "x86_emit_floatuns (operands); DONE;") + +(define_expand "floatunsdisf2" + [(use (match_operand:SF 0 "register_operand" "")) + (use (match_operand:DI 1 "register_operand" ""))] + "TARGET_SSE && TARGET_SSE_MATH && TARGET_64BIT" + "x86_emit_floatuns (operands); DONE;") + +(define_expand "floatunsdidf2" + [(use (match_operand:DF 0 "register_operand" "")) + (use (match_operand:DI 1 "register_operand" ""))] + "TARGET_SSE2 && TARGET_SSE_MATH && TARGET_64BIT" + "x86_emit_floatuns (operands); DONE;") + +;; SSE extract/set expanders + +(define_expand "vec_setv2df" + [(match_operand:V2DF 0 "register_operand" "") + (match_operand:DF 1 "register_operand" "") + (match_operand 2 "const_int_operand" "")] + "TARGET_SSE2" +{ + switch (INTVAL (operands[2])) + { + case 0: + emit_insn (gen_sse2_movsd (operands[0], operands[0], + simplify_gen_subreg (V2DFmode, operands[1], + DFmode, 0))); + break; + case 1: + { + rtx op1 = simplify_gen_subreg (V2DFmode, operands[1], DFmode, 0); + + emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], op1)); + } + break; + default: + abort (); + } + DONE; +}) + +(define_expand "vec_extractv2df" + [(match_operand:DF 0 "register_operand" "") + (match_operand:V2DF 1 "register_operand" "") + (match_operand 2 "const_int_operand" "")] + "TARGET_SSE2" +{ + switch (INTVAL (operands[2])) + { + case 0: + emit_move_insn (operands[0], gen_lowpart (DFmode, operands[1])); + break; + case 1: + { + rtx dest = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0); + + emit_insn (gen_sse2_unpckhpd (dest, operands[1], operands[1])); + } + break; + default: + abort (); + } + DONE; +}) + +(define_expand "vec_initv2df" + [(match_operand:V2DF 0 "register_operand" "") + (match_operand 1 "" "")] + "TARGET_SSE2" +{ + ix86_expand_vector_init (operands[0], operands[1]); + DONE; +}) + +(define_expand "vec_setv4sf" + [(match_operand:V4SF 0 "register_operand" "") + (match_operand:SF 1 "register_operand" "") + (match_operand 2 "const_int_operand" "")] + "TARGET_SSE" +{ + switch (INTVAL (operands[2])) + { + case 0: + emit_insn (gen_sse_movss (operands[0], operands[0], + simplify_gen_subreg (V4SFmode, operands[1], + SFmode, 0))); + break; + case 1: + { + rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[0]); + emit_insn (gen_sse_unpcklps (operands[0], operands[0], operands[0])); + emit_insn (gen_sse_movss (operands[0], operands[0], op1)); + emit_insn (gen_sse_shufps (operands[0], operands[0], tmp, + GEN_INT (1 + (0<<2) + (2<<4) + (3<<6)))); + } + case 2: + { + rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[0]); + emit_insn (gen_sse_movss (tmp, tmp, op1)); + emit_insn (gen_sse_shufps (operands[0], operands[0], tmp, + GEN_INT (0 + (1<<2) + (0<<4) + (3<<6)))); + } + break; + case 3: + { + rtx op1 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[0]); + emit_insn (gen_sse_movss (tmp, tmp, op1)); + emit_insn (gen_sse_shufps (operands[0], operands[0], tmp, + GEN_INT (0 + (1<<2) + (2<<4) + (0<<6)))); + } + break; + default: + abort (); + } + DONE; +}) + +(define_expand "vec_extractv4sf" + [(match_operand:SF 0 "register_operand" "") + (match_operand:V4SF 1 "register_operand" "") + (match_operand 2 "const_int_operand" "")] + "TARGET_SSE" +{ + switch (INTVAL (operands[2])) + { + case 0: + emit_move_insn (operands[0], gen_lowpart (SFmode, operands[1])); + break; + case 1: + { + rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[1]); + emit_insn (gen_sse_shufps (op0, tmp, tmp, + GEN_INT (1))); + } + case 2: + { + rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[1]); + emit_insn (gen_sse_unpckhps (op0, tmp, tmp)); + } + case 3: + { + rtx op0 = simplify_gen_subreg (V4SFmode, operands[1], SFmode, 0); + rtx tmp = gen_reg_rtx (V4SFmode); + + emit_move_insn (tmp, operands[1]); + emit_insn (gen_sse_shufps (op0, tmp, tmp, + GEN_INT (3))); + } + default: + abort (); + } + DONE; +}) + +(define_expand "vec_initv4sf" + [(match_operand:V4SF 0 "register_operand" "") + (match_operand 1 "" "")] + "TARGET_SSE" +{ + ix86_expand_vector_init (operands[0], operands[1]); + DONE; +}) ;; Add instructions @@ -4719,9 +4946,9 @@ split_di (operands+1, 1, operands+1, operands+4); split_di (operands+2, 1, operands+2, operands+5);") -(define_insn "*adddi3_carry_rex64" +(define_insn "adddi3_carry_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r") - (plus:DI (plus:DI (ltu:DI (reg:CC 17) (const_int 0)) + (plus:DI (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "") (match_operand:DI 1 "nonimmediate_operand" "%0,0")) (match_operand:DI 2 "x86_64_general_operand" "re,rm"))) (clobber (reg:CC 17))] @@ -4744,9 +4971,35 @@ [(set_attr "type" "alu") (set_attr "mode" "DI")]) -(define_insn "*addsi3_carry" +(define_insn "addqi3_carry" + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") + (plus:QI (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "") + (match_operand:QI 1 "nonimmediate_operand" "%0,0")) + (match_operand:QI 2 "general_operand" "qi,qm"))) + (clobber (reg:CC 17))] + "ix86_binary_operator_ok (PLUS, QImode, operands)" + "adc{b}\t{%2, %0|%0, %2}" + [(set_attr "type" "alu") + (set_attr "pent_pair" "pu") + (set_attr "mode" "QI") + (set_attr "ppro_uops" "few")]) + +(define_insn "addhi3_carry" + [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") + (plus:HI (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "") + (match_operand:HI 1 "nonimmediate_operand" "%0,0")) + (match_operand:HI 2 "general_operand" "ri,rm"))) + (clobber (reg:CC 17))] + "ix86_binary_operator_ok (PLUS, HImode, operands)" + "adc{w}\t{%2, %0|%0, %2}" + [(set_attr "type" "alu") + (set_attr "pent_pair" "pu") + (set_attr "mode" "HI") + (set_attr "ppro_uops" "few")]) + +(define_insn "addsi3_carry" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") - (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0)) + (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "") (match_operand:SI 1 "nonimmediate_operand" "%0,0")) (match_operand:SI 2 "general_operand" "ri,rm"))) (clobber (reg:CC 17))] @@ -4760,7 +5013,7 @@ (define_insn "*addsi3_carry_zext" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI - (plus:SI (plus:SI (ltu:SI (reg:CC 17) (const_int 0)) + (plus:SI (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "") (match_operand:SI 1 "nonimmediate_operand" "%0")) (match_operand:SI 2 "general_operand" "rim")))) (clobber (reg:CC 17))] @@ -4805,7 +5058,7 @@ (define_insn "*lea_1" [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "address_operand" "p"))] + (match_operand:SI 1 "no_seg_address_operand" "p"))] "!TARGET_64BIT" "lea{l}\t{%a1, %0|%0, %a1}" [(set_attr "type" "lea") @@ -4813,7 +5066,7 @@ (define_insn "*lea_1_rex64" [(set (match_operand:SI 0 "register_operand" "=r") - (subreg:SI (match_operand:DI 1 "address_operand" "p") 0))] + (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0))] "TARGET_64BIT" "lea{l}\t{%a1, %0|%0, %a1}" [(set_attr "type" "lea") @@ -4821,7 +5074,8 @@ (define_insn "*lea_1_zext" [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (subreg:SI (match_operand:DI 1 "address_operand" "p") 0)))] + (zero_extend:DI + (subreg:SI (match_operand:DI 1 "no_seg_address_operand" "p") 0)))] "TARGET_64BIT" "lea{l}\t{%a1, %k0|%k0, %a1}" [(set_attr "type" "lea") @@ -4829,7 +5083,7 @@ (define_insn "*lea_2_rex64" [(set (match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "address_operand" "p"))] + (match_operand:DI 1 "no_seg_address_operand" "p"))] "TARGET_64BIT" "lea{q}\t{%a1, %0|%0, %a1}" [(set_attr "type" "lea") @@ -5093,7 +5347,7 @@ if (! rtx_equal_p (operands[0], operands[1])) abort (); /* ???? We ought to handle there the 32bit case too - - do we need new constrant? */ + - do we need new constraint? */ /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. Exceptions: -128 encodes smaller than 128, so swap sign and op. */ if (GET_CODE (operands[2]) == CONST_INT @@ -5143,7 +5397,7 @@ if (! rtx_equal_p (operands[0], operands[1])) abort (); /* ???? We ought to handle there the 32bit case too - - do we need new constrant? */ + - do we need new constraint? */ /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'. Exceptions: -128 encodes smaller than 128, so swap sign and op. */ if (GET_CODE (operands[2]) == CONST_INT @@ -5403,7 +5657,7 @@ (plus:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "nonmemory_operand" "")))) (clobber (reg:CC 17))] - "reload_completed + "TARGET_64BIT && reload_completed && true_regnum (operands[0]) != true_regnum (operands[1])" [(set (match_dup 0) (zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))] @@ -5593,7 +5847,7 @@ (const_string "alu"))) (set_attr "mode" "SI")]) -; For comparisons agains 1, -1 and 128, we may generate better code +; For comparisons against 1, -1 and 128, we may generate better code ; by converting cmp to add, inc or dec as done by peephole2. This pattern ; is matched then. We can't accept general immediate, because for ; case of overflows, the result is messed up. @@ -6053,7 +6307,7 @@ if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 0) { - operands[2] = GEN_INT (-INTVAL (operands[2])); + operands[1] = GEN_INT (-INTVAL (operands[1])); return "sub{b}\t{%1, %0|%0, %1}"; } return "add{b}\t{%1, %0|%0, %1}"; @@ -6311,13 +6565,6 @@ [(set (match_operand:XF 0 "register_operand" "") (plus:XF (match_operand:XF 1 "register_operand" "") (match_operand:XF 2 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "addtf3" - [(set (match_operand:TF 0 "register_operand" "") - (plus:TF (match_operand:TF 1 "register_operand" "") - (match_operand:TF 2 "register_operand" "")))] "TARGET_80387" "") @@ -6375,7 +6622,7 @@ (define_insn "subdi3_carry_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r") (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0") - (plus:DI (ltu:DI (reg:CC 17) (const_int 0)) + (plus:DI (match_operand:DI 3 "ix86_carry_flag_operator" "") (match_operand:DI 2 "x86_64_general_operand" "re,rm")))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)" @@ -6421,11 +6668,36 @@ [(set_attr "type" "alu") (set_attr "mode" "DI")]) +(define_insn "subqi3_carry" + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") + (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0") + (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "") + (match_operand:QI 2 "general_operand" "qi,qm")))) + (clobber (reg:CC 17))] + "ix86_binary_operator_ok (MINUS, QImode, operands)" + "sbb{b}\t{%2, %0|%0, %2}" + [(set_attr "type" "alu") + (set_attr "pent_pair" "pu") + (set_attr "ppro_uops" "few") + (set_attr "mode" "QI")]) + +(define_insn "subhi3_carry" + [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") + (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0") + (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "") + (match_operand:HI 2 "general_operand" "ri,rm")))) + (clobber (reg:CC 17))] + "ix86_binary_operator_ok (MINUS, HImode, operands)" + "sbb{w}\t{%2, %0|%0, %2}" + [(set_attr "type" "alu") + (set_attr "pent_pair" "pu") + (set_attr "ppro_uops" "few") + (set_attr "mode" "HI")]) (define_insn "subsi3_carry" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0") - (plus:SI (ltu:SI (reg:CC 17) (const_int 0)) + (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "") (match_operand:SI 2 "general_operand" "ri,rm")))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (MINUS, SImode, operands)" @@ -6439,7 +6711,7 @@ [(set (match_operand:DI 0 "register_operand" "=rm,r") (zero_extend:DI (minus:SI (match_operand:SI 1 "register_operand" "0,0") - (plus:SI (ltu:SI (reg:CC 17) (const_int 0)) + (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "") (match_operand:SI 2 "general_operand" "ri,rm"))))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)" @@ -6522,7 +6794,7 @@ (define_insn "*subsi_3_zext" [(set (reg 17) - (compare (match_operand:SI 1 "nonimmediate_operand" "0") + (compare (match_operand:SI 1 "register_operand" "0") (match_operand:SI 2 "general_operand" "rim"))) (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI @@ -6639,13 +6911,6 @@ [(set (match_operand:XF 0 "register_operand" "") (minus:XF (match_operand:XF 1 "register_operand" "") (match_operand:XF 2 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "subtf3" - [(set (match_operand:TF 0 "register_operand" "") - (minus:TF (match_operand:TF 1 "register_operand" "") - (match_operand:TF 2 "register_operand" "")))] "TARGET_80387" "") @@ -6675,7 +6940,7 @@ (define_insn "*muldi3_1_rex64" [(set (match_operand:DI 0 "register_operand" "=r,r,r") - (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,0,0") + (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%rm,rm,0") (match_operand:DI 2 "x86_64_general_operand" "K,e,mr"))) (clobber (reg:CC 17))] "TARGET_64BIT @@ -6686,6 +6951,15 @@ imul{q}\t{%2, %0|%0, %2}" [(set_attr "type" "imul") (set_attr "prefix_0f" "0,0,1") + (set (attr "athlon_decode") + (cond [(eq_attr "cpu" "athlon") + (const_string "vector") + (eq_attr "alternative" "1") + (const_string "vector") + (and (eq_attr "alternative" "2") + (match_operand 1 "memory_operand" "")) + (const_string "vector")] + (const_string "direct"))) (set_attr "mode" "DI")]) (define_expand "mulsi3" @@ -6698,56 +6972,50 @@ (define_insn "*mulsi3_1" [(set (match_operand:SI 0 "register_operand" "=r,r,r") - (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,0,0") + (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0") (match_operand:SI 2 "general_operand" "K,i,mr"))) (clobber (reg:CC 17))] "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM" - ; For the {r,0,i} alternative (i.e., register <- register * immediate), - ; there are two ways of writing the exact same machine instruction - ; in assembly language. One, for example, is: - ; - ; imul $12, %eax - ; - ; while the other is: - ; - ; imul $12, %eax, %eax - ; - ; The first is simply short-hand for the latter. But, some assemblers, - ; like the SCO OSR5 COFF assembler, don't handle the first form. "@ imul{l}\t{%2, %1, %0|%0, %1, %2} imul{l}\t{%2, %1, %0|%0, %1, %2} imul{l}\t{%2, %0|%0, %2}" [(set_attr "type" "imul") (set_attr "prefix_0f" "0,0,1") + (set (attr "athlon_decode") + (cond [(eq_attr "cpu" "athlon") + (const_string "vector") + (eq_attr "alternative" "1") + (const_string "vector") + (and (eq_attr "alternative" "2") + (match_operand 1 "memory_operand" "")) + (const_string "vector")] + (const_string "direct"))) (set_attr "mode" "SI")]) (define_insn "*mulsi3_1_zext" [(set (match_operand:DI 0 "register_operand" "=r,r,r") (zero_extend:DI - (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,0,0") + (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0") (match_operand:SI 2 "general_operand" "K,i,mr")))) (clobber (reg:CC 17))] "TARGET_64BIT && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)" - ; For the {r,0,i} alternative (i.e., register <- register * immediate), - ; there are two ways of writing the exact same machine instruction - ; in assembly language. One, for example, is: - ; - ; imul $12, %eax - ; - ; while the other is: - ; - ; imul $12, %eax, %eax - ; - ; The first is simply short-hand for the latter. But, some assemblers, - ; like the SCO OSR5 COFF assembler, don't handle the first form. "@ imul{l}\t{%2, %1, %k0|%k0, %1, %2} imul{l}\t{%2, %1, %k0|%k0, %1, %2} imul{l}\t{%2, %k0|%k0, %2}" [(set_attr "type" "imul") (set_attr "prefix_0f" "0,0,1") + (set (attr "athlon_decode") + (cond [(eq_attr "cpu" "athlon") + (const_string "vector") + (eq_attr "alternative" "1") + (const_string "vector") + (and (eq_attr "alternative" "2") + (match_operand 1 "memory_operand" "")) + (const_string "vector")] + (const_string "direct"))) (set_attr "mode" "SI")]) (define_expand "mulhi3" @@ -6760,18 +7028,22 @@ (define_insn "*mulhi3_1" [(set (match_operand:HI 0 "register_operand" "=r,r,r") - (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,0,0") + (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm,0") (match_operand:HI 2 "general_operand" "K,i,mr"))) (clobber (reg:CC 17))] "GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM" - ; %%% There was a note about "Assembler has weird restrictions", - ; concerning alternative 1 when op1 == op0. True? "@ imul{w}\t{%2, %1, %0|%0, %1, %2} imul{w}\t{%2, %1, %0|%0, %1, %2} imul{w}\t{%2, %0|%0, %2}" [(set_attr "type" "imul") (set_attr "prefix_0f" "0,0,1") + (set (attr "athlon_decode") + (cond [(eq_attr "cpu" "athlon") + (const_string "vector") + (eq_attr "alternative" "1,2") + (const_string "vector")] + (const_string "direct"))) (set_attr "mode" "HI")]) (define_expand "mulqi3" @@ -6792,6 +7064,10 @@ "mul{b}\t%2" [(set_attr "type" "imul") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "direct"))) (set_attr "mode" "QI")]) (define_expand "umulqihi3" @@ -6814,6 +7090,10 @@ "mul{b}\t%2" [(set_attr "type" "imul") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "direct"))) (set_attr "mode" "QI")]) (define_expand "mulqihi3" @@ -6834,6 +7114,10 @@ "imul{b}\t%2" [(set_attr "type" "imul") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "direct"))) (set_attr "mode" "QI")]) (define_expand "umulditi3" @@ -6857,6 +7141,10 @@ [(set_attr "type" "imul") (set_attr "ppro_uops" "few") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "DI")]) ;; We can't use this pattern in 64bit mode, since it results in two separate 32bit registers @@ -6881,6 +7169,10 @@ [(set_attr "type" "imul") (set_attr "ppro_uops" "few") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) (define_expand "mulditi3" @@ -6903,6 +7195,10 @@ "imul{q}\t%2" [(set_attr "type" "imul") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "DI")]) (define_expand "mulsidi3" @@ -6925,6 +7221,10 @@ "imul{l}\t%2" [(set_attr "type" "imul") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) (define_expand "umuldi3_highpart" @@ -6958,6 +7258,10 @@ [(set_attr "type" "imul") (set_attr "ppro_uops" "few") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "DI")]) (define_expand "umulsi3_highpart" @@ -6990,6 +7294,10 @@ [(set_attr "type" "imul") (set_attr "ppro_uops" "few") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) (define_insn "*umulsi3_highpart_zext" @@ -7009,6 +7317,10 @@ [(set_attr "type" "imul") (set_attr "ppro_uops" "few") (set_attr "length_immediate" "0") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) (define_expand "smuldi3_highpart" @@ -7041,6 +7353,10 @@ "imul{q}\t%2" [(set_attr "type" "imul") (set_attr "ppro_uops" "few") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "DI")]) (define_expand "smulsi3_highpart" @@ -7072,6 +7388,10 @@ "imul{l}\t%2" [(set_attr "type" "imul") (set_attr "ppro_uops" "few") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) (define_insn "*smulsi3_highpart_zext" @@ -7090,6 +7410,10 @@ "imul{l}\t%2" [(set_attr "type" "imul") (set_attr "ppro_uops" "few") + (set (attr "athlon_decode") + (if_then_else (eq_attr "cpu" "athlon") + (const_string "vector") + (const_string "double"))) (set_attr "mode" "SI")]) ;; The patterns that match these are at the end of this file. @@ -7098,13 +7422,6 @@ [(set (match_operand:XF 0 "register_operand" "") (mult:XF (match_operand:XF 1 "register_operand" "") (match_operand:XF 2 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "multf3" - [(set (match_operand:TF 0 "register_operand" "") - (mult:TF (match_operand:TF 1 "register_operand" "") - (match_operand:TF 2 "register_operand" "")))] "TARGET_80387" "") @@ -7152,13 +7469,6 @@ [(set (match_operand:XF 0 "register_operand" "") (div:XF (match_operand:XF 1 "register_operand" "") (match_operand:XF 2 "register_operand" "")))] - "!TARGET_64BIT && TARGET_80387" - "") - -(define_expand "divtf3" - [(set (match_operand:TF 0 "register_operand" "") - (div:TF (match_operand:TF 1 "register_operand" "") - (match_operand:TF 2 "register_operand" "")))] "TARGET_80387" "") @@ -7189,7 +7499,7 @@ "") ;; Allow to come the parameter in eax or edx to avoid extra moves. -;; Penalize eax case sligthly because it results in worse scheduling +;; Penalize eax case slightly because it results in worse scheduling ;; of code. (define_insn "*divmoddi4_nocltd_rex64" [(set (match_operand:DI 0 "register_operand" "=&a,?a") @@ -7274,7 +7584,7 @@ "") ;; Allow to come the parameter in eax or edx to avoid extra moves. -;; Penalize eax case sligthly because it results in worse scheduling +;; Penalize eax case slightly because it results in worse scheduling ;; of code. (define_insn "*divmodsi4_nocltd" [(set (match_operand:SI 0 "register_operand" "=&a,?a") @@ -7502,10 +7812,11 @@ (define_insn "*testdi_1_rex64" [(set (reg 17) (compare - (and:DI (match_operand:DI 0 "nonimmediate_operand" "%*a,r,*a,r,rm") - (match_operand:DI 1 "x86_64_szext_nonmemory_operand" "Z,Z,e,e,re")) + (and:DI (match_operand:DI 0 "nonimmediate_operand" "%!*a,r,!*a,r,rm") + (match_operand:DI 1 "x86_64_szext_general_operand" "Z,Z,e,e,re")) (const_int 0)))] - "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" + "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" "@ test{l}\t{%k1, %k0|%k0, %k1} test{l}\t{%k1, %k0|%k0, %k1} @@ -7520,10 +7831,11 @@ (define_insn "testsi_1" [(set (reg 17) (compare - (and:SI (match_operand:SI 0 "nonimmediate_operand" "%*a,r,rm") - (match_operand:SI 1 "nonmemory_operand" "in,in,rin")) + (and:SI (match_operand:SI 0 "nonimmediate_operand" "%!*a,r,rm") + (match_operand:SI 1 "general_operand" "in,in,rin")) (const_int 0)))] - "ix86_match_ccmode (insn, CCNOmode)" + "ix86_match_ccmode (insn, CCNOmode) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" "test{l}\t{%1, %0|%0, %1}" [(set_attr "type" "test") (set_attr "modrm" "0,1,1") @@ -7541,10 +7853,11 @@ (define_insn "*testhi_1" [(set (reg 17) - (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%*a,r,rm") - (match_operand:HI 1 "nonmemory_operand" "n,n,rn")) + (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%!*a,r,rm") + (match_operand:HI 1 "general_operand" "n,n,rn")) (const_int 0)))] - "ix86_match_ccmode (insn, CCNOmode)" + "ix86_match_ccmode (insn, CCNOmode) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" "test{w}\t{%1, %0|%0, %1}" [(set_attr "type" "test") (set_attr "modrm" "0,1,1") @@ -7561,10 +7874,11 @@ (define_insn "*testqi_1" [(set (reg 17) - (compare (and:QI (match_operand:QI 0 "nonimmediate_operand" "%*a,q,qm,r") - (match_operand:QI 1 "nonmemory_operand" "n,n,qn,n")) + (compare (and:QI (match_operand:QI 0 "nonimmediate_operand" "%!*a,q,qm,r") + (match_operand:QI 1 "general_operand" "n,n,qn,n")) (const_int 0)))] - "ix86_match_ccmode (insn, CCNOmode)" + "ix86_match_ccmode (insn, CCNOmode) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" { if (which_alternative == 3) { @@ -7619,9 +7933,10 @@ (const_int 8) (const_int 8)) (zero_extend:SI - (match_operand:QI 1 "nonimmediate_operand" "Qm"))) + (match_operand:QI 1 "general_operand" "Qm"))) (const_int 0)))] - "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" + "!TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" "test{b}\t{%1, %h0|%h0, %1}" [(set_attr "type" "test") (set_attr "mode" "QI")]) @@ -7747,7 +8062,7 @@ ;; Convert HImode/SImode test instructions with immediate to QImode ones. ;; i386 does not allow to encode test with 8bit sign extended immediate, so ;; this is relatively important trick. -;; Do the converison only post-reload to avoid limiting of the register class +;; Do the conversion only post-reload to avoid limiting of the register class ;; to QI regs. (define_split [(set (reg 17) @@ -8211,7 +8526,7 @@ ;; Convert wide AND instructions with immediate operand to shorter QImode ;; equivalents when possible. -;; Don't do the splitting with memory operands, since it intoduces risc +;; Don't do the splitting with memory operands, since it introduces risk ;; of memory mismatch stalls. We may want to do the splitting for optimizing ;; for size, but that can (should?) be handled by generic code instead. (define_split @@ -9265,12 +9580,15 @@ in register. */ rtx reg = gen_reg_rtx (SFmode); rtx dest = operands[0]; + rtx imm = gen_lowpart (SFmode, gen_int_mode (0x80000000, SImode)); operands[1] = force_reg (SFmode, operands[1]); operands[0] = force_reg (SFmode, operands[0]); - emit_move_insn (reg, - gen_lowpart (SFmode, - gen_int_mode (0x80000000, SImode))); + reg = force_reg (V4SFmode, + gen_rtx_CONST_VECTOR (V4SFmode, + gen_rtvec (4, imm, CONST0_RTX (SFmode), + CONST0_RTX (SFmode), + CONST0_RTX (SFmode)))); emit_insn (gen_negsf2_ifs (operands[0], operands[1], reg)); if (dest != operands[0]) emit_move_insn (dest, operands[0]); @@ -9289,7 +9607,7 @@ (define_insn "negsf2_ifs" [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf") (neg:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0"))) - (use (match_operand:SF 2 "nonmemory_operand" "x,0#x,*g#x,*g#x")) + (use (match_operand:V4SF 2 "nonimmediate_operand" "xm,0,xm*r,xm*r")) (clobber (reg:CC 17))] "TARGET_SSE && (reload_in_progress || reload_completed @@ -9310,7 +9628,7 @@ (define_split [(set (match_operand:SF 0 "register_operand" "") (neg:SF (match_operand:SF 1 "register_operand" ""))) - (use (match_operand:SF 2 "" "")) + (use (match_operand:V4SF 2 "" "")) (clobber (reg:CC 17))] "reload_completed && !SSE_REG_P (operands[0])" [(parallel [(set (match_dup 0) @@ -9320,13 +9638,15 @@ (define_split [(set (match_operand:SF 0 "register_operand" "") (neg:SF (match_operand:SF 1 "register_operand" ""))) - (use (match_operand:SF 2 "register_operand" "")) + (use (match_operand:V4SF 2 "nonimmediate_operand" "")) (clobber (reg:CC 17))] "reload_completed && SSE_REG_P (operands[0])" [(set (subreg:TI (match_dup 0) 0) - (xor:TI (subreg:TI (match_dup 1) 0) - (subreg:TI (match_dup 2) 0)))] + (xor:TI (match_dup 1) + (match_dup 2)))] { + operands[1] = simplify_gen_subreg (TImode, operands[1], SFmode, 0); + operands[2] = simplify_gen_subreg (TImode, operands[2], V4SFmode, 0); if (operands_match_p (operands[0], operands[2])) { rtx tmp; @@ -9365,7 +9685,7 @@ [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1))) (clobber (reg:CC 17))])] "operands[1] = gen_int_mode (0x80000000, SImode); - operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));") + operands[0] = gen_lowpart (SImode, operands[0]);") (define_split [(set (match_operand 0 "memory_operand" "") @@ -9377,8 +9697,7 @@ { int size = GET_MODE_SIZE (GET_MODE (operands[1])); - /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */ - if (size >= 12) + if (GET_MODE (operands[1]) == XFmode) size = 10; operands[0] = adjust_address (operands[0], QImode, size - 1); operands[1] = gen_int_mode (0x80, QImode); @@ -9399,7 +9718,7 @@ { /* Using SSE is tricky, since we need bitwise negation of -0 in register. */ - rtx reg = gen_reg_rtx (DFmode); + rtx reg; #if HOST_BITS_PER_WIDE_INT >= 64 rtx imm = gen_int_mode (((HOST_WIDE_INT)1) << 63, DImode); #else @@ -9409,7 +9728,10 @@ operands[1] = force_reg (DFmode, operands[1]); operands[0] = force_reg (DFmode, operands[0]); - emit_move_insn (reg, gen_lowpart (DFmode, imm)); + imm = gen_lowpart (DFmode, imm); + reg = force_reg (V2DFmode, + gen_rtx_CONST_VECTOR (V2DFmode, + gen_rtvec (2, imm, CONST0_RTX (DFmode)))); emit_insn (gen_negdf2_ifs (operands[0], operands[1], reg)); if (dest != operands[0]) emit_move_insn (dest, operands[0]); @@ -9428,7 +9750,7 @@ (define_insn "negdf2_ifs" [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,f#Yr,rm#Yf") (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0"))) - (use (match_operand:DF 2 "nonmemory_operand" "Y,0,*g#Y,*g#Y")) + (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r,Ym*r")) (clobber (reg:CC 17))] "!TARGET_64BIT && TARGET_SSE2 && (reload_in_progress || reload_completed @@ -9438,8 +9760,8 @@ (define_insn "*negdf2_ifs_rex64" [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#f,Y#f,fm#Y") - (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#f,0"))) - (use (match_operand:DF 2 "general_operand" "Y,0,*g#Y*r")) + (neg:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0"))) + (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r")) (clobber (reg:CC 17))] "TARGET_64BIT && TARGET_SSE2 && (reload_in_progress || reload_completed @@ -9450,7 +9772,7 @@ (define_split [(set (match_operand:DF 0 "memory_operand" "") (neg:DF (match_operand:DF 1 "memory_operand" ""))) - (use (match_operand:DF 2 "" "")) + (use (match_operand:V2DF 2 "" "")) (clobber (reg:CC 17))] "" [(parallel [(set (match_dup 0) @@ -9460,7 +9782,7 @@ (define_split [(set (match_operand:DF 0 "register_operand" "") (neg:DF (match_operand:DF 1 "register_operand" ""))) - (use (match_operand:DF 2 "" "")) + (use (match_operand:V2DF 2 "" "")) (clobber (reg:CC 17))] "reload_completed && !SSE_REG_P (operands[0]) && (!TARGET_64BIT || FP_REG_P (operands[0]))" @@ -9471,7 +9793,7 @@ (define_split [(set (match_operand:DF 0 "register_operand" "") (neg:DF (match_operand:DF 1 "register_operand" ""))) - (use (match_operand:DF 2 "" "")) + (use (match_operand:V2DF 2 "" "")) (clobber (reg:CC 17))] "TARGET_64BIT && reload_completed && GENERAL_REG_P (operands[0])" [(parallel [(set (match_dup 0) @@ -9484,13 +9806,19 @@ (define_split [(set (match_operand:DF 0 "register_operand" "") (neg:DF (match_operand:DF 1 "register_operand" ""))) - (use (match_operand:DF 2 "register_operand" "")) + (use (match_operand:V2DF 2 "nonimmediate_operand" "")) (clobber (reg:CC 17))] "reload_completed && SSE_REG_P (operands[0])" [(set (subreg:TI (match_dup 0) 0) - (xor:TI (subreg:TI (match_dup 1) 0) - (subreg:TI (match_dup 2) 0)))] + (xor:TI (match_dup 1) + (match_dup 2)))] { + operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0); + operands[1] = simplify_gen_subreg (TImode, operands[1], DFmode, 0); + operands[2] = simplify_gen_subreg (TImode, operands[2], V2DFmode, 0); + /* Avoid possible reformatting on the operands. */ + if (TARGET_SSE_PARTIAL_REGS && !optimize_size) + emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], operands[0])); if (operands_match_p (operands[0], operands[2])) { rtx tmp; @@ -9546,15 +9874,8 @@ [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "") (neg:XF (match_operand:XF 1 "nonimmediate_operand" ""))) (clobber (reg:CC 17))])] - "!TARGET_64BIT && TARGET_80387" - "ix86_expand_unary_operator (NEG, XFmode, operands); DONE;") - -(define_expand "negtf2" - [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "") - (neg:TF (match_operand:TF 1 "nonimmediate_operand" ""))) - (clobber (reg:CC 17))])] "TARGET_80387" - "ix86_expand_unary_operator (NEG, TFmode, operands); DONE;") + "ix86_expand_unary_operator (NEG, XFmode, operands); DONE;") ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems ;; because of secondary memory needed to reload from class FLOAT_INT_REGS @@ -9563,7 +9884,7 @@ [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f") (neg:XF (match_operand:XF 1 "nonimmediate_operand" "0,0"))) (clobber (reg:CC 17))] - "!TARGET_64BIT && TARGET_80387 + "TARGET_80387 && ix86_unary_operator_ok (NEG, XFmode, operands)" "#") @@ -9587,37 +9908,7 @@ operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));") -;; Keep 'f' and 'r' in separate alternatives to avoid reload problems -;; because of secondary memory needed to reload from class FLOAT_INT_REGS -;; to itself. -(define_insn "*negtf2_if" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f") - (neg:TF (match_operand:TF 1 "nonimmediate_operand" "0,0"))) - (clobber (reg:CC 17))] - "TARGET_80387 && ix86_unary_operator_ok (NEG, TFmode, operands)" - "#") - -(define_split - [(set (match_operand:TF 0 "fp_register_operand" "") - (neg:TF (match_operand:TF 1 "register_operand" ""))) - (clobber (reg:CC 17))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (neg:TF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:TF 0 "register_and_not_fp_reg_operand" "") - (neg:TF (match_operand:TF 1 "register_operand" ""))) - (clobber (reg:CC 17))] - "TARGET_80387 && reload_completed" - [(parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1))) - (clobber (reg:CC 17))])] - "operands[1] = GEN_INT (0x8000); - operands[0] = gen_rtx_REG (SImode, - true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));") - -;; Conditionize these after reload. If they matches before reload, we +;; Conditionalize these after reload. If they matches before reload, we ;; lose the clobber and ability to use integer instructions. (define_insn "*negsf2_1" @@ -9651,7 +9942,7 @@ (define_insn "*negxf2_1" [(set (match_operand:XF 0 "register_operand" "=f") (neg:XF (match_operand:XF 1 "register_operand" "0")))] - "!TARGET_64BIT && TARGET_80387 && reload_completed" + "TARGET_80387 && reload_completed" "fchs" [(set_attr "type" "fsgn") (set_attr "mode" "XF") @@ -9661,7 +9952,7 @@ [(set (match_operand:XF 0 "register_operand" "=f") (neg:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" "fchs" [(set_attr "type" "fsgn") (set_attr "mode" "XF") @@ -9671,35 +9962,6 @@ [(set (match_operand:XF 0 "register_operand" "=f") (neg:XF (float_extend:XF (match_operand:SF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387" - "fchs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF") - (set_attr "ppro_uops" "few")]) - -(define_insn "*negtf2_1" - [(set (match_operand:TF 0 "register_operand" "=f") - (neg:TF (match_operand:TF 1 "register_operand" "0")))] - "TARGET_80387 && reload_completed" - "fchs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF") - (set_attr "ppro_uops" "few")]) - -(define_insn "*negextenddftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (neg:TF (float_extend:TF - (match_operand:DF 1 "register_operand" "0"))))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF") - (set_attr "ppro_uops" "few")]) - -(define_insn "*negextendsftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (neg:TF (float_extend:TF - (match_operand:SF 1 "register_operand" "0"))))] "TARGET_80387" "fchs" [(set_attr "type" "fsgn") @@ -9723,14 +9985,18 @@ { /* Using SSE is tricky, since we need bitwise negation of -0 in register. */ - rtx reg = gen_reg_rtx (SFmode); + rtx reg = gen_reg_rtx (V4SFmode); rtx dest = operands[0]; + rtx imm; operands[1] = force_reg (SFmode, operands[1]); operands[0] = force_reg (SFmode, operands[0]); - emit_move_insn (reg, - gen_lowpart (SFmode, - gen_int_mode (0x80000000, SImode))); + imm = gen_lowpart (SFmode, gen_int_mode(~0x80000000, SImode)); + reg = force_reg (V4SFmode, + gen_rtx_CONST_VECTOR (V4SFmode, + gen_rtvec (4, imm, CONST0_RTX (SFmode), + CONST0_RTX (SFmode), + CONST0_RTX (SFmode)))); emit_insn (gen_abssf2_ifs (operands[0], operands[1], reg)); if (dest != operands[0]) emit_move_insn (dest, operands[0]); @@ -9747,20 +10013,20 @@ "#") (define_insn "abssf2_ifs" - [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,f#xr,rm#xf") - (abs:SF (match_operand:SF 1 "nonimmediate_operand" "x,0,0"))) - (use (match_operand:SF 2 "nonmemory_operand" "*0#x,*g#x,*g#x")) + [(set (match_operand:SF 0 "nonimmediate_operand" "=x#fr,x#fr,f#xr,rm#xf") + (abs:SF (match_operand:SF 1 "nonimmediate_operand" "0,x#fr,0,0"))) + (use (match_operand:V4SF 2 "nonimmediate_operand" "xm,0,xm*r,xm*r")) (clobber (reg:CC 17))] "TARGET_SSE && (reload_in_progress || reload_completed || (register_operand (operands[0], VOIDmode) - && register_operand (operands[1], VOIDmode)))" + && register_operand (operands[1], VOIDmode)))" "#") (define_split [(set (match_operand:SF 0 "memory_operand" "") (abs:SF (match_operand:SF 1 "memory_operand" ""))) - (use (match_operand:SF 2 "" "")) + (use (match_operand:V4SF 2 "" "")) (clobber (reg:CC 17))] "" [(parallel [(set (match_dup 0) @@ -9770,7 +10036,7 @@ (define_split [(set (match_operand:SF 0 "register_operand" "") (abs:SF (match_operand:SF 1 "register_operand" ""))) - (use (match_operand:SF 2 "" "")) + (use (match_operand:V4SF 2 "" "")) (clobber (reg:CC 17))] "reload_completed && !SSE_REG_P (operands[0])" [(parallel [(set (match_dup 0) @@ -9780,12 +10046,23 @@ (define_split [(set (match_operand:SF 0 "register_operand" "") (abs:SF (match_operand:SF 1 "register_operand" ""))) - (use (match_operand:SF 2 "register_operand" "")) + (use (match_operand:V4SF 2 "nonimmediate_operand" "")) (clobber (reg:CC 17))] "reload_completed && SSE_REG_P (operands[0])" [(set (subreg:TI (match_dup 0) 0) - (and:TI (not:TI (subreg:TI (match_dup 2) 0)) - (subreg:TI (match_dup 1) 0)))]) + (and:TI (match_dup 1) + (match_dup 2)))] +{ + operands[1] = simplify_gen_subreg (TImode, operands[1], SFmode, 0); + operands[2] = simplify_gen_subreg (TImode, operands[2], V4SFmode, 0); + if (operands_match_p (operands[0], operands[2])) + { + rtx tmp; + tmp = operands[1]; + operands[1] = operands[2]; + operands[2] = tmp; + } +}) ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems ;; because of secondary memory needed to reload from class FLOAT_INT_REGS @@ -9801,7 +10078,7 @@ [(set (match_operand:SF 0 "fp_register_operand" "") (abs:SF (match_operand:SF 1 "register_operand" ""))) (clobber (reg:CC 17))] - "TARGET_80387" + "TARGET_80387 && reload_completed" [(set (match_dup 0) (abs:SF (match_dup 1)))] "") @@ -9814,7 +10091,7 @@ [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1))) (clobber (reg:CC 17))])] "operands[1] = gen_int_mode (~0x80000000, SImode); - operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));") + operands[0] = gen_lowpart (SImode, operands[0]);") (define_split [(set (match_operand 0 "memory_operand" "") @@ -9826,8 +10103,7 @@ { int size = GET_MODE_SIZE (GET_MODE (operands[1])); - /* XFmode's size is 12, TFmode 16, but only 10 bytes are used. */ - if (size >= 12) + if (GET_MODE (operands[1]) == XFmode) size = 10; operands[0] = adjust_address (operands[0], QImode, size - 1); operands[1] = gen_int_mode (~0x80, QImode); @@ -9848,17 +10124,22 @@ { /* Using SSE is tricky, since we need bitwise negation of -0 in register. */ - rtx reg = gen_reg_rtx (DFmode); + rtx reg = gen_reg_rtx (V2DFmode); #if HOST_BITS_PER_WIDE_INT >= 64 - rtx imm = gen_int_mode (((HOST_WIDE_INT)1) << 63, DImode); + rtx imm = gen_int_mode (~(((HOST_WIDE_INT)1) << 63), DImode); #else - rtx imm = immed_double_const (0, 0x80000000, DImode); + rtx imm = immed_double_const (~0, ~0x80000000, DImode); #endif rtx dest = operands[0]; operands[1] = force_reg (DFmode, operands[1]); operands[0] = force_reg (DFmode, operands[0]); - emit_move_insn (reg, gen_lowpart (DFmode, imm)); + + /* Produce LONG_DOUBLE with the proper immediate argument. */ + imm = gen_lowpart (DFmode, imm); + reg = force_reg (V2DFmode, + gen_rtx_CONST_VECTOR (V2DFmode, + gen_rtvec (2, imm, CONST0_RTX (DFmode)))); emit_insn (gen_absdf2_ifs (operands[0], operands[1], reg)); if (dest != operands[0]) emit_move_insn (dest, operands[0]); @@ -9875,9 +10156,9 @@ "#") (define_insn "absdf2_ifs" - [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr,mr#Yf") - (abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0,0"))) - (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y,*g#Y")) + [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,mf#Yr,mr#Yf") + (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0,0"))) + (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r,Ym*r")) (clobber (reg:CC 17))] "!TARGET_64BIT && TARGET_SSE2 && (reload_in_progress || reload_completed @@ -9886,9 +10167,9 @@ "#") (define_insn "*absdf2_ifs_rex64" - [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,mf#Yr") - (abs:DF (match_operand:DF 1 "nonimmediate_operand" "Y,0"))) - (use (match_operand:DF 2 "nonmemory_operand" "*0#Y,*g#Y")) + [(set (match_operand:DF 0 "nonimmediate_operand" "=Y#fr,Y#fr,mf#Yr") + (abs:DF (match_operand:DF 1 "nonimmediate_operand" "0,Y#fr,0"))) + (use (match_operand:V2DF 2 "nonimmediate_operand" "Ym,0,Ym*r")) (clobber (reg:CC 17))] "TARGET_64BIT && TARGET_SSE2 && (reload_in_progress || reload_completed @@ -9899,7 +10180,7 @@ (define_split [(set (match_operand:DF 0 "memory_operand" "") (abs:DF (match_operand:DF 1 "memory_operand" ""))) - (use (match_operand:DF 2 "" "")) + (use (match_operand:V2DF 2 "" "")) (clobber (reg:CC 17))] "" [(parallel [(set (match_dup 0) @@ -9909,7 +10190,7 @@ (define_split [(set (match_operand:DF 0 "register_operand" "") (abs:DF (match_operand:DF 1 "register_operand" ""))) - (use (match_operand:DF 2 "" "")) + (use (match_operand:V2DF 2 "" "")) (clobber (reg:CC 17))] "reload_completed && !SSE_REG_P (operands[0])" [(parallel [(set (match_dup 0) @@ -9919,12 +10200,27 @@ (define_split [(set (match_operand:DF 0 "register_operand" "") (abs:DF (match_operand:DF 1 "register_operand" ""))) - (use (match_operand:DF 2 "register_operand" "")) + (use (match_operand:V2DF 2 "nonimmediate_operand" "")) (clobber (reg:CC 17))] "reload_completed && SSE_REG_P (operands[0])" [(set (subreg:TI (match_dup 0) 0) - (and:TI (not:TI (subreg:TI (match_dup 2) 0)) - (subreg:TI (match_dup 1) 0)))]) + (and:TI (match_dup 1) + (match_dup 2)))] +{ + operands[0] = simplify_gen_subreg (V2DFmode, operands[0], DFmode, 0); + operands[1] = simplify_gen_subreg (TImode, operands[1], DFmode, 0); + operands[2] = simplify_gen_subreg (TImode, operands[2], V2DFmode, 0); + /* Avoid possible reformatting on the operands. */ + if (TARGET_SSE_PARTIAL_REGS && !optimize_size) + emit_insn (gen_sse2_unpcklpd (operands[0], operands[0], operands[0])); + if (operands_match_p (operands[0], operands[2])) + { + rtx tmp; + tmp = operands[1]; + operands[1] = operands[2]; + operands[2] = tmp; + } +}) ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems @@ -9973,15 +10269,8 @@ [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "") (neg:XF (match_operand:XF 1 "nonimmediate_operand" ""))) (clobber (reg:CC 17))])] - "!TARGET_64BIT && TARGET_80387" - "ix86_expand_unary_operator (ABS, XFmode, operands); DONE;") - -(define_expand "abstf2" - [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "") - (neg:TF (match_operand:TF 1 "nonimmediate_operand" ""))) - (clobber (reg:CC 17))])] "TARGET_80387" - "ix86_expand_unary_operator (ABS, TFmode, operands); DONE;") + "ix86_expand_unary_operator (ABS, XFmode, operands); DONE;") ;; Keep 'f' and 'r' in separate alternatives to avoid reload problems ;; because of secondary memory needed to reload from class FLOAT_INT_REGS @@ -9990,7 +10279,7 @@ [(set (match_operand:XF 0 "nonimmediate_operand" "=f#r,rm#f") (abs:XF (match_operand:XF 1 "nonimmediate_operand" "0,0"))) (clobber (reg:CC 17))] - "!TARGET_64BIT && TARGET_80387 + "TARGET_80387 && ix86_unary_operator_ok (ABS, XFmode, operands)" "#") @@ -10014,33 +10303,6 @@ operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));") -(define_insn "*abstf2_if" - [(set (match_operand:TF 0 "nonimmediate_operand" "=f#r,rm#f") - (abs:TF (match_operand:TF 1 "nonimmediate_operand" "0,0"))) - (clobber (reg:CC 17))] - "TARGET_80387 && ix86_unary_operator_ok (ABS, TFmode, operands)" - "#") - -(define_split - [(set (match_operand:TF 0 "fp_register_operand" "") - (abs:TF (match_operand:TF 1 "register_operand" ""))) - (clobber (reg:CC 17))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (abs:TF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:TF 0 "register_and_not_any_fp_reg_operand" "") - (abs:TF (match_operand:TF 1 "register_operand" ""))) - (clobber (reg:CC 17))] - "TARGET_80387 && reload_completed" - [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1))) - (clobber (reg:CC 17))])] - "operands[1] = GEN_INT (~0x8000); - operands[0] = gen_rtx_REG (SImode, - true_regnum (operands[0]) + (TARGET_64BIT ? 1 : 2));") - (define_insn "*abssf2_1" [(set (match_operand:SF 0 "register_operand" "=f") (abs:SF (match_operand:SF 1 "register_operand" "0")))] @@ -10069,7 +10331,7 @@ (define_insn "*absxf2_1" [(set (match_operand:XF 0 "register_operand" "=f") (abs:XF (match_operand:XF 1 "register_operand" "0")))] - "!TARGET_64BIT && TARGET_80387 && reload_completed" + "TARGET_80387 && reload_completed" "fabs" [(set_attr "type" "fsgn") (set_attr "mode" "DF")]) @@ -10078,7 +10340,7 @@ [(set (match_operand:XF 0 "register_operand" "=f") (abs:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" "fabs" [(set_attr "type" "fsgn") (set_attr "mode" "XF")]) @@ -10087,32 +10349,6 @@ [(set (match_operand:XF 0 "register_operand" "=f") (abs:XF (float_extend:XF (match_operand:SF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF")]) - -(define_insn "*abstf2_1" - [(set (match_operand:TF 0 "register_operand" "=f") - (abs:TF (match_operand:TF 1 "register_operand" "0")))] - "TARGET_80387 && reload_completed" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "DF")]) - -(define_insn "*absextenddftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (abs:TF (float_extend:TF - (match_operand:DF 1 "register_operand" "0"))))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fsgn") - (set_attr "mode" "XF")]) - -(define_insn "*absextendsftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (abs:TF (float_extend:TF - (match_operand:SF 1 "register_operand" "0"))))] "TARGET_80387" "fabs" [(set_attr "type" "fsgn") @@ -10697,9 +10933,11 @@ (zero_extend:DI (ashift (match_operand 1 "register_operand" "") (match_operand:QI 2 "const_int_operand" "")))) (clobber (reg:CC 17))] - "reload_completed + "TARGET_64BIT && reload_completed && true_regnum (operands[0]) != true_regnum (operands[1])" - [(set (match_dup 0) (zero_extend:DI (subreg:SI (mult:SI (match_dup 1) (match_dup 2)) 0)))] + [(set (match_dup 0) (zero_extend:DI + (subreg:SI (mult:SI (match_dup 1) + (match_dup 2)) 0)))] { operands[1] = gen_lowpart (Pmode, operands[1]); operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode); @@ -11112,7 +11350,7 @@ (define_insn "*ashrdi3_1_one_bit_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm") (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11142,7 +11380,7 @@ [(set (reg 17) (compare (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=rm") (ashiftrt:DI (match_dup 1) (match_dup 2)))] @@ -11301,7 +11539,7 @@ (define_insn "*ashrsi3_1_one_bit" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ASHIFTRT, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11315,7 +11553,7 @@ (define_insn "*ashrsi3_1_one_bit_zext" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")))) + (match_operand:QI 2 "const1_operand" "")))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11354,7 +11592,7 @@ [(set (reg 17) (compare (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:SI 0 "nonimmediate_operand" "=rm") (ashiftrt:SI (match_dup 1) (match_dup 2)))] @@ -11372,7 +11610,7 @@ [(set (reg 17) (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))] @@ -11425,7 +11663,7 @@ (define_insn "*ashrhi3_1_one_bit" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ASHIFTRT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11455,7 +11693,7 @@ [(set (reg 17) (compare (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=rm") (ashiftrt:HI (match_dup 1) (match_dup 2)))] @@ -11497,7 +11735,7 @@ (define_insn "*ashrqi3_1_one_bit" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ASHIFTRT, QImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11511,7 +11749,7 @@ (define_insn "*ashrqi3_1_one_bit_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm")) (ashiftrt:QI (match_dup 0) - (match_operand:QI 1 "const_int_1_operand" ""))) + (match_operand:QI 1 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ASHIFTRT, QImode, operands) && (! TARGET_PARTIAL_REG_STALL || optimize_size) @@ -11555,7 +11793,7 @@ [(set (reg 17) (compare (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "I")) + (match_operand:QI 2 "const1_operand" "I")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=qm") (ashiftrt:QI (match_dup 1) (match_dup 2)))] @@ -11609,7 +11847,7 @@ (define_insn "*lshrdi3_1_one_bit_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm") (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11639,7 +11877,7 @@ [(set (reg 17) (compare (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=rm") (lshiftrt:DI (match_dup 1) (match_dup 2)))] @@ -11719,7 +11957,7 @@ (define_insn "*lshrsi3_1_one_bit" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (LSHIFTRT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11733,7 +11971,7 @@ (define_insn "*lshrsi3_1_one_bit_zext" [(set (match_operand:DI 0 "register_operand" "=r") (lshiftrt:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0")) - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (LSHIFTRT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11773,7 +12011,7 @@ [(set (reg 17) (compare (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:SI 0 "nonimmediate_operand" "=rm") (lshiftrt:SI (match_dup 1) (match_dup 2)))] @@ -11791,7 +12029,7 @@ [(set (reg 17) (compare (lshiftrt:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:DI 0 "register_operand" "=r") (lshiftrt:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))] @@ -11844,7 +12082,7 @@ (define_insn "*lshrhi3_1_one_bit" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (LSHIFTRT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11874,7 +12112,7 @@ [(set (reg 17) (compare (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=rm") (lshiftrt:HI (match_dup 1) (match_dup 2)))] @@ -11916,7 +12154,7 @@ (define_insn "*lshrqi3_1_one_bit" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (LSHIFTRT, QImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -11930,7 +12168,7 @@ (define_insn "*lshrqi3_1_one_bit_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm")) (lshiftrt:QI (match_dup 0) - (match_operand:QI 1 "const_int_1_operand" ""))) + (match_operand:QI 1 "const1_operand" ""))) (clobber (reg:CC 17))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && (TARGET_SHIFT1 || optimize_size)" @@ -11973,7 +12211,7 @@ [(set (reg 17) (compare (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=qm") (lshiftrt:QI (match_dup 1) (match_dup 2)))] @@ -12017,7 +12255,7 @@ (define_insn "*rotlsi3_1_one_bit_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm") (rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, DImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12051,7 +12289,7 @@ (define_insn "*rotlsi3_1_one_bit" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATE, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12066,7 +12304,7 @@ [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (rotate:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")))) + (match_operand:QI 2 "const1_operand" "")))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ROTATE, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12110,7 +12348,7 @@ (define_insn "*rotlhi3_1_one_bit" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATE, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12144,7 +12382,7 @@ (define_insn "*rotlqi3_1_one_bit_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm")) (rotate:QI (match_dup 0) - (match_operand:QI 1 "const_int_1_operand" ""))) + (match_operand:QI 1 "const1_operand" ""))) (clobber (reg:CC 17))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && (TARGET_SHIFT1 || optimize_size)" @@ -12158,7 +12396,7 @@ (define_insn "*rotlqi3_1_one_bit" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATE, QImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12205,7 +12443,7 @@ (define_insn "*rotrdi3_1_one_bit_rex64" [(set (match_operand:DI 0 "nonimmediate_operand" "=rm") (rotatert:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, DImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12239,7 +12477,7 @@ (define_insn "*rotrsi3_1_one_bit" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATERT, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12254,7 +12492,7 @@ [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (rotatert:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_1_operand" "")))) + (match_operand:QI 2 "const1_operand" "")))) (clobber (reg:CC 17))] "TARGET_64BIT && ix86_binary_operator_ok (ROTATERT, SImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12301,7 +12539,7 @@ (define_insn "*rotrhi3_one_bit" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATERT, HImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12335,7 +12573,7 @@ (define_insn "*rotrqi3_1_one_bit" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_1_operand" ""))) + (match_operand:QI 2 "const1_operand" ""))) (clobber (reg:CC 17))] "ix86_binary_operator_ok (ROTATERT, QImode, operands) && (TARGET_SHIFT1 || optimize_size)" @@ -12349,7 +12587,7 @@ (define_insn "*rotrqi3_1_one_bit_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm")) (rotatert:QI (match_dup 0) - (match_operand:QI 1 "const_int_1_operand" ""))) + (match_operand:QI 1 "const1_operand" ""))) (clobber (reg:CC 17))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && (TARGET_SHIFT1 || optimize_size)" @@ -12422,10 +12660,10 @@ }) (define_expand "insv" - [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "") - (match_operand:SI 1 "immediate_operand" "") - (match_operand:SI 2 "immediate_operand" "")) - (match_operand:SI 3 "register_operand" ""))] + [(set (zero_extract (match_operand 0 "ext_register_operand" "") + (match_operand 1 "immediate_operand" "") + (match_operand 2 "immediate_operand" "")) + (match_operand 3 "register_operand" ""))] "" { /* Handle extractions from %ah et al. */ @@ -12436,6 +12674,13 @@ matches the predicate, so check it again here. */ if (! register_operand (operands[0], VOIDmode)) FAIL; + + if (TARGET_64BIT) + emit_insn (gen_movdi_insv_1_rex64 (operands[0], operands[3])); + else + emit_insn (gen_movsi_insv_1 (operands[0], operands[3])); + + DONE; }) ;; %%% bts, btr, btc, bt. @@ -12648,7 +12893,7 @@ ;; The SSE store flag instructions saves 0 or 0xffffffff to the result. ;; subsequent logical operations are used to imitate conditional moves. ;; 0xffffffff is NaN, but not in normalized form, so we can't represent -;; it directly. Futher holding this value in pseudo register might bring +;; it directly. Further holding this value in pseudo register might bring ;; problem in implicit normalization in spill code. ;; So we don't define FLOAT_STORE_FLAG_VALUE and create these ;; instructions after reload by splitting the conditional move patterns. @@ -13321,7 +13566,7 @@ (match_dup 2))] { operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17); - operands[5] = gen_rtx_REG (QImode, REGNO (operands[3])); + operands[5] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) @@ -13343,7 +13588,7 @@ (match_dup 2))] { operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17); - operands[5] = gen_rtx_REG (QImode, REGNO (operands[3])); + operands[5] = gen_lowpart (QImode, operands[3]); ix86_expand_clear (operands[3]); }) @@ -13363,7 +13608,7 @@ (match_operand:SI 3 "" "")))])] "!TARGET_64BIT" { - ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3]); + ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3], 0); DONE; }) @@ -13408,7 +13653,17 @@ (use (match_operand 2 "" ""))] "" { - ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL); + ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 0); + DONE; +}) + +(define_expand "sibcall" + [(call (match_operand:QI 0 "" "") + (match_operand 1 "" "")) + (use (match_operand 2 "" ""))] + "" +{ + ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL, 1); DONE; }) @@ -13427,41 +13682,51 @@ (define_insn "*call_1" [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm")) (match_operand 1 "" ""))] - "!TARGET_64BIT" + "!SIBLING_CALL_P (insn) && !TARGET_64BIT" { if (constant_call_address_operand (operands[0], QImode)) - { - if (SIBLING_CALL_P (insn)) - return "jmp\t%P0"; - else - return "call\t%P0"; - } - if (SIBLING_CALL_P (insn)) - return "jmp\t%A0"; - else - return "call\t%A0"; + return "call\t%P0"; + return "call\t%A0"; +} + [(set_attr "type" "call")]) + +(define_insn "*sibcall_1" + [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a")) + (match_operand 1 "" ""))] + "SIBLING_CALL_P (insn) && !TARGET_64BIT" +{ + if (constant_call_address_operand (operands[0], QImode)) + return "jmp\t%P0"; + return "jmp\t%A0"; } [(set_attr "type" "call")]) (define_insn "*call_1_rex64" [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm")) (match_operand 1 "" ""))] - "TARGET_64BIT" + "!SIBLING_CALL_P (insn) && TARGET_64BIT" { if (constant_call_address_operand (operands[0], QImode)) - { - if (SIBLING_CALL_P (insn)) - return "jmp\t%P0"; - else - return "call\t%P0"; - } - if (SIBLING_CALL_P (insn)) - return "jmp\t%A0"; - else - return "call\t%A0"; + return "call\t%P0"; + return "call\t%A0"; } [(set_attr "type" "call")]) +(define_insn "*sibcall_1_rex64" + [(call (mem:QI (match_operand:DI 0 "constant_call_address_operand" "")) + (match_operand 1 "" ""))] + "SIBLING_CALL_P (insn) && TARGET_64BIT" + "jmp\t%P0" + [(set_attr "type" "call")]) + +(define_insn "*sibcall_1_rex64_v" + [(call (mem:QI (reg:DI 40)) + (match_operand 0 "" ""))] + "SIBLING_CALL_P (insn) && TARGET_64BIT" + "jmp\t*%%r11" + [(set_attr "type" "call")]) + + ;; Call subroutine, returning value in operand 0 (define_expand "call_value_pop" @@ -13474,7 +13739,7 @@ "!TARGET_64BIT" { ix86_expand_call (operands[0], operands[1], operands[2], - operands[3], operands[4]); + operands[3], operands[4], 0); DONE; }) @@ -13486,7 +13751,19 @@ ;; Operand 2 not used on the i386. "" { - ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL); + ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 0); + DONE; +}) + +(define_expand "sibcall_value" + [(set (match_operand 0 "" "") + (call (match_operand:QI 1 "" "") + (match_operand:SI 2 "" ""))) + (use (match_operand:SI 3 "" ""))] + ;; Operand 2 not used on the i386. + "" +{ + ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL, 1); DONE; }) @@ -13509,7 +13786,7 @@ ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL), operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1), - NULL); + NULL, 0); for (i = 0; i < XVECLEN (operands[2], 0); i++) { @@ -13561,6 +13838,19 @@ (set_attr "length_immediate" "0") (set_attr "modrm" "0")]) +;; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET +;; instruction Athlon and K8 have. + +(define_insn "return_internal_long" + [(return) + (unspec [(const_int 0)] UNSPEC_REP)] + "reload_completed" + "rep {;} ret" + [(set_attr "length" "1") + (set_attr "length_immediate" "0") + (set_attr "prefix_rep" "1") + (set_attr "modrm" "0")]) + (define_insn "return_pop_internal" [(return) (use (match_operand:SI 0 "const_int_operand" ""))] @@ -13587,6 +13877,26 @@ (set_attr "modrm" "0") (set_attr "ppro_uops" "one")]) +;; Align to 16-byte boundary, max skip in op0. Used to avoid +;; branch prediction penalty for the third jump in a 16-byte +;; block on K8. + +(define_insn "align" + [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_ALIGN)] + "" +{ +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN + ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0])); +#else + /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that. + The align insn is used to avoid 3 jump instructions in the row to improve + branch prediction and the benefits hardly outweight the cost of extra 8 + nops on the average inserted by full alignment pseudo operation. */ +#endif + return ""; +} + [(set_attr "length" "16")]) + (define_expand "prologue" [(const_int 1)] "" @@ -13657,11 +13967,7 @@ (clobber (mem:BLK (scratch)))] "!TARGET_64BIT" "leave" - [(set_attr "length_immediate" "0") - (set_attr "length" "1") - (set_attr "modrm" "0") - (set_attr "athlon_decode" "vector") - (set_attr "ppro_uops" "few")]) + [(set_attr "type" "leave")]) (define_insn "leave_rex64" [(set (reg:DI 7) (plus:DI (reg:DI 6) (const_int 8))) @@ -13669,111 +13975,100 @@ (clobber (mem:BLK (scratch)))] "TARGET_64BIT" "leave" - [(set_attr "length_immediate" "0") - (set_attr "length" "1") - (set_attr "modrm" "0") - (set_attr "athlon_decode" "vector") - (set_attr "ppro_uops" "few")]) + [(set_attr "type" "leave")]) (define_expand "ffssi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "") - (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "")))] + [(parallel + [(set (match_operand:SI 0 "register_operand" "") + (ffs:SI (match_operand:SI 1 "nonimmediate_operand" ""))) + (clobber (match_scratch:SI 2 "")) + (clobber (reg:CC 17))])] "" + "") + +(define_insn_and_split "*ffs_cmove" + [(set (match_operand:SI 0 "register_operand" "=r") + (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) + (clobber (match_scratch:SI 2 "=&r")) + (clobber (reg:CC 17))] + "TARGET_CMOVE" + "#" + "&& reload_completed" + [(set (match_dup 2) (const_int -1)) + (parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0))) + (set (match_dup 0) (ctz:SI (match_dup 1)))]) + (set (match_dup 0) (if_then_else:SI + (eq (reg:CCZ 17) (const_int 0)) + (match_dup 2) + (match_dup 0))) + (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1))) + (clobber (reg:CC 17))])] + "") + +(define_insn_and_split "*ffs_no_cmove" + [(set (match_operand:SI 0 "nonimmediate_operand" "=r") + (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) + (clobber (match_scratch:SI 2 "=&q")) + (clobber (reg:CC 17))] + "" + "#" + "reload_completed" + [(parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0))) + (set (match_dup 0) (ctz:SI (match_dup 1)))]) + (set (strict_low_part (match_dup 3)) + (eq:QI (reg:CCZ 17) (const_int 0))) + (parallel [(set (match_dup 2) (neg:SI (match_dup 2))) + (clobber (reg:CC 17))]) + (parallel [(set (match_dup 0) (ior:SI (match_dup 0) (match_dup 2))) + (clobber (reg:CC 17))]) + (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1))) + (clobber (reg:CC 17))])] { - rtx out = gen_reg_rtx (SImode), tmp = gen_reg_rtx (SImode); - rtx in = operands[1]; - - if (TARGET_CMOVE) - { - emit_move_insn (tmp, constm1_rtx); - emit_insn (gen_ffssi_1 (out, in)); - emit_insn (gen_rtx_SET (VOIDmode, out, - gen_rtx_IF_THEN_ELSE (SImode, - gen_rtx_EQ (VOIDmode, gen_rtx_REG (CCZmode, FLAGS_REG), - const0_rtx), - tmp, - out))); - emit_insn (gen_addsi3 (out, out, const1_rtx)); - emit_move_insn (operands[0], out); - } - - /* Pentium bsf instruction is extremly slow. The following code is - recommended by the Intel Optimizing Manual as a reasonable replacement: - TEST EAX,EAX - JZ SHORT BS2 - XOR ECX,ECX - MOV DWORD PTR [TEMP+4],ECX - SUB ECX,EAX - AND EAX,ECX - MOV DWORD PTR [TEMP],EAX - FILD QWORD PTR [TEMP] - FSTP QWORD PTR [TEMP] - WAIT ; WAIT only needed for compatibility with - ; earlier processors - MOV ECX, DWORD PTR [TEMP+4] - SHR ECX,20 - SUB ECX,3FFH - TEST EAX,EAX ; clear zero flag - BS2: - Following piece of code expand ffs to similar beast. - */ - - else if (TARGET_PENTIUM && !optimize_size && TARGET_80387) - { - rtx label = gen_label_rtx (); - rtx lo, hi; - rtx mem = assign_386_stack_local (DImode, 0); - rtx fptmp = gen_reg_rtx (DFmode); - split_di (&mem, 1, &lo, &hi); - - emit_move_insn (out, const0_rtx); - - emit_cmp_and_jump_insns (in, const0_rtx, EQ, 0, SImode, 1, label); - - emit_move_insn (hi, out); - emit_insn (gen_subsi3 (out, out, in)); - emit_insn (gen_andsi3 (out, out, in)); - emit_move_insn (lo, out); - emit_insn (gen_floatdidf2 (fptmp,mem)); - emit_move_insn (gen_rtx_MEM (DFmode, XEXP (mem, 0)), fptmp); - emit_move_insn (out, hi); - emit_insn (gen_lshrsi3 (out, out, GEN_INT (20))); - emit_insn (gen_subsi3 (out, out, GEN_INT (0x3ff - 1))); - - emit_label (label); - LABEL_NUSES (label) = 1; - - emit_move_insn (operands[0], out); - } - else - { - emit_move_insn (tmp, const0_rtx); - emit_insn (gen_ffssi_1 (out, in)); - emit_insn (gen_rtx_SET (VOIDmode, - gen_rtx_STRICT_LOW_PART (VOIDmode, gen_lowpart (QImode, tmp)), - gen_rtx_EQ (QImode, gen_rtx_REG (CCZmode, FLAGS_REG), - const0_rtx))); - emit_insn (gen_negsi2 (tmp, tmp)); - emit_insn (gen_iorsi3 (out, out, tmp)); - emit_insn (gen_addsi3 (out, out, const1_rtx)); - emit_move_insn (operands[0], out); - } - DONE; + operands[3] = gen_lowpart (QImode, operands[2]); + ix86_expand_clear (operands[2]); }) -(define_insn "ffssi_1" +(define_insn "*ffssi_1" [(set (reg:CCZ 17) - (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm") + (compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm") (const_int 0))) (set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(match_dup 1)] UNSPEC_BSF))] + (ctz:SI (match_dup 1)))] "" "bsf{l}\t{%1, %0|%0, %1}" [(set_attr "prefix_0f" "1") (set_attr "ppro_uops" "few")]) -;; ffshi2 is not useful -- 4 word prefix ops are needed, which is larger -;; and slower than the two-byte movzx insn needed to do the work in SImode. +(define_insn "ctzsi2" + [(set (match_operand:SI 0 "register_operand" "=r") + (ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) + (clobber (reg:CC 17))] + "" + "bsf{l}\t{%1, %0|%0, %1}" + [(set_attr "prefix_0f" "1") + (set_attr "ppro_uops" "few")]) + +(define_expand "clzsi2" + [(parallel + [(set (match_operand:SI 0 "register_operand" "") + (minus:SI (const_int 31) + (clz:SI (match_operand:SI 1 "nonimmediate_operand" "")))) + (clobber (reg:CC 17))]) + (parallel + [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 31))) + (clobber (reg:CC 17))])] + "" + "") + +(define_insn "*bsr" + [(set (match_operand:SI 0 "register_operand" "=r") + (minus:SI (const_int 31) + (clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))) + (clobber (reg:CC 17))] + "" + "bsr{l}\t{%1, %0|%0, %1}" + [(set_attr "prefix_0f" "1") + (set_attr "ppro_uops" "few")]) ;; Thread-local storage patterns for ELF. ;; @@ -13941,6 +14236,56 @@ (clobber (match_dup 5)) (clobber (reg:CC 17))])] "") + +;; Load and add the thread base pointer from %gs:0. + +(define_insn "*load_tp_si" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(const_int 0)] UNSPEC_TP))] + "!TARGET_64BIT" + "mov{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}" + [(set_attr "type" "imov") + (set_attr "modrm" "0") + (set_attr "length" "7") + (set_attr "memory" "load") + (set_attr "imm_disp" "false")]) + +(define_insn "*add_tp_si" + [(set (match_operand:SI 0 "register_operand" "=r") + (plus:SI (unspec:SI [(const_int 0)] UNSPEC_TP) + (match_operand:SI 1 "register_operand" "0"))) + (clobber (reg:CC 17))] + "!TARGET_64BIT" + "add{l}\t{%%gs:0, %0|%0, DWORD PTR %%gs:0}" + [(set_attr "type" "alu") + (set_attr "modrm" "0") + (set_attr "length" "7") + (set_attr "memory" "load") + (set_attr "imm_disp" "false")]) + +(define_insn "*load_tp_di" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(const_int 0)] UNSPEC_TP))] + "TARGET_64BIT" + "mov{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}" + [(set_attr "type" "imov") + (set_attr "modrm" "0") + (set_attr "length" "7") + (set_attr "memory" "load") + (set_attr "imm_disp" "false")]) + +(define_insn "*add_tp_di" + [(set (match_operand:DI 0 "register_operand" "=r") + (plus:DI (unspec:DI [(const_int 0)] UNSPEC_TP) + (match_operand:DI 1 "register_operand" "0"))) + (clobber (reg:CC 17))] + "TARGET_64BIT" + "add{q}\t{%%fs:0, %0|%0, QWORD PTR %%fs:0}" + [(set_attr "type" "alu") + (set_attr "modrm" "0") + (set_attr "length" "7") + (set_attr "memory" "load") + (set_attr "imm_disp" "false")]) ;; These patterns match the binary 387 instructions for addM3, subM3, ;; mulM3 and divM3. There are three patterns for each of DFmode and @@ -14054,7 +14399,7 @@ (match_operator:XF 3 "binary_fp_operator" [(match_operand:XF 1 "register_operand" "%0") (match_operand:XF 2 "register_operand" "f")]))] - "!TARGET_64BIT && TARGET_80387 + "TARGET_80387 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'" "* return output_387_binary_op (insn, operands);" [(set (attr "type") @@ -14063,19 +14408,6 @@ (const_string "fop"))) (set_attr "mode" "XF")]) -(define_insn "*fop_tf_comm" - [(set (match_operand:TF 0 "register_operand" "=f") - (match_operator:TF 3 "binary_fp_operator" - [(match_operand:TF 1 "register_operand" "%0") - (match_operand:TF 2 "register_operand" "f")]))] - "TARGET_80387 && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (if_then_else (match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (const_string "fop"))) - (set_attr "mode" "XF")]) - (define_insn "*fop_sf_1_nosse" [(set (match_operand:SF 0 "register_operand" "=f,f") (match_operator:SF 3 "binary_fp_operator" @@ -14307,12 +14639,30 @@ (const_string "fop"))) (set_attr "mode" "SF")]) +(define_insn "*fop_df_6" + [(set (match_operand:DF 0 "register_operand" "=f,f") + (match_operator:DF 3 "binary_fp_operator" + [(float_extend:DF + (match_operand:SF 1 "register_operand" "0,f")) + (float_extend:DF + (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] + "TARGET_80387 && !(TARGET_SSE2 && TARGET_SSE_MATH)" + "* return output_387_binary_op (insn, operands);" + [(set (attr "type") + (cond [(match_operand:DF 3 "mult_operator" "") + (const_string "fmul") + (match_operand:DF 3 "div_operator" "") + (const_string "fdiv") + ] + (const_string "fop"))) + (set_attr "mode" "SF")]) + (define_insn "*fop_xf_1" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" [(match_operand:XF 1 "register_operand" "0,f") (match_operand:XF 2 "register_operand" "f,0")]))] - "!TARGET_64BIT && TARGET_80387 + "TARGET_80387 && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'" "* return output_387_binary_op (insn, operands);" [(set (attr "type") @@ -14324,29 +14674,12 @@ (const_string "fop"))) (set_attr "mode" "XF")]) -(define_insn "*fop_tf_1" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(match_operand:TF 1 "register_operand" "0,f") - (match_operand:TF 2 "register_operand" "f,0")]))] - "TARGET_80387 - && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "XF")]) - (define_insn "*fop_xf_2" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" [(float:XF (match_operand:SI 1 "nonimmediate_operand" "m,?r")) (match_operand:XF 2 "register_operand" "0,0")]))] - "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP" + "TARGET_80387 && TARGET_USE_FIOP" "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" [(set (attr "type") (cond [(match_operand:XF 3 "mult_operator" "") @@ -14359,30 +14692,12 @@ (set_attr "mode" "SI") (set_attr "ppro_uops" "many")]) -(define_insn "*fop_tf_2" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(float:TF (match_operand:SI 1 "nonimmediate_operand" "m,?r")) - (match_operand:TF 2 "register_operand" "0,0")]))] - "TARGET_80387 && TARGET_USE_FIOP" - "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "fp_int_src" "true") - (set_attr "mode" "SI") - (set_attr "ppro_uops" "many")]) - (define_insn "*fop_xf_3" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" [(match_operand:XF 1 "register_operand" "0,0") (float:XF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))] - "!TARGET_64BIT && TARGET_80387 && TARGET_USE_FIOP" + "TARGET_80387 && TARGET_USE_FIOP" "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" [(set (attr "type") (cond [(match_operand:XF 3 "mult_operator" "") @@ -14395,30 +14710,12 @@ (set_attr "mode" "SI") (set_attr "ppro_uops" "many")]) -(define_insn "*fop_tf_3" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(match_operand:TF 1 "register_operand" "0,0") - (float:TF (match_operand:SI 2 "nonimmediate_operand" "m,?r"))]))] - "TARGET_80387 && TARGET_USE_FIOP" - "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "fp_int_src" "true") - (set_attr "mode" "SI") - (set_attr "ppro_uops" "many")]) - (define_insn "*fop_xf_4" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" - [(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,0")) + [(float_extend:XF (match_operand 1 "nonimmediate_operand" "fm,0")) (match_operand:XF 2 "register_operand" "0,f")]))] - "!TARGET_64BIT && TARGET_80387" + "TARGET_80387" "* return output_387_binary_op (insn, operands);" [(set (attr "type") (cond [(match_operand:XF 3 "mult_operator" "") @@ -14429,29 +14726,13 @@ (const_string "fop"))) (set_attr "mode" "SF")]) -(define_insn "*fop_tf_4" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "fm,0")) - (match_operand:TF 2 "register_operand" "0,f")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "SF")]) - (define_insn "*fop_xf_5" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" [(match_operand:XF 1 "register_operand" "0,f") (float_extend:XF - (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] - "!TARGET_64BIT && TARGET_80387" + (match_operand 2 "nonimmediate_operand" "fm,0"))]))] + "TARGET_80387" "* return output_387_binary_op (insn, operands);" [(set (attr "type") (cond [(match_operand:XF 3 "mult_operator" "") @@ -14462,62 +14743,14 @@ (const_string "fop"))) (set_attr "mode" "SF")]) -(define_insn "*fop_tf_5" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(match_operand:TF 1 "register_operand" "0,f") - (float_extend:TF - (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "SF")]) - (define_insn "*fop_xf_6" [(set (match_operand:XF 0 "register_operand" "=f,f") (match_operator:XF 3 "binary_fp_operator" - [(float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,0")) - (match_operand:XF 2 "register_operand" "0,f")]))] - "!TARGET_64BIT && TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:XF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:XF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "DF")]) - -(define_insn "*fop_tf_6" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "fm,0")) - (match_operand:TF 2 "register_operand" "0,f")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "DF")]) - -(define_insn "*fop_xf_7" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (match_operator:XF 3 "binary_fp_operator" - [(match_operand:XF 1 "register_operand" "0,f") + [(float_extend:XF + (match_operand 1 "register_operand" "0,f")) (float_extend:XF - (match_operand:DF 2 "nonimmediate_operand" "fm,0"))]))] - "!TARGET_64BIT && TARGET_80387" + (match_operand 2 "nonimmediate_operand" "fm,0"))]))] + "TARGET_80387" "* return output_387_binary_op (insn, operands);" [(set (attr "type") (cond [(match_operand:XF 3 "mult_operator" "") @@ -14526,24 +14759,7 @@ (const_string "fdiv") ] (const_string "fop"))) - (set_attr "mode" "DF")]) - -(define_insn "*fop_tf_7" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (match_operator:TF 3 "binary_fp_operator" - [(match_operand:TF 1 "register_operand" "0,f") - (float_extend:TF - (match_operand:DF 2 "nonimmediate_operand" "fm,0"))]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:TF 3 "mult_operator" "") - (const_string "fmul") - (match_operand:TF 3 "div_operator" "") - (const_string "fdiv") - ] - (const_string "fop"))) - (set_attr "mode" "DF")]) + (set_attr "mode" "SF")]) (define_split [(set (match_operand 0 "register_operand" "") @@ -14682,17 +14898,7 @@ (define_insn "sqrtxf2" [(set (match_operand:XF 0 "register_operand" "=f") (sqrt:XF (match_operand:XF 1 "register_operand" "0")))] - "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387 - && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) " - "fsqrt" - [(set_attr "type" "fpspc") - (set_attr "mode" "XF") - (set_attr "athlon_decode" "direct")]) - -(define_insn "sqrttf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (sqrt:TF (match_operand:TF 1 "register_operand" "0")))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + "TARGET_80387 && !TARGET_NO_FANCY_MATH_387 && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) " "fsqrt" [(set_attr "type" "fpspc") @@ -14703,17 +14909,7 @@ [(set (match_operand:XF 0 "register_operand" "=f") (sqrt:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387" - "fsqrt" - [(set_attr "type" "fpspc") - (set_attr "mode" "XF") - (set_attr "athlon_decode" "direct")]) - -(define_insn "*sqrtextenddftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (sqrt:TF (float_extend:TF - (match_operand:DF 1 "register_operand" "0"))))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" + "TARGET_80387 && !TARGET_NO_FANCY_MATH_387" "fsqrt" [(set_attr "type" "fpspc") (set_attr "mode" "XF") @@ -14723,17 +14919,7 @@ [(set (match_operand:XF 0 "register_operand" "=f") (sqrt:XF (float_extend:XF (match_operand:SF 1 "register_operand" "0"))))] - "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387" - "fsqrt" - [(set_attr "type" "fpspc") - (set_attr "mode" "XF") - (set_attr "athlon_decode" "direct")]) - -(define_insn "*sqrtextendsftf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (sqrt:TF (float_extend:TF - (match_operand:SF 1 "register_operand" "0"))))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" + "TARGET_80387 && !TARGET_NO_FANCY_MATH_387" "fsqrt" [(set_attr "type" "fpspc") (set_attr "mode" "XF") @@ -14771,16 +14957,7 @@ (define_insn "sinxf2" [(set (match_operand:XF 0 "register_operand" "=f") (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_SIN))] - "!TARGET_64BIT && TARGET_80387 && !TARGET_NO_FANCY_MATH_387 - && flag_unsafe_math_optimizations" - "fsin" - [(set_attr "type" "fpspc") - (set_attr "mode" "XF")]) - -(define_insn "sintf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_SIN))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + "TARGET_80387 && !TARGET_NO_FANCY_MATH_387 && flag_unsafe_math_optimizations" "fsin" [(set_attr "type" "fpspc") @@ -14818,20 +14995,333 @@ (define_insn "cosxf2" [(set (match_operand:XF 0 "register_operand" "=f") (unspec:XF [(match_operand:XF 1 "register_operand" "0")] UNSPEC_COS))] - "!TARGET_64BIT && ! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_unsafe_math_optimizations" "fcos" [(set_attr "type" "fpspc") (set_attr "mode" "XF")]) -(define_insn "costf2" - [(set (match_operand:TF 0 "register_operand" "=f") - (unspec:TF [(match_operand:TF 1 "register_operand" "0")] UNSPEC_COS))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 +(define_insn "atan2df3_1" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 2 "register_operand" "0") + (match_operand:DF 1 "register_operand" "u")] + UNSPEC_FPATAN)) + (clobber (match_scratch:DF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_unsafe_math_optimizations" - "fcos" + "fpatan" + [(set_attr "type" "fpspc") + (set_attr "mode" "DF")]) + +(define_expand "atan2df3" + [(use (match_operand:DF 0 "register_operand" "=f")) + (use (match_operand:DF 2 "register_operand" "0")) + (use (match_operand:DF 1 "register_operand" "u"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx copy = gen_reg_rtx (DFmode); + emit_move_insn (copy, operands[1]); + emit_insn (gen_atan2df3_1 (operands[0], copy, operands[2])); + DONE; +}) + +(define_insn "atan2sf3_1" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 2 "register_operand" "0") + (match_operand:SF 1 "register_operand" "u")] + UNSPEC_FPATAN)) + (clobber (match_scratch:SF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fpatan" + [(set_attr "type" "fpspc") + (set_attr "mode" "SF")]) + +(define_expand "atan2sf3" + [(use (match_operand:SF 0 "register_operand" "=f")) + (use (match_operand:SF 2 "register_operand" "0")) + (use (match_operand:SF 1 "register_operand" "u"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx copy = gen_reg_rtx (SFmode); + emit_move_insn (copy, operands[1]); + emit_insn (gen_atan2sf3_1 (operands[0], copy, operands[2])); + DONE; +}) + +(define_insn "atan2xf3_1" + [(set (match_operand:XF 0 "register_operand" "=f") + (unspec:XF [(match_operand:XF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FPATAN)) + (clobber (match_scratch:XF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fpatan" [(set_attr "type" "fpspc") (set_attr "mode" "XF")]) + +(define_expand "atan2xf3" + [(use (match_operand:XF 0 "register_operand" "=f")) + (use (match_operand:XF 2 "register_operand" "0")) + (use (match_operand:XF 1 "register_operand" "u"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx copy = gen_reg_rtx (XFmode); + emit_move_insn (copy, operands[1]); + emit_insn (gen_atan2xf3_1 (operands[0], copy, operands[2])); + DONE; +}) + +(define_insn "*fyl2x_sfxf3" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FYL2X)) + (clobber (match_scratch:SF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fyl2x" + [(set_attr "type" "fpspc") + (set_attr "mode" "SF")]) + +(define_insn "*fyl2x_dfxf3" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FYL2X)) + (clobber (match_scratch:DF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fyl2x" + [(set_attr "type" "fpspc") + (set_attr "mode" "DF")]) + +(define_insn "*fyl2x_xf3" + [(set (match_operand:XF 0 "register_operand" "=f") + (unspec:XF [(match_operand:XF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FYL2X)) + (clobber (match_scratch:XF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fyl2x" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) + +(define_expand "logsf2" + [(parallel [(set (match_operand:SF 0 "register_operand" "") + (unspec:SF [(match_operand:SF 1 "register_operand" "") + (match_dup 2)] UNSPEC_FYL2X)) + (clobber (match_scratch:SF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + + operands[2] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (4); /* fldln2 */ + emit_move_insn (operands[2], temp); +}) + +(define_expand "logdf2" + [(parallel [(set (match_operand:DF 0 "register_operand" "") + (unspec:DF [(match_operand:DF 1 "register_operand" "") + (match_dup 2)] UNSPEC_FYL2X)) + (clobber (match_scratch:DF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + + operands[2] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (4); /* fldln2 */ + emit_move_insn (operands[2], temp); +}) + +(define_expand "logxf2" + [(parallel [(set (match_operand:XF 0 "register_operand" "") + (unspec:XF [(match_operand:XF 1 "register_operand" "") + (match_dup 2)] UNSPEC_FYL2X)) + (clobber (match_scratch:XF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + + operands[2] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (4); /* fldln2 */ + emit_move_insn (operands[2], temp); +}) + +(define_insn "*fscale_sfxf3" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:XF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FSCALE)) + (clobber (match_scratch:SF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fscale\;fstp\t%y1" + [(set_attr "type" "fpspc") + (set_attr "mode" "SF")]) + +(define_insn "*fscale_dfxf3" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:XF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FSCALE)) + (clobber (match_scratch:DF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fscale\;fstp\t%y1" + [(set_attr "type" "fpspc") + (set_attr "mode" "DF")]) + +(define_insn "*fscale_xf3" + [(set (match_operand:XF 0 "register_operand" "=f") + (unspec:XF [(match_operand:XF 2 "register_operand" "0") + (match_operand:XF 1 "register_operand" "u")] + UNSPEC_FSCALE)) + (clobber (match_scratch:XF 3 "=1"))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "fscale\;fstp\t%y1" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) + +(define_insn "*frndintxf2" + [(set (match_operand:XF 0 "register_operand" "=f") + (unspec:XF [(match_operand:XF 1 "register_operand" "0")] + UNSPEC_FRNDINT))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "frndint" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) + +(define_insn "*f2xm1xf2" + [(set (match_operand:XF 0 "register_operand" "=f") + (unspec:XF [(match_operand:XF 1 "register_operand" "0")] + UNSPEC_F2XM1))] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" + "f2xm1" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) + +(define_expand "expsf2" + [(set (match_dup 2) + (float_extend:XF (match_operand:SF 1 "register_operand" ""))) + (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3))) + (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT)) + (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5))) + (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1)) + (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8))) + (parallel [(set (match_operand:SF 0 "register_operand" "") + (unspec:SF [(match_dup 9) (match_dup 5)] UNSPEC_FSCALE)) + (clobber (match_scratch:SF 5 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + int i; + + for (i=2; i<10; i++) + operands[i] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (5); /* fldl2e */ + emit_move_insn (operands[3], temp); + emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */ +}) + +(define_expand "expdf2" + [(set (match_dup 2) + (float_extend:XF (match_operand:DF 1 "register_operand" ""))) + (set (match_dup 4) (mult:XF (match_dup 2) (match_dup 3))) + (set (match_dup 5) (unspec:XF [(match_dup 4)] UNSPEC_FRNDINT)) + (set (match_dup 6) (minus:XF (match_dup 4) (match_dup 5))) + (set (match_dup 7) (unspec:XF [(match_dup 6)] UNSPEC_F2XM1)) + (set (match_dup 9) (plus:XF (match_dup 7) (match_dup 8))) + (parallel [(set (match_operand:DF 0 "register_operand" "") + (unspec:DF [(match_dup 9) (match_dup 5)] UNSPEC_FSCALE)) + (clobber (match_scratch:DF 5 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + int i; + + for (i=2; i<10; i++) + operands[i] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (5); /* fldl2e */ + emit_move_insn (operands[3], temp); + emit_move_insn (operands[8], CONST1_RTX (XFmode)); /* fld1 */ +}) + +(define_expand "expxf2" + [(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand" "") + (match_dup 2))) + (set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT)) + (set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4))) + (set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1)) + (set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7))) + (parallel [(set (match_operand:XF 0 "register_operand" "") + (unspec:XF [(match_dup 8) (match_dup 4)] UNSPEC_FSCALE)) + (clobber (match_scratch:XF 5 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + rtx temp; + int i; + + for (i=2; i<9; i++) + operands[i] = gen_reg_rtx (XFmode); + temp = standard_80387_constant_rtx (5); /* fldl2e */ + emit_move_insn (operands[2], temp); + emit_move_insn (operands[7], CONST1_RTX (XFmode)); /* fld1 */ +}) + +(define_expand "atansf2" + [(parallel [(set (match_operand:SF 0 "register_operand" "") + (unspec:SF [(match_dup 2) + (match_operand:SF 1 "register_operand" "")] + UNSPEC_FPATAN)) + (clobber (match_scratch:SF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + operands[2] = gen_reg_rtx (SFmode); + emit_move_insn (operands[2], CONST1_RTX (SFmode)); /* fld1 */ +}) + +(define_expand "atandf2" + [(parallel [(set (match_operand:DF 0 "register_operand" "") + (unspec:DF [(match_dup 2) + (match_operand:DF 1 "register_operand" "")] + UNSPEC_FPATAN)) + (clobber (match_scratch:DF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + operands[2] = gen_reg_rtx (DFmode); + emit_move_insn (operands[2], CONST1_RTX (DFmode)); /* fld1 */ +}) + +(define_expand "atanxf2" + [(parallel [(set (match_operand:XF 0 "register_operand" "") + (unspec:XF [(match_dup 2) + (match_operand:XF 1 "register_operand" "")] + UNSPEC_FPATAN)) + (clobber (match_scratch:XF 3 ""))])] + "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 + && flag_unsafe_math_optimizations" +{ + operands[2] = gen_reg_rtx (XFmode); + emit_move_insn (operands[2], CONST1_RTX (XFmode)); /* fld1 */ +}) ;; Block operation instructions @@ -14846,7 +15336,7 @@ (use (match_operand:BLK 1 "memory_operand" "")) (use (match_operand:SI 2 "nonmemory_operand" "")) (use (match_operand:SI 3 "const_int_operand" ""))] - "" + "! optimize_size" { if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3])) DONE; @@ -14870,170 +15360,45 @@ ;; Most CPUs don't like single string operations ;; Handle this case here to simplify previous expander. -(define_expand "strmovdi_rex64" - [(set (match_dup 2) - (mem:DI (match_operand:DI 1 "register_operand" ""))) - (set (mem:DI (match_operand:DI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8))) +(define_expand "strmov" + [(set (match_dup 4) (match_operand 3 "memory_operand" "")) + (set (match_operand 1 "memory_operand" "") (match_dup 4)) + (parallel [(set (match_operand 0 "register_operand" "") (match_dup 5)) (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 8))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovdi_rex_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (DImode); -}) - - -(define_expand "strmovsi" - [(set (match_dup 2) - (mem:SI (match_operand:SI 1 "register_operand" ""))) - (set (mem:SI (match_operand:SI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 4))) + (parallel [(set (match_operand 2 "register_operand" "") (match_dup 6)) (clobber (reg:CC 17))])] "" { - if (TARGET_64BIT) - { - emit_insn (gen_strmovsi_rex64 (operands[0], operands[1])); - DONE; - } + rtx adjust = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[1]))); + + /* If .md ever supports :P for Pmode, these can be directly + in the pattern above. */ + operands[5] = gen_rtx_PLUS (Pmode, operands[0], adjust); + operands[6] = gen_rtx_PLUS (Pmode, operands[2], adjust); + if (TARGET_SINGLE_STRINGOP || optimize_size) { - emit_insn (gen_strmovsi_1 (operands[0], operands[1], operands[0], - operands[1])); + emit_insn (gen_strmov_singleop (operands[0], operands[1], + operands[2], operands[3], + operands[5], operands[6])); DONE; } - else - operands[2] = gen_reg_rtx (SImode); + + operands[4] = gen_reg_rtx (GET_MODE (operands[1])); }) -(define_expand "strmovsi_rex64" - [(set (match_dup 2) - (mem:SI (match_operand:DI 1 "register_operand" ""))) - (set (mem:SI (match_operand:DI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 4))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovsi_rex_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (SImode); -}) +(define_expand "strmov_singleop" + [(parallel [(set (match_operand 1 "memory_operand" "") + (match_operand 3 "memory_operand" "")) + (set (match_operand 0 "register_operand" "") + (match_operand 4 "" "")) + (set (match_operand 2 "register_operand" "") + (match_operand 5 "" "")) + (use (reg:SI 19))])] + "TARGET_SINGLE_STRINGOP || optimize_size" + "") -(define_expand "strmovhi" - [(set (match_dup 2) - (mem:HI (match_operand:SI 1 "register_operand" ""))) - (set (mem:HI (match_operand:SI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 2))) - (clobber (reg:CC 17))])] - "" -{ - if (TARGET_64BIT) - { - emit_insn (gen_strmovhi_rex64 (operands[0], operands[1])); - DONE; - } - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovhi_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (HImode); -}) - -(define_expand "strmovhi_rex64" - [(set (match_dup 2) - (mem:HI (match_operand:DI 1 "register_operand" ""))) - (set (mem:HI (match_operand:DI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 2))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovhi_rex_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (HImode); -}) - -(define_expand "strmovqi" - [(set (match_dup 2) - (mem:QI (match_operand:SI 1 "register_operand" ""))) - (set (mem:QI (match_operand:SI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:SI (match_dup 1) (const_int 1))) - (clobber (reg:CC 17))])] - "" -{ - if (TARGET_64BIT) - { - emit_insn (gen_strmovqi_rex64 (operands[0], operands[1])); - DONE; - } - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovqi_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (QImode); -}) - -(define_expand "strmovqi_rex64" - [(set (match_dup 2) - (mem:QI (match_operand:DI 1 "register_operand" ""))) - (set (mem:QI (match_operand:DI 0 "register_operand" "")) - (match_dup 2)) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1))) - (clobber (reg:CC 17))]) - (parallel [(set (match_dup 1) (plus:DI (match_dup 1) (const_int 1))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strmovqi_rex_1 (operands[0], operands[1], operands[0], - operands[1])); - DONE; - } - else - operands[2] = gen_reg_rtx (QImode); -}) - -(define_insn "strmovdi_rex_1" +(define_insn "*strmovdi_rex_1" [(set (mem:DI (match_operand:DI 2 "register_operand" "0")) (mem:DI (match_operand:DI 3 "register_operand" "1"))) (set (match_operand:DI 0 "register_operand" "=D") @@ -15049,7 +15414,7 @@ (set_attr "mode" "DI") (set_attr "memory" "both")]) -(define_insn "strmovsi_1" +(define_insn "*strmovsi_1" [(set (mem:SI (match_operand:SI 2 "register_operand" "0")) (mem:SI (match_operand:SI 3 "register_operand" "1"))) (set (match_operand:SI 0 "register_operand" "=D") @@ -15065,7 +15430,7 @@ (set_attr "mode" "SI") (set_attr "memory" "both")]) -(define_insn "strmovsi_rex_1" +(define_insn "*strmovsi_rex_1" [(set (mem:SI (match_operand:DI 2 "register_operand" "0")) (mem:SI (match_operand:DI 3 "register_operand" "1"))) (set (match_operand:DI 0 "register_operand" "=D") @@ -15081,7 +15446,7 @@ (set_attr "mode" "SI") (set_attr "memory" "both")]) -(define_insn "strmovhi_1" +(define_insn "*strmovhi_1" [(set (mem:HI (match_operand:SI 2 "register_operand" "0")) (mem:HI (match_operand:SI 3 "register_operand" "1"))) (set (match_operand:SI 0 "register_operand" "=D") @@ -15097,7 +15462,7 @@ (set_attr "memory" "both") (set_attr "mode" "HI")]) -(define_insn "strmovhi_rex_1" +(define_insn "*strmovhi_rex_1" [(set (mem:HI (match_operand:DI 2 "register_operand" "0")) (mem:HI (match_operand:DI 3 "register_operand" "1"))) (set (match_operand:DI 0 "register_operand" "=D") @@ -15113,7 +15478,7 @@ (set_attr "memory" "both") (set_attr "mode" "HI")]) -(define_insn "strmovqi_1" +(define_insn "*strmovqi_1" [(set (mem:QI (match_operand:SI 2 "register_operand" "0")) (mem:QI (match_operand:SI 3 "register_operand" "1"))) (set (match_operand:SI 0 "register_operand" "=D") @@ -15129,7 +15494,7 @@ (set_attr "memory" "both") (set_attr "mode" "QI")]) -(define_insn "strmovqi_rex_1" +(define_insn "*strmovqi_rex_1" [(set (mem:QI (match_operand:DI 2 "register_operand" "0")) (mem:QI (match_operand:DI 3 "register_operand" "1"))) (set (match_operand:DI 0 "register_operand" "=D") @@ -15145,7 +15510,20 @@ (set_attr "memory" "both") (set_attr "mode" "QI")]) -(define_insn "rep_movdi_rex64" +(define_expand "rep_mov" + [(parallel [(set (match_operand 4 "register_operand" "") (const_int 0)) + (set (match_operand 0 "register_operand" "") + (match_operand 5 "" "")) + (set (match_operand 2 "register_operand" "") + (match_operand 6 "" "")) + (set (match_operand 1 "memory_operand" "") + (match_operand 3 "memory_operand" "")) + (use (match_dup 4)) + (use (reg:SI 19))])] + "" + "") + +(define_insn "*rep_movdi_rex64" [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2") @@ -15165,7 +15543,7 @@ (set_attr "memory" "both") (set_attr "mode" "DI")]) -(define_insn "rep_movsi" +(define_insn "*rep_movsi" [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0)) (set (match_operand:SI 0 "register_operand" "=D") (plus:SI (ashift:SI (match_operand:SI 5 "register_operand" "2") @@ -15185,7 +15563,7 @@ (set_attr "memory" "both") (set_attr "mode" "SI")]) -(define_insn "rep_movsi_rex64" +(define_insn "*rep_movsi_rex64" [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (ashift:DI (match_operand:DI 5 "register_operand" "2") @@ -15205,7 +15583,7 @@ (set_attr "memory" "both") (set_attr "mode" "SI")]) -(define_insn "rep_movqi" +(define_insn "*rep_movqi" [(set (match_operand:SI 2 "register_operand" "=c") (const_int 0)) (set (match_operand:SI 0 "register_operand" "=D") (plus:SI (match_operand:SI 3 "register_operand" "0") @@ -15223,7 +15601,7 @@ (set_attr "memory" "both") (set_attr "mode" "SI")]) -(define_insn "rep_movqi_rex64" +(define_insn "*rep_movqi_rex64" [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (match_operand:DI 3 "register_operand" "0") @@ -15268,120 +15646,40 @@ ;; Most CPUs don't like single string operations ;; Handle this case here to simplify previous expander. -(define_expand "strsetdi_rex64" - [(set (mem:DI (match_operand:DI 0 "register_operand" "")) - (match_operand:DI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 8))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsetdi_rex_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) - -(define_expand "strsetsi" - [(set (mem:SI (match_operand:SI 0 "register_operand" "")) - (match_operand:SI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 4))) +(define_expand "strset" + [(set (match_operand 1 "memory_operand" "") + (match_operand 2 "register_operand" "")) + (parallel [(set (match_operand 0 "register_operand" "") + (match_dup 3)) (clobber (reg:CC 17))])] "" { - if (TARGET_64BIT) - { - emit_insn (gen_strsetsi_rex64 (operands[0], operands[1])); - DONE; - } - else if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsetsi_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) + if (GET_MODE (operands[1]) != GET_MODE (operands[2])) + operands[1] = adjust_address_nv (operands[1], GET_MODE (operands[2]), 0); -(define_expand "strsetsi_rex64" - [(set (mem:SI (match_operand:DI 0 "register_operand" "")) - (match_operand:SI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 4))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ + /* If .md ever supports :P for Pmode, this can be directly + in the pattern above. */ + operands[3] = gen_rtx_PLUS (Pmode, operands[0], + GEN_INT (GET_MODE_SIZE (GET_MODE + (operands[2])))); if (TARGET_SINGLE_STRINGOP || optimize_size) { - emit_insn (gen_strsetsi_rex_1 (operands[0], operands[0], operands[1])); + emit_insn (gen_strset_singleop (operands[0], operands[1], operands[2], + operands[3])); DONE; } }) -(define_expand "strsethi" - [(set (mem:HI (match_operand:SI 0 "register_operand" "")) - (match_operand:HI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 2))) - (clobber (reg:CC 17))])] - "" -{ - if (TARGET_64BIT) - { - emit_insn (gen_strsethi_rex64 (operands[0], operands[1])); - DONE; - } - else if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsethi_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) +(define_expand "strset_singleop" + [(parallel [(set (match_operand 1 "memory_operand" "") + (match_operand 2 "register_operand" "")) + (set (match_operand 0 "register_operand" "") + (match_operand 3 "" "")) + (use (reg:SI 19))])] + "TARGET_SINGLE_STRINGOP || optimize_size" + "") -(define_expand "strsethi_rex64" - [(set (mem:HI (match_operand:DI 0 "register_operand" "")) - (match_operand:HI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 2))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsethi_rex_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) - -(define_expand "strsetqi" - [(set (mem:QI (match_operand:SI 0 "register_operand" "")) - (match_operand:QI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1))) - (clobber (reg:CC 17))])] - "" -{ - if (TARGET_64BIT) - { - emit_insn (gen_strsetqi_rex64 (operands[0], operands[1])); - DONE; - } - else if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsetqi_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) - -(define_expand "strsetqi_rex64" - [(set (mem:QI (match_operand:DI 0 "register_operand" "")) - (match_operand:QI 1 "register_operand" "")) - (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1))) - (clobber (reg:CC 17))])] - "TARGET_64BIT" -{ - if (TARGET_SINGLE_STRINGOP || optimize_size) - { - emit_insn (gen_strsetqi_rex_1 (operands[0], operands[0], operands[1])); - DONE; - } -}) - -(define_insn "strsetdi_rex_1" +(define_insn "*strsetdi_rex_1" [(set (mem:SI (match_operand:DI 1 "register_operand" "0")) (match_operand:SI 2 "register_operand" "a")) (set (match_operand:DI 0 "register_operand" "=D") @@ -15394,7 +15692,7 @@ (set_attr "memory" "store") (set_attr "mode" "DI")]) -(define_insn "strsetsi_1" +(define_insn "*strsetsi_1" [(set (mem:SI (match_operand:SI 1 "register_operand" "0")) (match_operand:SI 2 "register_operand" "a")) (set (match_operand:SI 0 "register_operand" "=D") @@ -15407,7 +15705,7 @@ (set_attr "memory" "store") (set_attr "mode" "SI")]) -(define_insn "strsetsi_rex_1" +(define_insn "*strsetsi_rex_1" [(set (mem:SI (match_operand:DI 1 "register_operand" "0")) (match_operand:SI 2 "register_operand" "a")) (set (match_operand:DI 0 "register_operand" "=D") @@ -15420,7 +15718,7 @@ (set_attr "memory" "store") (set_attr "mode" "SI")]) -(define_insn "strsethi_1" +(define_insn "*strsethi_1" [(set (mem:HI (match_operand:SI 1 "register_operand" "0")) (match_operand:HI 2 "register_operand" "a")) (set (match_operand:SI 0 "register_operand" "=D") @@ -15433,7 +15731,7 @@ (set_attr "memory" "store") (set_attr "mode" "HI")]) -(define_insn "strsethi_rex_1" +(define_insn "*strsethi_rex_1" [(set (mem:HI (match_operand:DI 1 "register_operand" "0")) (match_operand:HI 2 "register_operand" "a")) (set (match_operand:DI 0 "register_operand" "=D") @@ -15446,7 +15744,7 @@ (set_attr "memory" "store") (set_attr "mode" "HI")]) -(define_insn "strsetqi_1" +(define_insn "*strsetqi_1" [(set (mem:QI (match_operand:SI 1 "register_operand" "0")) (match_operand:QI 2 "register_operand" "a")) (set (match_operand:SI 0 "register_operand" "=D") @@ -15459,7 +15757,7 @@ (set_attr "memory" "store") (set_attr "mode" "QI")]) -(define_insn "strsetqi_rex_1" +(define_insn "*strsetqi_rex_1" [(set (mem:QI (match_operand:DI 1 "register_operand" "0")) (match_operand:QI 2 "register_operand" "a")) (set (match_operand:DI 0 "register_operand" "=D") @@ -15472,7 +15770,18 @@ (set_attr "memory" "store") (set_attr "mode" "QI")]) -(define_insn "rep_stosdi_rex64" +(define_expand "rep_stos" + [(parallel [(set (match_operand 1 "register_operand" "") (const_int 0)) + (set (match_operand 0 "register_operand" "") + (match_operand 4 "" "")) + (set (match_operand 2 "memory_operand" "") (const_int 0)) + (use (match_operand 3 "register_operand" "")) + (use (match_dup 1)) + (use (reg:SI 19))])] + "" + "") + +(define_insn "*rep_stosdi_rex64" [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1") @@ -15490,7 +15799,7 @@ (set_attr "memory" "store") (set_attr "mode" "DI")]) -(define_insn "rep_stossi" +(define_insn "*rep_stossi" [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0)) (set (match_operand:SI 0 "register_operand" "=D") (plus:SI (ashift:SI (match_operand:SI 4 "register_operand" "1") @@ -15508,7 +15817,7 @@ (set_attr "memory" "store") (set_attr "mode" "SI")]) -(define_insn "rep_stossi_rex64" +(define_insn "*rep_stossi_rex64" [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (ashift:DI (match_operand:DI 4 "register_operand" "1") @@ -15526,7 +15835,7 @@ (set_attr "memory" "store") (set_attr "mode" "SI")]) -(define_insn "rep_stosqi" +(define_insn "*rep_stosqi" [(set (match_operand:SI 1 "register_operand" "=c") (const_int 0)) (set (match_operand:SI 0 "register_operand" "=D") (plus:SI (match_operand:SI 3 "register_operand" "0") @@ -15543,7 +15852,7 @@ (set_attr "memory" "store") (set_attr "mode" "QI")]) -(define_insn "rep_stosqi_rex64" +(define_insn "*rep_stosqi_rex64" [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0)) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (match_operand:DI 3 "register_operand" "0") @@ -15552,7 +15861,7 @@ (const_int 0)) (use (match_operand:QI 2 "register_operand" "a")) (use (match_dup 4)) - (use (reg:DI 19))] + (use (reg:SI 19))] "TARGET_64BIT" "{rep\;stosb|rep stosb}" [(set_attr "type" "str") @@ -15566,17 +15875,25 @@ (match_operand:BLK 2 "general_operand" ""))) (use (match_operand 3 "general_operand" "")) (use (match_operand 4 "immediate_operand" ""))] - "" + "! optimize_size || TARGET_INLINE_ALL_STRINGOPS" { rtx addr1, addr2, out, outlow, count, countreg, align; + /* Can't use this if the user has appropriated esi or edi. */ + if (global_regs[4] || global_regs[5]) + FAIL; + out = operands[0]; if (GET_CODE (out) != REG) out = gen_reg_rtx (SImode); addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0)); - + if (addr1 != XEXP (operands[1], 0)) + operands[1] = replace_equiv_address_nv (operands[1], addr1); + if (addr2 != XEXP (operands[2], 0)) + operands[2] = replace_equiv_address_nv (operands[2], addr2); + count = operands[3]; countreg = ix86_zero_extend_to_Pmode (count); @@ -15593,27 +15910,17 @@ emit_move_insn (operands[0], const0_rtx); DONE; } - if (TARGET_64BIT) - emit_insn (gen_cmpstrqi_nz_rex_1 (addr1, addr2, countreg, align, - addr1, addr2, countreg)); - else - emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align, - addr1, addr2, countreg)); + emit_insn (gen_cmpstrqi_nz_1 (addr1, addr2, countreg, align, + operands[1], operands[2])); } else { if (TARGET_64BIT) - { - emit_insn (gen_cmpdi_1_rex64 (countreg, countreg)); - emit_insn (gen_cmpstrqi_rex_1 (addr1, addr2, countreg, align, - addr1, addr2, countreg)); - } + emit_insn (gen_cmpdi_1_rex64 (countreg, countreg)); else - { - emit_insn (gen_cmpsi_1 (countreg, countreg)); - emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align, - addr1, addr2, countreg)); - } + emit_insn (gen_cmpsi_1 (countreg, countreg)); + emit_insn (gen_cmpstrqi_1 (addr1, addr2, countreg, align, + operands[1], operands[2])); } outlow = gen_lowpart (QImode, out); @@ -15644,7 +15951,20 @@ ;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is ;; zero. Emit extra code to make sure that a zero-length compare is EQ. -(define_insn "cmpstrqi_nz_1" +(define_expand "cmpstrqi_nz_1" + [(parallel [(set (reg:CC 17) + (compare:CC (match_operand 4 "memory_operand" "") + (match_operand 5 "memory_operand" ""))) + (use (match_operand 2 "register_operand" "")) + (use (match_operand:SI 3 "immediate_operand" "")) + (use (reg:SI 19)) + (clobber (match_operand 0 "register_operand" "")) + (clobber (match_operand 1 "register_operand" "")) + (clobber (match_dup 2))])] + "" + "") + +(define_insn "*cmpstrqi_nz_1" [(set (reg:CC 17) (compare:CC (mem:BLK (match_operand:SI 4 "register_operand" "0")) (mem:BLK (match_operand:SI 5 "register_operand" "1")))) @@ -15660,7 +15980,7 @@ (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) -(define_insn "cmpstrqi_nz_rex_1" +(define_insn "*cmpstrqi_nz_rex_1" [(set (reg:CC 17) (compare:CC (mem:BLK (match_operand:DI 4 "register_operand" "0")) (mem:BLK (match_operand:DI 5 "register_operand" "1")))) @@ -15678,7 +15998,23 @@ ;; The same, but the count is not known to not be zero. -(define_insn "cmpstrqi_1" +(define_expand "cmpstrqi_1" + [(parallel [(set (reg:CC 17) + (if_then_else:CC (ne (match_operand 2 "register_operand" "") + (const_int 0)) + (compare:CC (match_operand 4 "memory_operand" "") + (match_operand 5 "memory_operand" "")) + (const_int 0))) + (use (match_operand:SI 3 "immediate_operand" "")) + (use (reg:CC 17)) + (use (reg:SI 19)) + (clobber (match_operand 0 "register_operand" "")) + (clobber (match_operand 1 "register_operand" "")) + (clobber (match_dup 2))])] + "" + "") + +(define_insn "*cmpstrqi_1" [(set (reg:CC 17) (if_then_else:CC (ne (match_operand:SI 6 "register_operand" "2") (const_int 0)) @@ -15697,7 +16033,7 @@ (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) -(define_insn "cmpstrqi_rex_1" +(define_insn "*cmpstrqi_rex_1" [(set (reg:CC 17) (if_then_else:CC (ne (match_operand:DI 6 "register_operand" "2") (const_int 0)) @@ -15742,7 +16078,15 @@ FAIL; }) -(define_insn "strlenqi_1" +(define_expand "strlenqi_1" + [(parallel [(set (match_operand 0 "register_operand" "") (match_operand 2 "" "")) + (use (reg:SI 19)) + (clobber (match_operand 1 "register_operand" "")) + (clobber (reg:CC 17))])] + "" + "") + +(define_insn "*strlenqi_1" [(set (match_operand:SI 0 "register_operand" "=&c") (unspec:SI [(mem:BLK (match_operand:SI 5 "register_operand" "1")) (match_operand:QI 2 "register_operand" "a") @@ -15757,7 +16101,7 @@ (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) -(define_insn "strlenqi_rex_1" +(define_insn "*strlenqi_rex_1" [(set (match_operand:DI 0 "register_operand" "=&c") (unspec:DI [(mem:BLK (match_operand:DI 5 "register_operand" "1")) (match_operand:QI 2 "register_operand" "a") @@ -15869,7 +16213,7 @@ (define_insn "x86_movdicc_0_m1_rex64" [(set (match_operand:DI 0 "register_operand" "=r") - (if_then_else:DI (ltu (reg:CC 17) (const_int 0)) + (if_then_else:DI (match_operand 1 "ix86_carry_flag_operator" "") (const_int -1) (const_int 0))) (clobber (reg:CC 17))] @@ -15884,7 +16228,7 @@ (set_attr "mode" "DI") (set_attr "length_immediate" "0")]) -(define_insn "*movdicc_c_rex64" +(define_insn "movdicc_c_rex64" [(set (match_operand:DI 0 "register_operand" "=r,r") (if_then_else:DI (match_operator 1 "ix86_comparison_operator" [(reg 17) (const_int 0)]) @@ -15912,7 +16256,7 @@ (define_insn "x86_movsicc_0_m1" [(set (match_operand:SI 0 "register_operand" "=r") - (if_then_else:SI (ltu (reg:CC 17) (const_int 0)) + (if_then_else:SI (match_operand 1 "ix86_carry_flag_operator" "") (const_int -1) (const_int 0))) (clobber (reg:CC 17))] @@ -15944,9 +16288,9 @@ (define_expand "movhicc" [(set (match_operand:HI 0 "register_operand" "") (if_then_else:HI (match_operand 1 "comparison_operator" "") - (match_operand:HI 2 "nonimmediate_operand" "") - (match_operand:HI 3 "nonimmediate_operand" "")))] - "TARGET_CMOVE && TARGET_HIMODE_MATH" + (match_operand:HI 2 "general_operand" "") + (match_operand:HI 3 "general_operand" "")))] + "TARGET_HIMODE_MATH" "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;") (define_insn "*movhicc_noc" @@ -15963,6 +16307,33 @@ [(set_attr "type" "icmov") (set_attr "mode" "HI")]) +(define_expand "movqicc" + [(set (match_operand:QI 0 "register_operand" "") + (if_then_else:QI (match_operand 1 "comparison_operator" "") + (match_operand:QI 2 "general_operand" "") + (match_operand:QI 3 "general_operand" "")))] + "TARGET_QIMODE_MATH" + "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;") + +(define_insn_and_split "*movqicc_noc" + [(set (match_operand:QI 0 "register_operand" "=r,r") + (if_then_else:QI (match_operator 1 "ix86_comparison_operator" + [(match_operand 4 "flags_reg_operand" "") (const_int 0)]) + (match_operand:QI 2 "register_operand" "r,0") + (match_operand:QI 3 "register_operand" "0,r")))] + "TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL" + "#" + "&& reload_completed" + [(set (match_dup 0) + (if_then_else:SI (match_op_dup 1 [(match_dup 4) (const_int 0)]) + (match_dup 2) + (match_dup 3)))] + "operands[0] = gen_lowpart (SImode, operands[0]); + operands[2] = gen_lowpart (SImode, operands[2]); + operands[3] = gen_lowpart (SImode, operands[3]);" + [(set_attr "type" "icmov") + (set_attr "mode" "SI")]) + (define_expand "movsfcc" [(set (match_operand:SF 0 "register_operand" "") (if_then_else:SF (match_operand 1 "comparison_operator" "") @@ -15972,11 +16343,11 @@ "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;") (define_insn "*movsfcc_1" - [(set (match_operand:SF 0 "register_operand" "=f,f,r,r") + [(set (match_operand:SF 0 "register_operand" "=f#r,f#r,r#f,r#f") (if_then_else:SF (match_operator 1 "fcmov_comparison_operator" [(reg 17) (const_int 0)]) - (match_operand:SF 2 "nonimmediate_operand" "f,0,rm,0") - (match_operand:SF 3 "nonimmediate_operand" "0,f,0,rm")))] + (match_operand:SF 2 "nonimmediate_operand" "f#r,0,rm#f,0") + (match_operand:SF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))] "TARGET_CMOVE && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)" "@ @@ -15996,11 +16367,11 @@ "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;") (define_insn "*movdfcc_1" - [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r") + [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,&r#f,&r#f") (if_then_else:DF (match_operator 1 "fcmov_comparison_operator" [(reg 17) (const_int 0)]) - (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0") - (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))] + (match_operand:DF 2 "nonimmediate_operand" "f#r,0,rm#f,0") + (match_operand:DF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))] "!TARGET_64BIT && TARGET_CMOVE && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)" "@ @@ -16012,11 +16383,11 @@ (set_attr "mode" "DF")]) (define_insn "*movdfcc_1_rex64" - [(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r") + [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,r#f,r#f") (if_then_else:DF (match_operator 1 "fcmov_comparison_operator" [(reg 17) (const_int 0)]) - (match_operand:DF 2 "nonimmediate_operand" "f,0,rm,0") - (match_operand:DF 3 "nonimmediate_operand" "0,f,0,rm")))] + (match_operand:DF 2 "nonimmediate_operand" "f#r,0#r,rm#f,0#f") + (match_operand:DF 3 "nonimmediate_operand" "0#r,f#r,0#f,rm#f")))] "TARGET_64BIT && TARGET_CMOVE && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)" "@ @@ -16030,7 +16401,7 @@ (define_split [(set (match_operand:DF 0 "register_and_not_any_fp_reg_operand" "") (if_then_else:DF (match_operator 1 "fcmov_comparison_operator" - [(match_operand 4 "" "") (const_int 0)]) + [(match_operand 4 "flags_reg_operand" "") (const_int 0)]) (match_operand:DF 2 "nonimmediate_operand" "") (match_operand:DF 3 "nonimmediate_operand" "")))] "!TARGET_64BIT && reload_completed" @@ -16051,14 +16422,6 @@ (if_then_else:XF (match_operand 1 "comparison_operator" "") (match_operand:XF 2 "register_operand" "") (match_operand:XF 3 "register_operand" "")))] - "!TARGET_64BIT && TARGET_CMOVE" - "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;") - -(define_expand "movtfcc" - [(set (match_operand:TF 0 "register_operand" "") - (if_then_else:TF (match_operand 1 "comparison_operator" "") - (match_operand:TF 2 "register_operand" "") - (match_operand:TF 3 "register_operand" "")))] "TARGET_CMOVE" "if (! ix86_expand_fp_movcc (operands)) FAIL; DONE;") @@ -16068,19 +16431,6 @@ [(reg 17) (const_int 0)]) (match_operand:XF 2 "register_operand" "f,0") (match_operand:XF 3 "register_operand" "0,f")))] - "!TARGET_64BIT && TARGET_CMOVE" - "@ - fcmov%F1\t{%2, %0|%0, %2} - fcmov%f1\t{%3, %0|%0, %3}" - [(set_attr "type" "fcmov") - (set_attr "mode" "XF")]) - -(define_insn "*movtfcc_1" - [(set (match_operand:TF 0 "register_operand" "=f,f") - (if_then_else:TF (match_operator 1 "fcmov_comparison_operator" - [(reg 17) (const_int 0)]) - (match_operand:TF 2 "register_operand" "f,0") - (match_operand:TF 3 "register_operand" "0,f")))] "TARGET_CMOVE" "@ fcmov%F1\t{%2, %0|%0, %2} @@ -16138,6 +16488,39 @@ (match_dup 1) (match_dup 2)))]) +;; Conditional addition patterns +(define_expand "addqicc" + [(match_operand:QI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:QI 2 "register_operand" "") + (match_operand:QI 3 "const_int_operand" "")] + "" + "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;") + +(define_expand "addhicc" + [(match_operand:HI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:HI 2 "register_operand" "") + (match_operand:HI 3 "const_int_operand" "")] + "" + "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;") + +(define_expand "addsicc" + [(match_operand:SI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:SI 2 "register_operand" "") + (match_operand:SI 3 "const_int_operand" "")] + "" + "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;") + +(define_expand "adddicc" + [(match_operand:DI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:DI 2 "register_operand" "") + (match_operand:DI 3 "const_int_operand" "")] + "TARGET_64BIT" + "if (!ix86_expand_int_addcc (operands)) FAIL; DONE;") + ;; We can't represent the LT test directly. Do this by swapping the operands. (define_split @@ -16236,7 +16619,7 @@ && operands_match_p (operands[2], operands[3])))" [(set (reg:CCFP 17) (compare:CCFP (match_dup 2) - (match_dup 2))) + (match_dup 1))) (set (match_dup 0) (if_then_else:DF (ge (reg:CCFP 17) (const_int 0)) (match_dup 1) @@ -16426,23 +16809,7 @@ ;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))] ;; ;; in proper program order. -(define_expand "pro_epilogue_adjust_stack" - [(parallel [(set (match_operand:SI 0 "register_operand" "=r,r") - (plus:SI (match_operand:SI 1 "register_operand" "0,r") - (match_operand:SI 2 "immediate_operand" "i,i"))) - (clobber (reg:CC 17)) - (clobber (mem:BLK (scratch)))])] - "" -{ - if (TARGET_64BIT) - { - emit_insn (gen_pro_epilogue_adjust_stack_rex64 - (operands[0], operands[1], operands[2])); - DONE; - } -}) - -(define_insn "*pro_epilogue_adjust_stack_1" +(define_insn "pro_epilogue_adjust_stack_1" [(set (match_operand:SI 0 "register_operand" "=r,r") (plus:SI (match_operand:SI 1 "register_operand" "0,r") (match_operand:SI 2 "immediate_operand" "i,i"))) @@ -16498,6 +16865,8 @@ case TYPE_ALU: if (GET_CODE (operands[2]) == CONST_INT + /* Avoid overflows. */ + && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))) && (INTVAL (operands[2]) == 128 || (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) != -128))) @@ -16524,6 +16893,30 @@ (const_string "lea"))) (set_attr "mode" "DI")]) +(define_insn "pro_epilogue_adjust_stack_rex64_2" + [(set (match_operand:DI 0 "register_operand" "=r,r") + (plus:DI (match_operand:DI 1 "register_operand" "0,r") + (match_operand:DI 3 "immediate_operand" "i,i"))) + (use (match_operand:DI 2 "register_operand" "r,r")) + (clobber (reg:CC 17)) + (clobber (mem:BLK (scratch)))] + "TARGET_64BIT" +{ + switch (get_attr_type (insn)) + { + case TYPE_ALU: + return "add{q}\t{%2, %0|%0, %2}"; + + case TYPE_LEA: + operands[2] = gen_rtx_PLUS (DImode, operands[1], operands[2]); + return "lea{q}\t{%a2, %0|%0, %a2}"; + + default: + abort (); + } +} + [(set_attr "type" "alu,lea") + (set_attr "mode" "DI")]) ;; Placeholder for the conditional moves. This one is split either to SSE ;; based moves emulation or to usual cmove sequence. Little bit unfortunate @@ -16544,6 +16937,12 @@ (clobber (reg:CC 17))] "TARGET_SSE && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM) + /* Avoid combine from being smart and converting min/max + instruction patterns into conditional moves. */ + && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT + && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE) + || !rtx_equal_p (operands[4], operands[2]) + || !rtx_equal_p (operands[5], operands[3])) && (!TARGET_IEEE_FP || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))" "#") @@ -16571,6 +16970,12 @@ (clobber (reg:CC 17))] "TARGET_SSE2 && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM) + /* Avoid combine from being smart and converting min/max + instruction patterns into conditional moves. */ + && ((GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != GT + && GET_CODE (operands[1]) != UNLE && GET_CODE (operands[1]) != UNGE) + || !rtx_equal_p (operands[4], operands[2]) + || !rtx_equal_p (operands[5], operands[3])) && (!TARGET_IEEE_FP || (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE))" "#") @@ -16609,7 +17014,7 @@ DONE; }) -;; Split SSE based conditional move into seqence: +;; Split SSE based conditional move into sequence: ;; cmpCC op0, op4 - set op0 to 0 or ffffffff depending on the comparison ;; and op2, op0 - zero op2 if comparison was false ;; nand op0, op3 - load op3 to op0 if comparison was false @@ -16632,10 +17037,22 @@ (set (subreg:TI (match_dup 0) 0) (ior:TI (subreg:TI (match_dup 6) 0) (subreg:TI (match_dup 7) 0)))] { - /* If op2 == op3, op3 will be clobbered before it is used. - This should be optimized out though. */ + if (GET_MODE (operands[2]) == DFmode + && TARGET_SSE_PARTIAL_REGS && !optimize_size) + { + rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0); + emit_insn (gen_sse2_unpcklpd (op, op, op)); + op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0); + emit_insn (gen_sse2_unpcklpd (op, op, op)); + } + + /* If op2 == op3, op3 would be clobbered before it is used. */ if (operands_match_p (operands[2], operands[3])) - abort (); + { + emit_move_insn (operands[0], operands[2]); + DONE; + } + PUT_MODE (operands[1], GET_MODE (operands[0])); if (operands_match_p (operands[0], operands[4])) operands[6] = operands[4], operands[7] = operands[2]; @@ -16643,7 +17060,7 @@ operands[6] = operands[2], operands[7] = operands[4]; }) -;; Special case of conditional move we can handle effectivly. +;; Special case of conditional move we can handle effectively. ;; Do not brother with the integer/floating point case, since these are ;; bot considerably slower, unlike in the generic case. (define_insn "*sse_movsfcc_const0_1" @@ -16738,8 +17155,22 @@ || const0_operand (operands[3], GET_MODE (operands[0])))" [(set (match_dup 0) (match_op_dup 1 [(match_dup 0) (match_dup 5)])) (set (subreg:TI (match_dup 0) 0) (and:TI (match_dup 6) - (subreg:TI (match_dup 7) 0)))] + (match_dup 7)))] { + if (TARGET_SSE_PARTIAL_REGS && !optimize_size + && GET_MODE (operands[2]) == DFmode) + { + if (REG_P (operands[2])) + { + rtx op = simplify_gen_subreg (V2DFmode, operands[2], DFmode, 0); + emit_insn (gen_sse2_unpcklpd (op, op, op)); + } + if (REG_P (operands[3])) + { + rtx op = simplify_gen_subreg (V2DFmode, operands[3], DFmode, 0); + emit_insn (gen_sse2_unpcklpd (op, op, op)); + } + } PUT_MODE (operands[1], GET_MODE (operands[0])); if (!sse_comparison_operator (operands[1], VOIDmode) || !rtx_equal_p (operands[0], operands[4])) @@ -16762,39 +17193,71 @@ operands[7] = operands[2]; operands[6] = gen_rtx_SUBREG (TImode, operands[0], 0); } + operands[7] = simplify_gen_subreg (TImode, operands[7], + GET_MODE (operands[7]), 0); }) (define_expand "allocate_stack_worker" [(match_operand:SI 0 "register_operand" "")] "TARGET_STACK_PROBE" { - if (TARGET_64BIT) - emit_insn (gen_allocate_stack_worker_rex64 (operands[0])); + if (reload_completed) + { + if (TARGET_64BIT) + emit_insn (gen_allocate_stack_worker_rex64_postreload (operands[0])); + else + emit_insn (gen_allocate_stack_worker_postreload (operands[0])); + } else - emit_insn (gen_allocate_stack_worker_1 (operands[0])); + { + if (TARGET_64BIT) + emit_insn (gen_allocate_stack_worker_rex64 (operands[0])); + else + emit_insn (gen_allocate_stack_worker_1 (operands[0])); + } DONE; }) (define_insn "allocate_stack_worker_1" - [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] UNSPEC_STACK_PROBE) + [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")] + UNSPECV_STACK_PROBE) (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0))) - (clobber (match_dup 0)) + (clobber (match_scratch:SI 1 "=0")) (clobber (reg:CC 17))] "!TARGET_64BIT && TARGET_STACK_PROBE" "call\t__alloca" [(set_attr "type" "multi") (set_attr "length" "5")]) +(define_expand "allocate_stack_worker_postreload" + [(parallel [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "a")] + UNSPECV_STACK_PROBE) + (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0))) + (clobber (match_dup 0)) + (clobber (reg:CC 17))])] + "" + "") + (define_insn "allocate_stack_worker_rex64" - [(unspec:DI [(match_operand:DI 0 "register_operand" "a")] UNSPEC_STACK_PROBE) + [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")] + UNSPECV_STACK_PROBE) (set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0))) - (clobber (match_dup 0)) + (clobber (match_scratch:DI 1 "=0")) (clobber (reg:CC 17))] "TARGET_64BIT && TARGET_STACK_PROBE" "call\t__alloca" [(set_attr "type" "multi") (set_attr "length" "5")]) +(define_expand "allocate_stack_worker_rex64_postreload" + [(parallel [(unspec_volatile:DI [(match_operand:DI 0 "register_operand" "a")] + UNSPECV_STACK_PROBE) + (set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0))) + (clobber (match_dup 0)) + (clobber (reg:CC 17))])] + "" + "") + (define_expand "allocate_stack" [(parallel [(set (match_operand:SI 0 "register_operand" "=r") (minus:SI (reg:SI 7) @@ -17025,7 +17488,7 @@ [(parallel [(set (match_dup 2) (const_int 0)) (clobber (reg:CC 17))]) (set (match_dup 0) (match_dup 1))] - "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));") + "operands[2] = gen_lowpart (SImode, operands[1]);") (define_peephole2 [(match_scratch:QI 1 "q") @@ -17039,7 +17502,7 @@ [(parallel [(set (match_dup 2) (const_int 0)) (clobber (reg:CC 17))]) (set (match_dup 0) (match_dup 1))] - "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));") + "operands[2] = gen_lowpart (SImode, operands[1]);") (define_peephole2 [(match_scratch:SI 2 "r") @@ -17085,7 +17548,7 @@ ;; NOT is not pairable on Pentium, while XOR is, but one byte longer. ;; Don't split NOTs with a displacement operand, because resulting XOR -;; will not be pariable anyway. +;; will not be pairable anyway. ;; ;; On AMD K6, NOT is vector decoded with memory operand that can not be ;; represented using a modRM byte. The XOR replacement is long decoded, @@ -17294,8 +17757,8 @@ && peep2_regno_dead_p (0, FLAGS_REG)" [(parallel [(set (match_dup 0) (const_int 0)) (clobber (reg:CC 17))])] - "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode, - true_regnum (operands[0]));") + "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode, + operands[0]);") (define_peephole2 [(set (strict_low_part (match_operand 0 "register_operand" "")) @@ -17318,8 +17781,8 @@ && peep2_regno_dead_p (0, FLAGS_REG)" [(parallel [(set (match_dup 0) (const_int -1)) (clobber (reg:CC 17))])] - "operands[0] = gen_rtx_REG (GET_MODE (operands[0]) == DImode ? DImode : SImode, - true_regnum (operands[0]));") + "operands[0] = gen_lowpart (GET_MODE (operands[0]) == DImode ? DImode : SImode, + operands[0]);") ;; Attempt to convert simple leas to adds. These can be created by ;; move expanders. @@ -17693,6 +18156,102 @@ (set (reg:DI 7) (plus:DI (reg:DI 7) (const_int 8)))])] "") +;; Imul $32bit_imm, mem, reg is vector decoded, while +;; imul $32bit_imm, reg, reg is direct decoded. +(define_peephole2 + [(match_scratch:DI 3 "r") + (parallel [(set (match_operand:DI 0 "register_operand" "") + (mult:DI (match_operand:DI 1 "memory_operand" "") + (match_operand:DI 2 "immediate_operand" ""))) + (clobber (reg:CC 17))])] + "TARGET_K8 && !optimize_size + && (GET_CODE (operands[2]) != CONST_INT + || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))" + [(set (match_dup 3) (match_dup 1)) + (parallel [(set (match_dup 0) (mult:DI (match_dup 3) (match_dup 2))) + (clobber (reg:CC 17))])] +"") + +(define_peephole2 + [(match_scratch:SI 3 "r") + (parallel [(set (match_operand:SI 0 "register_operand" "") + (mult:SI (match_operand:SI 1 "memory_operand" "") + (match_operand:SI 2 "immediate_operand" ""))) + (clobber (reg:CC 17))])] + "TARGET_K8 && !optimize_size + && (GET_CODE (operands[2]) != CONST_INT + || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))" + [(set (match_dup 3) (match_dup 1)) + (parallel [(set (match_dup 0) (mult:SI (match_dup 3) (match_dup 2))) + (clobber (reg:CC 17))])] +"") + +(define_peephole2 + [(match_scratch:SI 3 "r") + (parallel [(set (match_operand:DI 0 "register_operand" "") + (zero_extend:DI + (mult:SI (match_operand:SI 1 "memory_operand" "") + (match_operand:SI 2 "immediate_operand" "")))) + (clobber (reg:CC 17))])] + "TARGET_K8 && !optimize_size + && (GET_CODE (operands[2]) != CONST_INT + || !CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))" + [(set (match_dup 3) (match_dup 1)) + (parallel [(set (match_dup 0) (zero_extend:DI (mult:SI (match_dup 3) (match_dup 2)))) + (clobber (reg:CC 17))])] +"") + +;; imul $8/16bit_imm, regmem, reg is vector decoded. +;; Convert it into imul reg, reg +;; It would be better to force assembler to encode instruction using long +;; immediate, but there is apparently no way to do so. +(define_peephole2 + [(parallel [(set (match_operand:DI 0 "register_operand" "") + (mult:DI (match_operand:DI 1 "nonimmediate_operand" "") + (match_operand:DI 2 "const_int_operand" ""))) + (clobber (reg:CC 17))]) + (match_scratch:DI 3 "r")] + "TARGET_K8 && !optimize_size + && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')" + [(set (match_dup 3) (match_dup 2)) + (parallel [(set (match_dup 0) (mult:DI (match_dup 0) (match_dup 3))) + (clobber (reg:CC 17))])] +{ + if (!rtx_equal_p (operands[0], operands[1])) + emit_move_insn (operands[0], operands[1]); +}) + +(define_peephole2 + [(parallel [(set (match_operand:SI 0 "register_operand" "") + (mult:SI (match_operand:SI 1 "nonimmediate_operand" "") + (match_operand:SI 2 "const_int_operand" ""))) + (clobber (reg:CC 17))]) + (match_scratch:SI 3 "r")] + "TARGET_K8 && !optimize_size + && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')" + [(set (match_dup 3) (match_dup 2)) + (parallel [(set (match_dup 0) (mult:SI (match_dup 0) (match_dup 3))) + (clobber (reg:CC 17))])] +{ + if (!rtx_equal_p (operands[0], operands[1])) + emit_move_insn (operands[0], operands[1]); +}) + +(define_peephole2 + [(parallel [(set (match_operand:HI 0 "register_operand" "") + (mult:HI (match_operand:HI 1 "nonimmediate_operand" "") + (match_operand:HI 2 "immediate_operand" ""))) + (clobber (reg:CC 17))]) + (match_scratch:HI 3 "r")] + "TARGET_K8 && !optimize_size" + [(set (match_dup 3) (match_dup 2)) + (parallel [(set (match_dup 0) (mult:HI (match_dup 0) (match_dup 3))) + (clobber (reg:CC 17))])] +{ + if (!rtx_equal_p (operands[0], operands[1])) + emit_move_insn (operands[0], operands[1]); +}) + ;; Call-value patterns last so that the wildcard operand does not ;; disrupt insn-recog's switch tables. @@ -17763,19 +18322,23 @@ [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm")) (match_operand:SI 2 "" "")))] - "!TARGET_64BIT" + "!SIBLING_CALL_P (insn) && !TARGET_64BIT" { if (constant_call_address_operand (operands[1], QImode)) - { - if (SIBLING_CALL_P (insn)) - return "jmp\t%P1"; - else - return "call\t%P1"; - } - if (SIBLING_CALL_P (insn)) - return "jmp\t%*%1"; - else - return "call\t%*%1"; + return "call\t%P1"; + return "call\t%*%1"; +} + [(set_attr "type" "callv")]) + +(define_insn "*sibcall_value_1" + [(set (match_operand 0 "" "") + (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a")) + (match_operand:SI 2 "" "")))] + "SIBLING_CALL_P (insn) && !TARGET_64BIT" +{ + if (constant_call_address_operand (operands[1], QImode)) + return "jmp\t%P1"; + return "jmp\t%*%1"; } [(set_attr "type" "callv")]) @@ -17783,21 +18346,29 @@ [(set (match_operand 0 "" "") (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm")) (match_operand:DI 2 "" "")))] - "TARGET_64BIT" + "!SIBLING_CALL_P (insn) && TARGET_64BIT" { if (constant_call_address_operand (operands[1], QImode)) - { - if (SIBLING_CALL_P (insn)) - return "jmp\t%P1"; - else - return "call\t%P1"; - } - if (SIBLING_CALL_P (insn)) - return "jmp\t%A1"; - else - return "call\t%A1"; + return "call\t%P1"; + return "call\t%A1"; } [(set_attr "type" "callv")]) + +(define_insn "*sibcall_value_1_rex64" + [(set (match_operand 0 "" "") + (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" "")) + (match_operand:DI 2 "" "")))] + "SIBLING_CALL_P (insn) && TARGET_64BIT" + "jmp\t%P1" + [(set_attr "type" "callv")]) + +(define_insn "*sibcall_value_1_rex64_v" + [(set (match_operand 0 "" "") + (call (mem:QI (reg:DI 40)) + (match_operand:DI 1 "" "")))] + "SIBLING_CALL_P (insn) && TARGET_64BIT" + "jmp\t*%%r11" + [(set_attr "type" "callv")]) (define_insn "trap" [(trap_if (const_int 1) (const_int 5))] @@ -17842,7 +18413,7 @@ { operands[2] = gen_label_rtx (); output_asm_insn ("j%c0\t%l2\; int\t%1", operands); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", + (*targetm.asm_out.internal_label) (asm_out_file, "L", CODE_LABEL_NUMBER (operands[2])); RET; }) @@ -17855,37 +18426,120 @@ [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m") (match_operand:V4SF 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE" - ;; @@@ let's try to use movaps here. "@ - xorps\t%0, %0 - movaps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1}" + xorps\t%0, %0 + movaps\t{%1, %0|%0, %1} + movaps\t{%1, %0|%0, %1}" [(set_attr "type" "ssemov") (set_attr "mode" "V4SF")]) +(define_split + [(set (match_operand:V4SF 0 "register_operand" "") + (match_operand:V4SF 1 "zero_extended_scalar_load_operand" ""))] + "TARGET_SSE" + [(set (match_dup 0) + (vec_merge:V4SF + (vec_duplicate:V4SF (match_dup 1)) + (match_dup 2) + (const_int 1)))] +{ + operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0); + operands[2] = CONST0_RTX (V4SFmode); +}) + (define_insn "movv4si_internal" [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,x,m") (match_operand:V4SI 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE" - ;; @@@ let's try to use movaps here. - "@ - xorps\t%0, %0 - movaps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "2") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "TI")))]) (define_insn "movv2di_internal" [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x,x,m") (match_operand:V2DI 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE" - ;; @@@ let's try to use movaps here. - "@ - pxor\t%0, %0 - movdqa\t{%1, %0|%0, %1} - movdqa\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "2") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "TI")))]) + +(define_split + [(set (match_operand:V2DF 0 "register_operand" "") + (match_operand:V2DF 1 "zero_extended_scalar_load_operand" ""))] + "TARGET_SSE2" + [(set (match_dup 0) + (vec_merge:V2DF + (vec_duplicate:V2DF (match_dup 1)) + (match_dup 2) + (const_int 1)))] +{ + operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0); + operands[2] = CONST0_RTX (V2DFmode); +}) (define_insn "movv8qi_internal" [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,y,m") @@ -17947,41 +18601,140 @@ DONE; }) +(define_expand "movtf" + [(set (match_operand:TF 0 "nonimmediate_operand" "") + (match_operand:TF 1 "nonimmediate_operand" ""))] + "TARGET_64BIT" +{ + if (TARGET_64BIT) + ix86_expand_move (TFmode, operands); + else + ix86_expand_vector_move (TFmode, operands); + DONE; +}) + (define_insn "movv2df_internal" [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m") (match_operand:V2DF 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE2 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "@ - xorpd\t%0, %0 - movapd\t{%1, %0|%0, %1} - movapd\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "xorpd\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movapd\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov") - (set_attr "mode" "V2DF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "V2DF")) + (eq_attr "alternative" "2") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "V2DF"))] + (const_string "V2DF")))]) (define_insn "movv8hi_internal" [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,x,m") (match_operand:V8HI 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE2 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "@ - xorps\t%0, %0 - movaps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "2") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "TI")))]) (define_insn "movv16qi_internal" [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,x,m") - (match_operand:V16QI 1 "vector_move_operand" "C,xm,x"))] + (match_operand:V16QI 1 "nonimmediate_operand" "C,xm,x"))] "TARGET_SSE2 && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "@ - xorps\t%0, %0 - movaps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "2") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "TI")))]) (define_expand "movv2df" [(set (match_operand:V2DF 0 "nonimmediate_operand" "") @@ -18073,6 +18826,12 @@ DONE; }) +(define_insn "*pushti" + [(set (match_operand:TI 0 "push_operand" "=<") + (match_operand:TI 1 "register_operand" "x"))] + "TARGET_SSE" + "#") + (define_insn "*pushv2df" [(set (match_operand:V2DF 0 "push_operand" "=<") (match_operand:V2DF 1 "register_operand" "x"))] @@ -18156,152 +18915,132 @@ operands[3] = GEN_INT (-GET_MODE_SIZE (GET_MODE (operands[0])));") -(define_insn_and_split "*pushti" - [(set (match_operand:TI 0 "push_operand" "=<") - (match_operand:TI 1 "nonmemory_operand" "x"))] - "TARGET_SSE" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:TI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv2df" - [(set (match_operand:V2DF 0 "push_operand" "=<") - (match_operand:V2DF 1 "nonmemory_operand" "x"))] - "TARGET_SSE2" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V2DF (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv2di" - [(set (match_operand:V2DI 0 "push_operand" "=<") - (match_operand:V2DI 1 "nonmemory_operand" "x"))] - "TARGET_SSE2" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V2DI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv8hi" - [(set (match_operand:V8HI 0 "push_operand" "=<") - (match_operand:V8HI 1 "nonmemory_operand" "x"))] - "TARGET_SSE2" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V8HI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv16qi" - [(set (match_operand:V16QI 0 "push_operand" "=<") - (match_operand:V16QI 1 "nonmemory_operand" "x"))] - "TARGET_SSE2" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V16QI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv4sf" - [(set (match_operand:V4SF 0 "push_operand" "=<") - (match_operand:V4SF 1 "nonmemory_operand" "x"))] - "TARGET_SSE" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V4SF (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv4si" - [(set (match_operand:V4SI 0 "push_operand" "=<") - (match_operand:V4SI 1 "nonmemory_operand" "x"))] - "TARGET_SSE" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16))) - (set (mem:V4SI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "multi")]) - -(define_insn_and_split "*pushv2si" - [(set (match_operand:V2SI 0 "push_operand" "=<") - (match_operand:V2SI 1 "nonmemory_operand" "y"))] - "TARGET_MMX" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8))) - (set (mem:V2SI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "mmx")]) - -(define_insn_and_split "*pushv4hi" - [(set (match_operand:V4HI 0 "push_operand" "=<") - (match_operand:V4HI 1 "nonmemory_operand" "y"))] - "TARGET_MMX" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8))) - (set (mem:V4HI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "mmx")]) - -(define_insn_and_split "*pushv8qi" - [(set (match_operand:V8QI 0 "push_operand" "=<") - (match_operand:V8QI 1 "nonmemory_operand" "y"))] - "TARGET_MMX" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8))) - (set (mem:V8QI (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "mmx")]) - -(define_insn_and_split "*pushv2sf" - [(set (match_operand:V2SF 0 "push_operand" "=<") - (match_operand:V2SF 1 "nonmemory_operand" "y"))] - "TARGET_3DNOW" - "#" - "" - [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8))) - (set (mem:V2SF (reg:SI 7)) (match_dup 1))] - "" - [(set_attr "type" "mmx")]) - (define_insn "movti_internal" [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m") (match_operand:TI 1 "vector_move_operand" "C,xm,x"))] "TARGET_SSE && !TARGET_64BIT && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "@ - xorps\t%0, %0 - movaps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 1: + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "ssemov,ssemov,ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "0,1") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "2") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI"))] + (const_string "TI")))]) (define_insn "*movti_rex64" - [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x") - (match_operand:TI 1 "general_operand" "riFo,riF,C,x,m"))] + [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm") + (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))] "TARGET_64BIT && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "@ - # - # - xorps\t%0, %0 - movaps\\t{%1, %0|%0, %1} - movaps\\t{%1, %0|%0, %1}" +{ + switch (which_alternative) + { + case 0: + case 1: + return "#"; + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 3: + case 4: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} [(set_attr "type" "*,*,ssemov,ssemov,ssemov") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (cond [(eq_attr "alternative" "2,3") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "4") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "DI")))]) + +(define_insn "*movtf_rex64" + [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o,x,x,xm") + (match_operand:TF 1 "general_operand" "riFo,riF,C,xm,x"))] + "TARGET_64BIT + && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" +{ + switch (which_alternative) + { + case 0: + case 1: + return "#"; + case 2: + if (get_attr_mode (insn) == MODE_V4SF) + return "xorps\t%0, %0"; + else + return "pxor\t%0, %0"; + case 3: + case 4: + if (get_attr_mode (insn) == MODE_V4SF) + return "movaps\t{%1, %0|%0, %1}"; + else + return "movdqa\t{%1, %0|%0, %1}"; + default: + abort (); + } +} + [(set_attr "type" "*,*,ssemov,ssemov,ssemov") + (set (attr "mode") + (cond [(eq_attr "alternative" "2,3") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")) + (eq_attr "alternative" "4") + (if_then_else + (ior (ne (symbol_ref "TARGET_SSE_TYPELESS_STORES") + (const_int 0)) + (ne (symbol_ref "optimize_size") + (const_int 0))) + (const_string "V4SF") + (const_string "TI"))] + (const_string "DI")))]) (define_split [(set (match_operand:TI 0 "nonimmediate_operand" "") @@ -18311,6 +19050,14 @@ [(const_int 0)] "ix86_split_long_move (operands); DONE;") +(define_split + [(set (match_operand:TF 0 "nonimmediate_operand" "") + (match_operand:TF 1 "general_operand" ""))] + "reload_completed && !SSE_REG_P (operands[0]) + && !SSE_REG_P (operands[1])" + [(const_int 0)] + "ix86_split_long_move (operands); DONE;") + ;; These two patterns are useful for specifying exactly whether to use ;; movaps or movups (define_expand "sse_movaps" @@ -18690,14 +19437,14 @@ ;; on integral types. We deal with this by representing the floating point ;; logical as logical on arguments casted to TImode as this is what hardware ;; really does. Unfortunately hardware requires the type information to be -;; present and thus we must avoid subregs from being simplified and elliminated +;; present and thus we must avoid subregs from being simplified and eliminated ;; in later compilation phases. ;; ;; We have following variants from each instruction: ;; sse_andsf3 - the operation taking V4SF vector operands ;; and doing TImode cast on them ;; *sse_andsf3_memory - the operation taking one memory operand casted to -;; TImode, since backend insist on elliminating casts +;; TImode, since backend insist on eliminating casts ;; on memory operands ;; sse_andti3_sf_1 - the operation taking SF scalar operands. ;; We can not accept memory operand here as instruction reads @@ -18705,7 +19452,7 @@ ;; scalar float operations that expands to logicals (fabs) ;; sse_andti3_sf_2 - the operation taking SF scalar input and TImode ;; memory operand. Eventually combine can be able -;; to synthetize these using splitter. +;; to synthesize these using splitter. ;; sse2_anddf3, *sse2_anddf3_memory ;; ;; @@ -18963,7 +19710,7 @@ (define_insn "sse2_nandv2di3" [(set (match_operand:V2DI 0 "register_operand" "=x") - (and:V2DI (not:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "0")) + (and:V2DI (not:V2DI (match_operand:V2DI 1 "register_operand" "0")) (match_operand:V2DI 2 "nonimmediate_operand" "xm")))] "TARGET_SSE2 && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)" @@ -19015,12 +19762,26 @@ ;; this insn. (define_insn "sse_clrv4sf" [(set (match_operand:V4SF 0 "register_operand" "=x") - (unspec:V4SF [(const_int 0)] UNSPEC_NOP))] + (match_operand:V4SF 1 "const0_operand" "X"))] "TARGET_SSE" - "xorps\t{%0, %0|%0, %0}" +{ + if (get_attr_mode (insn) == MODE_TI) + return "pxor\t{%0, %0|%0, %0}"; + else + return "xorps\t{%0, %0|%0, %0}"; +} [(set_attr "type" "sselog") (set_attr "memory" "none") - (set_attr "mode" "V4SF")]) + (set (attr "mode") + (if_then_else + (and (and (ne (symbol_ref "TARGET_SSE_LOAD0_BY_PXOR") + (const_int 0)) + (ne (symbol_ref "TARGET_SSE2") + (const_int 0))) + (eq (symbol_ref "optimize_size") + (const_int 0))) + (const_string "TI") + (const_string "V4SF")))]) ;; Use xor, but don't show input operands so they aren't live before ;; this insn. @@ -19103,7 +19864,7 @@ (parallel [(const_int 0)]))))] "TARGET_SSE" "comiss\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecmp") + [(set_attr "type" "ssecomi") (set_attr "mode" "SF")]) (define_insn "sse_ucomi" @@ -19116,7 +19877,7 @@ (parallel [(const_int 0)]))))] "TARGET_SSE" "ucomiss\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecmp") + [(set_attr "type" "ssecomi") (set_attr "mode" "SF")]) @@ -19241,15 +20002,16 @@ (set_attr "mode" "SF")]) (define_insn "cvtsi2ss" - [(set (match_operand:V4SF 0 "register_operand" "=x") + [(set (match_operand:V4SF 0 "register_operand" "=x,x") (vec_merge:V4SF - (match_operand:V4SF 1 "register_operand" "0") + (match_operand:V4SF 1 "register_operand" "0,0") (vec_duplicate:V4SF - (float:SF (match_operand:SI 2 "nonimmediate_operand" "rm"))) + (float:SF (match_operand:SI 2 "nonimmediate_operand" "r,rm"))) (const_int 14)))] "TARGET_SSE" "cvtsi2ss\t{%2, %0|%0, %2}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "vector,double") (set_attr "mode" "SF")]) (define_insn "cvtsi2ssq" @@ -19261,19 +20023,20 @@ (const_int 14)))] "TARGET_SSE && TARGET_64BIT" "cvtsi2ssq\t{%2, %0|%0, %2}" - [(set_attr "type" "ssecvt") - (set_attr "athlon_decode" "vector,vector") + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "vector,double") (set_attr "mode" "SF")]) (define_insn "cvtss2si" - [(set (match_operand:SI 0 "register_operand" "=r") + [(set (match_operand:SI 0 "register_operand" "=r,r") (vec_select:SI - (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")) + (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "x,m")) (parallel [(const_int 0)])))] "TARGET_SSE" "cvtss2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "SF")]) + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "double,vector") + (set_attr "mode" "SI")]) (define_insn "cvtss2siq" [(set (match_operand:DI 0 "register_operand" "=r,r") @@ -19282,20 +20045,21 @@ (parallel [(const_int 0)])))] "TARGET_SSE" "cvtss2siq\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") - (set_attr "athlon_decode" "vector,vector") - (set_attr "mode" "SF")]) + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "double,vector") + (set_attr "mode" "DI")]) (define_insn "cvttss2si" - [(set (match_operand:SI 0 "register_operand" "=r") + [(set (match_operand:SI 0 "register_operand" "=r,r") (vec_select:SI - (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] + (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "x,xm")] UNSPEC_FIX) (parallel [(const_int 0)])))] "TARGET_SSE" "cvttss2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "SF")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "SF") + (set_attr "athlon_decode" "double,vector")]) (define_insn "cvttss2siq" [(set (match_operand:DI 0 "register_operand" "=r,r") @@ -19305,9 +20069,9 @@ (parallel [(const_int 0)])))] "TARGET_SSE && TARGET_64BIT" "cvttss2siq\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "SF") - (set_attr "athlon_decode" "vector,vector")]) + (set_attr "athlon_decode" "double,vector")]) ;; MMX insns @@ -19639,7 +20403,7 @@ (vec_merge:V4HI (match_operand:V4HI 1 "register_operand" "0") (vec_duplicate:V4HI (truncate:HI (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (match_operand:SI 3 "immediate_operand" "i")))] + (match_operand:SI 3 "const_0_to_15_operand" "N")))] "TARGET_SSE || TARGET_3DNOW_A" "pinsrw\t{%3, %2, %0|%0, %2, %3}" [(set_attr "type" "mmxcvt") @@ -19649,7 +20413,7 @@ [(set (match_operand:SI 0 "register_operand" "=r") (zero_extend:SI (vec_select:HI (match_operand:V4HI 1 "register_operand" "y") (parallel - [(match_operand:SI 2 "immediate_operand" "i")]))))] + [(match_operand:SI 2 "const_0_to_3_operand" "N")]))))] "TARGET_SSE || TARGET_3DNOW_A" "pextrw\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "mmxcvt") @@ -20100,7 +20864,7 @@ output_asm_insn (\"rex\", operands); output_asm_insn (\"movaps\\t{%5, %4|%4, %5}\", operands); } - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", + (*targetm.asm_out.internal_label) (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[3])); RET; } @@ -20330,7 +21094,7 @@ [(set_attr "type" "mmxshft") (set_attr "mode" "TI")]) -;; 3DNow reciprical and sqrt +;; 3DNow reciprocal and sqrt (define_insn "pfrcpv2sf2" [(set (match_operand:V2SF 0 "register_operand" "=y") @@ -20724,7 +21488,7 @@ (parallel [(const_int 0)]))))] "TARGET_SSE2" "comisd\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecmp") + [(set_attr "type" "ssecomi") (set_attr "mode" "DF")]) (define_insn "sse2_ucomi" @@ -20737,7 +21501,7 @@ (parallel [(const_int 0)]))))] "TARGET_SSE2" "ucomisd\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecmp") + [(set_attr "type" "ssecomi") (set_attr "mode" "DF")]) ;; SSE Strange Moves. @@ -20901,31 +21665,34 @@ ;; Conversions between SI and DF (define_insn "cvtsd2si" - [(set (match_operand:SI 0 "register_operand" "=r") - (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "xm") + [(set (match_operand:SI 0 "register_operand" "=r,r") + (fix:SI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m") (parallel [(const_int 0)]))))] "TARGET_SSE2" "cvtsd2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "double,vector") (set_attr "mode" "SI")]) (define_insn "cvtsd2siq" - [(set (match_operand:DI 0 "register_operand" "=r") - (fix:DI (vec_select:DF (match_operand:V2DF 1 "register_operand" "xm") + [(set (match_operand:DI 0 "register_operand" "=r,r") + (fix:DI (vec_select:DF (match_operand:V2DF 1 "register_operand" "x,m") (parallel [(const_int 0)]))))] "TARGET_SSE2 && TARGET_64BIT" "cvtsd2siq\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "SI")]) + [(set_attr "type" "sseicvt") + (set_attr "athlon_decode" "double,vector") + (set_attr "mode" "DI")]) (define_insn "cvttsd2si" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "xm") + [(set (match_operand:SI 0 "register_operand" "=r,r") + (unspec:SI [(vec_select:DF (match_operand:V2DF 1 "register_operand" "x,xm") (parallel [(const_int 0)]))] UNSPEC_FIX))] "TARGET_SSE2" "cvttsd2si\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "SI")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "SI") + (set_attr "athlon_decode" "double,vector")]) (define_insn "cvttsd2siq" [(set (match_operand:DI 0 "register_operand" "=r,r") @@ -20933,21 +21700,22 @@ (parallel [(const_int 0)]))] UNSPEC_FIX))] "TARGET_SSE2 && TARGET_64BIT" "cvttsd2siq\t{%1, %0|%0, %1}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "DI") - (set_attr "athlon_decode" "vector,vector")]) + (set_attr "athlon_decode" "double,vector")]) (define_insn "cvtsi2sd" - [(set (match_operand:V2DF 0 "register_operand" "=x") - (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0") + [(set (match_operand:V2DF 0 "register_operand" "=x,x") + (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0,0") (vec_duplicate:V2DF (float:DF - (match_operand:SI 2 "nonimmediate_operand" "rm"))) + (match_operand:SI 2 "nonimmediate_operand" "r,rm"))) (const_int 2)))] "TARGET_SSE2" "cvtsi2sd\t{%2, %0|%0, %2}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "DF")]) + [(set_attr "type" "sseicvt") + (set_attr "mode" "DF") + (set_attr "athlon_decode" "double,direct")]) (define_insn "cvtsi2sdq" [(set (match_operand:V2DF 0 "register_operand" "=x,x") @@ -20958,22 +21726,23 @@ (const_int 2)))] "TARGET_SSE2 && TARGET_64BIT" "cvtsi2sdq\t{%2, %0|%0, %2}" - [(set_attr "type" "ssecvt") + [(set_attr "type" "sseicvt") (set_attr "mode" "DF") - (set_attr "athlon_decode" "vector,direct")]) + (set_attr "athlon_decode" "double,direct")]) ;; Conversions between SF and DF (define_insn "cvtsd2ss" - [(set (match_operand:V4SF 0 "register_operand" "=x") - (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0") + [(set (match_operand:V4SF 0 "register_operand" "=x,x") + (vec_merge:V4SF (match_operand:V4SF 1 "register_operand" "0,0") (vec_duplicate:V4SF (float_truncate:V2SF - (match_operand:V2DF 2 "register_operand" "xm"))) + (match_operand:V2DF 2 "nonimmediate_operand" "x,xm"))) (const_int 14)))] "TARGET_SSE2" "cvtsd2ss\t{%2, %0|%0, %2}" [(set_attr "type" "ssecvt") + (set_attr "athlon_decode" "vector,double") (set_attr "mode" "SF")]) (define_insn "cvtss2sd" @@ -20981,7 +21750,7 @@ (vec_merge:V2DF (match_operand:V2DF 1 "register_operand" "0") (float_extend:V2DF (vec_select:V2SF - (match_operand:V4SF 2 "register_operand" "xm") + (match_operand:V4SF 2 "nonimmediate_operand" "xm") (parallel [(const_int 0) (const_int 1)]))) (const_int 2)))] @@ -21257,10 +22026,20 @@ (define_insn "sse2_clrti" [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))] "TARGET_SSE2" - "pxor\t{%0, %0|%0, %0}" - [(set_attr "type" "sseiadd") +{ + if (get_attr_mode (insn) == MODE_TI) + return "pxor\t%0, %0"; + else + return "xorps\t%0, %0"; +} + [(set_attr "type" "ssemov") (set_attr "memory" "none") - (set_attr "mode" "TI")]) + (set (attr "mode") + (if_then_else + (ne (symbol_ref "optimize_size") + (const_int 0)) + (const_string "V4SF") + (const_string "TI")))]) ;; MMX unsigned averages/sum of absolute differences @@ -21320,7 +22099,7 @@ (vec_duplicate:V8HI (truncate:HI (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (match_operand:SI 3 "immediate_operand" "i")))] + (match_operand:SI 3 "const_0_to_255_operand" "N")))] "TARGET_SSE2" "pinsrw\t{%3, %2, %0|%0, %2, %3}" [(set_attr "type" "ssecvt") @@ -21331,7 +22110,7 @@ (zero_extend:SI (vec_select:HI (match_operand:V8HI 1 "register_operand" "x") (parallel - [(match_operand:SI 2 "immediate_operand" "i")]))))] + [(match_operand:SI 2 "const_0_to_7_operand" "N")]))))] "TARGET_SSE2" "pextrw\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "ssecvt") @@ -21468,7 +22247,7 @@ (define_insn "ashrv8hi3" [(set (match_operand:V8HI 0 "register_operand" "=x") (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psraw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21477,7 +22256,7 @@ (define_insn "ashrv4si3" [(set (match_operand:V4SI 0 "register_operand" "=x") (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psrad\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21486,7 +22265,7 @@ (define_insn "lshrv8hi3" [(set (match_operand:V8HI 0 "register_operand" "=x") (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psrlw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21495,7 +22274,7 @@ (define_insn "lshrv4si3" [(set (match_operand:V4SI 0 "register_operand" "=x") (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psrld\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21504,7 +22283,7 @@ (define_insn "lshrv2di3" [(set (match_operand:V2DI 0 "register_operand" "=x") (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psrlq\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21513,7 +22292,7 @@ (define_insn "ashlv8hi3" [(set (match_operand:V8HI 0 "register_operand" "=x") (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psllw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21522,7 +22301,7 @@ (define_insn "ashlv4si3" [(set (match_operand:V4SI 0 "register_operand" "=x") (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "pslld\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21531,7 +22310,7 @@ (define_insn "ashlv2di3" [(set (match_operand:V2DI 0 "register_operand" "=x") (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0") - (match_operand:TI 2 "nonmemory_operand" "xi")))] + (match_operand:SI 2 "nonmemory_operand" "xi")))] "TARGET_SSE2" "psllq\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21540,7 +22319,7 @@ (define_insn "ashrv8hi3_ti" [(set (match_operand:V8HI 0 "register_operand" "=x") (ashiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psraw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21549,7 +22328,7 @@ (define_insn "ashrv4si3_ti" [(set (match_operand:V4SI 0 "register_operand" "=x") (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psrad\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21558,7 +22337,7 @@ (define_insn "lshrv8hi3_ti" [(set (match_operand:V8HI 0 "register_operand" "=x") (lshiftrt:V8HI (match_operand:V8HI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psrlw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21567,7 +22346,7 @@ (define_insn "lshrv4si3_ti" [(set (match_operand:V4SI 0 "register_operand" "=x") (lshiftrt:V4SI (match_operand:V4SI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psrld\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21576,7 +22355,7 @@ (define_insn "lshrv2di3_ti" [(set (match_operand:V2DI 0 "register_operand" "=x") (lshiftrt:V2DI (match_operand:V2DI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psrlq\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21585,7 +22364,7 @@ (define_insn "ashlv8hi3_ti" [(set (match_operand:V8HI 0 "register_operand" "=x") (ashift:V8HI (match_operand:V8HI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psllw\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21594,7 +22373,7 @@ (define_insn "ashlv4si3_ti" [(set (match_operand:V4SI 0 "register_operand" "=x") (ashift:V4SI (match_operand:V4SI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "pslld\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21603,7 +22382,7 @@ (define_insn "ashlv2di3_ti" [(set (match_operand:V2DI 0 "register_operand" "=x") (ashift:V2DI (match_operand:V2DI 1 "register_operand" "0") - (subreg:TI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] + (subreg:SI (match_operand:V2DI 2 "nonmemory_operand" "xi") 0)))] "TARGET_SSE2" "psllq\t{%2, %0|%0, %2}" [(set_attr "type" "sseishft") @@ -21640,26 +22419,26 @@ (define_insn "sse2_unpckhpd" [(set (match_operand:V2DF 0 "register_operand" "=x") (vec_concat:V2DF - (vec_select:V2DF (match_operand:V2DF 1 "register_operand" "0") - (parallel [(const_int 1)])) - (vec_select:V2DF (match_operand:V2DF 2 "register_operand" "x") - (parallel [(const_int 0)]))))] + (vec_select:DF (match_operand:V2DF 1 "register_operand" "0") + (parallel [(const_int 1)])) + (vec_select:DF (match_operand:V2DF 2 "register_operand" "x") + (parallel [(const_int 1)]))))] "TARGET_SSE2" "unpckhpd\t{%2, %0|%0, %2}" [(set_attr "type" "ssecvt") - (set_attr "mode" "TI")]) + (set_attr "mode" "V2DF")]) (define_insn "sse2_unpcklpd" [(set (match_operand:V2DF 0 "register_operand" "=x") (vec_concat:V2DF - (vec_select:V2DF (match_operand:V2DF 1 "register_operand" "0") - (parallel [(const_int 0)])) - (vec_select:V2DF (match_operand:V2DF 2 "register_operand" "x") - (parallel [(const_int 1)]))))] + (vec_select:DF (match_operand:V2DF 1 "register_operand" "0") + (parallel [(const_int 0)])) + (vec_select:DF (match_operand:V2DF 2 "register_operand" "x") + (parallel [(const_int 0)]))))] "TARGET_SSE2" "unpcklpd\t{%2, %0|%0, %2}" [(set_attr "type" "ssecvt") - (set_attr "mode" "TI")]) + (set_attr "mode" "V2DF")]) ;; MMX pack/unpack insns. @@ -21975,17 +22754,6 @@ [(set_attr "type" "ssecvt") (set_attr "mode" "V2DF")]) -(define_insn "sse2_movlpd" - [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m") - (vec_merge:V2DF - (match_operand:V2DF 1 "nonimmediate_operand" "0,0") - (match_operand:V2DF 2 "nonimmediate_operand" "m,x") - (const_int 1)))] - "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)" - "movlpd\t{%2, %0|%0, %2}" - [(set_attr "type" "ssecvt") - (set_attr "mode" "V2DF")]) - (define_expand "sse2_loadsd" [(match_operand:V2DF 0 "register_operand" "") (match_operand:DF 1 "memory_operand" "")] @@ -22008,15 +22776,17 @@ (set_attr "mode" "DF")]) (define_insn "sse2_movsd" - [(set (match_operand:V2DF 0 "register_operand" "=x") + [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,m") (vec_merge:V2DF - (match_operand:V2DF 1 "register_operand" "0") - (match_operand:V2DF 2 "register_operand" "x") + (match_operand:V2DF 1 "nonimmediate_operand" "0,0,0") + (match_operand:V2DF 2 "nonimmediate_operand" "x,m,x") (const_int 1)))] - "TARGET_SSE2" - "movsd\t{%2, %0|%0, %2}" + "TARGET_SSE2 && ix86_binary_operator_ok (UNKNOWN, V2DFmode, operands)" + "@movsd\t{%2, %0|%0, %2} + movlpd\t{%2, %0|%0, %2} + movlpd\t{%2, %0|%0, %2}" [(set_attr "type" "ssecvt") - (set_attr "mode" "DF")]) + (set_attr "mode" "DF,V2DF,V2DF")]) (define_insn "sse2_storesd" [(set (match_operand:DF 0 "memory_operand" "=m") @@ -22082,13 +22852,13 @@ [(set_attr "type" "sse") (set_attr "memory" "unknown")]) -;; PNI +;; SSE3 (define_insn "mwait" [(unspec_volatile [(match_operand:SI 0 "register_operand" "a") (match_operand:SI 1 "register_operand" "c")] UNSPECV_MWAIT)] - "TARGET_PNI" + "TARGET_SSE3" "mwait\t%0, %1" [(set_attr "length" "3")]) @@ -22097,18 +22867,18 @@ (match_operand:SI 1 "register_operand" "c") (match_operand:SI 2 "register_operand" "d")] UNSPECV_MONITOR)] - "TARGET_PNI" + "TARGET_SSE3" "monitor\t%0, %1, %2" [(set_attr "length" "3")]) -;; PNI arithmetic +;; SSE3 arithmetic (define_insn "addsubv4sf3" [(set (match_operand:V4SF 0 "register_operand" "=x") (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")] UNSPEC_ADDSUB))] - "TARGET_PNI" + "TARGET_SSE3" "addsubps\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V4SF")]) @@ -22118,7 +22888,7 @@ (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") (match_operand:V2DF 2 "nonimmediate_operand" "xm")] UNSPEC_ADDSUB))] - "TARGET_PNI" + "TARGET_SSE3" "addsubpd\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V2DF")]) @@ -22128,7 +22898,7 @@ (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")] UNSPEC_HADD))] - "TARGET_PNI" + "TARGET_SSE3" "haddps\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V4SF")]) @@ -22138,7 +22908,7 @@ (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") (match_operand:V2DF 2 "nonimmediate_operand" "xm")] UNSPEC_HADD))] - "TARGET_PNI" + "TARGET_SSE3" "haddpd\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V2DF")]) @@ -22148,7 +22918,7 @@ (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") (match_operand:V4SF 2 "nonimmediate_operand" "xm")] UNSPEC_HSUB))] - "TARGET_PNI" + "TARGET_SSE3" "hsubps\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V4SF")]) @@ -22158,7 +22928,7 @@ (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") (match_operand:V2DF 2 "nonimmediate_operand" "xm")] UNSPEC_HSUB))] - "TARGET_PNI" + "TARGET_SSE3" "hsubpd\t{%2, %0|%0, %2}" [(set_attr "type" "sseadd") (set_attr "mode" "V2DF")]) @@ -22167,7 +22937,7 @@ [(set (match_operand:V4SF 0 "register_operand" "=x") (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSHDUP))] - "TARGET_PNI" + "TARGET_SSE3" "movshdup\t{%1, %0|%0, %1}" [(set_attr "type" "sse") (set_attr "mode" "V4SF")]) @@ -22176,7 +22946,7 @@ [(set (match_operand:V4SF 0 "register_operand" "=x") (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSLDUP))] - "TARGET_PNI" + "TARGET_SSE3" "movsldup\t{%1, %0|%0, %1}" [(set_attr "type" "sse") (set_attr "mode" "V4SF")]) @@ -22185,7 +22955,7 @@ [(set (match_operand:V16QI 0 "register_operand" "=x") (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")] UNSPEC_LDQQU))] - "TARGET_PNI" + "TARGET_SSE3" "lddqu\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "TI")]) @@ -22193,7 +22963,7 @@ (define_insn "loadddup" [(set (match_operand:V2DF 0 "register_operand" "=x") (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m")))] - "TARGET_PNI" + "TARGET_SSE3" "movddup\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "DF")]) @@ -22203,7 +22973,7 @@ (vec_duplicate:V2DF (vec_select:DF (match_operand:V2DF 1 "register_operand" "x") (parallel [(const_int 0)]))))] - "TARGET_PNI" + "TARGET_SSE3" "movddup\t{%1, %0|%0, %1}" [(set_attr "type" "ssecvt") (set_attr "mode" "DF")]) diff --git a/contrib/gcc/configure b/contrib/gcc/configure index 74b8a4fa6083..e9d75d91d9a9 100755 --- a/contrib/gcc/configure +++ b/contrib/gcc/configure @@ -1,116 +1,324 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.57. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Defaults: -ac_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-gnu-ld arrange to work with GNU ld." -ac_help="$ac_help - --with-ld arrange to use the specified ld (full pathname)" -ac_help="$ac_help - --with-gnu-as arrange to work with GNU as" -ac_help="$ac_help - --with-as arrange to use the specified as (full pathname)" -ac_help="$ac_help - --with-stabs arrange to use stabs instead of host debug format" -ac_help="$ac_help - --with-elf arrange to use ELF instead of host debug format" -ac_help="$ac_help - --with-local-prefix=DIR specifies directory to put local include" -ac_help="$ac_help - --with-gxx-include-dir=DIR - specifies directory to put g++ header files" -ac_help="$ac_help - --enable-multilib enable library support for multiple ABIs" -ac_help="$ac_help - --enable-checking[=LIST] - enable expensive run-time checks. With LIST, - enable only specific categories of checks. - Categories are: misc,tree,rtl,rtlflag,gc,gcac; - default is misc,tree,gc,rtlflag" -ac_help="$ac_help - --enable-coverage[=LEVEL] - enable compiler\'s code coverage collection. - Use to measure compiler performance and locate - unused parts of the compiler. With LEVEL, specificy - optimization. Values are opt, noopt, - default is noopt" -ac_help="$ac_help - --with-cpp-install-dir=DIR - install the user visible C preprocessor in DIR - (relative to PREFIX) as well as PREFIX/bin" -ac_help="$ac_help - --enable-__cxa_atexit enable __cxa_atexit for C++" -ac_help="$ac_help - --enable-c-mbchar enable multibyte characters for C and C++" -ac_help="$ac_help - --enable-threads enable thread usage for target GCC - --enable-threads=LIB use LIB thread package for target GCC" -ac_help="$ac_help - --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime" -ac_help="$ac_help - --with-dwarf2 force the default debug format to be DWARF 2" -ac_help="$ac_help - --disable-shared don't provide a shared libgcc" -ac_help="$ac_help - --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" -ac_help="$ac_help - --enable-initfini-array use .init_array/.fini_array sections" -ac_help="$ac_help - --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling" -ac_help="$ac_help - --enable-libunwind-exceptions force use libunwind for exceptions" -ac_help="$ac_help - --enable-nls use Native Language Support (default)" -ac_help="$ac_help - --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --disable-win32-registry - disable lookup of installation paths in the - Registry on Windows hosts - --enable-win32-registry enable registry lookup (default) - --enable-win32-registry=KEY - use KEY instead of GCC version as the last portion - of the registry key" -ac_help="$ac_help - --with-gc={simple,page} choose the garbage collection mechanism to use - with the compiler" -ac_help="$ac_help - --with-system-zlib use installed libz" -ac_help="$ac_help - --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-version-specific-runtime-libs - specify that runtime libraries should be - installed in a compiler-specific directory" -ac_help="$ac_help - --with-slibdir=DIR shared libraries in DIR [LIBDIR]" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="tree.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#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 build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP GNATBIND ac_ct_GNATBIND strict1_warn warn_cflags WERROR nocommon_flag EGREP 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 SET_MAKE AWK LN LN_S RANLIB ac_ct_RANLIB INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext extra_modes_file FORBUILD PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc BUILD_PREFIX BUILD_PREFIX_1 CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO libgcc_visibility gthread_flags 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 gcc_version gcc_version_full gcc_version_trigger 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 symbolic_link 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 target_noncanonical c_target_objs cxx_target_objs target_cpu_default LIBOBJS LTLIBOBJS' +ac_subst_files='language_hooks' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -119,10 +327,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -136,17 +349,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -154,59 +359,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -215,95 +420,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -312,19 +469,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -338,26 +495,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -374,7 +531,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -384,7 +541,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -395,58 +552,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -457,99 +613,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=tree.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -559,13 +726,500 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-generated-files-in-srcdir + put copies of generated files in source dir + intended for creating source tarballs for users + without texinfo bison or flex. + --enable-werror enable -Werror in bootstrap stage2 and later + --enable-checking=LIST + enable expensive run-time checks. With LIST, + enable only specific categories of checks. + Categories are: misc,tree,rtl,rtlflag,gc,gcac,fold; + default is no checking + --enable-coverage=LEVEL + enable compiler\'s code coverage collection. + Use to measure compiler performance and locate + unused parts of the compiler. With LEVEL, specify + optimization. Values are opt, noopt, + default is noopt + --enable-gather-detailed-mem-stats enable detailed memory allocation stats gathering + --enable-multilib enable library support for multiple ABIs + --enable-__cxa_atexit enable __cxa_atexit for C++ + --enable-threads enable thread usage for target GCC + --enable-threads=LIB use LIB thread package for target GCC + --enable-objc-gc enable the use of Boehm's garbage collector with + the GNU Objective-C runtime + --disable-shared don't provide a shared libgcc + --enable-intermodule build the compiler in one step + --enable-initfini-array use .init_array/.fini_array sections + --enable-sjlj-exceptions + arrange to use setjmp/longjmp exception handling + --enable-libunwind-exceptions force use libunwind for exceptions + --disable-win32-registry + disable lookup of installation paths in the + Registry on Windows hosts + --enable-win32-registry enable registry lookup (default) + --enable-win32-registry=KEY + use KEY instead of GCC version as the last portion + of the registry key + --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-version-specific-runtime-libs + specify that runtime libraries should be + installed in a compiler-specific directory + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-local-prefix=DIR specifies directory to put local include + --with-gxx-include-dir=DIR + specifies directory to put g++ header files + --with-cpp-install-dir=DIR + install the user visible C preprocessor in DIR + (relative to PREFIX) as well as PREFIX/bin + --with-gnu-ld arrange to work with GNU ld. + --with-ld arrange to use the specified ld (full pathname) + --with-gnu-as arrange to work with GNU as + --with-as arrange to use the specified as (full pathname) + --with-stabs arrange to use stabs instead of host debug format + --with-dwarf2 force the default debug format to be DWARF 2 + --with-sysroot=DIR Search for usr/lib, usr/include, et al, within DIR. + --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib + --with-gc={simple,page,zone} choose the garbage collection mechanism to use + with the compiler + --with-system-zlib use installed libz + --with-slibdir=DIR shared libraries in DIR LIBDIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -576,220 +1230,108 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -remove=rm -hard_link=ln -symbolic_link='ln -s' -copy=cp - -# Check for bogus environment variables. -# Test if LIBRARY_PATH contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# LIBRARY_PATH contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -echo $ac_n "checking LIBRARY_PATH variable""... $ac_c" 1>&6 -echo "configure:631: checking LIBRARY_PATH variable" >&5 -case ${LIBRARY_PATH} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - library_path_setting="contains current directory" - ;; - *) - library_path_setting="ok" - ;; -esac -echo "$ac_t""$library_path_setting" 1>&6 -if test "$library_path_setting" != "ok"; then -{ echo "configure: error: -*** LIBRARY_PATH shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again." 1>&2; exit 1; } -fi - -# Test if GCC_EXEC_PREFIX contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# GCC_EXEC_PREFIX contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -echo $ac_n "checking GCC_EXEC_PREFIX variable""... $ac_c" 1>&6 -echo "configure:656: checking GCC_EXEC_PREFIX variable" >&5 -case ${GCC_EXEC_PREFIX} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - gcc_exec_prefix_setting="contains current directory" - ;; - *) - gcc_exec_prefix_setting="ok" - ;; -esac -echo "$ac_t""$gcc_exec_prefix_setting" 1>&6 -if test "$gcc_exec_prefix_setting" != "ok"; then -{ echo "configure: error: -*** GCC_EXEC_PREFIX shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again." 1>&2; exit 1; } -fi - -# Check for additional parameters - -# With GNU ld -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - gnu_ld_flag="$with_gnu_ld" -else - gnu_ld_flag=no -fi -# With pre-defined ld -# Check whether --with-ld or --without-ld was given. -if test "${with_ld+set}" = set; then - withval="$with_ld" - DEFAULT_LINKER="$with_ld" -fi - -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test ! -x "$DEFAULT_LINKER"; then - echo "configure: warning: cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" 1>&2 - elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gnu_ld_flag=yes - fi - cat >> confdefs.h <&2 - elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gas_flag=yes - fi - cat >> confdefs.h <&2; exit 1; } ;; -no) ;; -*) local_prefix=$with_local_prefix ;; -esac -fi -# Default local prefix if it is empty -if test x$local_prefix = x; then - local_prefix=/usr/local -fi - -# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only -# passed in by the toplevel make and thus we'd get different behavior -# depending on where we built the sources. -gcc_gxx_include_dir= -# Specify the g++ header file directory -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -if test "${with_gxx_include_dir+set}" = set; then - withval="$with_gxx_include_dir" - case "${withval}" in -yes) { echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2; exit 1; } ;; -no) ;; -*) gcc_gxx_include_dir=$with_gxx_include_dir ;; -esac -fi -if test x${gcc_gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_include_dir='${libsubdir}/include/c++' - else - topsrcdir=${srcdir}/.. . ${srcdir}/../config.if - gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir} - fi -fi + + + + + ac_config_headers="$ac_config_headers auto-host.h:config.in" + # Determine the host, build, and target systems ac_aux_dir= @@ -802,335 +1344,1048 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + # The aliases save the names the user supplied, while $host etc. # will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:843: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:864: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:882: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- +# Determine the noncanonical target name, for directory use. + case ${build_alias} in + "") build_noncanonical=${build} ;; + *) build_noncanonical=${build_alias} ;; +esac + + case ${host_alias} in + "") host_noncanonical=${build_noncanonical} ;; + *) host_noncanonical=${host_alias} ;; +esac + + case ${target_alias} in + "") target_noncanonical=${host_noncanonical} ;; + *) target_noncanonical=${target_alias} ;; +esac + + +# Determine the target- and build-specific subdirectories + # Prefix 'build-' so this never conflicts with target_subdir. +build_subdir="build-${build_noncanonical}" +# Not really a subdirectory, but here for completeness. +host_subdir=. +# No prefix. +target_subdir=${target_noncanonical} + # Set program_transform_name -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +# Check for bogus environment variables. +# Test if LIBRARY_PATH contains the notation for the current directory +# since this would lead to problems installing/building glibc. +# LIBRARY_PATH contains the current directory if one of the following +# is true: +# - one of the terminals (":" and ";") is the first or last sign +# - two terminals occur directly after each other +# - the path contains an element with a dot in it +echo "$as_me:$LINENO: checking LIBRARY_PATH variable" >&5 +echo $ECHO_N "checking LIBRARY_PATH variable... $ECHO_C" >&6 +case ${LIBRARY_PATH} in + [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) + library_path_setting="contains current directory" + ;; + *) + library_path_setting="ok" + ;; +esac +echo "$as_me:$LINENO: result: $library_path_setting" >&5 +echo "${ECHO_T}$library_path_setting" >&6 +if test "$library_path_setting" != "ok"; then +{ { echo "$as_me:$LINENO: error: +*** LIBRARY_PATH shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again." >&5 +echo "$as_me: error: +*** LIBRARY_PATH shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again." >&2;} + { (exit 1); exit 1; }; } +fi + +# Test if GCC_EXEC_PREFIX contains the notation for the current directory +# since this would lead to problems installing/building glibc. +# GCC_EXEC_PREFIX contains the current directory if one of the following +# is true: +# - one of the terminals (":" and ";") is the first or last sign +# - two terminals occur directly after each other +# - the path contains an element with a dot in it +echo "$as_me:$LINENO: checking GCC_EXEC_PREFIX variable" >&5 +echo $ECHO_N "checking GCC_EXEC_PREFIX variable... $ECHO_C" >&6 +case ${GCC_EXEC_PREFIX} in + [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) + gcc_exec_prefix_setting="contains current directory" + ;; + *) + gcc_exec_prefix_setting="ok" + ;; +esac +echo "$as_me:$LINENO: result: $gcc_exec_prefix_setting" >&5 +echo "${ECHO_T}$gcc_exec_prefix_setting" >&6 +if test "$gcc_exec_prefix_setting" != "ok"; then +{ { echo "$as_me:$LINENO: error: +*** GCC_EXEC_PREFIX shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again." >&5 +echo "$as_me: error: +*** GCC_EXEC_PREFIX shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again." >&2;} + { (exit 1); exit 1; }; } +fi + +# ----------- +# Directories +# ----------- + +# Specify the local prefix +local_prefix= + +# Check whether --with-local-prefix or --without-local-prefix was given. +if test "${with_local_prefix+set}" = set; then + withval="$with_local_prefix" + case "${withval}" in +yes) { { echo "$as_me:$LINENO: error: bad value ${withval} given for local include directory prefix" >&5 +echo "$as_me: error: bad value ${withval} given for local include directory prefix" >&2;} + { (exit 1); exit 1; }; } ;; +no) ;; +*) local_prefix=$with_local_prefix ;; +esac +fi; + +# Default local prefix if it is empty +if test x$local_prefix = x; then + local_prefix=/usr/local +fi + +# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only +# passed in by the toplevel make and thus we'd get different behavior +# depending on where we built the sources. +gcc_gxx_include_dir= +# Specify the g++ header file directory + +# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. +if test "${with_gxx_include_dir+set}" = set; then + withval="$with_gxx_include_dir" + case "${withval}" in +yes) { { echo "$as_me:$LINENO: error: bad value ${withval} given for g++ include directory" >&5 +echo "$as_me: error: bad value ${withval} given for g++ include directory" >&2;} + { (exit 1); exit 1; }; } ;; +no) ;; +*) gcc_gxx_include_dir=$with_gxx_include_dir ;; +esac +fi; + +if test x${gcc_gxx_include_dir} = x; then + if test x${enable_version_specific_runtime_libs} = xyes; then + gcc_gxx_include_dir='${libsubdir}/include/c++' + else + topsrcdir=${srcdir}/.. . ${srcdir}/../config.if + gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir} + fi +fi + + +# Check whether --with-cpp_install_dir or --without-cpp_install_dir was given. +if test "${with_cpp_install_dir+set}" = set; then + withval="$with_cpp_install_dir" + if test x$withval = xyes; then + { { echo "$as_me:$LINENO: error: option --with-cpp-install-dir requires an argument" >&5 +echo "$as_me: error: option --with-cpp-install-dir requires an argument" >&2;} + { (exit 1); exit 1; }; } +elif test x$withval != xno; then + cpp_install_dir=$withval +fi +fi; + +# We would like to our source tree to be readonly. However when releases or +# pre-releases are generated, the flex/bison generated files as well as the +# various formats of manuals need to be included along with the rest of the +# sources. Therefore we have --enable-generated-files-in-srcdir to do +# just that. + +echo "$as_me:$LINENO: checking whether to place generated files in the source directory" >&5 +echo $ECHO_N "checking whether to place generated files in the source directory... $ECHO_C" >&6 + # Check whether --enable-generated-files-in-srcdir or --disable-generated-files-in-srcdir was given. +if test "${enable_generated_files_in_srcdir+set}" = set; then + enableval="$enable_generated_files_in_srcdir" + generated_files_in_srcdir=$enableval +else + generated_files_in_srcdir=no +fi; + +echo "$as_me:$LINENO: result: $generated_files_in_srcdir" >&5 +echo "${ECHO_T}$generated_files_in_srcdir" >&6 + +if test "$generated_files_in_srcdir" = "yes"; then + GENINSRC='' +else + GENINSRC='#' +fi + + +# ------------------- +# Find default linker +# ------------------- + +# With GNU ld + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + gnu_ld_flag="$with_gnu_ld" +else + gnu_ld_flag=no +fi; + +# With pre-defined ld + +# Check whether --with-ld or --without-ld was given. +if test "${with_ld+set}" = set; then + withval="$with_ld" + DEFAULT_LINKER="$with_ld" +fi; +if test x"${DEFAULT_LINKER+set}" = x"set"; then + if test ! -x "$DEFAULT_LINKER"; then + { echo "$as_me:$LINENO: WARNING: cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" >&5 +echo "$as_me: WARNING: cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" >&2;} + elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then + gnu_ld_flag=yes + fi + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_LINKER "$DEFAULT_LINKER" +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether a default linker was specified" >&5 +echo $ECHO_N "checking whether a default linker was specified... $ECHO_C" >&6 +if test x"${DEFAULT_LINKER+set}" = x"set"; then + if test x"$gnu_ld_flag" = x"no"; then + echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER)" >&5 +echo "${ECHO_T}yes ($DEFAULT_LINKER)" >&6 + else + echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER - GNU ld)" >&5 +echo "${ECHO_T}yes ($DEFAULT_LINKER - GNU ld)" >&6 + fi +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# ---------------------- +# Find default assembler +# ---------------------- + +# With GNU as + +# Check whether --with-gnu-as or --without-gnu-as was given. +if test "${with_gnu_as+set}" = set; then + withval="$with_gnu_as" + gas_flag="$with_gnu_as" +else + gas_flag=no +fi; + + +# Check whether --with-as or --without-as was given. +if test "${with_as+set}" = set; then + withval="$with_as" + DEFAULT_ASSEMBLER="$with_as" +fi; +if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then + if test ! -x "$DEFAULT_ASSEMBLER"; then + { echo "$as_me:$LINENO: WARNING: cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER" >&5 +echo "$as_me: WARNING: cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER" >&2;} + elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then + gas_flag=yes + fi + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_ASSEMBLER "$DEFAULT_ASSEMBLER" +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether a default assembler was specified" >&5 +echo $ECHO_N "checking whether a default assembler was specified... $ECHO_C" >&6 +if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then + if test x"$gas_flag" = x"no"; then + echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER)" >&5 +echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER)" >&6 + else + echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER - GNU as)" >&5 +echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER - GNU as)" >&6 + fi +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# --------------- +# Find C compiler +# --------------- + +# If a non-executable a.out is present (e.g. created by GNU as above even if +# invoked with -v only), the IRIX 6 native ld just overwrites the existing +# file, even when creating an executable, so an execution test fails. +# Remove possible default executable files to avoid this. +# +# FIXME: This really belongs into AC_PROG_CC and can be removed once +# Autoconf includes it. +rm -f a.out a.exe b.out # Find the native compiler -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:930: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:960: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1011: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1043: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + test -n "$ac_ct_CC" && break +done -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + CC=$ac_ct_CC +fi -cat > conftest.$ac_ext << EOF +fi -#line 1054 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:1059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1085: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1090: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - cat > conftest.c <&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me #endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1118: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -1144,34 +2399,287 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "x$CC" != xcc; then - echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 -echo "configure:1151: checking whether $CC and cc understand -c and -o together" >&5 + echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 +echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6 else - echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 -echo "configure:1154: checking whether cc understands -c and -o together" >&5 + echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 +echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6 fi -set dummy $CC; ac_cc="`echo $2 | - sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" -if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +set dummy $CC; ac_cc=`echo $2 | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'foo(){}' > conftest.c + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. -ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' -if { (eval echo configure:1166: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:1167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5' +if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. - if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then - ac_try='cc -c conftest.c -o conftest.o 1>&5' - if { (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:1175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + if { ac_try='cc -c conftest.$ac_ext >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5' + if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # cc works too. : @@ -1188,12 +2696,15 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - echo "$ac_t""no" 1>&6 - cat >> confdefs.h <<\EOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cat >>confdefs.h <<\_ACEOF #define NO_MINUS_C_MINUS_O 1 -EOF +_ACEOF fi @@ -1206,730 +2717,1020 @@ fi -# See if GNAT has been installed -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi +# ------------------------- +# Check C compiler features +# ------------------------- -# Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. -set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1221: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$GNATBIND"; then - ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GNATBIND="${ac_tool_prefix}gnatbind" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -GNATBIND="$ac_cv_prog_GNATBIND" -if test -n "$GNATBIND"; then - echo "$ac_t""$GNATBIND" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_GNATBIND"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "gnatbind", so it can be a program name with args. -set dummy gnatbind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1253: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$GNATBIND"; then - ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GNATBIND="gnatbind" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_GNATBIND" && ac_cv_prog_GNATBIND="no" -fi -fi -GNATBIND="$ac_cv_prog_GNATBIND" -if test -n "$GNATBIND"; then - echo "$ac_t""$GNATBIND" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - GNATBIND="no" -fi -fi - -echo $ac_n "checking for compiler driver that understands Ada""... $ac_c" 1>&6 -echo "configure:1286: checking for compiler driver that understands Ada" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_adac'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.adb <&1 || echo failure` - if test x"$errors" = x; then - gcc_cv_prog_adac=$cand - break - fi -done -rm -f conftest.* -fi - -echo "$ac_t""$gcc_cv_prog_adac" 1>&6 -ADAC=$gcc_cv_prog_adac - - -if test x$GNATBIND != xno && test x$ADAC != xno; then - have_gnat=yes -else - have_gnat=no -fi - - -echo $ac_n "checking whether ${CC-cc} accepts -Wno-long-long""... $ac_c" 1>&6 -echo "configure:1328: checking whether ${CC-cc} accepts -Wno-long-long" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_no_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ${CC-cc} accepts -Wno-long-long" >&5 +echo $ECHO_N "checking whether ${CC-cc} accepts -Wno-long-long... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_no_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else save_CFLAGS="$CFLAGS" CFLAGS="-Wno-long-long" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ -; return 0; } -EOF -if { (eval echo configure:1342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_no_long_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_prog_cc_no_long_long=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_no_long_long=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_no_long_long" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_no_long_long" >&6 -echo "$ac_t""$ac_cv_prog_cc_no_long_long" 1>&6 - -if test x$have_gnat != xno ; then -echo $ac_n "checking whether ${ADAC} accepts -Wno-long-long""... $ac_c" 1>&6 -echo "configure:1359: checking whether ${ADAC} accepts -Wno-long-long" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_adac_no_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat >conftest.adb <&5 2>&5 ; then - ac_cv_prog_adac_no_long_long=yes -else - ac_cv_prog_adac_no_long_long=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_prog_adac_no_long_long" 1>&6 -else - ac_cv_prog_adac_no_long_long=yes -fi - -strict1_warn= -if test $ac_cv_prog_cc_no_long_long = yes && \ - test $ac_cv_prog_adac_no_long_long = yes ; then - strict1_warn="-pedantic -Wno-long-long" -fi - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1387: checking how to run the C preprocessor" >&5 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1467: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:1481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext done fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF + no) +cat >>confdefs.h <<\_ACEOF +#define inline +_ACEOF ;; - *) cat >> confdefs.h <>confdefs.h <<_ACEOF #define inline $ac_cv_c_inline -EOF +_ACEOF ;; esac -echo $ac_n "checking for volatile""... $ac_c" 1>&6 -echo "configure:1507: checking for volatile" >&5 -if eval "test \"`echo '$''{'gcc_cv_c_volatile'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for long long int" >&5 +echo $ECHO_N "checking for long long int... $ECHO_C" >&6 +if test "${ac_cv_c_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -volatile int foo; -; return 0; } -EOF -if { (eval echo configure:1519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_c_volatile=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_c_volatile=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_c_volatile" 1>&6 -if test $gcc_cv_c_volatile = yes ; then - cat >> confdefs.h <<\EOF -#define HAVE_VOLATILE 1 -EOF - -fi - - -echo $ac_n "checking for long double""... $ac_c" 1>&6 -echo "configure:1541: checking for long double" >&5 -if eval "test \"`echo '$''{'gcc_cv_c_long_double'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$GCC" = yes; then - gcc_cv_c_long_double=yes -else -cat > conftest.$ac_ext <= sizeof(double)):; -; return 0; } -EOF -if { (eval echo configure:1559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_c_long_double=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_c_long_double=no -fi -rm -f conftest* -fi -fi - -echo "$ac_t""$gcc_cv_c_long_double" 1>&6 -if test $gcc_cv_c_long_double = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LONG_DOUBLE 1 -EOF - -fi - -echo $ac_n "checking for long long int""... $ac_c" 1>&6 -echo "configure:1581: checking for long long int" >&5 -if eval "test \"`echo '$''{'ac_cv_c_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_long_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_long_long=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c_long_long" 1>&6 +ac_cv_c_long_long=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5 +echo "${ECHO_T}$ac_cv_c_long_long" >&6 if test $ac_cv_c_long_long = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_LONG 1 -EOF +_ACEOF fi -echo $ac_n "checking for __int64""... $ac_c" 1>&6 -echo "configure:1613: checking for __int64" >&5 -if eval "test \"`echo '$''{'ac_cv_c___int64'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for __int64" >&5 +echo $ECHO_N "checking for __int64... $ECHO_C" >&6 +if test "${ac_cv_c___int64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ __int64 i; -; return 0; } -EOF -if { (eval echo configure:1625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c___int64=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c___int64=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c___int64" 1>&6 +ac_cv_c___int64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c___int64" >&5 +echo "${ECHO_T}$ac_cv_c___int64" >&6 if test $ac_cv_c___int64 = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE___INT64 1 -EOF +_ACEOF fi -echo $ac_n "checking for built-in _Bool""... $ac_c" 1>&6 -echo "configure:1646: checking for built-in _Bool" >&5 -if eval "test \"`echo '$''{'gcc_cv_c__bool'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for built-in _Bool" >&5 +echo $ECHO_N "checking for built-in _Bool... $ECHO_C" >&6 +if test "${gcc_cv_c__bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ _Bool foo; -; return 0; } -EOF -if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_c__bool=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_c__bool=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_c__bool=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$gcc_cv_c__bool" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_c__bool" >&5 +echo "${ECHO_T}$gcc_cv_c__bool" >&6 if test $gcc_cv_c__bool = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE__BOOL 1 -EOF +_ACEOF fi # sizeof(char) is 1 by definition. -echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1682: checking size of short" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6 +if test "${ac_cv_sizeof_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include -int main() { +int +main () +{ +switch (0) case 0: case (sizeof (void *) == $ac_size):; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=$ac_size +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test x$ac_cv_sizeof_void_p != x ; then break; fi +done + +fi + +if test x$ac_cv_sizeof_void_p = x ; then + { { echo "$as_me:$LINENO: error: cannot determine a size for void *" >&5 +echo "$as_me: error: cannot determine a size for void *" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + +echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6 +if test "${ac_cv_sizeof_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "confdefs.h" +#include + + +int +main () +{ switch (0) case 0: case (sizeof (short) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:1698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_sizeof_short=$ac_size else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test x$ac_cv_sizeof_short != x ; then break; fi done fi if test x$ac_cv_sizeof_short = x ; then - { echo "configure: error: cannot determine a size for short" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot determine a size for short" >&5 +echo "$as_me: error: cannot determine a size for short" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_short" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6 + +cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short -EOF +_ACEOF -echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1721: checking size of int" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include -int main() { +int +main () +{ switch (0) case 0: case (sizeof (int) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:1737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_sizeof_int=$ac_size else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test x$ac_cv_sizeof_int != x ; then break; fi done fi if test x$ac_cv_sizeof_int = x ; then - { echo "configure: error: cannot determine a size for int" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot determine a size for int" >&5 +echo "$as_me: error: cannot determine a size for int" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 + +cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int -EOF +_ACEOF -echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1760: checking size of long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include -int main() { +int +main () +{ switch (0) case 0: case (sizeof (long) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:1776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_sizeof_long=$ac_size else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test x$ac_cv_sizeof_long != x ; then break; fi done fi if test x$ac_cv_sizeof_long = x ; then - { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot determine a size for long" >&5 +echo "$as_me: error: cannot determine a size for long" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 + +cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long -EOF +_ACEOF if test $ac_cv_c_long_long = yes; then - echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1800: checking size of long long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include -int main() { +int +main () +{ switch (0) case 0: case (sizeof (long long) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:1816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_sizeof_long_long=$ac_size else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test x$ac_cv_sizeof_long_long != x ; then break; fi done fi if test x$ac_cv_sizeof_long_long = x ; then - { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot determine a size for long long" >&5 +echo "$as_me: error: cannot determine a size for long long" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 + +cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -EOF +_ACEOF fi if test $ac_cv_c___int64 = yes; then - echo $ac_n "checking size of __int64""... $ac_c" 1>&6 -echo "configure:1841: checking size of __int64" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof___int64'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking size of __int64" >&5 +echo $ECHO_N "checking size of __int64... $ECHO_C" >&6 +if test "${ac_cv_sizeof___int64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include -int main() { +int +main () +{ switch (0) case 0: case (sizeof (__int64) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:1857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_sizeof___int64=$ac_size else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test x$ac_cv_sizeof___int64 != x ; then break; fi done fi if test x$ac_cv_sizeof___int64 = x ; then - { echo "configure: error: cannot determine a size for __int64" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot determine a size for __int64" >&5 +echo "$as_me: error: cannot determine a size for __int64" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof___int64" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof___int64" >&6 + +cat >>confdefs.h <<_ACEOF #define SIZEOF___INT64 $ac_cv_sizeof___int64 -EOF +_ACEOF fi -echo $ac_n "checking execution character set""... $ac_c" 1>&6 -echo "configure:1882: checking execution character set" >&5 -if eval "test \"`echo '$''{'ac_cv_c_charset'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# ----------------- +# Find Ada compiler +# ----------------- + +# See if GNAT has been installed + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. +set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_GNATBIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <&5 | - egrep "ASCII" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_charset=ASCII -fi -rm -f conftest* - - if test x${ac_cv_c_charset+set} != xset; then - cat > conftest.$ac_ext <&5 | - egrep "EBCDIC" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_charset=EBCDIC -fi -rm -f conftest* - + if test -n "$GNATBIND"; then + ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_GNATBIND="${ac_tool_prefix}gnatbind" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - if test x${ac_cv_c_charset+set} != xset; then - ac_cv_c_charset=unknown +done +done + +fi +fi +GNATBIND=$ac_cv_prog_GNATBIND +if test -n "$GNATBIND"; then + echo "$as_me:$LINENO: result: $GNATBIND" >&5 +echo "${ECHO_T}$GNATBIND" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_GNATBIND"; then + ac_ct_GNATBIND=$GNATBIND + # Extract the first word of "gnatbind", so it can be a program name with args. +set dummy gnatbind; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_GNATBIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_GNATBIND"; then + ac_cv_prog_ac_ct_GNATBIND="$ac_ct_GNATBIND" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_GNATBIND="gnatbind" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done + + test -z "$ac_cv_prog_ac_ct_GNATBIND" && ac_cv_prog_ac_ct_GNATBIND="no" +fi +fi +ac_ct_GNATBIND=$ac_cv_prog_ac_ct_GNATBIND +if test -n "$ac_ct_GNATBIND"; then + echo "$as_me:$LINENO: result: $ac_ct_GNATBIND" >&5 +echo "${ECHO_T}$ac_ct_GNATBIND" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo "$ac_t""$ac_cv_c_charset" 1>&6 -if test $ac_cv_c_charset = unknown; then - { echo "configure: error: *** Cannot determine host character set." 1>&2; exit 1; } -elif test $ac_cv_c_charset = EBCDIC; then - cat >> confdefs.h <<\EOF -#define HOST_EBCDIC 1 + GNATBIND=$ac_ct_GNATBIND +else + GNATBIND="$ac_cv_prog_GNATBIND" +fi + +echo "$as_me:$LINENO: checking whether compiler driver understands Ada" >&5 +echo $ECHO_N "checking whether compiler driver understands Ada... $ECHO_C" >&6 +if test "${gcc_cv_cc_supports_ada+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.adb <&1 || echo failure` +if test x"$errors" = x && test -f conftest.$ac_objext; then + gcc_cv_cc_supports_ada=yes + break +fi +rm -f conftest.* +fi +echo "$as_me:$LINENO: result: $gcc_cv_cc_supports_ada" >&5 +echo "${ECHO_T}$gcc_cv_cc_supports_ada" >&6 +if test x$GNATBIND != xno && test x$gcc_cv_cc_supports_ada != xno; then + have_gnat=yes +else + have_gnat=no fi -# If the native compiler is GCC, we can enable warnings even in stage1. + +# --------------------- +# Warnings and checking +# --------------------- + +strict1_warn= +if test $ac_cv_prog_cc_no_long_long = yes ; then + strict1_warn="-pedantic -Wno-long-long" +fi + + +# If the native compiler is GCC, we can enable warnings even in stage1. # That's useful for people building cross-compilers, or just running a # quick `make'. warn_cflags= @@ -1938,15 +3739,18 @@ if test "x$GCC" = "xyes"; then fi -# Determine whether or not multilibs are enabled. -# Check whether --enable-multilib or --disable-multilib was given. -if test "${enable_multilib+set}" = set; then - enableval="$enable_multilib" - : -else - enable_multilib=yes -fi +# Enable -Werror in bootstrap stage2 and later. +# Change the default to "no" on release branches. +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" +else + enable_werror=no +fi; +if test x$enable_werror = xyes ; then + WERROR=-Werror +fi # Enable expensive internal checks @@ -1959,6 +3763,7 @@ ac_rtl_checking= ac_rtlflag_checking= ac_gc_checking= ac_gc_always_collect= +ac_fold_checking= case "${enableval}" in yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; ac_rtlflag_checking=1 ;; @@ -1975,135 +3780,632 @@ no) ;; rtl) ac_rtl_checking=1 ;; gc) ac_gc_checking=1 ;; gcac) ac_gc_always_collect=1 ;; + fold) ac_fold_checking=1 ;; valgrind) ac_checking_valgrind=1 ;; - *) { echo "configure: error: unknown check category $check" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: unknown check category $check" >&5 +echo "$as_me: error: unknown check category $check" >&2;} + { (exit 1); exit 1; }; } ;; esac done ;; esac -fi - +else + # By default, disable all checks for release versions of GCC. +ac_checking=; ac_tree_checking=; ac_gc_checking=; ac_rtlflag_checking=; +fi; nocommon_flag="" if test x$ac_checking != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_CHECKING 1 -EOF +_ACEOF nocommon_flag=-fno-common fi if test x$ac_tree_checking != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_TREE_CHECKING 1 -EOF +_ACEOF fi if test x$ac_rtl_checking != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_RTL_CHECKING 1 -EOF +_ACEOF fi if test x$ac_rtlflag_checking != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_RTL_FLAG_CHECKING 1 -EOF +_ACEOF fi if test x$ac_gc_checking != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_GC_CHECKING 1 -EOF +_ACEOF fi if test x$ac_gc_always_collect != x ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_GC_ALWAYS_COLLECT 1 -EOF +_ACEOF + +fi +if test x$ac_fold_checking != x ; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_FOLD_CHECKING 1 +_ACEOF fi valgrind_path_defines= valgrind_command= + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_valgrind_h+set}" = set; then + echo "$as_me:$LINENO: checking for valgrind.h" >&5 +echo $ECHO_N "checking for valgrind.h... $ECHO_C" >&6 +if test "${ac_cv_header_valgrind_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_h" >&5 +echo "${ECHO_T}$ac_cv_header_valgrind_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking valgrind.h usability" >&5 +echo $ECHO_N "checking valgrind.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking valgrind.h presence" >&5 +echo $ECHO_N "checking valgrind.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: valgrind.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: valgrind.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: valgrind.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: valgrind.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: valgrind.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: valgrind.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: valgrind.h: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for valgrind.h" >&5 +echo $ECHO_N "checking for valgrind.h... $ECHO_C" >&6 +if test "${ac_cv_header_valgrind_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_valgrind_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_valgrind_h" >&5 +echo "${ECHO_T}$ac_cv_header_valgrind_h" >&6 + +fi +if test $ac_cv_header_valgrind_h = yes; then + have_valgrind_h=yes +else + have_valgrind_h=no +fi + + + if test x$ac_checking_valgrind != x ; then # It is certainly possible that there's valgrind but no valgrind.h. # GCC relies on making annotations so we must have both. - ac_safe=`echo "valgrind.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for valgrind.h""... $ac_c" 1>&6 -echo "configure:2034: checking for valgrind.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for VALGRIND_DISCARD in " >&5 +echo $ECHO_N "checking for VALGRIND_DISCARD in ... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifndef VALGRIND_DISCARD +#error VALGRIND_DISCARD not defined +#endif +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cpp_err=yes fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - have_valgrind_h=yes +if test -z "$ac_cpp_err"; then + gcc_cv_header_valgrind_memcheck_h=yes else - echo "$ac_t""no" 1>&6 -have_valgrind_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gcc_cv_header_valgrind_memcheck_h=no +fi +rm -f conftest.err conftest.$ac_ext + echo "$as_me:$LINENO: result: $gcc_cv_header_valgrind_memcheck_h" >&5 +echo "${ECHO_T}$gcc_cv_header_valgrind_memcheck_h" >&6 + echo "$as_me:$LINENO: checking for VALGRIND_DISCARD in " >&5 +echo $ECHO_N "checking for VALGRIND_DISCARD in ... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifndef VALGRIND_DISCARD +#error VALGRIND_DISCARD not defined +#endif +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + gcc_cv_header_memcheck_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gcc_cv_header_memcheck_h=no +fi +rm -f conftest.err conftest.$ac_ext + echo "$as_me:$LINENO: result: $gcc_cv_header_memcheck_h" >&5 +echo "${ECHO_T}$gcc_cv_header_memcheck_h" >&6 + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi - # Extract the first word of "valgrind", so it can be a program name with args. +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "valgrind", so it can be a program name with args. set dummy valgrind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2069: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_valgrind_path'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_valgrind_path+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$valgrind_path" in - /*) - ac_cv_path_valgrind_path="$valgrind_path" # Let the user override the test with a path. - ;; + [\\/]* | ?:[\\/]*) + ac_cv_path_valgrind_path="$valgrind_path" # Let the user override the test with a path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1; then - ac_cv_path_valgrind_path="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - ;; + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1; then + ac_cv_path_valgrind_path="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + ;; esac fi valgrind_path="$ac_cv_path_valgrind_path" if test -n "$valgrind_path"; then - echo "$ac_t""$valgrind_path" 1>&6 + echo "$as_me:$LINENO: result: $valgrind_path" >&5 +echo "${ECHO_T}$valgrind_path" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then - { echo "configure: error: *** Can't find both valgrind and valgrind.h" 1>&2; exit 1; } + if test "x$valgrind_path" = "x" \ + || (test $have_valgrind_h = no \ + && test $gcc_cv_header_memcheck_h = no \ + && test $gcc_cv_header_valgrind_memcheck_h = no); then + { { echo "$as_me:$LINENO: error: *** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h" >&5 +echo "$as_me: error: *** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h" >&2;} + { (exit 1); exit 1; }; } fi valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' valgrind_command="$valgrind_path -q" - cat >> confdefs.h <<\EOF -#define ENABLE_VALGRIND_CHECKING 1 -EOF +cat >>confdefs.h <<\_ACEOF +#define ENABLE_VALGRIND_CHECKING 1 +_ACEOF + + if test $gcc_cv_header_valgrind_memcheck_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_VALGRIND_MEMCHECK_H 1 +_ACEOF + + fi + if test $gcc_cv_header_memcheck_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MEMCHECK_H 1 +_ACEOF + + fi fi @@ -2114,91 +4416,80 @@ if test "${enable_coverage+set}" = set; then enableval="$enable_coverage" case "${enableval}" in yes|noopt) - coverage_flags="-fprofile-arcs -ftest-coverage -O0" + coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0" ;; opt) - coverage_flags="-fprofile-arcs -ftest-coverage -O2" + coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2" ;; *) - { echo "configure: error: unknown coverage setting $enableval" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: unknown coverage setting $enableval" >&5 +echo "$as_me: error: unknown coverage setting $enableval" >&2;} + { (exit 1); exit 1; }; } ;; esac else coverage_flags="" -fi +fi; +# Check whether --enable-gather-detailed-mem-stats or --disable-gather-detailed-mem-stats was given. +if test "${enable_gather_detailed_mem_stats+set}" = set; then + enableval="$enable_gather_detailed_mem_stats" + +else + enable_gather_detailed_mem_stats=no +fi; +if test x$enable_gather_detailed_mem_stats = xyes ; then + +cat >>confdefs.h <<\_ACEOF +#define GATHER_STATISTICS 1 +_ACEOF -# Check whether --with-cpp_install_dir or --without-cpp_install_dir was given. -if test "${with_cpp_install_dir+set}" = set; then - withval="$with_cpp_install_dir" - if test x$withval = xyes; then - { echo "configure: error: option --with-cpp-install-dir requires an argument" 1>&2; exit 1; } -elif test x$withval != xno; then - cpp_install_dir=$withval -fi fi +# ------------------------------- +# Miscenalleous configure options +# ------------------------------- + +# With stabs + +# Check whether --with-stabs or --without-stabs was given. +if test "${with_stabs+set}" = set; then + withval="$with_stabs" + stabs="$with_stabs" +else + stabs=no +fi; + +# Determine whether or not multilibs are enabled. +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + +else + enable_multilib=yes +fi; + # Enable __cxa_atexit for C++. # Check whether --enable-__cxa_atexit or --disable-__cxa_atexit was given. if test "${enable___cxa_atexit+set}" = set; then enableval="$enable___cxa_atexit" - : -fi -if test x$enable___cxa_atexit = xyes; then - cat >> confdefs.h <<\EOF -#define DEFAULT_USE_CXA_ATEXIT 1 -EOF +fi; -fi - -# Enable Multibyte Characters for C/C++ -# Check whether --enable-c-mbchar or --disable-c-mbchar was given. -if test "${enable_c_mbchar+set}" = set; then - enableval="$enable_c_mbchar" - if test x$enable_c_mbchar != xno; then - cat >> confdefs.h <<\EOF -#define MULTIBYTE_CHARS 1 -EOF - -fi -fi - - # Enable threads # Pass with no value to take the default # Pass with a value to specify a thread package # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" - : + else enable_threads='' -fi - - +fi; +# Save in case it gets overwritten in config.gcc enable_threads_flag=$enable_threads -# Check if a valid thread package -case x${enable_threads_flag} in - x | xno) - # No threads - target_thread_file='single' - ;; - xyes) - # default - target_thread_file='' - ;; - xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix) - target_thread_file=$enable_threads_flag - ;; - *) - echo "$enable_threads is an unknown thread package" 1>&2 - exit 1 - ;; -esac # Check whether --enable-objc-gc or --disable-objc-gc was given. if test "${enable_objc_gc+set}" = set; then @@ -2210,7 +4501,7 @@ else fi else objc_boehm_gc='' -fi +fi; # Check whether --with-dwarf2 or --without-dwarf2 was given. @@ -2219,13 +4510,12 @@ if test "${with_dwarf2+set}" = set; then dwarf2="$with_dwarf2" else dwarf2=no -fi - +fi; # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" - + case $enable_shared in yes | no) ;; *) @@ -2242,158 +4532,150 @@ if test "${enable_shared+set}" = set; then else enable_shared=yes -fi +fi; -# Stage specific cflags for build. -stage1_cflags= -case $build in -vax-*-*) - if test x$GCC = xyes - then - stage1_cflags="-Wa,-J" +# Check whether --with-sysroot or --without-sysroot was given. +if test "${with_sysroot+set}" = set; then + withval="$with_sysroot" + + case ${with_sysroot} in + yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; + *) TARGET_SYSTEM_ROOT=$with_sysroot ;; + esac + + TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' + CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)' + + if test "x$exec_prefix" = xNONE; then + if test "x$prefix" = xNONE; then + test_prefix=/usr/local else - stage1_cflags="-J" + test_prefix=$prefix fi - ;; -powerpc-*-darwin*) - # The spiffy cpp-precomp chokes on some legitimate constructs in GCC - # sources; use -no-cpp-precomp to get to GNU cpp. - # Apple's GCC has bugs in designated initializer handling, so disable - # that too. - stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" - ;; -esac + else + test_prefix=$exec_prefix + fi + case ${TARGET_SYSTEM_ROOT} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" + TARGET_SYSTEM_ROOT_DEFINE="$t" + ;; + esac - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:2272: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftestmake <<\EOF + + TARGET_SYSTEM_ROOT= + TARGET_SYSTEM_ROOT_DEFINE= + CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' + +fi; + + + + +# Build with intermodule optimisations +# Check whether --enable-intermodule or --disable-intermodule was given. +if test "${enable_intermodule+set}" = set; then + enableval="$enable_intermodule" + case ${enable_intermodule} in + yes) onestep="-onestep";; + *) onestep="";; +esac +else + onestep="" +fi; + + +# ------------------------- +# Checks for other programs +# ------------------------- + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi -echo $ac_n "checking whether a default assembler was specified""... $ac_c" 1>&6 -echo "configure:2300: checking whether a default assembler was specified" >&5 -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then - echo "$ac_t""yes ($DEFAULT_ASSEMBLER)" 1>&6 - else - echo "$ac_t""yes ($DEFAULT_ASSEMBLER - GNU as)" 1>&6 - fi -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking whether a default linker was specified""... $ac_c" 1>&6 -echo "configure:2312: checking whether a default linker was specified" >&5 -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test x"$gnu_ld_flag" = x"no"; then - echo "$ac_t""yes ($DEFAULT_LINKER)" 1>&6 - else - echo "$ac_t""yes ($DEFAULT_LINKER - GNU ld)" 1>&6 - fi -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking for GNU C library""... $ac_c" 1>&6 -echo "configure:2324: checking for GNU C library" >&5 -if eval "test \"`echo '$''{'gcc_cv_glibc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { - -#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) -#error Not a GNU C library system -#endif -; return 0; } -EOF -if { (eval echo configure:2339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_glibc=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_glibc=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_glibc" 1>&6 -if test $gcc_cv_glibc = yes; then - cat >> confdefs.h <<\EOF -#define _GNU_SOURCE 1 -EOF - -fi - # Find some useful tools -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2365: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done -echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:2395: checking whether ln works" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_LN'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +# We need awk to run opts.sh (to create options.c and options.h). +# Bail out if it's missing. +case ${AWK} in + "") { { echo "$as_me:$LINENO: error: can't build without awk, bailing out" >&5 +echo "$as_me: error: can't build without awk, bailing out" >&2;} + { (exit 1); exit 1; }; } ;; +esac + +echo "$as_me:$LINENO: checking whether ln works" >&5 +echo $ECHO_N "checking whether ln works... $ECHO_C" >&6 +if test "${gcc_cv_prog_LN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftestdata_t echo >conftestdata_f @@ -2413,19 +4695,22 @@ rm -f conftestdata_f conftestdata_t fi LN="$gcc_cv_prog_LN" if test "$gcc_cv_prog_LN" = "ln"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else if test "$gcc_cv_prog_LN" = "ln -s"; then - echo "$ac_t""no, using ln -s" 1>&6 + echo "$as_me:$LINENO: result: no, using ln -s" >&5 +echo "${ECHO_T}no, using ln -s" >&6 else - echo "$ac_t""no, and neither does ln -s, so using cp" 1>&6 + echo "$as_me:$LINENO: result: no, and neither does ln -s, so using cp" >&5 +echo "${ECHO_T}no, and neither does ln -s, so using cp" >&6 fi fi -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2427: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +if test "${gcc_cv_prog_LN_S+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftestdata_t echo >conftestdata_f @@ -2445,43 +4730,96 @@ rm -f conftestdata_f conftestdata_t fi LN_S="$gcc_cv_prog_LN_S" if test "$gcc_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else if test "$gcc_cv_prog_LN_S" = "ln"; then - echo "$ac_t""no, using ln" 1>&6 + echo "$as_me:$LINENO: result: no, using ln" >&5 +echo "${ECHO_T}no, using ln" >&6 else - echo "$ac_t""no, and neither does ln, so using cp" 1>&6 + echo "$as_me:$LINENO: result: no, and neither does ln, so using cp" >&5 +echo "${ECHO_T}no, and neither does ln, so using cp" >&6 fi fi -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2461: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" fi # Find a good install program. We prefer a C program (faster), @@ -2494,11 +4832,11 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2499: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do @@ -2536,7 +4874,8 @@ fi INSTALL="$ac_install_sh" fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2545,665 +4884,75 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2550: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# See if cmp has --ignore-initial. +echo "$as_me:$LINENO: checking for cmp's capabilities" >&5 +echo $ECHO_N "checking for cmp's capabilities... $ECHO_C" >&6 +if test "${gcc_cv_prog_cmp_skip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:2630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2654: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:2668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_time=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 -EOF - -fi - -echo $ac_n "checking for working stdbool.h""... $ac_c" 1>&6 -echo "configure:2689: checking for working stdbool.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdbool_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -bool foo = false; -; return 0; } -EOF -if { (eval echo configure:2701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_stdbool_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdbool_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_stdbool_h" 1>&6 -if test $ac_cv_header_stdbool_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_STDBOOL_H 1 -EOF - -fi - -echo $ac_n "checking whether string.h and strings.h may both be included""... $ac_c" 1>&6 -echo "configure:2722: checking whether string.h and strings.h may both be included" >&5 -if eval "test \"`echo '$''{'gcc_cv_header_string'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -int main() { - -; return 0; } -EOF -if { (eval echo configure:2735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_header_string=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_header_string=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_header_string" 1>&6 -if test $gcc_cv_header_string = yes; then - cat >> confdefs.h <<\EOF -#define STRING_WITH_STRINGS 1 -EOF - -fi - -echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2756: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif -int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; -; return 0; } -EOF -if { (eval echo configure:2777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_sys_wait_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_sys_wait_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 -if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_SYS_WAIT_H 1 -EOF - -fi - -for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h \ - fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ - sys/resource.h sys/param.h sys/times.h sys/stat.h \ - direct.h malloc.h langinfo.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2804: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - -# Check for thread headers. -ac_safe=`echo "thread.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for thread.h""... $ac_c" 1>&6 -echo "configure:2844: checking for thread.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - have_thread_h=yes -else - echo "$ac_t""no" 1>&6 -have_thread_h= -fi - -ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for pthread.h""... $ac_c" 1>&6 -echo "configure:2878: checking for pthread.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - have_pthread_h=yes -else - echo "$ac_t""no" 1>&6 -have_pthread_h= -fi - - -# These tests can't be done till we know if we have limits.h. -echo $ac_n "checking for CHAR_BIT""... $ac_c" 1>&6 -echo "configure:2913: checking for CHAR_BIT" >&5 -if eval "test \"`echo '$''{'gcc_cv_decl_char_bit'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#endif -#ifdef CHAR_BIT -found -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "found" >/dev/null 2>&1; then - rm -rf conftest* - gcc_cv_decl_char_bit=yes -else - rm -rf conftest* - gcc_cv_decl_char_bit=no -fi -rm -f conftest* - - -fi - -echo "$ac_t""$gcc_cv_decl_char_bit" 1>&6 -if test $gcc_cv_decl_char_bit = no; then - echo $ac_n "checking number of bits in a byte""... $ac_c" 1>&6 -echo "configure:2943: checking number of bits in a byte" >&5 -if eval "test \"`echo '$''{'gcc_cv_c_nbby'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - i=8 - gcc_cv_c_nbby= - while test $i -lt 65; do - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_c_nbby=$i; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - i=`expr $i + 1` - done - test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed - -fi - -echo "$ac_t""$gcc_cv_c_nbby" 1>&6 -if test $gcc_cv_c_nbby = failed; then - { echo "configure: error: cannot determine number of bits in a byte" 1>&2; exit 1; } -else - cat >> confdefs.h <&6 -echo "configure:2986: checking byte ordering" >&5 -if eval "test \"`echo '$''{'ac_cv_c_compile_endian'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_compile_endian=unknown - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext < -#endif -/* This structure must have no internal padding. */ - struct { - char prefix[sizeof "\nendian:" - 1]; - short word; - char postfix[2]; - } tester = { - "\nendian:", -#if SIZEOF_SHORT == 4 - ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) | -#endif - ('A' << CHAR_BIT) | 'B', - 'X', '\n' -}; -EOF -if { (eval echo configure:3020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - od -c conftest.o | - sed 's/^[0-7]*[ ]*/ / - s/\*/./g - s/ \\n/*/g - s/ [0-9][0-9][0-9]/./g - s/ \\[^ ]/./g' | - tr -d ' - ' | tr -s '*' ' -' | fold | sed '$a\ -' > conftest.dmp - if grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_compile_endian=big-endian - elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_compile_endian=little-endian + echo abfoo >t1 + echo cdfoo >t2 + gcc_cv_prog_cmp_skip=slowcompare + if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then + if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then + : + else + gcc_cv_prog_cmp_skip=gnucompare + fi fi -fi -rm -rf conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - - -fi - -echo "$ac_t""$ac_cv_c_compile_endian" 1>&6 -if test $ac_cv_c_compile_endian = unknown; then - { echo "configure: error: *** unable to determine endianness" 1>&2; exit 1; } -elif test $ac_cv_c_compile_endian = big-endian; then - cat >> confdefs.h <<\EOF -#define HOST_WORDS_BIG_ENDIAN 1 -EOF - -fi - -echo $ac_n "checking floating point format""... $ac_c" 1>&6 -echo "configure:3059: checking floating point format" >&5 -if eval "test \"`echo '$''{'ac_cv_c_float_format'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - od -c conftest.o | - sed 's/^[0-7]*[ ]*/ / - s/\*/./g - s/ \\n/*/g - s/ [0-9][0-9][0-9]/./g - s/ \\[^ ]/./g' | - tr -d ' - ' | tr -s '*' ' -' | fold | sed '$a\ -' > conftest.dmp - if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (big-endian)' - elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IEEE (little-endian)' - elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='VAX D-float' - elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='PDP-10' - elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then - ac_cv_c_float_format='IBM 370 hex' - else - { echo "configure: error: Unknown floating point format" 1>&2; exit 1; } + if test $gcc_cv_prog_cmp_skip = slowcompare ; then + if cmp t1 t2 2 2 > /dev/null 2>&1; then + if cmp t1 t2 1 1 > /dev/null 2>&1; then + : + else + gcc_cv_prog_cmp_skip=fastcompare + fi + fi fi -else - { echo "configure: error: compile failed" 1>&2; exit 1; } -fi -rm -rf conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - + rm t1 t2 fi +echo "$as_me:$LINENO: result: $gcc_cv_prog_cmp_skip" >&5 +echo "${ECHO_T}$gcc_cv_prog_cmp_skip" >&6 +make_compare_target=$gcc_cv_prog_cmp_skip -echo "$ac_t""$ac_cv_c_float_format" 1>&6 -# IEEE is the default format. If the float endianness isn't the same -# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN -# (which is a tristate: yes, no, default). This is only an issue with -# IEEE; the other formats are only supported by a few machines each, -# all with the same endianness. -format= -fbigend= -case $ac_cv_c_float_format in - 'IEEE (big-endian)' ) - if test $ac_cv_c_compile_endian = little-endian; then - fbigend=1 - fi - ;; - 'IEEE (little-endian)' ) - if test $ac_cv_c_compile_endian = big-endian; then - fbigend=0 - fi - ;; - 'VAX D-float' ) - format=VAX_FLOAT_FORMAT - ;; - 'PDP-10' ) - format=PDP10_FLOAT_FORMAT - ;; - 'IBM 370 hex' ) - format=IBM_FLOAT_FORMAT - ;; -esac -if test -n "$format"; then - cat >> confdefs.h <> confdefs.h <&6 -echo "configure:3183: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_have_mktemp_command'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_have_mktemp_command+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_mktemp_command"; then ac_cv_prog_have_mktemp_command="$have_mktemp_command" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_have_mktemp_command="yes" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_mktemp_command="yes" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_prog_have_mktemp_command" && ac_cv_prog_have_mktemp_command="no" fi fi -have_mktemp_command="$ac_cv_prog_have_mktemp_command" +have_mktemp_command=$ac_cv_prog_have_mktemp_command if test -n "$have_mktemp_command"; then - echo "$ac_t""$have_mktemp_command" 1>&6 + echo "$as_me:$LINENO: result: $have_mktemp_command" >&5 +echo "${ECHO_T}$have_mktemp_command" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi @@ -3211,49 +4960,56 @@ fi if test -f $srcdir/../texinfo/Makefile.in; then MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo' gcc_cv_prog_makeinfo_modern=yes - echo "$ac_t""Using makeinfo from the unified source tree." 1>&6 + echo "$as_me:$LINENO: result: Using makeinfo from the unified source tree." >&5 +echo "${ECHO_T}Using makeinfo from the unified source tree." >&6 else # See if makeinfo has been installed and is modern enough # that we can use it. # Extract the first word of "makeinfo", so it can be a program name with args. set dummy makeinfo; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3222: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKEINFO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKEINFO"; then ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_MAKEINFO="makeinfo" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MAKEINFO="makeinfo" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -MAKEINFO="$ac_cv_prog_MAKEINFO" +MAKEINFO=$ac_cv_prog_MAKEINFO if test -n "$MAKEINFO"; then - echo "$ac_t""$MAKEINFO" 1>&6 + echo "$as_me:$LINENO: result: $MAKEINFO" >&5 +echo "${ECHO_T}$MAKEINFO" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test -n "$MAKEINFO"; then # Found it, now check the version. - echo $ac_n "checking for modern makeinfo""... $ac_c" 1>&6 -echo "configure:3251: checking for modern makeinfo" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_makeinfo_modern'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for modern makeinfo" >&5 +echo $ECHO_N "checking for modern makeinfo... $ECHO_C" >&6 +if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:3257: version of makeinfo is $ac_prog_version" >&5 + echo "configure:5012: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[2-9]*) @@ -3262,8 +5018,8 @@ else esac fi - -echo "$ac_t""$gcc_cv_prog_makeinfo_modern" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_prog_makeinfo_modern" >&5 +echo "${ECHO_T}$gcc_cv_prog_makeinfo_modern" >&6 else gcc_cv_prog_makeinfo_modern=no fi @@ -3271,22 +5027,27 @@ fi fi if test $gcc_cv_prog_makeinfo_modern = no; then - echo "configure: warning: + { echo "$as_me:$LINENO: WARNING: *** Makeinfo is missing or too old. -*** Info documentation will not be built." 1>&2 +*** Info documentation will not be built." >&5 +echo "$as_me: WARNING: +*** Makeinfo is missing or too old. +*** Info documentation will not be built." >&2;} BUILD_INFO= else - BUILD_INFO=info + BUILD_INFO=info fi # Is pod2man recent enough to regenerate manpages? -echo $ac_n "checking for recent Pod::Man""... $ac_c" 1>&6 -echo "configure:3285: checking for recent Pod::Man" >&5 +echo "$as_me:$LINENO: checking for recent Pod::Man" >&5 +echo $ECHO_N "checking for recent Pod::Man... $ECHO_C" >&6 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then - echo "$ac_t""yes" 1>&6 - GENERATED_MANPAGES=generated-manpages + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + GENERATED_MANPAGES=generated-manpages else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 GENERATED_MANPAGES= fi @@ -3296,32 +5057,38 @@ if test -f $srcdir/../flex/skel.c; then else # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3301: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_FLEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$FLEX"; then ac_cv_prog_FLEX="$FLEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_FLEX="flex" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_FLEX="flex" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_prog_FLEX" && ac_cv_prog_FLEX="${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex" fi fi -FLEX="$ac_cv_prog_FLEX" +FLEX=$ac_cv_prog_FLEX if test -n "$FLEX"; then - echo "$ac_t""$FLEX" 1>&6 + echo "$as_me:$LINENO: result: $FLEX" >&5 +echo "${ECHO_T}$FLEX" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi fi @@ -3333,42 +5100,989 @@ if test -f $srcdir/../bison/bison.simple; then else # Extract the first word of "bison", so it can be a program name with args. set dummy bison; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3338: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_BISON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$BISON"; then ac_cv_prog_BISON="$BISON" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_BISON="bison" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_BISON="bison" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_prog_BISON" && ac_cv_prog_BISON="${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison" fi fi -BISON="$ac_cv_prog_BISON" +BISON=$ac_cv_prog_BISON if test -n "$BISON"; then - echo "$ac_t""$BISON" 1>&6 + echo "$as_me:$LINENO: result: $BISON" >&5 +echo "${ECHO_T}$BISON" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi fi +# -------------------- +# Checks for C headers +# -------------------- + +echo "$as_me:$LINENO: checking for GNU C library" >&5 +echo $ECHO_N "checking for GNU C library... $ECHO_C" >&6 +if test "${gcc_cv_glibc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) +#error Not a GNU C library system +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_glibc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_glibc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $gcc_cv_glibc" >&5 +echo "${ECHO_T}$gcc_cv_glibc" >&6 +if test $gcc_cv_glibc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + +fi + +# Need to reject headers which give warnings, so that the -Werror bootstrap +# works later. *sigh* This needs to come before all header checks. + +ac_c_preproc_warn_flag=yes + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for working stdbool.h" >&5 +echo $ECHO_N "checking for working stdbool.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdbool_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +bool foo = false; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdbool_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdbool_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 +if test $ac_cv_header_stdbool_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STDBOOL_H 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5 +echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6 +if test "${gcc_cv_header_string+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_header_string=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_header_string=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gcc_cv_header_string" >&5 +echo "${ECHO_T}$gcc_cv_header_string" >&6 +if test $gcc_cv_header_string = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STRING_WITH_STRINGS 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_sys_wait_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_sys_wait_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +if test $ac_cv_header_sys_wait_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF + +fi + + + + + + + + + + + + + + + + + + + + + + +for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h \ + fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ + sys/resource.h sys/param.h sys/times.h sys/stat.h \ + direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# Check for thread headers. +echo "$as_me:$LINENO: checking for thread.h" >&5 +echo $ECHO_N "checking for thread.h... $ECHO_C" >&6 +if test "${ac_cv_header_thread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_thread_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_thread_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_thread_h" >&5 +echo "${ECHO_T}$ac_cv_header_thread_h" >&6 +if test $ac_cv_header_thread_h = yes; then + have_thread_h=yes +else + have_thread_h= +fi + +echo "$as_me:$LINENO: checking for pthread.h" >&5 +echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 +if test "${ac_cv_header_pthread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_pthread_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_pthread_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 +echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 +if test $ac_cv_header_pthread_h = yes; then + have_pthread_h=yes +else + have_pthread_h= +fi + + +# These tests can't be done till we know if we have limits.h. +echo "$as_me:$LINENO: checking for CHAR_BIT" >&5 +echo $ECHO_N "checking for CHAR_BIT... $ECHO_C" >&6 +if test "${gcc_cv_decl_char_bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef CHAR_BIT +found +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "found" >/dev/null 2>&1; then + gcc_cv_decl_char_bit=yes +else + gcc_cv_decl_char_bit=no +fi +rm -f conftest* + + +fi +echo "$as_me:$LINENO: result: $gcc_cv_decl_char_bit" >&5 +echo "${ECHO_T}$gcc_cv_decl_char_bit" >&6 +if test $gcc_cv_decl_char_bit = no; then + echo "$as_me:$LINENO: checking number of bits in a byte" >&5 +echo $ECHO_N "checking number of bits in a byte... $ECHO_C" >&6 +if test "${gcc_cv_c_nbby+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=8 + gcc_cv_c_nbby= + while test $i -lt 65; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +switch(0) { + case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i): + case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)): + ; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_c_nbby=$i; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + i=`expr $i + 1` + done + test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed + +fi +echo "$as_me:$LINENO: result: $gcc_cv_c_nbby" >&5 +echo "${ECHO_T}$gcc_cv_c_nbby" >&6 +if test $gcc_cv_c_nbby = failed; then + { { echo "$as_me:$LINENO: error: cannot determine number of bits in a byte" >&5 +echo "$as_me: error: cannot determine number of bits in a byte" >&2;} + { (exit 1); exit 1; }; } +else + +cat >>confdefs.h <<_ACEOF +#define CHAR_BIT $gcc_cv_c_nbby +_ACEOF + +fi +fi +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + echo $ac_n "cross-compiling... " 2>&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +if test $ac_cv_c_bigendian = unknown; then +echo "$as_me:$LINENO: checking to probe for byte ordering" >&5 +echo $ECHO_N "checking to probe for byte ordering... $ECHO_C" >&6 + +cat >conftest.c <&6 + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&6 + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&6 + fi + fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +fi +if test $ac_cv_c_bigendian = yes; then + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HOST_WORDS_BIG_ENDIAN 1 +_ACEOF + + BYTEORDER=4321 +else + BYTEORDER=1234 +fi + +cat >>confdefs.h <<_ACEOF +#define BYTEORDER $BYTEORDER +_ACEOF + +if test $ac_cv_c_bigendian = unknown; then + { { echo "$as_me:$LINENO: error: unknown endianess - sorry" >&5 +echo "$as_me: error: unknown endianess - sorry" >&2;} + { (exit please pre-set ac_cv_c_bigendian); exit please pre-set ac_cv_c_bigendian; }; } +fi + + +# -------- +# UNSORTED +# -------- + +# Stage specific cflags for build. +stage1_cflags= +case $build in +vax-*-*) + if test x$GCC = xyes + then + stage1_cflags="-Wa,-J" + else + stage1_cflags="-J" + fi + ;; +powerpc-*-darwin*) + # The spiffy cpp-precomp chokes on some legitimate constructs in GCC + # sources; use -no-cpp-precomp to get to GNU cpp. + # Apple's GCC has bugs in designated initializer handling, so disable + # that too. + stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" + ;; +esac + + # These libraries may be used by collect2. # We may need a special search path to get them linked. -echo $ac_n "checking for collect2 libraries""... $ac_c" 1>&6 -echo "configure:3370: checking for collect2 libraries" >&5 -if eval "test \"`echo '$''{'gcc_cv_collect2_libs'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for collect2 libraries" >&5 +echo $ECHO_N "checking for collect2 libraries... $ECHO_C" >&6 +if test "${gcc_cv_collect2_libs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else save_LIBS="$LIBS" for libs in '' -lld -lmld \ @@ -3376,32 +6090,54 @@ for libs in '' -lld -lmld \ '-L/usr/lib/cmplrs/cc3.11 -lmld' do LIBS="$libs" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -ldopen() -; return 0; } -EOF -if { (eval echo configure:3392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldopen (); +int +main () +{ +ldopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_collect2_libs="$libs"; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done LIBS="$save_LIBS" test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required' fi - -echo "$ac_t""$gcc_cv_collect2_libs" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_collect2_libs" >&5 +echo "${ECHO_T}$gcc_cv_collect2_libs" >&6 case $gcc_cv_collect2_libs in "none required") ;; *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; @@ -3412,68 +6148,112 @@ esac # -lexc. So test for it. save_LIBS="$LIBS" LIBS= - -echo $ac_n "checking for library containing exc_resume""... $ac_c" 1>&6 -echo "configure:3418: checking for library containing exc_resume" >&5 -if eval "test \"`echo '$''{'ac_cv_search_exc_resume'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for library containing exc_resume" >&5 +echo $ECHO_N "checking for library containing exc_resume... $ECHO_C" >&6 +if test "${ac_cv_search_exc_resume+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_exc_resume="no" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -exc_resume() -; return 0; } -EOF -if { (eval echo configure:3436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char exc_resume (); +int +main () +{ +exc_resume (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_search_exc_resume="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_exc_resume" = "no" && for i in exc; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { -exc_resume() -; return 0; } -EOF -if { (eval echo configure:3458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_exc_resume="-l$i" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_exc_resume" = no; then + for ac_lib in exc; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char exc_resume (); +int +main () +{ +exc_resume (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_exc_resume="-l$ac_lib" break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_exc_resume" >&5 +echo "${ECHO_T}$ac_cv_search_exc_resume" >&6 +if test "$ac_cv_search_exc_resume" != no; then + test "$ac_cv_search_exc_resume" = "none required" || LIBS="$ac_cv_search_exc_resume $LIBS" + fi -echo "$ac_t""$ac_cv_search_exc_resume" 1>&6 -if test "$ac_cv_search_exc_resume" != "no"; then - test "$ac_cv_search_exc_resume" = "none required" || LIBS="$ac_cv_search_exc_resume $LIBS" - -else : - -fi GNAT_LIBEXC="$LIBS" LIBS="$save_LIBS" @@ -3482,296 +6262,465 @@ LIBS="$save_LIBS" # they're both in the same place. jcf-dump needs them. save_LIBS="$LIBS" LIBS= - -echo $ac_n "checking for library containing ldexp""... $ac_c" 1>&6 -echo "configure:3488: checking for library containing ldexp" >&5 -if eval "test \"`echo '$''{'ac_cv_search_ldexp'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for library containing ldexp" >&5 +echo $ECHO_N "checking for library containing ldexp... $ECHO_C" >&6 +if test "${ac_cv_search_ldexp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_ldexp="no" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -ldexp() -; return 0; } -EOF -if { (eval echo configure:3506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldexp (); +int +main () +{ +ldexp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_search_ldexp="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_ldexp" = "no" && for i in m; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { -ldexp() -; return 0; } -EOF -if { (eval echo configure:3528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_ldexp="-l$i" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_ldexp" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldexp (); +int +main () +{ +ldexp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_ldexp="-l$ac_lib" break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_ldexp" >&5 +echo "${ECHO_T}$ac_cv_search_ldexp" >&6 +if test "$ac_cv_search_ldexp" != no; then + test "$ac_cv_search_ldexp" = "none required" || LIBS="$ac_cv_search_ldexp $LIBS" + fi -echo "$ac_t""$ac_cv_search_ldexp" 1>&6 -if test "$ac_cv_search_ldexp" != "no"; then - test "$ac_cv_search_ldexp" = "none required" || LIBS="$ac_cv_search_ldexp $LIBS" - -else : - -fi LDEXP_LIB="$LIBS" LIBS="$save_LIBS" -# See if the stage1 system preprocessor understands the ANSI C -# preprocessor stringification operator. (Used by symcat.h.) - - -echo $ac_n "checking for preprocessor stringizing operator""... $ac_c" 1>&6 -echo "configure:3557: checking for preprocessor stringizing operator" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stringize'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 | - egrep "#teststring" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_stringize=no -else - rm -rf conftest* - ac_cv_c_stringize=yes -fi -rm -f conftest* - -fi - -if test "${ac_cv_c_stringize}" = yes -then - cat >> confdefs.h <<\EOF -#define HAVE_STRINGIZE 1 -EOF - -fi -echo "$ac_t""${ac_cv_c_stringize}" 1>&6 - - # Use only if it exists, # doesn't clash with , and declares intmax_t. -echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6 -echo "configure:3595: checking for inttypes.h" >&5 -if eval "test \"`echo '$''{'gcc_cv_header_inttypes_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${gcc_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -int main() { +int +main () +{ intmax_t i = -1; -; return 0; } -EOF -if { (eval echo configure:3608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_header_inttypes_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_header_inttypes_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_header_inttypes_h=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$gcc_cv_header_inttypes_h" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gcc_cv_header_inttypes_h" >&6 if test $gcc_cv_header_inttypes_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_INTTYPES_H 1 -EOF +_ACEOF fi + + + + + + + + + + + + + + + + + + + + + + + + + for ac_func in times clock dup2 kill getrlimit setrlimit atoll atoq \ sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \ - fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \ - scandir alphasort gettimeofday mmap + fwrite_unlocked fprintf_unlocked getrusage nl_langinfo \ + scandir alphasort gettimeofday mbstowcs wcswidth mmap mincore \ + setlocale do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3635: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done -echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:3689: checking for ssize_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test x$ac_cv_func_mbstowcs = xyes; then + echo "$as_me:$LINENO: checking whether mbstowcs works" >&5 +echo $ECHO_N "checking whether mbstowcs works... $ECHO_C" >&6 +if test "${gcc_cv_func_mbstowcs_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#if STDC_HEADERS + if test "$cross_compiling" = yes; then + gcc_cv_func_mbstowcs_works=yes +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +int main() +{ + mbstowcs(0, "", 0); + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_func_mbstowcs_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gcc_cv_func_mbstowcs_works=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_func_mbstowcs_works" >&5 +echo "${ECHO_T}$gcc_cv_func_mbstowcs_works" >&6 + if test x$gcc_cv_func_mbstowcs_works = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_MBSTOWCS 1 +_ACEOF + + fi +fi + +echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 +if test "${ac_cv_type_ssize_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((ssize_t *) 0) + return 0; +if (sizeof (ssize_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_ssize_t=yes else - rm -rf conftest* - ac_cv_type_ssize_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_ssize_t=no fi -echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 -if test $ac_cv_type_ssize_t = no; then - cat >> confdefs.h <<\EOF +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 +if test $ac_cv_type_ssize_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define ssize_t int -EOF +_ACEOF fi # Try to determine the array type of the second argument of getgroups # for the target system (int or gid_t). -echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3725: checking for uid_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 +if test "${ac_cv_type_uid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else - rm -rf conftest* ac_cv_type_uid_t=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then - cat >> confdefs.h <<\EOF -#define uid_t int -EOF - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF +#define uid_t int +_ACEOF + + +cat >>confdefs.h <<\_ACEOF #define gid_t int -EOF +_ACEOF fi -echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:3759: checking type of array argument to getgroups" >&5 -if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking type of array argument to getgroups" >&5 +echo $ECHO_N "checking type of array argument to getgroups... $ECHO_C" >&6 +if test "${ac_cv_type_getgroups+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_type_getgroups=cross else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ #include #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) -main() + +int +main () { gid_t gidset[NGID]; int i, n; @@ -3786,43 +6735,56 @@ main() happens when gid_t is short but getgroups modifies an array of ints. */ exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); } - -EOF -if { (eval echo configure:3792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_type_getgroups=gid_t -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_type_getgroups=int -fi -rm -fr conftest* -fi - -if test $ac_cv_type_getgroups = cross; then - cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then - rm -rf conftest* +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_getgroups=gid_t +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_type_getgroups=int +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +if test $ac_cv_type_getgroups = cross; then + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then ac_cv_type_getgroups=gid_t else - rm -rf conftest* ac_cv_type_getgroups=int fi rm -f conftest* fi fi +echo "$as_me:$LINENO: result: $ac_cv_type_getgroups" >&5 +echo "${ECHO_T}$ac_cv_type_getgroups" >&6 -echo "$ac_t""$ac_cv_type_getgroups" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define GETGROUPS_T $ac_cv_type_getgroups -EOF +_ACEOF if test "${target}" = "${build}"; then @@ -3842,17 +6804,21 @@ else fi -echo $ac_n "checking whether the printf functions support %p""... $ac_c" 1>&6 -echo "configure:3847: checking whether the printf functions support %p" >&5 -if eval "test \"`echo '$''{'gcc_cv_func_printf_ptr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether the printf functions support %p" >&5 +echo $ECHO_N "checking whether the printf functions support %p... $ECHO_C" >&6 +if test "${gcc_cv_func_printf_ptr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then gcc_cv_func_printf_ptr=no else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main() @@ -3863,27 +6829,38 @@ int main() sscanf(buf, "%p", &q); return (p != q); } -EOF -if { (eval echo configure:3868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_func_printf_ptr=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - gcc_cv_func_printf_ptr=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gcc_cv_func_printf_ptr=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi rm -f core core.* *.core fi - -echo "$ac_t""$gcc_cv_func_printf_ptr" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_func_printf_ptr" >&5 +echo "${ECHO_T}$gcc_cv_func_printf_ptr" >&6 if test $gcc_cv_func_printf_ptr = yes ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRINTF_PTR 1 -EOF +_ACEOF fi @@ -3893,29 +6870,29 @@ if test $ac_cv_header_sys_mman_h != yes \ gcc_cv_func_mmap_dev_zero=no gcc_cv_func_mmap_anon=no else - echo $ac_n "checking whether read-only mmap of a plain file works""... $ac_c" 1>&6 -echo "configure:3898: checking whether read-only mmap of a plain file works" >&5 -if eval "test \"`echo '$''{'gcc_cv_func_mmap_file'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether read-only mmap of a plain file works" >&5 +echo $ECHO_N "checking whether read-only mmap of a plain file works... $ECHO_C" >&6 +if test "${gcc_cv_func_mmap_file+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Add a system to this blacklist if + # Add a system to this blacklist if # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a # memory area containing the same data that you'd get if you applied # read() to the same fd. The only system known to have a problem here # is VMS, where text files have record structure. case "$host_os" in - vms*) + vms* | ultrix*) gcc_cv_func_mmap_file=no ;; *) gcc_cv_func_mmap_file=yes;; esac fi - -echo "$ac_t""$gcc_cv_func_mmap_file" 1>&6 - echo $ac_n "checking whether mmap from /dev/zero works""... $ac_c" 1>&6 -echo "configure:3917: checking whether mmap from /dev/zero works" >&5 -if eval "test \"`echo '$''{'gcc_cv_func_mmap_dev_zero'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_func_mmap_file" >&5 +echo "${ECHO_T}$gcc_cv_func_mmap_file" >&6 + echo "$as_me:$LINENO: checking whether mmap from /dev/zero works" >&5 +echo $ECHO_N "checking whether mmap from /dev/zero works... $ECHO_C" >&6 +if test "${gcc_cv_func_mmap_dev_zero+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Add a system to this blacklist if it has mmap() but /dev/zero # does not exist, or if mmapping /dev/zero does not give anonymous @@ -3934,18 +6911,22 @@ else gcc_cv_func_mmap_dev_zero=yes;; esac fi - -echo "$ac_t""$gcc_cv_func_mmap_dev_zero" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_func_mmap_dev_zero" >&5 +echo "${ECHO_T}$gcc_cv_func_mmap_dev_zero" >&6 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. - echo $ac_n "checking for MAP_ANON(YMOUS)""... $ac_c" 1>&6 -echo "configure:3943: checking for MAP_ANON(YMOUS)" >&5 -if eval "test \"`echo '$''{'gcc_cv_decl_map_anon'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for MAP_ANON(YMOUS)" >&5 +echo $ECHO_N "checking for MAP_ANON(YMOUS)... $ECHO_C" >&6 +if test "${gcc_cv_decl_map_anon+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -3954,31 +6935,45 @@ else #define MAP_ANONYMOUS MAP_ANON #endif -int main() { +int +main () +{ int n = MAP_ANONYMOUS; -; return 0; } -EOF -if { (eval echo configure:3962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_decl_map_anon=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_decl_map_anon=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gcc_cv_decl_map_anon" 1>&6 +gcc_cv_decl_map_anon=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gcc_cv_decl_map_anon" >&5 +echo "${ECHO_T}$gcc_cv_decl_map_anon" >&6 if test $gcc_cv_decl_map_anon = no; then gcc_cv_func_mmap_anon=no else - echo $ac_n "checking whether mmap with MAP_ANON(YMOUS) works""... $ac_c" 1>&6 -echo "configure:3980: checking whether mmap with MAP_ANON(YMOUS) works" >&5 -if eval "test \"`echo '$''{'gcc_cv_func_mmap_anon'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether mmap with MAP_ANON(YMOUS) works" >&5 +echo $ECHO_N "checking whether mmap with MAP_ANON(YMOUS) works... $ECHO_C" >&6 +if test "${gcc_cv_func_mmap_anon+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Add a system to this blacklist if it has mmap() and MAP_ANON or # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) @@ -3992,192 +6987,343 @@ else gcc_cv_func_mmap_anon=yes;; esac fi - -echo "$ac_t""$gcc_cv_func_mmap_anon" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_func_mmap_anon" >&5 +echo "${ECHO_T}$gcc_cv_func_mmap_anon" >&6 fi fi if test $gcc_cv_func_mmap_file = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP_FILE 1 -EOF +_ACEOF fi if test $gcc_cv_func_mmap_dev_zero = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP_DEV_ZERO 1 -EOF +_ACEOF fi if test $gcc_cv_func_mmap_anon = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP_ANON 1 -EOF +_ACEOF fi case "${host}" in -*-*-uwin*) - { echo "configure: error: -*** UWIN may not be used as a host platform because -*** linking with posix.dll is not allowed by the GNU GPL" 1>&2; exit 1; } - ;; *-*-*vms*) - # Under VMS, vfork works very different than on Unix. The standard test + # Under VMS, vfork works very differently than on Unix. The standard test # won't work, and it isn't easily adaptable. It makes more sense to # just force it. ac_cv_func_vfork_works=yes ;; esac -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:4035: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_pid_t=no fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define pid_t int -EOF +_ACEOF fi -ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:4069: checking for vfork.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VFORK_H 1 -EOF -else - echo "$ac_t""no" 1>&6 -fi -echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:4104: checking for working vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +for ac_header in unistd.h vfork.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:4110: checking for vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi else - cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +for ac_func in fork vfork +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vfork(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vfork(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_vfork) || defined (__stub___vfork) +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -vfork(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vfork=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vfork=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + echo "$as_me:$LINENO: checking for working fork" >&5 +echo $ECHO_N "checking for working fork... $ECHO_C" >&6 +if test "${ac_cv_func_fork_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 -fi + if test "$cross_compiling" = yes; then + ac_cv_func_fork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* By Ruediger Kuhlmann. */ + #include + #if HAVE_UNISTD_H + # include + #endif + /* Some systems only have a dummy stub for fork() */ + int main () + { + if (fork() < 0) + exit (1); + exit (0); + } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fork_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_fork_works=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +echo "${ECHO_T}$ac_cv_func_fork_works" >&6 + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + echo "$as_me:$LINENO: checking for working vfork" >&5 +echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 +if test "${ac_cv_func_vfork_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ #include +#include #include #include -#ifdef HAVE_UNISTD_H -#include +#include +#if HAVE_UNISTD_H +# include #endif -#ifdef HAVE_VFORK_H -#include +#if HAVE_VFORK_H +# include #endif /* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. - The compiler is told about this with #include , - but some compilers (e.g. gcc -O) don't grok . - Test for this by using a static variable whose address - is put into a register that is clobbered by the vfork. */ -static + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void #ifdef __cplusplus sparc_address_test (int arg) -#else +# else sparc_address_test (arg) int arg; #endif { @@ -4195,25 +7341,27 @@ sparc_address_test (arg) int arg; } } } -main() { + +int +main () +{ pid_t parent = getpid (); pid_t child; - sparc_address_test (); + sparc_address_test (0); child = vfork (); if (child == 0) { - /* Here is another test for sparc vfork register problems. - This test uses lots of local variables, at least - as many local variables as main has allocated so far - including compiler temporaries. 4 locals are enough for - gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. - A buggy compiler should reuse the register of parent - for one of the local variables, since it will think that - parent can't possibly be used any more in this routine. - Assigning to the local variable will thus munge parent - in the parent process. */ + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); @@ -4223,11 +7371,10 @@ main() { || p != p5 || p != p6 || p != p7) _exit(1); - /* On some systems (e.g. IRIX 3.3), - vfork doesn't separate parent from child file descriptors. - If the child closes a descriptor before it execs or exits, - this munges the parent's descriptor as well. - Test for this by closing stdout in the child. */ + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; @@ -4250,115 +7397,245 @@ main() { ); } } -EOF -if { (eval echo configure:4255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_vfork_works=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_vfork_works=no fi -rm -fr conftest* +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=ac_cv_func_vfork + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi -fi +if test "x$ac_cv_func_vfork_works" = xyes; then -echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 -if test $ac_cv_func_vfork_works = no; then - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_VFORK 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF #define vfork fork -EOF +_ACEOF + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_FORK 1 +_ACEOF fi - + am_cv_lib_iconv_ldpath= - # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then withval="$with_libiconv_prefix" - + for dir in `echo "$withval" | tr : ' '`; do if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi done - -fi + +fi; - echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:4294: checking for iconv" >&5 -if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +for ac_header in iconv.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -int main() { +int +main () +{ iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:4312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_func_iconv=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -int main() { +int +main () +{ iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:4334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_lib_iconv=yes am_cv_func_iconv=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi - + fi - -echo "$ac_t""$am_cv_func_iconv" 1>&6 +echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 if test "$am_cv_func_iconv" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ICONV 1 -EOF - echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:4355: checking for iconv declaration" >&5 - if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 + if test "${am_cv_proto_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -4372,36 +7649,110 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si size_t iconv(); #endif -int main() { +int +main () +{ -; return 0; } -EOF -if { (eval echo configure:4380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_proto_iconv_arg1="" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_proto_iconv_arg1="const" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_proto_iconv_arg1="const" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$ac_t""${ac_t:- - }$am_cv_proto_iconv" 1>&6 - cat >> confdefs.h <&5 +echo "${ECHO_T}${ac_t:- + }$am_cv_proto_iconv" >&6 + +cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 -EOF +_ACEOF fi LIBICONV= if test "$am_cv_lib_iconv" = yes; then LIBICONV="$am_cv_lib_iconv_ldpath -liconv" fi - + + +# Until we have in-tree GNU iconv: +LIBICONV_DEP= + + + + echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LC_MESSAGES 1 +_ACEOF + + fi # We will need to find libiberty.h and ansidecl.h @@ -4409,142 +7760,192 @@ saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" for ac_func in getenv atol sbrk abort atof getcwd getwd \ strsignal putc_unlocked fputs_unlocked fwrite_unlocked \ - fprintf_unlocked strstr errno vasprintf \ + fprintf_unlocked strstr errno snprintf vasprintf \ malloc realloc calloc free basename getopt clock do ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 -echo "configure:4418: checking whether $ac_func is declared" >&5 -if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 +echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 +if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #undef $ac_tr_decl #define $ac_tr_decl 1 - + #include "ansidecl.h" #include "system.h" -int main() { +int +main () +{ #ifndef $ac_func char *(*pfn) = (char *(*)) $ac_func ; #endif -; return 0; } -EOF -if { (eval echo configure:4437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then eval "gcc_cv_have_decl_$ac_func=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "gcc_cv_have_decl_$ac_func=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "gcc_cv_have_decl_$ac_func=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 1 -EOF - +_ACEOF + else - echo "$ac_t""no" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 0 -EOF - +_ACEOF + fi done if test x = y ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETENV 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_ATOL 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_SBRK 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_ABORT 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_ATOF 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETCWD 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETWD 1 -EOF +_ACEOF \ - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_STRSIGNAL 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_PUTC_UNLOCKED 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_FPUTS_UNLOCKED 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_FWRITE_UNLOCKED 1 -EOF +_ACEOF \ - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_FPRINTF_UNLOCKED 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_STRSTR 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_ERRNO 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_VASPRINTF 1 -EOF +_ACEOF \ - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_MALLOC 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_REALLOC 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_CALLOC 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_FREE 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_BASENAME 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETOPT 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_CLOCK 1 -EOF +_ACEOF fi for ac_func in getrlimit setrlimit getrusage do ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 -echo "configure:4539: checking whether $ac_func is declared" >&5 -if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 +echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 +if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #undef $ac_tr_decl #define $ac_tr_decl 1 - + #include "ansidecl.h" #include "system.h" #ifdef HAVE_SYS_RESOURCE_H @@ -4552,53 +7953,76 @@ else #endif -int main() { +int +main () +{ #ifndef $ac_func char *(*pfn) = (char *(*)) $ac_func ; #endif -; return 0; } -EOF -if { (eval echo configure:4562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then eval "gcc_cv_have_decl_$ac_func=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "gcc_cv_have_decl_$ac_func=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "gcc_cv_have_decl_$ac_func=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 1 -EOF - +_ACEOF + else - echo "$ac_t""no" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 0 -EOF - +_ACEOF + fi done if test x = y ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETRLIMIT 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_SETRLIMIT 1 -EOF - cat >> confdefs.h <<\EOF +_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_GETRUSAGE 1 -EOF +_ACEOF fi -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "ansidecl.h" #include "system.h" @@ -4606,37 +8030,137 @@ cat > conftest.$ac_ext < #endif -int main() { +int +main () +{ rlim_t l = 0; -; return 0; } -EOF -if { (eval echo configure:4614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat >> confdefs.h <<\EOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +cat >>confdefs.h <<\_ACEOF #define rlim_t long -EOF +_ACEOF fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext + +for ac_func in ldgetname +do + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 +echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 +if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#undef $ac_tr_decl +#define $ac_tr_decl 1 + +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_LDFCN_H +#include +#endif + + +int +main () +{ +#ifndef $ac_func +char *(*pfn) = (char *(*)) $ac_func ; +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "gcc_cv_have_decl_$ac_func=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "gcc_cv_have_decl_$ac_func=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + +if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF +#define $ac_tr_decl 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF +#define $ac_tr_decl 0 +_ACEOF + +fi + +done +if test x = y ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DECL_LDGETNAME 1 +_ACEOF +fi + for ac_func in times do ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 -echo "configure:4631: checking whether $ac_func is declared" >&5 -if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 +echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 +if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #undef $ac_tr_decl #define $ac_tr_decl 1 - + #include "ansidecl.h" #include "system.h" #ifdef HAVE_SYS_TIMES_H @@ -4644,54 +8168,75 @@ else #endif -int main() { +int +main () +{ #ifndef $ac_func char *(*pfn) = (char *(*)) $ac_func ; #endif -; return 0; } -EOF -if { (eval echo configure:4654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then eval "gcc_cv_have_decl_$ac_func=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "gcc_cv_have_decl_$ac_func=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "gcc_cv_have_decl_$ac_func=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 1 -EOF - +_ACEOF + else - echo "$ac_t""no" 1>&6 ; cat >> confdefs.h <&5 +echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF #define $ac_tr_decl 0 -EOF - +_ACEOF + fi done if test x = y ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DECL_TIMES 1 -EOF +_ACEOF fi # More time-related stuff. -echo $ac_n "checking for struct tms""... $ac_c" 1>&6 -echo "configure:4688: checking for struct tms" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tms'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for struct tms" >&5 +echo $ECHO_N "checking for struct tms... $ECHO_C" >&6 +if test "${ac_cv_struct_tms+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "ansidecl.h" #include "system.h" @@ -4699,121 +8244,238 @@ cat > conftest.$ac_ext < #endif -int main() { +int +main () +{ struct tms tms; -; return 0; } -EOF -if { (eval echo configure:4707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_tms=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_tms=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_struct_tms" 1>&6 +ac_cv_struct_tms=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_tms" >&5 +echo "${ECHO_T}$ac_cv_struct_tms" >&6 if test $ac_cv_struct_tms = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_TMS 1 -EOF +_ACEOF fi # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. # revisit after autoconf 2.50. -echo $ac_n "checking for clock_t""... $ac_c" 1>&6 -echo "configure:4730: checking for clock_t" >&5 -if eval "test \"`echo '$''{'gcc_cv_type_clock_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for clock_t" >&5 +echo $ECHO_N "checking for clock_t... $ECHO_C" >&6 +if test "${gcc_cv_type_clock_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "ansidecl.h" #include "system.h" -int main() { +int +main () +{ clock_t x; -; return 0; } -EOF -if { (eval echo configure:4746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_type_clock_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_type_clock_t=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gcc_cv_type_clock_t" 1>&6 +gcc_cv_type_clock_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gcc_cv_type_clock_t" >&5 +echo "${ECHO_T}$gcc_cv_type_clock_t" >&6 if test $gcc_cv_type_clock_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_CLOCK_T 1 -EOF +_ACEOF fi -# Check whether --enable-initfini-array or --disable-initfini-array was given. -if test "${enable_initfini_array+set}" = set; then - enableval="$enable_initfini_array" - gcc_cv_initfinit_array=$enableval +echo "$as_me:$LINENO: checking for uchar" >&5 +echo $ECHO_N "checking for uchar... $ECHO_C" >&6 +if test "${gcc_cv_type_uchar+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo $ac_n "checking for .preinit_array/.init_array/.fini_array support""... $ac_c" 1>&6 -echo "configure:4772: checking for .preinit_array/.init_array/.fini_array support" >&5 -if eval "test \"`echo '$''{'gcc_cv_initfinit_array'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "ansidecl.h" +#include "system.h" + +int +main () +{ +if ((uchar *)0) return 0; + if (sizeof(uchar)) return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_uchar=yes else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } - then - if ./conftest; then - gcc_cv_initfinit_array=yes - else - gcc_cv_initfinit_array=no - fi - else - gcc_cv_initfinit_array=no - fi - rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uchar=no fi - -echo "$ac_t""$gcc_cv_initfinit_array" 1>&6 - - if test $gcc_cv_initfinit_array = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_INITFINI_ARRAY 1 -EOF - - fi +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $gcc_cv_type_uchar" >&5 +echo "${ECHO_T}$gcc_cv_type_uchar" >&6 +if test $ac_cv_type_uchar = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_UCHAR 1 +_ACEOF + +fi # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" -# mkdir takes a single argument on some systems. -echo $ac_n "checking if mkdir takes one argument""... $ac_c" 1>&6 -echo "configure:4811: checking if mkdir takes one argument" >&5 -if eval "test \"`echo '$''{'gcc_cv_mkdir_takes_one_arg'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# Check whether --enable-initfini-array or --disable-initfini-array was given. +if test "${enable_initfini_array+set}" = set; then + enableval="$enable_initfini_array" + else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $ECHO_C" >&6 +if test "${gcc_cv_initfini_array+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gcc_cv_initfini_array=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +static int x = -1; +int main (void) { return x; } +int foo (void) { x = 0; } +int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_initfini_array=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gcc_cv_initfini_array=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_initfini_array" >&5 +echo "${ECHO_T}$gcc_cv_initfini_array" >&6 + enable_initfini_array=$gcc_cv_initfini_array + +fi; +if test $enable_initfini_array = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INITFINI_ARRAY 1 +_ACEOF + +fi + +# mkdir takes a single argument on some systems. +echo "$as_me:$LINENO: checking if mkdir takes one argument" >&5 +echo $ECHO_N "checking if mkdir takes one argument... $ECHO_C" >&6 +if test "${gcc_cv_mkdir_takes_one_arg+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_SYS_STAT_H @@ -4825,27 +8487,42 @@ else #ifdef HAVE_DIRECT_H # include #endif -int main() { +int +main () +{ mkdir ("foo", 0); -; return 0; } -EOF -if { (eval echo configure:4833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gcc_cv_mkdir_takes_one_arg=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_mkdir_takes_one_arg=yes -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gcc_cv_mkdir_takes_one_arg" 1>&6 +gcc_cv_mkdir_takes_one_arg=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gcc_cv_mkdir_takes_one_arg" >&5 +echo "${ECHO_T}$gcc_cv_mkdir_takes_one_arg" >&6 if test $gcc_cv_mkdir_takes_one_arg = yes ; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define MKDIR_TAKES_ONE_ARG 1 -EOF +_ACEOF fi @@ -4861,50 +8538,71 @@ objext='.o' if test "${enable_sjlj_exceptions+set}" = set; then enableval="$enable_sjlj_exceptions" sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` -cat >> confdefs.h <>confdefs.h <<_ACEOF #define CONFIG_SJLJ_EXCEPTIONS $sjlj -EOF +_ACEOF -fi +fi; - -echo $ac_n "checking for main in -lunwind""... $ac_c" 1>&6 -echo "configure:4873: checking for main in -lunwind" >&5 -ac_lib_var=`echo unwind'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test x$host = x$target; then + echo "$as_me:$LINENO: checking for main in -lunwind" >&5 +echo $ECHO_N "checking for main in -lunwind... $ECHO_C" >&6 +if test "${ac_cv_lib_unwind_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lunwind $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:4888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_unwind_main=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_unwind_main=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_unwind_main" >&5 +echo "${ECHO_T}$ac_cv_lib_unwind_main" >&6 +if test $ac_cv_lib_unwind_main = yes; then use_libunwind_default=yes else - echo "$ac_t""no" 1>&6 -use_libunwind_default=no + use_libunwind_default=no fi +else + use_libunwind_default=no +fi # Use libunwind based exception handling. # Check whether --enable-libunwind-exceptions or --disable-libunwind-exceptions was given. if test "${enable_libunwind_exceptions+set}" = set; then @@ -4912,35 +8610,32 @@ if test "${enable_libunwind_exceptions+set}" = set; then use_libunwind_exceptions=$enableval else use_libunwind_exceptions=$use_libunwind_default -fi - +fi; if test x"$use_libunwind_exceptions" = xyes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_LIBUNWIND_EXCEPTIONS 1 -EOF +_ACEOF fi +# -------------------------------------------------------- +# Build, host, and target specific configuration fragments +# -------------------------------------------------------- + +# Collect build-machine-specific information. +. ${srcdir}/config.build + +# Collect host-machine-specific information. +. ${srcdir}/config.host + target_gtfiles= -build_xm_file= -build_xm_defines= -build_install_headers_dir=install-headers-tar -build_exeext= -host_xm_file= -host_xm_defines= -host_xmake_file= -host_truncate_target= -host_exeext= -# Decode the host machine, then the target machine. -# For the host machine, we save the xm_file variable as host_xm_file; -# then we decode the target machine and forget everything else -# that came from the host machine. -for machine in $build $host $target; do - . ${srcdir}/config.gcc -done +# Collect target-machine-specific information. +. ${srcdir}/config.gcc extra_objs="${host_extra_objs} ${extra_objs}" +extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}" # Default the target-machine variables that were not explicitly set. if test x"$tm_file" = x @@ -4974,7 +8669,8 @@ bx= for x in $build_xm_file; do if test -f $srcdir/config/$x then bx="$bx $x" - else echo "configure: warning: $srcdir/config/$x does not exist." 1>&2 + else { echo "$as_me:$LINENO: WARNING: $srcdir/config/$x does not exist." >&5 +echo "$as_me: WARNING: $srcdir/config/$x does not exist." >&2;} fi done build_xm_file="$bx" @@ -4983,7 +8679,8 @@ hx= for x in $host_xm_file; do if test -f $srcdir/config/$x then hx="$hx $x" - else echo "configure: warning: $srcdir/config/$x does not exist." 1>&2 + else { echo "$as_me:$LINENO: WARNING: $srcdir/config/$x does not exist." >&5 +echo "$as_me: WARNING: $srcdir/config/$x does not exist." >&2;} fi done host_xm_file="$hx" @@ -4992,7 +8689,8 @@ tx= for x in $xm_file; do if test -f $srcdir/config/$x then tx="$tx $x" - else echo "configure: warning: $srcdir/config/$x does not exist." 1>&2 + else { echo "$as_me:$LINENO: WARNING: $srcdir/config/$x does not exist." >&5 +echo "$as_me: WARNING: $srcdir/config/$x does not exist." >&2;} fi done xm_file="$tx" @@ -5010,6 +8708,14 @@ else done fi +if test x$need_64bit_hwint = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_64BIT_HOST_WIDE_INT 1 +_ACEOF + +fi + count=a for f in $host_xm_file; do count=${count}x @@ -5024,6 +8730,7 @@ else echo " $srcdir/config/$f" done fi +echo "Using ${out_host_hook_obj} for host machine hooks." if test "$host_xm_file" != "$build_xm_file"; then count=a @@ -5042,32 +8749,133 @@ if test "$host_xm_file" != "$build_xm_file"; then fi fi -if test x$thread_file = x; then - if test x$target_thread_file != x; then - thread_file=$target_thread_file - else - thread_file='single' - fi +# Check if a valid thread package +case ${enable_threads_flag} in + "" | no) + # No threads + target_thread_file='single' + ;; + yes) + # default + target_thread_file='single' + ;; + aix | dce | gnat | irix | posix | rtems | \ + single | solaris | vxworks | win32 ) + target_thread_file=${enable_threads_flag} + ;; + *) + echo "${enable_threads_flag} is an unknown thread package" 1>&2 + exit 1 + ;; +esac + +if test x${thread_file} = x; then + # No thread file set by target-specific clauses in config.gcc, + # so use file chosen by default logic above + thread_file=${target_thread_file} +fi + +if test x$enable___cxa_atexit = xyes || \ + test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then + echo "$as_me:$LINENO: checking for __cxa_atexit" >&5 +echo $ECHO_N "checking for __cxa_atexit... $ECHO_C" >&6 +if test "${ac_cv_func___cxa_atexit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char __cxa_atexit (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __cxa_atexit (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub___cxa_atexit) || defined (__stub_____cxa_atexit) +choke me +#else +char (*f) () = __cxa_atexit; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != __cxa_atexit; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func___cxa_atexit=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func___cxa_atexit=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func___cxa_atexit" >&5 +echo "${ECHO_T}$ac_cv_func___cxa_atexit" >&6 +if test $ac_cv_func___cxa_atexit = yes; then + +cat >>confdefs.h <<\_ACEOF +#define DEFAULT_USE_CXA_ATEXIT 1 +_ACEOF + +else + echo "__cxa_atexit can't be enabled on this target" +fi + fi # Look for a file containing extra machine modes. if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then extra_modes_file='$(srcdir)'/config/${extra_modes} - - cat >> confdefs.h <> confdefs.h <<\EOF -#define EXTRA_CC_MODES 1 -EOF + +cat >>confdefs.h <<_ACEOF +#define EXTRA_MODES_FILE "config/$extra_modes" +_ACEOF fi # auto-host.h is the file containing items generated by autoconf and is # the first file included by config.h. -# If host=build, it is correct to have hconfig include auto-host.h -# as well. If host!=build, we are in error and need to do more +# If host=build, it is correct to have bconfig include auto-host.h +# as well. If host!=build, we are in error and need to do more # work to find out the build config parameters. if test x$host = x$build then @@ -5077,7 +8885,7 @@ else # We create a subdir, then run autoconf in the subdir. # To prevent recursion we set host and build for the new # invocation of configure to the build for this invocation - # of configure. + # of configure. tempdir=build.$$ rm -rf $tempdir mkdir $tempdir @@ -5098,19 +8906,21 @@ else cd .. rm -rf $tempdir build_auto=auto-build.h - FORBUILD=../$build_alias + FORBUILD=../${build_subdir} fi tm_file="${tm_file} defaults.h" -host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}" -build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}" -xm_file="ansidecl.h ${xm_file} ${tm_file}" +tm_p_file="${tm_p_file} tm-preds.h" +host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" +build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" +# We don't want ansidecl.h in target files, write code there in ISO/GNU C. +# put this back in temporarily. +xm_file="ansidecl.h ${xm_file}" -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi +# -------- +# UNSORTED +# -------- # Get the version trigger filename from the toplevel if test "${with_gcc_version_trigger+set}" = set; then @@ -5129,10 +8939,23 @@ if test -f configargs.h ; then else gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" fi + +# Double all backslashes and backslash all quotes to turn +# gcc_config_arguments into a C string. +sed -e 's/\\/\\\\/g; s/"/\\"/g' <conftest.out +$gcc_config_arguments +EOF +gcc_config_arguments_str=`cat conftest.out` +rm -f conftest.out + cat > configargs.h <&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 +if test x"$USE_NLS" != xyes; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 else - enable_nls=yes -fi + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 - -# if cross compiling, disable NLS support. -# It's not worth the trouble, at least for now. - -if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then - echo "configure: warning: Disabling NLS support for canadian cross compiler." 1>&2 - enable_nls=no -fi - - - -echo $ac_n "checking for library containing strerror""... $ac_c" 1>&6 -echo "configure:5166: checking for library containing strerror" >&5 -if eval "test \"`echo '$''{'ac_cv_search_strerror'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_strerror="no" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_strerror="none required" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_strerror" = "no" && for i in cposix; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_strerror="-l$i" -break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" -fi - -echo "$ac_t""$ac_cv_search_strerror" 1>&6 -if test "$ac_cv_search_strerror" != "no"; then - test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" - -else : - -fi - - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5229: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:5283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:5304: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_off_t=yes -else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - -fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:5337: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_size_t=yes -else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned -EOF - -fi - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:5372: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:5384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA_H 1 -EOF - -fi - -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5405: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:5438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_func_alloca_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 -if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA 1 -EOF - -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5470: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_os_cray=yes -else - rm -rf conftest* - ac_cv_os_cray=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 -if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5500: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:5528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&6 -fi - -done -fi - -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5555: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 -else - cat > conftest.$ac_ext < addr) ? 1 : -1; -} -main () -{ - exit (find_stack_direction() < 0); -} -EOF -if { (eval echo configure:5582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_stack_direction=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <&6 -echo "configure:5605: checking whether we are using the GNU C Library 2.1 or newer" >&5 -if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "Lucky GNU user" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_gnu_library_2_1=yes -else - rm -rf conftest* - ac_cv_gnu_library_2_1=no -fi -rm -f conftest* - - - -fi - -echo "$ac_t""$ac_cv_gnu_library_2_1" 1>&6 - - GLIBC21="$ac_cv_gnu_library_2_1" - - - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5646: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ -strdup strtoul tsearch __argz_count __argz_stringify __argz_next -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5687: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - - - am_cv_lib_iconv_ldpath= - # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi - done - -fi - - - echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:5756: checking for iconv" >&5 -if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat > conftest.$ac_ext < -#include -int main() { -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:5774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_func_iconv=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" - cat > conftest.$ac_ext < -#include -int main() { -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); -; return 0; } -EOF -if { (eval echo configure:5796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - LIBS="$am_save_LIBS" - fi - -fi - -echo "$ac_t""$am_cv_func_iconv" 1>&6 - if test "$am_cv_func_iconv" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ICONV 1 -EOF - - echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:5817: checking for iconv declaration" >&5 - if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - cat > conftest.$ac_ext < -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - -int main() { - -; return 0; } -EOF -if { (eval echo configure:5842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - am_cv_proto_iconv_arg1="" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_proto_iconv_arg1="const" -fi -rm -f conftest* - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" -fi - - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$ac_t""${ac_t:- - }$am_cv_proto_iconv" 1>&6 - cat >> confdefs.h <&6 -echo "configure:5871: checking for nl_langinfo and CODESET" >&5 -if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -char* cs = nl_langinfo(CODESET); -; return 0; } -EOF -if { (eval echo configure:5883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_langinfo_codeset=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_langinfo_codeset=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$am_cv_langinfo_codeset" 1>&6 - if test $am_cv_langinfo_codeset = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LANGINFO_CODESET 1 -EOF - - fi - - if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:5906: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:5918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_val_LC_MESSAGES=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi - -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 - if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LC_MESSAGES 1 -EOF - - fi - fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:5939: checking whether NLS is requested" >&5 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi - - echo "$ac_t""$USE_NLS" 1>&6 - - - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - INTLLIBS= - INTLDEPS= - - if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF #define ENABLE_NLS 1 -EOF - - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:5962: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - CATOBJEXT=NONE - - - - - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:5982: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_LIBINTL_H 1 -EOF - - echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 -echo "configure:6013: checking for GNU gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -extern int _nl_msg_cat_cntr; -int main() { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:6027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gnugettext1_libc=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6 - - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 -echo "configure:6043: checking for GNU gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gt_save_LIBS="$LIBS" - LIBS="$LIBS -lintl $LIBICONV" - cat > conftest.$ac_ext < -extern int _nl_msg_cat_cntr; -int main() { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:6059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gnugettext1_libintl=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gnugettext1_libintl=no -fi -rm -f conftest* - LIBS="$gt_save_LIBS" -fi - -echo "$ac_t""$gt_cv_func_gnugettext1_libintl" 1>&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - cat >> confdefs.h <<\EOF -#define HAVE_GETTEXT 1 -EOF +_ACEOF - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - INTLLIBS="-lintl $LIBICONV" - fi - - gt_save_LIBS="$LIBS" - LIBS="$LIBS $INTLLIBS" - for ac_func in dcgettext -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6092: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:6120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - LIBS="$gt_save_LIBS" - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6149: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6183: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6220: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - CATOBJEXT=.gmo - fi - -else - echo "$ac_t""no" 1>&6 -fi - - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6270: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6304: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6340: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" - INTLDEPS="\$(top_builddir)/intl/libintl.a" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then - : ; - else - echo "$ac_t""found msgfmt program is not GNU msgfmt; ignore it" 1>&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then - : ; - else - echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 - XGETTEXT=":" - fi - fi - - POSUB=po - fi - - - - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes - fi - - for ac_prog in bison -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6412: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$INTLBISON"; then - ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_INTLBISON="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -INTLBISON="$ac_cv_prog_INTLBISON" -if test -n "$INTLBISON"; then - echo "$ac_t""$INTLBISON" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$INTLBISON" && break -done - - if test -z "$INTLBISON"; then - ac_verc_fail=yes + echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 + # Look for .po and .gmo files in the source directory. + CATALOGS= + XLINGUAS= + for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do + # If there aren't any .gmo files the shell will give us the + # literal string "../path/to/srcdir/po/*.gmo" which has to be + # weeded out. + case "$cat" in *\**) + continue;; + esac + # The quadruple backslash is collapsed to a double backslash + # by the backticks, then collapsed again by the double quotes, + # leaving us with one backslash in the sed expression (right + # before the dot that mustn't act as a wildcard). + cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"` + lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"` + # The user is allowed to set LINGUAS to a list of languages to + # install catalogs for. If it's empty that means "all of them." + if test "x$LINGUAS" = x; then + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" else - echo $ac_n "checking version of bison""... $ac_c" 1>&6 -echo "configure:6445: checking version of bison" >&5 - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + case "$LINGUAS" in *$lang*) + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + ;; esac - echo "$ac_t""$ac_prog_version" 1>&6 - fi - if test $ac_verc_fail = yes; then - INTLBISON=: fi + done + LINGUAS="$XLINGUAS" + echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 +fi - - - - - - - - - - if test $USE_INCLUDED_LIBINTL = yes; then - cat >> confdefs.h <<\EOF -#define USE_INCLUDED_LIBINTL 1 -EOF - - fi - - nls_cv_header_intl= - nls_cv_header_libgt= - - DATADIRNAME=share - - - INSTOBJEXT=.mo - - - GENCAT=gencat - - - - if test "x$CATOBJEXT" != x; then - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:6490: checking for catalogs to be installed" >&5 - # Look for .po and .gmo files in the source directory. - CATALOGS= - XLINGUAS= - for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do - # If there aren't any .gmo files the shell will give us the - # literal string "../path/to/srcdir/po/*.gmo" which has to be - # weeded out. - case "$cat" in *\**) - continue;; - esac - # The quadruple backslash is collapsed to a double backslash - # by the backticks, then collapsed again by the double quotes, - # leaving us with one backslash in the sed expression (right - # before the dot that mustn't act as a wildcard). The dot to - # be escaped in the second expression is hiding inside CATOBJEXT. - cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"` - lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"` - # The user is allowed to set LINGUAS to a list of languages to - # install catalogs for. If it's empty that means "all of them." - if test "x$LINGUAS" = x; then - CATALOGS="$CATALOGS $cat" - XLINGUAS="$XLINGUAS $lang" - else - case "$LINGUAS" in *$lang*) - CATALOGS="$CATALOGS $cat" - XLINGUAS="$XLINGUAS $lang" - ;; - esac - fi - done - LINGUAS="$XLINGUAS" - echo "$ac_t""$LINGUAS" 1>&6 - fi - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - INTL_LIBTOOL_SUFFIX_PREFIX= - - +# If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get +# -liconv on the link line twice. +case "$LIBINTL" in *$LIBICONV*) + LIBICONV= ;; +esac # Windows32 Registry support for specifying GCC installation paths. # Check whether --enable-win32-registry or --disable-win32-registry was given. if test "${enable_win32_registry+set}" = set; then enableval="$enable_win32_registry" - : -fi +fi; case $host_os in win32 | pe | cygwin* | mingw32* | uwin*) -echo $ac_n "checking whether windows registry support is requested""... $ac_c" 1>&6 -echo "configure:6548: checking whether windows registry support is requested" >&5 +echo "$as_me:$LINENO: checking whether windows registry support is requested" >&5 +echo $ECHO_N "checking whether windows registry support is requested... $ECHO_C" >&6 if test "x$enable_win32_registry" != xno; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define ENABLE_WIN32_REGISTRY 1 -EOF +_ACEOF - echo "$ac_t""yes" 1>&6 - -echo $ac_n "checking for library containing RegOpenKeyExA""... $ac_c" 1>&6 -echo "configure:6557: checking for library containing RegOpenKeyExA" >&5 -if eval "test \"`echo '$''{'ac_cv_search_RegOpenKeyExA'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + echo "$as_me:$LINENO: checking for library containing RegOpenKeyExA" >&5 +echo $ECHO_N "checking for library containing RegOpenKeyExA... $ECHO_C" >&6 +if test "${ac_cv_search_RegOpenKeyExA+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_RegOpenKeyExA="no" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -RegOpenKeyExA() -; return 0; } -EOF -if { (eval echo configure:6575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char RegOpenKeyExA (); +int +main () +{ +RegOpenKeyExA (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_search_RegOpenKeyExA="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_RegOpenKeyExA" = "no" && for i in advapi32; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { -RegOpenKeyExA() -; return 0; } -EOF -if { (eval echo configure:6597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_RegOpenKeyExA="-l$i" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_RegOpenKeyExA" = no; then + for ac_lib in advapi32; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char RegOpenKeyExA (); +int +main () +{ +RegOpenKeyExA (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_RegOpenKeyExA="-l$ac_lib" break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_RegOpenKeyExA" >&5 +echo "${ECHO_T}$ac_cv_search_RegOpenKeyExA" >&6 +if test "$ac_cv_search_RegOpenKeyExA" != no; then + test "$ac_cv_search_RegOpenKeyExA" = "none required" || LIBS="$ac_cv_search_RegOpenKeyExA $LIBS" + fi -echo "$ac_t""$ac_cv_search_RegOpenKeyExA" 1>&6 -if test "$ac_cv_search_RegOpenKeyExA" != "no"; then - test "$ac_cv_search_RegOpenKeyExA" = "none required" || LIBS="$ac_cv_search_RegOpenKeyExA $LIBS" - -else : - -fi else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Check if user specified a different registry key. @@ -6634,13 +9178,15 @@ xno) esac if test "x$enable_win32_registry" != xno; then - echo $ac_n "checking registry key on windows hosts""... $ac_c" 1>&6 -echo "configure:6639: checking registry key on windows hosts" >&5 - cat >> confdefs.h <&5 +echo $ECHO_N "checking registry key on windows hosts... $ECHO_C" >&6 - echo "$ac_t""$gcc_cv_win32_registry_key" 1>&6 +cat >>confdefs.h <<_ACEOF +#define WIN32_REGISTRY_KEY "$gcc_cv_win32_registry_key" +_ACEOF + + echo "$as_me:$LINENO: result: $gcc_cv_win32_registry_key" >&5 +echo "${ECHO_T}$gcc_cv_win32_registry_key" >&6 fi ;; esac @@ -6652,30 +9198,27 @@ topdir=`${PWDCMD-pwd}` cd $holddir # Conditionalize the makefile for this host machine. -# Make-host contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -host_overrides=Make-host -dep_host_xmake_file= -for f in .. ${host_xmake_file} +xmake_file= +for f in ${host_xmake_file} do if test -f ${srcdir}/config/$f then - dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f" + xmake_file="${xmake_file} \$(srcdir)/config/$f" fi done # Conditionalize the makefile for this target machine. -# Make-target contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -target_overrides=Make-target -dep_tmake_file= -for f in .. ${tmake_file} +tmake_file_= +for f in ${tmake_file} do if test -f ${srcdir}/config/$f then - dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f" + tmake_file_="${tmake_file_} \$(srcdir)/config/$f" fi done +tmake_file="${tmake_file_}" + +symbolic_link='ln -s' # If the host doesn't support symlinks, modify CC in # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works. @@ -6705,31 +9248,69 @@ rm -f symtest.tem out_object_file=`basename $out_file .c`.o tm_file_list= +tm_include_list= for f in $tm_file; do case $f in - ansidecl.h ) - tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;; defaults.h ) - tm_file_list="${tm_file_list} \$(srcdir)/$f" ;; - *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;; + tm_file_list="${tm_file_list} \$(srcdir)/$f" + tm_include_list="${tm_include_list} $f" + ;; + * ) + tm_file_list="${tm_file_list} \$(srcdir)/config/$f" + tm_include_list="${tm_include_list} config/$f" + ;; esac done tm_p_file_list= +tm_p_include_list= for f in $tm_p_file; do - tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" + case $f in + tm-preds.h ) + tm_p_file_list="${tm_p_file_list} $f" + tm_p_include_list="${tm_p_include_list} $f" + ;; + * ) + tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" + tm_p_include_list="${tm_p_include_list} config/$f" + esac +done + +xm_file_list= +xm_include_list= +for f in $xm_file; do + case $f in + ansidecl.h ) + xm_file_list="${xm_file_list} \$(srcdir)/../include/$f" + xm_include_list="${xm_include_list} $f" + ;; + auto-host.h ) + xm_file_list="${xm_file_list} $f" + xm_include_list="${xm_include_list} $f" + ;; + * ) + xm_file_list="${xm_file_list} \$(srcdir)/config/$f" + xm_include_list="${xm_include_list} config/$f" + ;; + esac done host_xm_file_list= +host_xm_include_list= for f in $host_xm_file; do case $f in ansidecl.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; + host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f" + host_xm_include_list="${host_xm_include_list} $f" + ;; auto-host.h ) - host_xm_file_list="${host_xm_file_list} $f" ;; - defaults.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; - *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;; + host_xm_file_list="${host_xm_file_list} $f" + host_xm_include_list="${host_xm_include_list} $f" + ;; + * ) + host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" + host_xm_include_list="${host_xm_include_list} config/$f" + ;; esac done @@ -6737,124 +9318,139 @@ build_xm_file_list= for f in $build_xm_file; do case $f in ansidecl.h ) - build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; + build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f" + build_xm_include_list="${build_xm_include_list} $f" + ;; auto-build.h | auto-host.h ) - build_xm_file_list="${build_xm_file_list} $f" ;; - defaults.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; - *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;; + build_xm_file_list="${build_xm_file_list} $f" + build_xm_include_list="${build_xm_include_list} $f" + ;; + * ) + build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" + build_xm_include_list="${build_xm_include_list} config/$f" + ;; esac done # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR. -CROSS= -ALL=all.internal -SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' +CROSS= +ALL=all.internal +SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' if test x$host != x$target then CROSS="-DCROSS_COMPILE" ALL=all.cross SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' case "$host","$target" in + # Darwin crosses can use the host system's libraries and headers, + # because of the fat library support. Of course, it must be the + # same version of Darwin on both sides. Allow the user to + # just say --target=foo-darwin without a version number to mean + # "the version on this system". + *-*-darwin*,*-*-darwin*) + hostos=`echo $host | sed 's/.*-darwin/darwin/'` + targetos=`echo $target | sed 's/.*-darwin/darwin/'` + if test $hostos = $targetos -o $targetos = darwin ; then + CROSS= + SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' + with_headers=yes + fi + ;; + i?86-*-*,x86_64-*-* \ | powerpc*-*-*,powerpc64*-*-*) CROSS="$CROSS -DNATIVE_CROSS" ;; esac +elif test "x$TARGET_SYSTEM_ROOT" != x; then + # This is just $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR) + SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' fi # If this is a cross-compiler that does not # have its own set of headers then define # inhibit_libc -# If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS. +# If this is using newlib, without having the headers available now, +# then define inhibit_libc in LIBGCC2_CFLAGS. # This prevents libgcc2 from containing any code which requires libc # support. inhibit_libc= -if test x$host != x$target && test x$with_headers = x; then +if { { test x$host != x$target && test "x$with_sysroot" = x ; } || + test x$with_newlib = xyes ; } && + { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then inhibit_libc=-Dinhibit_libc -else - if test x$with_newlib = xyes; then - inhibit_libc=-Dinhibit_libc - fi fi # When building gcc with a cross-compiler, we need to adjust things so # that the generator programs are still built with the native compiler. # Also, we cannot run fixincludes or fix-header. -# Note that the terminology here is wrong; it should be BUILD_* throughout. -# FIXME. # These are the normal (build=host) settings: -BUILD_PREFIX= -BUILD_PREFIX_1=ignore- -HOST_CC='$(CC)' -HOST_CFLAGS='$(ALL_CFLAGS)' +BUILD_PREFIX= +BUILD_PREFIX_1=ignore- +CC_FOR_BUILD='$(CC)' +BUILD_CFLAGS='$(ALL_CFLAGS)' -STMP_FIXINC=stmp-fixinc -STMP_FIXPROTO=stmp-fixproto +STMP_FIXINC=stmp-fixinc -# And these apply if build != host. -if test x$build != x$host +# Possibly disable fixproto, on a per-target basis. +case ${use_fixproto} in + no) + STMP_FIXPROTO= + ;; + yes) + STMP_FIXPROTO=stmp-fixproto + ;; +esac + + +# And these apply if build != host, or we are generating coverage data +if test x$build != x$host || test "x$coverage_flags" != x then BUILD_PREFIX=build- BUILD_PREFIX_1=build- - HOST_CC='$(CC_FOR_BUILD)' - HOST_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)' + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - STMP_FIXINC= - STMP_FIXPROTO= + if test "x$TARGET_SYSTEM_ROOT" = x; then + STMP_FIXINC= + STMP_FIXPROTO= + fi fi # Expand extra_headers to include complete path. # This substitutes for lots of t-* files. extra_headers_list= -if test "x$extra_headers" = x -then true -else - # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers. - for file in $extra_headers; - do - extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" - done -fi - -if test x$use_collect2 = xno; then - use_collect2= -fi +# Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers. +for file in ${extra_headers} ; do + extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" +done # Add a definition of USE_COLLECT2 if system wants one. -if test x$use_collect2 != x -then - host_xm_defines="${host_xm_defines} USE_COLLECT2" - xm_defines="${xm_defines} USE_COLLECT2" -fi +case $use_collect2 in + no) use_collect2= ;; + "") ;; + *) + host_xm_defines="${host_xm_defines} USE_COLLECT2" + xm_defines="${xm_defines} USE_COLLECT2" + ;; +esac -# If we have gas in the build tree, make a link to it. -if test -f ../gas/Makefile; then - rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null -fi - -# If we have nm and objdump in the build tree, make a link to them. -if test -f ../binutils/Makefile; then - rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null - rm -f objdump; $symbolic_link ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null -fi - -# If we have ld in the build tree, make a link to it. -if test -f ../ld/Makefile; then - rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null -fi - -# Figure out what assembler we will be using. -echo $ac_n "checking what assembler to use""... $ac_c" 1>&6 -echo "configure:6853: checking what assembler to use" >&5 +# Identify the assembler which will work hand-in-glove with the newly +# built GCC, so that we can examine its features. This is the assembler +# which will be driven by the driver program. +# +# If build != host, and we aren't building gas in-tree, we identify a +# build->target assembler and hope that it will have the same features +# as the host->target assembler we'll be using. +echo "$as_me:$LINENO: checking what assembler to use" >&5 +echo $ECHO_N "checking what assembler to use... $ECHO_C" >&6 +in_tree_gas=no gcc_cv_as= gcc_cv_gas_major_version= gcc_cv_gas_minor_version= gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas -gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd if test -x "$DEFAULT_ASSEMBLER"; then gcc_cv_as="$DEFAULT_ASSEMBLER" elif test -x "$AS"; then @@ -6862,18 +9458,39 @@ elif test -x "$AS"; then elif test -x as$host_exeext; then # Build using assembler in the current directory. gcc_cv_as=./as$host_exeext -elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then - # Single tree build which includes gas. - for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in - do - gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` - if test x$gcc_cv_gas_version != x; then - break - fi - done - gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` - gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` - gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"` +elif test -f $gcc_cv_as_gas_srcdir/configure.in \ + && test -f ../gas/Makefile; then + # Single tree build which includes gas. + in_tree_gas=yes + gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd +for f in $gcc_cv_as_bfd_srcdir/configure \ + $gcc_cv_as_gas_srcdir/configure \ + $gcc_cv_as_gas_srcdir/configure.in \ + $gcc_cv_as_gas_srcdir/Makefile.in ; do + gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` + if test x$gcc_cv_gas_version != x; then + break + fi +done +gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` +gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` +gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"` +case $gcc_cv_gas_patch_version in + "") gcc_cv_gas_patch_version="0" ;; +esac +gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \ + + $gcc_cv_gas_minor_version \) \* 1000 \ + + $gcc_cv_gas_patch_version` + + rm -f as$host_exeext + $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null + in_tree_gas_is_elf=no + if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ + || (grep 'obj_format = multi' ../gas/Makefile \ + && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null + then + in_tree_gas_is_elf=yes + fi fi if test "x$gcc_cv_as" = x; then @@ -6907,12 +9524,12 @@ if test "x$gcc_cv_as" = x; then gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext fi - test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ - $test_prefix/lib/gcc-lib/$target_alias \ - /usr/lib/gcc/$target_alias/$gcc_version \ - /usr/lib/gcc/$target_alias \ - $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ - $test_prefix/$target_alias/bin" + test_dirs="$test_prefix/libexec/gcc/$target_noncanonical/$gcc_version \ + $test_prefix/libexec/gcc/$target_noncanonical \ + /usr/lib/gcc/$target_noncanonical/$gcc_version \ + /usr/lib/gcc/$target_noncanonical \ + $test_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version \ + $test_prefix/$target_noncanonical/bin" if test x$host = x$target; then test_dirs="$test_dirs \ @@ -6935,15 +9552,27 @@ if test "x$gcc_cv_as" = x; then fi done fi -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - echo "$ac_t"""newly built gas"" 1>&6 -else - echo "$ac_t""$gcc_cv_as" 1>&6 -fi +case $in_tree_gas in + yes) + echo "$as_me:$LINENO: result: \"newly built gas\"" >&5 +echo "${ECHO_T}\"newly built gas\"" >&6 + ;; + no) + echo "$as_me:$LINENO: result: $gcc_cv_as" >&5 +echo "${ECHO_T}$gcc_cv_as" >&6 + ;; +esac -# Figure out what linker we will be using. -echo $ac_n "checking what linker to use""... $ac_c" 1>&6 -echo "configure:6947: checking what linker to use" >&5 +# Identify the linker which will work hand-in-glove with the newly +# built GCC, so that we can examine its features. This is the linker +# which will be driven by the driver program. +# +# If build != host, and we aren't building gas in-tree, we identify a +# build->target linker and hope that it will have the same features +# as the host->target linker we'll be using. +echo "$as_me:$LINENO: checking what linker to use" >&5 +echo $ECHO_N "checking what linker to use... $ECHO_C" >&6 +in_tree_ld=no gcc_cv_ld= gcc_cv_gld_major_version= gcc_cv_gld_minor_version= @@ -6953,11 +9582,18 @@ if test -x "$DEFAULT_LINKER"; then gcc_cv_ld="$DEFAULT_LINKER" elif test -x "$LD"; then gcc_cv_ld="$LD" -elif test -x ld$host_exeext; then +elif test -x collect-ld$host_exeext; then # Build using linker in the current directory. - gcc_cv_ld=./ld$host_exeext -elif test -f $gcc_cv_ld_gld_srcdir/configure.in -a -f ../ld/Makefile; then + gcc_cv_ld=./collect-ld$host_exeext +elif test -f $gcc_cv_ld_gld_srcdir/configure.in \ + && test -f ../ld/Makefile; then # Single tree build which includes ld. + in_tree_ld=yes + in_tree_ld_is_elf=no + if (grep 'EMUL = .*elf' ../ld/Makefile \ + || grep 'EMUL = .*linux' ../ld/Makefile) > /dev/null; then + in_tree_ld_is_elf=yes + fi for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in do gcc_cv_gld_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` @@ -6967,6 +9603,9 @@ elif test -f $gcc_cv_ld_gld_srcdir/configure.in -a -f ../ld/Makefile; then done gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` + rm -f collect-ld$host_exeext + $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext \ + 2>/dev/null fi if test "x$gcc_cv_ld" = x; then @@ -7000,12 +9639,12 @@ if test "x$gcc_cv_ld" = x; then gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext fi - test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ - $test_prefix/lib/gcc-lib/$target_alias \ - /usr/lib/gcc/$target_alias/$gcc_version \ - /usr/lib/gcc/$target_alias \ - $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ - $test_prefix/$target_alias/bin" + test_dirs="$test_prefix/libexec/gcc/$target_noncanonical/$gcc_version \ + $test_prefix/libexec/gcc/$target_noncanonical \ + /usr/lib/gcc/$target_noncanonical/$gcc_version \ + /usr/lib/gcc/$target_noncanonical \ + $test_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version \ + $test_prefix/$target_noncanonical/bin" if test x$host = x$target; then test_dirs="$test_dirs \ @@ -7028,275 +9667,414 @@ if test "x$gcc_cv_ld" = x; then fi done fi -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - echo "$ac_t"""newly built ld"" 1>&6 -else - echo "$ac_t""$gcc_cv_ld" 1>&6 -fi +case $in_tree_ld in + yes) + echo "$as_me:$LINENO: result: \"newly built ld\"" >&5 +echo "${ECHO_T}\"newly built ld\"" >&6 + ;; + no) + echo "$as_me:$LINENO: result: $gcc_cv_ld" >&5 +echo "${ECHO_T}$gcc_cv_ld" >&6 + ;; +esac # Figure out what nm we will be using. -echo $ac_n "checking what nm to use""... $ac_c" 1>&6 -echo "configure:7040: checking what nm to use" >&5 +gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils +echo "$as_me:$LINENO: checking what nm to use" >&5 +echo $ECHO_N "checking what nm to use... $ECHO_C" >&6 +in_tree_nm=no if test -x nm$host_exeext; then gcc_cv_nm=./nm$host_exeext +elif test -f $gcc_cv_binutils_srcdir/configure.in \ + && test -f ../binutils/Makefile; then + # Single tree build which includes binutils. + in_tree_nm=yes + gcc_cv_nm=./nm$host_exeext + rm -f nm$host_exeext + $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null elif test "x$program_prefix" != xNONE; then gcc_cv_nm=${program_prefix}nm$host_exeext else gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext fi -echo "$ac_t""$gcc_cv_nm" 1>&6 +case $in_tree_nm in + yes) echo "$as_me:$LINENO: result: \"newly built nm\"" >&5 +echo "${ECHO_T}\"newly built nm\"" >&6 ;; + no) echo "$as_me:$LINENO: result: $gcc_cv_nm" >&5 +echo "${ECHO_T}$gcc_cv_nm" >&6 ;; +esac # Figure out what objdump we will be using. -echo $ac_n "checking what objdump to use""... $ac_c" 1>&6 -echo "configure:7052: checking what objdump to use" >&5 +echo "$as_me:$LINENO: checking what objdump to use" >&5 +echo $ECHO_N "checking what objdump to use... $ECHO_C" >&6 +in_tree_objdump=no if test -x objdump$host_exeext; then gcc_cv_objdump=./objdump$host_exeext +elif test -f $gcc_cv_binutils_srcdir/configure.in \ + && test -f ../binutils/Makefile; then + # Single tree build which includes binutils. + in_tree_objdump=yes + gcc_cv_objdump=./objdump$host_exeext + rm -f objdump$host_exeext + $symbolic_link ../binutils/objdump$host_exeext \ + objdump$host_exeext 2>/dev/null elif test "x$program_prefix" != xNONE; then gcc_cv_objdump=${program_prefix}objdump$host_exeext else - gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext + gcc_cv_objdump=`echo objdump | \ + sed ${program_transform_name}`$host_exeext fi -echo "$ac_t""$gcc_cv_objdump" 1>&6 +case $in_tree_objdump in + yes) echo "$as_me:$LINENO: result: \"newly built objdump\"" >&5 +echo "${ECHO_T}\"newly built objdump\"" >&6 ;; + no) echo "$as_me:$LINENO: result: $gcc_cv_objdump" >&5 +echo "${ECHO_T}$gcc_cv_objdump" >&6 ;; +esac # Figure out what assembler alignment features are present. -echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:7064: checking assembler alignment features" >&5 -gcc_cv_as_alignment_features=none -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - # Gas version 2.6 and later support for .balign and .p2align. - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".balign and .p2align" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 -EOF - - fi - # Gas version 2.8 and later support specifying the maximum - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 -EOF - - fi -elif test x$gcc_cv_as != x; then - # Check if we have .balign and .p2align - echo ".balign 4" > conftest.s - echo ".p2align 2" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".balign and .p2align" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 -EOF - - fi - rm -f conftest.s conftest.o - # Check if specifying the maximum bytes to skip when - # using .p2align is supported. - echo ".p2align 4,,7" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 -EOF - - fi - rm -f conftest.s conftest.o +echo "$as_me:$LINENO: checking assembler for .balign and .p2align" >&5 +echo $ECHO_N "checking assembler for .balign and .p2align... $ECHO_C" >&6 +if test "${gcc_cv_as_balign_and_p2align+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_balign_and_p2align=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 6 \) \* 1000 + 0` + then gcc_cv_as_balign_and_p2align=yes fi -echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 - -echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:7112: checking assembler subsection support" >&5 -gcc_cv_as_subsections=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_subsections="working .subsection -1" + elif test x$gcc_cv_as != x; then + echo '.balign 4 +.p2align 2' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_balign_and_p2align=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x; then - # Check if we have .subsection - echo ".subsection 1" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_subsections=".subsection" - if test x$gcc_cv_nm != x; then - cat > conftest.s <&5 +echo "${ECHO_T}$gcc_cv_as_balign_and_p2align" >&6 +if test $gcc_cv_as_balign_and_p2align = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking assembler for .p2align with maximum skip" >&5 +echo $ECHO_N "checking assembler for .p2align with maximum skip... $ECHO_C" >&6 +if test "${gcc_cv_as_max_skip_p2align+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_max_skip_p2align=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 8 \) \* 1000 + 0` + then gcc_cv_as_max_skip_p2align=yes +fi + elif test x$gcc_cv_as != x; then + echo '.p2align 4,,7' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_max_skip_p2align=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_max_skip_p2align" >&5 +echo "${ECHO_T}$gcc_cv_as_max_skip_p2align" >&6 +if test $gcc_cv_as_max_skip_p2align = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking assembler for working .subsection -1" >&5 +echo $ECHO_N "checking assembler for working .subsection -1... $ECHO_C" >&6 +if test "${gcc_cv_as_subsection_m1+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_subsection_m1=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 9 \) \* 1000 + 0` + then gcc_cv_as_subsection_m1=yes +fi + elif test x$gcc_cv_as != x; then + echo 'conftest_label1: .word 0 .subsection -1 conftest_label2: .word 0 -.previous -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 - $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 - if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then - : - else - gcc_cv_as_subsections="working .subsection -1" - fi - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 +.previous' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + if test x$gcc_cv_nm != x; then + $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 + $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 + if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1 + then : + else gcc_cv_as_subsection_m1=yes + fi + rm -f conftest.nm1 conftest.nm2 + fi + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi fi -if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_subsection_m1" >&5 +echo "${ECHO_T}$gcc_cv_as_subsection_m1" >&6 +if test $gcc_cv_as_subsection_m1 = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_GAS_SUBSECTION_ORDERING 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_subsections" 1>&6 -echo $ac_n "checking assembler weak support""... $ac_c" 1>&6 -echo "configure:7152: checking assembler weak support" >&5 -gcc_cv_as_weak=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_weak="yes" +echo "$as_me:$LINENO: checking assembler for .weak" >&5 +echo $ECHO_N "checking assembler for .weak... $ECHO_C" >&6 +if test "${gcc_cv_as_weak+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_weak=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 2 \) \* 1000 + 0` + then gcc_cv_as_weak=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .weak foobar' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_weak=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x; then - # Check if we have .weak - echo " .weak foobar" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_weak="yes" - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 fi -if test x"$gcc_cv_as_weak" = xyes; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_weak" >&5 +echo "${ECHO_T}$gcc_cv_as_weak" >&6 +if test $gcc_cv_as_weak = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_GAS_WEAK 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_weak" 1>&6 -echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6 -echo "configure:7175: checking assembler hidden support" >&5 -gcc_cv_as_hidden=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -eq 12 \ - -a "$gcc_cv_gas_patch_version" -ge 1 \ - -o "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -gt 12 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_hidden="yes" +# .hidden needs to be supported in both the assembler and the linker, +# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. +# This is irritatingly difficult to feature test for; we have to check the +# date string after the version number. If we've got an in-tree +# ld, we don't know its patchlevel version, so we set the baseline at 2.13 +# to be safe. +# The gcc_GAS_CHECK_FEATURE call just sets a cache variable. +echo "$as_me:$LINENO: checking assembler for .hidden" >&5 +echo $ECHO_N "checking assembler for .hidden... $ECHO_C" >&6 +if test "${gcc_cv_as_hidden+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_hidden=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 13 \) \* 1000 + 0` + then gcc_cv_as_hidden=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .hidden foobar +foobar:' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_hidden=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x; then - # Check if we have .hidden - echo " .hidden foobar" > conftest.s - echo "foobar:" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_hidden="yes" - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 - - # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. - # This is irritatingly difficult to feature test for. Look for - # the date string after the version number. - ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1` - if echo "$ld_ver" | grep GNU > /dev/null; then - ld_vers=`echo $ld_ver | sed -n 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\)\([ ].*\|\)$,\1,p'` - ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` - if test 0"$ld_date" -lt 20020404; then - if test -n "$ld_date"; then - # If there was date string, but was earlier than 2002-04-04, fail - gcc_cv_as_hidden="no" - elif test -z "$ld_vers"; then - # If there was no date string nor ld version number, something is wrong - gcc_cv_as_hidden="no" - else - ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` - ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` - ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` - test -z "$ld_vers_patch" && ld_vers_patch=0 - if test "$ld_vers_major" -lt 2; then - gcc_cv_as_hidden="no" - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then - gcc_cv_as_hidden="no" - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \ - -a "$ld_vers_patch" -eq 0; then - gcc_cv_as_hidden="no" - fi - fi - fi - else - # non-GNU linkers don't seem to support .hidden yet - gcc_cv_as_hidden=no - fi fi -if test x"$gcc_cv_as_hidden" = xyes; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_hidden" >&5 +echo "${ECHO_T}$gcc_cv_as_hidden" >&6 + + +echo "$as_me:$LINENO: checking linker for .hidden support" >&5 +echo $ECHO_N "checking linker for .hidden support... $ECHO_C" >&6 +if test "${gcc_cv_ld_hidden+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $in_tree_ld = yes ; then + gcc_cv_ld_hidden=no + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then + gcc_cv_ld_hidden=yes + fi +else + gcc_cv_ld_hidden=yes + ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q` + if echo "$ld_ver" | grep GNU > /dev/null; then + ld_vers=`echo $ld_ver | sed -n \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \ + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'` + ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` + if test 0"$ld_date" -lt 20020404; then + if test -n "$ld_date"; then + # If there was date string, but was earlier than 2002-04-04, fail + gcc_cv_ld_hidden=no + elif test -z "$ld_vers"; then + # If there was no date string nor ld version number, something is wrong + gcc_cv_ld_hidden=no + else + ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` + ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` + ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + test -z "$ld_vers_patch" && ld_vers_patch=0 + if test "$ld_vers_major" -lt 2; then + gcc_cv_ld_hidden=no + elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then + gcc_cv_ld_hidden="no" + elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then + gcc_cv_ld_hidden=no + fi + fi + fi + else + case "${target}" in + hppa64*-*-hpux* | ia64*-*-hpux*) + gcc_cv_ld_hidden=yes + ;; + *) + gcc_cv_ld_hidden=no + ;; + esac + fi +fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_ld_hidden" >&5 +echo "${ECHO_T}$gcc_cv_ld_hidden" >&6 +libgcc_visibility=no + +if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then + libgcc_visibility=yes + +cat >>confdefs.h <<\_ACEOF #define HAVE_GAS_HIDDEN 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_hidden" 1>&6 -libgcc_visibility=$gcc_cv_as_hidden - -echo $ac_n "checking assembler leb128 support""... $ac_c" 1>&6 -echo "configure:7241: checking assembler leb128 support" >&5 -gcc_cv_as_leb128=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_leb128="yes" - fi -elif test x$gcc_cv_as != x; then - # Check if we have .[us]leb128, and support symbol arithmetic with it. - cat > conftest.s <&5 +echo $ECHO_N "checking assembler for .sleb128 and .uleb128... $ECHO_C" >&6 +if test "${gcc_cv_as_leb128+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_leb128=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` + then gcc_cv_as_leb128=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .data .uleb128 L2 - L1 L1: .uleb128 1280 .sleb128 -1010 -L2: -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_leb128="yes" - - # GAS versions before 2.11 do not support uleb128, - # despite appearing to. - # ??? There exists an elf-specific test that will crash - # the assembler. Perhaps it's better to figure out whether - # arbitrary sections are supported and try the test. - as_ver=`$gcc_cv_as --version 2>/dev/null | head -1` - if echo "$as_ver" | grep GNU > /dev/null; then - as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'` - as_major=`echo $as_ver | sed 's/\..*//'` - as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'` - if test $as_major -eq 2 -a $as_minor -lt 11; then - gcc_cv_as_leb128="no" - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -if test x"$gcc_cv_as_leb128" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_AS_LEB128 1 -EOF - -fi -echo "$ac_t""$gcc_cv_as_leb128" 1>&6 - -echo $ac_n "checking assembler eh_frame optimization""... $ac_c" 1>&6 -echo "configure:7286: checking assembler eh_frame optimization" >&5 -gcc_cv_as_eh_frame=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_eh_frame="yes" +L2:' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + # GAS versions before 2.11 do not support uleb128, + # despite appearing to. + # ??? There exists an elf-specific test that will crash + # the assembler. Perhaps it's better to figure out whether + # arbitrary sections are supported and try the test. + as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q` + if echo "$as_ver" | grep GNU > /dev/null; then + as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'` + as_major=`echo $as_ver | sed 's/\..*//'` + as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'` + if test $as_major -eq 2 && test $as_minor -lt 11 + then : + else gcc_cv_as_leb128=yes + fi fi -elif test x$gcc_cv_as != x; then - # Check if this is GAS. - as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1` - rm -f a.out 2> /dev/null - if echo "$as_ver" | grep GNU > /dev/null; then - # Versions up to and including 2.11.0 may mis-optimize - # .eh_frame data. Try something. - cat > conftest.s <&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_leb128" >&5 +echo "${ECHO_T}$gcc_cv_as_leb128" >&6 +if test $gcc_cv_as_leb128 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_LEB128 1 +_ACEOF + +fi + +# GAS versions up to and including 2.11.0 may mis-optimize +# .eh_frame data. +echo "$as_me:$LINENO: checking assembler for eh_frame optimization" >&5 +echo $ECHO_N "checking assembler for eh_frame optimization... $ECHO_C" >&6 +if test "${gcc_cv_as_eh_frame+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_eh_frame=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` + then gcc_cv_as_eh_frame=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .text .LFB1: .4byte 0 .L1: @@ -7327,70 +10105,105 @@ __FRAME_BEGIN__: .4byte .LFE1-.LFB1 .byte 0x4 .4byte .L1-.LFB1 -.LEFDE1: -EOF - cat > conftest.lit < conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + cat > conftest.lit < conftest.big < conftest.big < /dev/null 2>&1 \ - && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ - | tail -3 > conftest.got \ - && { cmp conftest.lit conftest.got > /dev/null 2>&1 \ - || cmp conftest.big conftest.got > /dev/null 2>&1; } - then - gcc_cv_as_eh_frame="yes" - else - gcc_cv_as_eh_frame="bad" - if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then - cat >> confdefs.h <<\EOF -#define USE_AS_TRADITIONAL_FORMAT 1 -EOF - - fi - fi - fi - rm -f conftest.* -fi -echo "$ac_t""$gcc_cv_as_eh_frame" 1>&6 - -echo $ac_n "checking assembler section merging support""... $ac_c" 1>&6 -echo "configure:7367: checking assembler section merging support" >&5 -gcc_cv_as_shf_merge=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_shf_merge=yes + # If the assembler didn't choke, and we can objdump, + # and we got the correct data, then succeed. + if test x$gcc_cv_objdump != x \ + && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ + | tail -3 > conftest.got \ + && { cmp conftest.lit conftest.got > /dev/null 2>&1 \ + || cmp conftest.big conftest.got > /dev/null 2>&1; } + then + gcc_cv_as_eh_frame=yes + elif { ac_try='$gcc_cv_as -o conftest.o --traditional-format /dev/null' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_as_eh_frame=buggy + else + # Uh oh, what do we do now? + gcc_cv_as_eh_frame=no + fi + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x; then - # Check if we support SHF_MERGE sections - echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s - if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_shf_merge=yes - fi - rm -f conftest.s conftest.o fi -if test x"$gcc_cv_as_shf_merge" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_GAS_SHF_MERGE 1 -EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_eh_frame" >&5 +echo "${ECHO_T}$gcc_cv_as_eh_frame" >&6 + + +if test $gcc_cv_as_eh_frame = buggy; then + +cat >>confdefs.h <<\_ACEOF +#define USE_AS_TRADITIONAL_FORMAT 1 +_ACEOF fi -echo "$ac_t""$gcc_cv_as_shf_merge" 1>&6 -echo $ac_n "checking assembler thread-local storage support""... $ac_c" 1>&6 -echo "configure:7390: checking assembler thread-local storage support" >&5 -gcc_cv_as_tls=no +echo "$as_me:$LINENO: checking assembler for section merging support" >&5 +echo $ECHO_N "checking assembler for section merging support... $ECHO_C" >&6 +if test "${gcc_cv_as_shf_merge+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_shf_merge=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` + then gcc_cv_as_shf_merge=yes +fi + elif test x$gcc_cv_as != x; then + echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s + if { ac_try='$gcc_cv_as --fatal-warnings -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_shf_merge=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_shf_merge" >&5 +echo "${ECHO_T}$gcc_cv_as_shf_merge" >&6 + + +cat >>confdefs.h <<_ACEOF +#define HAVE_GAS_SHF_MERGE `if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi` +_ACEOF + + +# Thread-local storage - the check is heavily parametrized. conftest_s= tls_first_major= tls_first_minor= +tls_as_opt= case "$target" in alpha*-*-*) conftest_s=' @@ -7413,6 +10226,7 @@ foo: .long 25 lda $4,foo($29) !tprel' tls_first_major=2 tls_first_minor=13 + tls_as_opt=--fatal-warnings ;; i[34567]86-*-*) conftest_s=' @@ -7432,6 +10246,7 @@ foo: .long 25 leal foo@NTPOFF(%ecx), %eax' tls_first_major=2 tls_first_minor=14 + tls_as_opt=--fatal-warnings ;; x86_64-*-*) conftest_s=' @@ -7446,6 +10261,7 @@ foo: .long 25 movq $foo@TPOFF, %rax' tls_first_major=2 tls_first_minor=14 + tls_as_opt=--fatal-warnings ;; ia64-*-*) conftest_s=' @@ -7463,6 +10279,67 @@ foo: data8 25 movl r24 = @tprel(foo#)' tls_first_major=2 tls_first_minor=13 + tls_as_opt=--fatal-warnings + ;; + powerpc-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + .align 2 +ld0: .space 4 +ld1: .space 4 +x1: .space 4 +x2: .space 4 +x3: .space 4 + .text + addi 3,31,ld0@got@tlsgd + bl __tls_get_addr + addi 3,31,x1@got@tlsld + bl __tls_get_addr + addi 9,3,x1@dtprel + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + lwz 9,x3@got@tprel(31) + add 9,9,x@tls + addi 9,2,x1@tprel + addis 9,2,x2@tprel@ha + addi 9,9,x2@tprel@l' + tls_first_major=2 + tls_first_minor=14 + tls_as_opt="-a32 --fatal-warnings" + ;; + powerpc64-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + .align 3 +ld0: .space 8 +ld1: .space 8 +x1: .space 8 +x2: .space 8 +x3: .space 8 + .text + addi 3,2,ld0@got@tlsgd + bl .__tls_get_addr + nop + addi 3,2,ld1@toc + bl .__tls_get_addr + nop + addi 3,2,x1@got@tlsld + bl .__tls_get_addr + nop + addi 9,3,x1@dtprel + bl .__tls_get_addr + nop + addis 9,3,x2@dtprel@ha + addi 9,9,x2@dtprel@l + bl .__tls_get_addr + nop + ld 9,x3@got@dtprel(2) + add 9,9,3 + bl .__tls_get_addr + nop' + tls_first_major=2 + tls_first_minor=14 + tls_as_opt="-a64 --fatal-warnings" ;; s390-*-*) conftest_s=' @@ -7481,6 +10358,7 @@ foo: .long 25 bas %r14,0(%r1,%r13):tls_ldcall:foo' tls_first_major=2 tls_first_minor=14 + tls_as_opt="-m31 --fatal-warnings" ;; s390x-*-*) conftest_s=' @@ -7498,54 +10376,143 @@ foo: .long 25 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' tls_first_major=2 tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; + sh-*-* | sh[34]-*-*) + conftest_s=' + .section ".tdata","awT",@progbits +foo: .long 25 + .text + .long foo@TLSGD + .long foo@TLSLDM + .long foo@DTPOFF + .long foo@GOTTPOFF + .long foo@TPOFF' + tls_first_major=2 + tls_first_minor=13 + tls_as_opt=--fatal-warnings + ;; + sparc*-*-*) + case "$target" in + sparc*-sun-solaris2.*) + on_solaris=yes + ;; + *) + on_solaris=no + ;; + esac + if test x$on_solaris = xyes && test x$gas_flag = xno; then + conftest_s=' + .section ".tdata",#alloc,#write,#tls +foo: .long 25 + .text + sethi %tgd_hi22(foo), %o0 + add %o0, %tgd_lo10(foo), %o1 + add %l7, %o1, %o0, %tgd_add(foo) + call __tls_get_addr, %tgd_call(foo) + sethi %tldm_hi22(foo), %l1 + add %l1, %tldm_lo10(foo), %l2 + add %l7, %l2, %o0, %tldm_add(foo) + call __tls_get_addr, %tldm_call(foo) + sethi %tldo_hix22(foo), %l3 + xor %l3, %tldo_lox10(foo), %l4 + add %o0, %l4, %l5, %tldo_add(foo) + sethi %tie_hi22(foo), %o3 + add %o3, %tie_lo10(foo), %o3 + ld [%l7 + %o3], %o2, %tie_ld(foo) + add %g7, %o2, %o4, %tie_add(foo) + sethi %tle_hix22(foo), %l1 + xor %l1, %tle_lox10(foo), %o5 + ld [%g7 + %o5], %o1' + tls_first_major=0 + tls_first_minor=0 + else + conftest_s=' + .section ".tdata","awT",@progbits +foo: .long 25 + .text + sethi %tgd_hi22(foo), %o0 + add %o0, %tgd_lo10(foo), %o1 + add %l7, %o1, %o0, %tgd_add(foo) + call __tls_get_addr, %tgd_call(foo) + sethi %tldm_hi22(foo), %l1 + add %l1, %tldm_lo10(foo), %l2 + add %l7, %l2, %o0, %tldm_add(foo) + call __tls_get_addr, %tldm_call(foo) + sethi %tldo_hix22(foo), %l3 + xor %l3, %tldo_lox10(foo), %l4 + add %o0, %l4, %l5, %tldo_add(foo) + sethi %tie_hi22(foo), %o3 + add %o3, %tie_lo10(foo), %o3 + ld [%l7 + %o3], %o2, %tie_ld(foo) + add %g7, %o2, %o4, %tie_add(foo) + sethi %tle_hix22(foo), %l1 + xor %l1, %tle_lox10(foo), %o5 + ld [%g7 + %o5], %o1' + tls_first_major=2 + tls_first_minor=14 + tls_as_opt="-32 --fatal-warnings" + fi ;; esac if test -z "$tls_first_major"; then - : -elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x -then - if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \ - -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \ - -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then - gcc_cv_as_tls=yes - fi -elif test x$gcc_cv_as != x; then - echo "$conftest_s" > conftest.s - if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_tls=yes - fi - rm -f conftest.s conftest.o + : # If we don't have a check, assume no support. +else + echo "$as_me:$LINENO: checking assembler for thread-local storage support" >&5 +echo $ECHO_N "checking assembler for thread-local storage support... $ECHO_C" >&6 +if test "${gcc_cv_as_tls+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_tls=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( $tls_first_major \* 1000 \) + $tls_first_minor \) \* 1000 + 0` + then gcc_cv_as_tls=yes fi -if test "$gcc_cv_as_tls" = yes; then - cat >> confdefs.h <<\EOF + elif test x$gcc_cv_as != x; then + echo "$conftest_s" > conftest.s + if { ac_try='$gcc_cv_as $tls_as_opt -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_tls=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_tls" >&5 +echo "${ECHO_T}$gcc_cv_as_tls" >&6 +if test $gcc_cv_as_tls = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_TLS 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_tls" 1>&6 +fi + +# Target-specific assembler checks. case "$target" in # All TARGET_ABI_OSF targets. alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*) - echo $ac_n "checking assembler supports explicit relocations""... $ac_c" 1>&6 -echo "configure:7533: checking assembler supports explicit relocations" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_explicit_relocs'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking assembler for explicit relocation support" >&5 +echo $ECHO_N "checking assembler for explicit relocation support... $ECHO_C" >&6 +if test "${gcc_cv_as_alpha_explicit_relocs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - gcc_cv_as_explicit_relocs=unknown - if test x$gcc_cv_gas_major_version != x \ - -a x$gcc_cv_gas_minor_version != x - then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 12 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_explicit_relocs=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s << 'EOF' - .set nomacro + gcc_cv_as_alpha_explicit_relocs=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` + then gcc_cv_as_alpha_explicit_relocs=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .set nomacro .text extbl $3, $2, $3 !lituse_bytoff!1 ldq $2, a($29) !literal!1 @@ -7557,309 +10524,519 @@ else lda $0, c($29) !gprel ldah $1, d($29) !gprelhigh lda $1, d($1) !gprellow - lda $29, 0($29) !gpdisp!3 -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_explicit_relocs=yes - else - gcc_cv_as_explicit_relocs=no - fi - rm -f conftest.s conftest.o - fi - + lda $29, 0($29) !gpdisp!3' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_alpha_explicit_relocs=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi fi +echo "$as_me:$LINENO: result: $gcc_cv_as_alpha_explicit_relocs" >&5 +echo "${ECHO_T}$gcc_cv_as_alpha_explicit_relocs" >&6 +if test $gcc_cv_as_alpha_explicit_relocs = yes; then -echo "$ac_t""$gcc_cv_as_explicit_relocs" 1>&6 - if test "x$gcc_cv_as_explicit_relocs" = xyes; then - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_EXPLICIT_RELOCS 1 -EOF +_ACEOF - fi +fi ;; + + cris-*-*) + echo "$as_me:$LINENO: checking assembler for -no-mul-bug-abort option" >&5 +echo $ECHO_N "checking assembler for -no-mul-bug-abort option... $ECHO_C" >&6 +if test "${gcc_cv_as_cris_no_mul_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_cris_no_mul_bug=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91` + then gcc_cv_as_cris_no_mul_bug=yes +fi + elif test x$gcc_cv_as != x; then + echo '.text' > conftest.s + if { ac_try='$gcc_cv_as -no-mul-bug-abort -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_cris_no_mul_bug=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_cris_no_mul_bug" >&5 +echo "${ECHO_T}$gcc_cv_as_cris_no_mul_bug" >&6 +if test $gcc_cv_as_cris_no_mul_bug = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_NO_MUL_BUG_ABORT_OPTION 1 +_ACEOF + +fi + ;; + sparc*-*-*) - echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:7583: checking assembler .register pseudo-op support" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking assembler for .register" >&5 +echo $ECHO_N "checking assembler for .register... $ECHO_C" >&6 +if test "${gcc_cv_as_sparc_register_op+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - gcc_cv_as_register_pseudo_op=unknown - if test x$gcc_cv_as != x; then - # Check if we have .register - echo ".register %g2, #scratch" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_register_pseudo_op=yes - else - gcc_cv_as_register_pseudo_op=no - fi - rm -f conftest.s conftest.o - fi - + gcc_cv_as_sparc_register_op=no + if test x$gcc_cv_as != x; then + echo '.register %g2, #scratch' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_sparc_register_op=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi fi +echo "$as_me:$LINENO: result: $gcc_cv_as_sparc_register_op" >&5 +echo "${ECHO_T}$gcc_cv_as_sparc_register_op" >&6 +if test $gcc_cv_as_sparc_register_op = yes; then -echo "$ac_t""$gcc_cv_as_register_pseudo_op" 1>&6 - if test "x$gcc_cv_as_register_pseudo_op" = xyes; then - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_REGISTER_PSEUDO_OP 1 -EOF +_ACEOF - fi - - echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6 -echo "configure:7611: checking assembler supports -relax" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - gcc_cv_as_relax_opt=unknown - if test x$gcc_cv_as != x; then - # Check if gas supports -relax - echo ".text" > conftest.s - if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_relax_opt=yes - else - gcc_cv_as_relax_opt=no - fi - rm -f conftest.s conftest.o - fi - fi -echo "$ac_t""$gcc_cv_as_relax_opt" 1>&6 - if test "x$gcc_cv_as_relax_opt" = xyes; then - cat >> confdefs.h <<\EOF + echo "$as_me:$LINENO: checking assembler for -relax option" >&5 +echo $ECHO_N "checking assembler for -relax option... $ECHO_C" >&6 +if test "${gcc_cv_as_sparc_relax+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_sparc_relax=no + if test x$gcc_cv_as != x; then + echo '.text' > conftest.s + if { ac_try='$gcc_cv_as -relax -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_sparc_relax=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_sparc_relax" >&5 +echo "${ECHO_T}$gcc_cv_as_sparc_relax" >&6 +if test $gcc_cv_as_sparc_relax = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_RELAX_OPTION 1 -EOF +_ACEOF - fi - - echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6 -echo "configure:7639: checking assembler and linker support unaligned pc related relocs" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - gcc_cv_as_sparc_ua_pcrel=unknown - if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then - gcc_cv_as_sparc_ua_pcrel=no - echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s - if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ - && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then - gcc_cv_as_sparc_ua_pcrel=yes - fi - rm -f conftest.s conftest.o conftest - fi - fi -echo "$ac_t""$gcc_cv_as_sparc_ua_pcrel" 1>&6 - if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then - cat >> confdefs.h <<\EOF + echo "$as_me:$LINENO: checking assembler for unaligned pcrel relocs" >&5 +echo $ECHO_N "checking assembler for unaligned pcrel relocs... $ECHO_C" >&6 +if test "${gcc_cv_as_sparc_ua_pcrel+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_sparc_ua_pcrel=no + if test x$gcc_cv_as != x; then + echo '.text +foo: + nop +.data +.align 4 +.byte 0 +.uaword %r_disp32(foo)' > conftest.s + if { ac_try='$gcc_cv_as -K PIC -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + if test x$gcc_cv_ld != x \ + && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then + gcc_cv_as_sparc_ua_pcrel=yes + fi + rm -f conftest + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_sparc_ua_pcrel" >&5 +echo "${ECHO_T}$gcc_cv_as_sparc_ua_pcrel" >&6 +if test $gcc_cv_as_sparc_ua_pcrel = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_SPARC_UA_PCREL 1 -EOF +_ACEOF - fi - echo $ac_n "checking assembler and linker support unaligned pc related relocs against hidden symbols""... $ac_c" 1>&6 -echo "configure:7666: checking assembler and linker support unaligned pc related relocs against hidden symbols" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_sparc_ua_pcrel_hidden'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking assembler for unaligned pcrel relocs against hidden symbols" >&5 +echo $ECHO_N "checking assembler for unaligned pcrel relocs against hidden symbols... $ECHO_C" >&6 +if test "${gcc_cv_as_sparc_ua_pcrel_hidden+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then - gcc_cv_as_sparc_ua_pcrel_hidden=unknown - if test x$gcc_cv_objdump != x; then - gcc_cv_as_sparc_ua_pcrel_hidden=no - echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s - echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s - echo "foo: .skip 4" >> conftest.s - if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ - && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ - && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ - | grep ' 31000000 07323334' > /dev/null 2>&1; then - if $gcc_cv_objdump -R conftest 2> /dev/null \ - | grep 'DISP32' > /dev/null 2>&1; then - : - else - gcc_cv_as_sparc_ua_pcrel_hidden=yes - fi - fi - fi - rm -f conftest.s conftest.o conftest - else - gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel" - fi - -fi - -echo "$ac_t""$gcc_cv_as_sparc_ua_pcrel_hidden" 1>&6 - if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_AS_SPARC_UA_PCREL_HIDDEN 1 -EOF - - fi - - echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6 -echo "configure:7706: checking for assembler offsetable %lo() support" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - gcc_cv_as_offsetable_lo10=unknown - if test "x$gcc_cv_as" != x; then - # Check if assembler has offsetable %lo() - echo "or %g1, %lo(ab) + 12, %g1" > conftest.s - echo "or %g1, %lo(ab + 12), %g1" > conftest1.s - if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \ - > /dev/null 2>&1 && - $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \ - > /dev/null 2>&1; then - if cmp conftest.o conftest1.o > /dev/null 2>&1; then - gcc_cv_as_offsetable_lo10=no - else - gcc_cv_as_offsetable_lo10=yes - fi + gcc_cv_as_sparc_ua_pcrel_hidden=no + if test x$gcc_cv_as != x; then + echo '.data +.align 4 +.byte 0x31 +.uaword %r_disp32(foo) +.byte 0x32, 0x33, 0x34 +.global foo +.hidden foo +foo: +.skip 4' > conftest.s + if { ac_try='$gcc_cv_as -K PIC -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ + && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ + && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ + | grep ' 31000000 07323334' > /dev/null 2>&1; then + if $gcc_cv_objdump -R conftest 2> /dev/null \ + | grep 'DISP32' > /dev/null 2>&1; then + : else - gcc_cv_as_offsetable_lo10=no + gcc_cv_as_sparc_ua_pcrel_hidden=yes fi - rm -f conftest.s conftest.o conftest1.s conftest1.o - fi - + fi + rm -f conftest + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_sparc_ua_pcrel_hidden" >&5 +echo "${ECHO_T}$gcc_cv_as_sparc_ua_pcrel_hidden" >&6 +if test $gcc_cv_as_sparc_ua_pcrel_hidden = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_SPARC_UA_PCREL_HIDDEN 1 +_ACEOF + fi -echo "$ac_t""$gcc_cv_as_offsetable_lo10" 1>&6 - if test "x$gcc_cv_as_offsetable_lo10" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_AS_OFFSETABLE_LO10 1 -EOF +fi # unaligned pcrel relocs + echo "$as_me:$LINENO: checking assembler for offsetable %lo()" >&5 +echo $ECHO_N "checking assembler for offsetable %lo()... $ECHO_C" >&6 +if test "${gcc_cv_as_sparc_offsetable_lo10+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_sparc_offsetable_lo10=no + if test x$gcc_cv_as != x; then + echo '.text + or %g1, %lo(ab) + 12, %g1 + or %g1, %lo(ab + 12), %g1' > conftest.s + if { ac_try='$gcc_cv_as -xarch=v9 -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + if test x$gcc_cv_objdump != x \ + && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \ + | grep ' 82106000 82106000' > /dev/null 2>&1; then + gcc_cv_as_offsetable_lo10=yes + fi + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_sparc_offsetable_lo10" >&5 +echo "${ECHO_T}$gcc_cv_as_sparc_offsetable_lo10" >&6 +if test $gcc_cv_as_sparc_offsetable_lo10 = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_OFFSETABLE_LO10 1 +_ACEOF + +fi ;; i[34567]86-*-* | x86_64-*-*) - echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:7745: checking assembler instructions" >&5 - gcc_cv_as_instructions= - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_instructions="filds fists" - fi - elif test x$gcc_cv_as != x; then - set "filds fists" "filds mem; fists mem" - while test $# -gt 0 - do - echo "$2" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" " - fi - shift 2 - done - rm -f conftest.s conftest.o - fi - if test x"$gcc_cv_as_instructions" != x; then - cat >> confdefs.h <&6 - - echo $ac_n "checking cmov syntax""... $ac_c" 1>&6 -echo "configure:7772: checking cmov syntax" >&5 - gcc_cv_as_ix86_cmov_sun_syntax=no - if test x$gcc_cv_as != x; then - echo 'cmovl.l %edx, %eax' > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_ix86_cmov_sun_syntax=yes - fi - rm -f conftest.s conftest.o - fi - if test "x$gcc_cv_as_ix86_cmov_sun_syntax" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_AS_IX86_CMOV_SUN_SYNTAX 1 -EOF - - fi - echo "$ac_t""$gcc_cv_as_ix86_cmov_sun_syntax" 1>&6 - - echo $ac_n "checking assembler GOTOFF in data directives""... $ac_c" 1>&6 -echo "configure:7790: checking assembler GOTOFF in data directives" >&5 - gcc_cv_as_gotoff_in_data=no - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x + echo "$as_me:$LINENO: checking assembler for filds and fists mnemonics" >&5 +echo $ECHO_N "checking assembler for filds and fists mnemonics... $ECHO_C" >&6 +if test "${gcc_cv_as_ix86_filds_fists+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_ix86_filds_fists=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 9 \) \* 1000 + 0` + then gcc_cv_as_ix86_filds_fists=yes +fi + elif test x$gcc_cv_as != x; then + echo 'filds mem; fists mem' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_gotoff_in_data=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s <&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_ix86_filds_fists" >&5 +echo "${ECHO_T}$gcc_cv_as_ix86_filds_fists" >&6 +if test $gcc_cv_as_ix86_filds_fists = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GAS_FILDS_FISTS 1 +_ACEOF + +fi + + echo "$as_me:$LINENO: checking assembler for cmov syntax" >&5 +echo $ECHO_N "checking assembler for cmov syntax... $ECHO_C" >&6 +if test "${gcc_cv_as_ix86_cmov_sun_syntax+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_ix86_cmov_sun_syntax=no + if test x$gcc_cv_as != x; then + echo 'cmovl.l %edx, %eax' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_ix86_cmov_sun_syntax=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_ix86_cmov_sun_syntax" >&5 +echo "${ECHO_T}$gcc_cv_as_ix86_cmov_sun_syntax" >&6 +if test $gcc_cv_as_ix86_cmov_sun_syntax = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_IX86_CMOV_SUN_SYNTAX 1 +_ACEOF + +fi + + # This one is used unconditionally by i386.[ch]; it is to be defined + # to 1 if the feature is present, 0 otherwise. + echo "$as_me:$LINENO: checking assembler for GOTOFF in data" >&5 +echo $ECHO_N "checking assembler for GOTOFF in data... $ECHO_C" >&6 +if test "${gcc_cv_as_ix86_gotoff_in_data+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_ix86_gotoff_in_data=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` + then gcc_cv_as_ix86_gotoff_in_data=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .text .L0: nop .data - .long .L0@GOTOFF -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_gotoff_in_data=yes - fi + .long .L0@GOTOFF' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_ix86_gotoff_in_data=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 fi - cat >> confdefs.h <&5 +echo "${ECHO_T}$gcc_cv_as_ix86_gotoff_in_data" >&6 + + +cat >>confdefs.h <<_ACEOF +#define HAVE_AS_GOTOFF_IN_DATA `if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi` +_ACEOF - echo "$ac_t""$gcc_cv_as_gotoff_in_data" 1>&6 ;; ia64*-*-*) - echo $ac_n "checking assembler supports ltoffx and ldxmov""... $ac_c" 1>&6 -echo "configure:7820: checking assembler supports ltoffx and ldxmov" >&5 -if eval "test \"`echo '$''{'gcc_cv_as_ltoffx_ldxmov_relocs'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking assembler for ltoffx and ldxmov relocs" >&5 +echo $ECHO_N "checking assembler for ltoffx and ldxmov relocs... $ECHO_C" >&6 +if test "${gcc_cv_as_ia64_ltoffx_ldxmov_relocs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - gcc_cv_as_ltoffx_ldxmov_relocs=unknown - if test x$gcc_cv_gas_major_version != x \ - -a x$gcc_cv_gas_minor_version != x - then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 14 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_ltoffx_ldxmov_relocs=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s << 'EOF' - .text + gcc_cv_as_ia64_ltoffx_ldxmov_relocs=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` + then gcc_cv_as_ia64_ltoffx_ldxmov_relocs=yes +fi + elif test x$gcc_cv_as != x; then + echo ' .text addl r15 = @ltoffx(x#), gp ;; - ld8.mov r16 = [r15], x# -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_ltoffx_ldxmov_relocs=yes - else - gcc_cv_as_ltoffx_ldxmov_relocs=no - fi - rm -f conftest.s conftest.o - fi - + ld8.mov r16 = [r15], x#' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_ia64_ltoffx_ldxmov_relocs=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_ia64_ltoffx_ldxmov_relocs" >&5 +echo "${ECHO_T}$gcc_cv_as_ia64_ltoffx_ldxmov_relocs" >&6 +if test $gcc_cv_as_ia64_ltoffx_ldxmov_relocs = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_LTOFFX_LDXMOV_RELOCS 1 +_ACEOF + fi -echo "$ac_t""$gcc_cv_as_ltoffx_ldxmov_relocs" 1>&6 - if test "x$gcc_cv_as_ltoffx_ldxmov_relocs" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_AS_LTOFFX_LDXMOV_RELOCS 1 -EOF + ;; + powerpc*-*-*) + case $target in + *-*-aix*) conftest_s=' .csect .text[PR] + mfcr 3,128';; + *-*-darwin*) conftest_s=' .text + mfcr r3,128';; + *) conftest_s=' .text + mfcr 3,128';; + esac + + echo "$as_me:$LINENO: checking assembler for mfcr field support" >&5 +echo $ECHO_N "checking assembler for mfcr field support... $ECHO_C" >&6 +if test "${gcc_cv_as_powerpc_mfcrf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_powerpc_mfcrf=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` + then gcc_cv_as_powerpc_mfcrf=yes +fi + elif test x$gcc_cv_as != x; then + echo "$conftest_s" > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_powerpc_mfcrf=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_powerpc_mfcrf" >&5 +echo "${ECHO_T}$gcc_cv_as_powerpc_mfcrf" >&6 +if test $gcc_cv_as_powerpc_mfcrf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_MFCRF 1 +_ACEOF + +fi + ;; + + mips*-*-*) + echo "$as_me:$LINENO: checking assembler for explicit relocation support" >&5 +echo $ECHO_N "checking assembler for explicit relocation support... $ECHO_C" >&6 +if test "${gcc_cv_as_mips_explicit_relocs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_mips_explicit_relocs=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` + then gcc_cv_as_mips_explicit_relocs=yes +fi + elif test x$gcc_cv_as != x; then + echo ' lw $4,%gp_rel(foo)($4)' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_mips_explicit_relocs=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_mips_explicit_relocs" >&5 +echo "${ECHO_T}$gcc_cv_as_mips_explicit_relocs" >&6 +if test $gcc_cv_as_mips_explicit_relocs = yes; then + if test x$target_cpu_default = x + then target_cpu_default=MASK_EXPLICIT_RELOCS + else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS" + fi +fi + ;; esac - -echo $ac_n "checking assembler dwarf2 debug_line support""... $ac_c" 1>&6 -echo "configure:7862: checking assembler dwarf2 debug_line support" >&5 -gcc_cv_as_dwarf2_debug_line=no # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any # info to the output file. So, as supported targets are added to gas 2.11, @@ -7868,121 +11045,192 @@ gcc_cv_as_dwarf2_debug_line=no # version to the per-target configury. case "$target" in i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \ - | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*) + | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-* \ + | xstormy16*-*-* | cris-*-* | xtensa-*-*) insn="nop" ;; - ia64*-*-*) + ia64*-*-* | s390*-*-*) insn="nop 0" ;; - esac -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_dwarf2_debug_line="yes" - fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo ' .file 1 "conftest.s"' > conftest.s - echo ' .loc 1 3 0' >> conftest.s - echo " $insn" >> conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ - && grep debug_line conftest.o > /dev/null 2>&1 ; then - # The .debug_line file table must be in the exact order that - # we specified the files, since these indices are also used - # by DW_AT_decl_file. Approximate this test by testing if - # the assembler bitches if the same index is assigned twice. - echo ' .file 1 "foo.s"' > conftest.s - echo ' .file 1 "bar.s"' >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_dwarf2_debug_line="no" - else - gcc_cv_as_dwarf2_debug_line="yes" - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 + mmix-*-*) + insn="swym 0" + ;; +esac +if test x"$insn" != x; then + conftest_s="\ + .file 1 \"conftest.s\" + .loc 1 3 0 + $insn" + echo "$as_me:$LINENO: checking assembler for dwarf2 debug_line support" >&5 +echo $ECHO_N "checking assembler for dwarf2 debug_line support... $ECHO_C" >&6 +if test "${gcc_cv_as_dwarf2_debug_line+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_dwarf2_debug_line=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` + then gcc_cv_as_dwarf2_debug_line=yes fi -if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then - cat >> confdefs.h <<\EOF + elif test x$gcc_cv_as != x; then + echo "$conftest_s" > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + # ??? This fails with non-gnu grep. Maybe use objdump? + if grep debug_line conftest.o > /dev/null 2>&1; then + gcc_cv_as_dwarf2_debug_line=yes + fi + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_dwarf2_debug_line" >&5 +echo "${ECHO_T}$gcc_cv_as_dwarf2_debug_line" >&6 + + +# The .debug_line file table must be in the exact order that +# we specified the files, since these indices are also used +# by DW_AT_decl_file. Approximate this test by testing if +# the assembler bitches if the same index is assigned twice. + echo "$as_me:$LINENO: checking assembler for buggy dwarf2 .file directive" >&5 +echo $ECHO_N "checking assembler for buggy dwarf2 .file directive... $ECHO_C" >&6 +if test "${gcc_cv_as_dwarf2_file_buggy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_dwarf2_file_buggy=no + if test x$gcc_cv_as != x; then + echo ' .file 1 "foo.s" + .file 1 "bar.s"' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_dwarf2_file_buggy=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_dwarf2_file_buggy" >&5 +echo "${ECHO_T}$gcc_cv_as_dwarf2_file_buggy" >&6 + + + if test $gcc_cv_as_dwarf2_debug_line = yes \ + && test $gcc_cv_as_dwarf2_file_buggy = no; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_DWARF2_DEBUG_LINE 1 -EOF +_ACEOF + fi + + echo "$as_me:$LINENO: checking assembler for --gdwarf2 option" >&5 +echo $ECHO_N "checking assembler for --gdwarf2 option... $ECHO_C" >&6 +if test "${gcc_cv_as_gdwarf2_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_gdwarf2_flag=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` + then gcc_cv_as_gdwarf2_flag=yes fi -echo "$ac_t""$gcc_cv_as_dwarf2_debug_line" 1>&6 - -echo $ac_n "checking assembler --gdwarf2 support""... $ac_c" 1>&6 -echo "configure:7919: checking assembler --gdwarf2 support" >&5 -gcc_cv_as_gdwarf2_flag=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_gdwarf2_flag="yes" + elif test x$gcc_cv_as != x; then + echo "$insn" > conftest.s + if { ac_try='$gcc_cv_as --gdwarf2 -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_gdwarf2_flag=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo '' > conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_gdwarf2_flag="yes" - fi - rm -f conftest.s conftest.o fi -if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_gdwarf2_flag" >&5 +echo "${ECHO_T}$gcc_cv_as_gdwarf2_flag" >&6 +if test $gcc_cv_as_gdwarf2_flag = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_GDWARF2_DEBUG_FLAG 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_gdwarf2_flag" 1>&6 -echo $ac_n "checking assembler --gstabs support""... $ac_c" 1>&6 -echo "configure:7948: checking assembler --gstabs support" >&5 -gcc_cv_as_gstabs_flag=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_gstabs_flag="yes" + echo "$as_me:$LINENO: checking assembler for --gstabs option" >&5 +echo $ECHO_N "checking assembler for --gstabs option... $ECHO_C" >&6 +if test "${gcc_cv_as_gstabs_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_gstabs_flag=no + if test $in_tree_gas = yes; then + if test $in_tree_gas_is_elf = yes \ + && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` + then gcc_cv_as_gstabs_flag=yes +fi + elif test x$gcc_cv_as != x; then + echo "$insn" > conftest.s + if { ac_try='$gcc_cv_as --gstabs -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + # The native Solaris 9/Intel assembler doesn't understand --gstabs + # and warns about it, but still exits successfully. So check for + # this. + if { ac_try='$gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then : + else gcc_cv_as_gstabs_flag=yes + fi + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo '' > conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then - gcc_cv_as_gstabs_flag="yes" - # The native Solaris 9/Intel assembler doesn't understand --gstabs - # and warns about it, but still exits successfully. So check for - # this. - if $gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | \ - grep -i warning > /dev/null ; then - gcc_cv_as_gstabs_flag="no" - fi - fi - rm -f conftest.s conftest.o fi -if test x"$gcc_cv_as_gstabs_flag" = xyes; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $gcc_cv_as_gstabs_flag" >&5 +echo "${ECHO_T}$gcc_cv_as_gstabs_flag" >&6 +if test $gcc_cv_as_gstabs_flag = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_AS_GSTABS_DEBUG_FLAG 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_as_gstabs_flag" 1>&6 +fi -echo $ac_n "checking linker read-only and read-write section mixing""... $ac_c" 1>&6 -echo "configure:7983: checking linker read-only and read-write section mixing" >&5 +echo "$as_me:$LINENO: checking linker read-only and read-write section mixing" >&5 +echo $ECHO_N "checking linker read-only and read-write section mixing... $ECHO_C" >&6 gcc_cv_ld_ro_rw_mix=unknown -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then +if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_ro_rw_mix=read-write fi elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then @@ -8009,18 +11257,21 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then rm -f conftest.* conftest[123].* fi if test x$gcc_cv_ld_ro_rw_mix = xread-write; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LD_RO_RW_SECTION_MIXING 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_ld_ro_rw_mix" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_ld_ro_rw_mix" >&5 +echo "${ECHO_T}$gcc_cv_ld_ro_rw_mix" >&6 -echo $ac_n "checking linker PT_GNU_EH_FRAME support""... $ac_c" 1>&6 -echo "configure:8021: checking linker PT_GNU_EH_FRAME support" >&5 +echo "$as_me:$LINENO: checking linker PT_GNU_EH_FRAME support" >&5 +echo $ECHO_N "checking linker PT_GNU_EH_FRAME support... $ECHO_C" >&6 gcc_cv_ld_eh_frame_hdr=no -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then +if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_eh_frame_hdr=yes fi elif test x$gcc_cv_ld != x; then @@ -8030,50 +11281,78 @@ elif test x$gcc_cv_ld != x; then fi fi if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LD_EH_FRAME_HDR 1 -EOF +_ACEOF fi -echo "$ac_t""$gcc_cv_ld_eh_frame_hdr" 1>&6 +echo "$as_me:$LINENO: result: $gcc_cv_ld_eh_frame_hdr" >&5 +echo "${ECHO_T}$gcc_cv_ld_eh_frame_hdr" >&6 + +echo "$as_me:$LINENO: checking linker position independent executable support" >&5 +echo $ECHO_N "checking linker position independent executable support... $ECHO_C" >&6 +gcc_cv_ld_pie=no +if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then + gcc_cv_ld_pie=yes + fi +elif test x$gcc_cv_ld != x; then + # Check if linker supports -pie option + if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then + gcc_cv_ld_pie=yes + fi +fi +if test x"$gcc_cv_ld_pie" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LD_PIE 1 +_ACEOF + +fi +echo "$as_me:$LINENO: result: $gcc_cv_ld_pie" >&5 +echo "${ECHO_T}$gcc_cv_ld_pie" >&6 -# Miscellaneous target-specific checks. case "$target" in - mips*-*-*) - echo $ac_n "checking whether libgloss uses STARTUP directives consistently""... $ac_c" 1>&6 -echo "configure:8045: checking whether libgloss uses STARTUP directives consistently" >&5 - gcc_cv_mips_libgloss_startup=no - gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix + *-*-linux*) + echo "$as_me:$LINENO: checking linker --as-needed support" >&5 +echo $ECHO_N "checking linker --as-needed support... $ECHO_C" >&6 +if test "${gcc_cv_ld_as_needed+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_ld_as_needed=no + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then + gcc_cv_ld_as_needed=yes + fi + elif test x$gcc_cv_ld != x; then + # Check if linker supports --as-needed and --no-as-needed options + if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then + gcc_cv_ld_as_needed=yes fi - else - test_prefix=$exec_prefix fi - for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld - do - if grep '^STARTUP' $f > /dev/null 2>&1; then - gcc_cv_mips_libgloss_startup=yes - break - fi - done - if test x"$gcc_cv_mips_libgloss_startup" = xyes; then - cat >> confdefs.h <<\EOF -#define HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES 1 -EOF + +fi +echo "$as_me:$LINENO: result: $gcc_cv_ld_as_needed" >&5 +echo "${ECHO_T}$gcc_cv_ld_as_needed" >&6 + if test x"$gcc_cv_ld_as_needed" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LD_AS_NEEDED 1 +_ACEOF fi - echo "$ac_t""$gcc_cv_mips_libgloss_startup" 1>&6 ;; esac -if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then - cat >> confdefs.h <>confdefs.h <<_ACEOF #define PREFIX_INCLUDE_DIR "$prefix/include" -EOF +_ACEOF fi @@ -8085,7 +11364,8 @@ fi if test x"${enable_languages+set}" != xset; then if test x"${LANGUAGES+set}" = xset; then enable_languages="${LANGUAGES}" - echo "configure: warning: setting LANGUAGES is deprecated, use --enable-languages instead" 1>&2 + { echo "$as_me:$LINENO: WARNING: setting LANGUAGES is deprecated, use --enable-languages instead" >&5 +echo "$as_me: WARNING: setting LANGUAGES is deprecated, use --enable-languages instead" >&2;} else enable_languages=all @@ -8094,7 +11374,9 @@ else if test x"${enable_languages}" = x \ || test x"${enable_languages}" = xyes; then - { echo "configure: error: --enable-languages needs at least one language argument" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: --enable-languages needs at least one language argument" >&5 +echo "$as_me: error: --enable-languages needs at least one language argument" >&2;} + { (exit 1); exit 1; }; } fi fi enable_languages=`echo "${enable_languages}" | sed -e 's/[ ,][ ,]*/,/g' -e 's/,$//'` @@ -8102,11 +11384,9 @@ enable_languages=`echo "${enable_languages}" | sed -e 's/[ ,][ ,]*/,/g' -e 's/ # First scan to see if an enabled language requires some other language. # We assume that a given config-lang.in will list all the language # front ends it requires, even if some are required indirectly. -for lang in ${srcdir}/*/config-lang.in .. +for lang in ${srcdir}/*/config-lang.in do case $lang in - ..) - ;; # The odd quoting in the next line works around # an apparent bug in bash 1.12 on linux. ${srcdir}/[*]/config-lang.in) @@ -8133,10 +11413,9 @@ done expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's: *: :g' -e 's: *: :g' -e 's:^ ::' -e 's: $::'` found_languages= subdirs= -for lang in ${srcdir}/*/config-lang.in .. +for lang in ${srcdir}/*/config-lang.in do case $lang in - ..) ;; # The odd quoting in the next line works around # an apparent bug in bash 1.12 on linux. ${srcdir}/[*]/config-lang.in) ;; @@ -8174,7 +11453,7 @@ done missing_languages= for expected_language in ${expected_languages} .. -do +do if test "${expected_language}" != ..; then missing_language="${expected_language}" if test "${expected_language}" = "c" \ @@ -8182,7 +11461,7 @@ do missing_language= fi for found_language in ${found_languages} .. - do + do if test "${found_language}" != ..; then if test "${expected_language}" = "${found_language}"; then missing_language= @@ -8196,9 +11475,13 @@ do done if test "x$missing_languages" != x; then - { echo "configure: error: + { { echo "$as_me:$LINENO: error: The following requested languages were not found:${missing_languages} -The following languages were available: c${found_languages}" 1>&2; exit 1; } +The following languages were available: c${found_languages}" >&5 +echo "$as_me: error: +The following requested languages were not found:${missing_languages} +The following languages were available: c${found_languages}" >&2;} + { (exit 1); exit 1; }; } fi # Make gthr-default.h if we have a thread file. @@ -8211,51 +11494,53 @@ fi # Find out what GC implementation we want, or may, use. + # Check whether --with-gc or --without-gc was given. if test "${with_gc+set}" = set; then withval="$with_gc" case "$withval" in - simple | page) + simple | page | zone) GGC=ggc-$withval ;; *) - { echo "configure: error: $withval is an invalid option to --with-gc" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: $withval is an invalid option to --with-gc" >&5 +echo "$as_me: error: $withval is an invalid option to --with-gc" >&2;} + { (exit 1); exit 1; }; } ;; esac else GGC=ggc-page -fi - +fi; echo "Using $GGC for garbage collection." # Use the system's zlib library. zlibdir=-L../zlib zlibinc="-I\$(srcdir)/../zlib" + # Check whether --with-system-zlib or --without-system-zlib was given. if test "${with_system_zlib+set}" = set; then withval="$with_system_zlib" zlibdir= zlibinc= -fi +fi; - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:8249: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" maintainer_mode=$enableval else maintainer_mode=no -fi +fi; - -echo "$ac_t""$maintainer_mode" 1>&6 +echo "$as_me:$LINENO: result: $maintainer_mode" >&5 +echo "${ECHO_T}$maintainer_mode" >&6 if test "$maintainer_mode" = "yes"; then MAINT='' @@ -8266,17 +11551,17 @@ fi # Make empty files to contain the specs and options for each language. # Then add #include lines to for a compiler that has specs and/or options. +lang_opt_files= lang_specs_files= -lang_options_files= lang_tree_files= for subdir in . $subdirs do + if test -f $srcdir/$subdir/lang.opt; then + lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt" + fi if test -f $srcdir/$subdir/lang-specs.h; then lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h" fi - if test -f $srcdir/$subdir/lang-options.h; then - lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h" - fi if test -f $srcdir/$subdir/$subdir-tree.def; then lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def" fi @@ -8288,8 +11573,10 @@ all_languages= all_boot_languages= all_compilers= all_stagestuff= -all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders' +all_outputs='Makefile fixinc/Makefile gccbug mklibgcc mkheaders' # List of language makefile fragments. +all_lang_makefrags= +# List of language subdirectory makefiles. Deprecated. all_lang_makefiles= # Files for gengtype all_gtfiles="$target_gtfiles" @@ -8304,13 +11591,10 @@ all_gtfiles_files_files= # The other mechanism is a set of hooks for each of the main targets # like `clean', `install', etc. -language_fragments="Make-lang" language_hooks="Make-hooks" -for s in .. $subdirs +for s in $subdirs do - if test $s != ".." - then language= boot_language= compilers= @@ -8323,9 +11607,9 @@ do echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2 exit 1 fi - all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in" + all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$s/Make-lang.in" if test -f ${srcdir}/$s/Makefile.in - then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in" + then all_lang_makefiles="$s/Makefile" fi all_languages="$all_languages $language" if test "x$boot_language" = xyes @@ -8336,15 +11620,11 @@ do all_stagestuff="$all_stagestuff $stagestuff" all_outputs="$all_outputs $outputs" all_gtfiles="$all_gtfiles $gtfiles" - for f in .. $gtfiles + for f in $gtfiles do - if test $f != ".." - then all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " all_gtfiles_files_files="$all_gtfiles_files_files ${f} " - fi done - fi done # Pick up gtfiles for c @@ -8352,43 +11632,34 @@ gtfiles= s="c" . ${srcdir}/c-config-lang.in all_gtfiles="$all_gtfiles $gtfiles" -for f in .. $gtfiles +for f in $gtfiles do - if test $f != ".." - then all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " all_gtfiles_files_files="$all_gtfiles_files_files ${f} " - fi done check_languages= -for language in .. $all_languages +for language in $all_languages do - if test $language != ".." - then check_languages="$check_languages check-$language" - fi done -# Since we can't use `::' targets, we link each language in -# with a set of hooks, reached indirectly via lang.${target}. +# We link each language in with a set of hooks, reached indirectly via +# lang.${target}. rm -f Make-hooks touch Make-hooks -target_list="all.build all.cross start.encap rest.encap \ - info dvi generated-manpages \ - install-normal install-common install-info install-man \ - uninstall \ - mostlyclean clean distclean extraclean maintainer-clean \ - stage1 stage2 stage3 stage4" +target_list="all.build all.cross start.encap rest.encap tags \ + install-normal install-common install-man \ + uninstall info man srcextra srcman srcinfo \ + mostlyclean clean distclean maintainer-clean \ + stage1 stage2 stage3 stage4 stageprofile stagefeedback" for t in $target_list do x= - for lang in .. $all_languages + for lang in $all_languages do - if test $lang != ".."; then x="$x $lang.$t" - fi done echo "lang.$t: $x" >> Make-hooks done @@ -8409,18 +11680,6 @@ if test "x$subdirs" != x; then fi echo "source ${srcdir}/gdbinit.in" >> .gdbinit -# Define variables host_canonical and build_canonical -# because some Cygnus local changes in the Makefile depend on them. -build_canonical=${build} -host_canonical=${host} -target_subdir= -if test "${host}" != "${target}" ; then - target_subdir=${target_alias}/ -fi - - - - # If $(exec_prefix) exists and is not the same as $(prefix), then compute an # absolute path for gcc_tooldir based on inserting the number of up-directory # movements required to get from $(exec_prefix) to $(prefix) into the basic @@ -8429,7 +11688,7 @@ fi # make and thus we'd get different behavior depending on where we built the # sources. if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then - gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)' + gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_noncanonical)' else # An explanation of the sed strings: # -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix' @@ -8453,7 +11712,7 @@ else # /foo /foo/bar/ugg ../../ # dollar='$$' - gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)" + gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_noncanonical)" fi @@ -8463,8 +11722,8 @@ fi # Check whether --enable-version-specific-runtime-libs or --disable-version-specific-runtime-libs was given. if test "${enable_version_specific_runtime_libs+set}" = set; then enableval="$enable_version_specific_runtime_libs" - : -fi + +fi; # Check whether --with-slibdir or --without-slibdir was given. @@ -8479,16 +11738,12 @@ elif test "$host" != "$target"; then else slibdir='$(libdir)' fi -fi - +fi; objdir=`${PWDCMD-pwd}` -# Process the language and host/target makefile fragments. -${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file" - # Substitute configuration variables @@ -8558,35 +11813,30 @@ ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xma -# Echo that links are built -if test x$host = x$target -then - str1="native " +# If it doesn't already exist, create document directory +echo "checking for the document directory." 1>&2 +if test -d doc ; then + true else - str1="cross-" - str2=" from $host" + mkdir doc fi -if test x$host != x$build -then - str3=" on a $build system" -fi - -if test "x$str2" != x || test "x$str3" != x -then - str4= -fi - -echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2 - -if test "x$str2" != x || test "x$str3" != x -then - echo " ${str2}${str3}." 1>&2 -fi - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` +# Echo link setup. +if test x${build} = x${host} ; then + if test x${host} = x${target} ; then + echo "Links are now set up to build a native compiler for ${target}." 1>&2 + else + echo "Links are now set up to build a cross-compiler" 1>&2 + echo " from ${host} to ${target}." 1>&2 + fi +else + if test x${host} = x${target} ; then + echo "Links are now set up to build (on ${build}) a native compiler" 1>&2 + echo " for ${target}." 1>&2 + else + echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2 + echo " from ${host} to ${target}." 1>&2 + fi fi # Configure the subdirectories @@ -8594,551 +11844,1291 @@ fi # Create the Makefile # and configure language subdirectories -trap '' 1 2 15 -cat > confcache <<\EOF + ac_config_files="$ac_config_files $all_outputs" + + + ac_config_commands="$ac_config_commands default" + +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + : ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF -ac_given_srcdir=$srcdir +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -trap 'rm -fr `echo "$all_outputs auto-host.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@CC@%$CC%g -s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g -s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g -s%@GNATBIND@%$GNATBIND%g -s%@ADAC@%$ADAC%g -s%@strict1_warn@%$strict1_warn%g -s%@CPP@%$CPP%g -s%@warn_cflags@%$warn_cflags%g -s%@enable_multilib@%$enable_multilib%g -s%@nocommon_flag@%$nocommon_flag%g -s%@valgrind_path@%$valgrind_path%g -s%@valgrind_path_defines@%$valgrind_path_defines%g -s%@valgrind_command@%$valgrind_command%g -s%@coverage_flags@%$coverage_flags%g -s%@enable_shared@%$enable_shared%g -s%@stage1_cflags@%$stage1_cflags%g -s%@SET_MAKE@%$SET_MAKE%g -s%@AWK@%$AWK%g -s%@LN@%$LN%g -s%@LN_S@%$LN_S%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@have_mktemp_command@%$have_mktemp_command%g -s%@MAKEINFO@%$MAKEINFO%g -s%@BUILD_INFO@%$BUILD_INFO%g -s%@GENERATED_MANPAGES@%$GENERATED_MANPAGES%g -s%@FLEX@%$FLEX%g -s%@BISON@%$BISON%g -s%@COLLECT2_LIBS@%$COLLECT2_LIBS%g -s%@GNAT_LIBEXC@%$GNAT_LIBEXC%g -s%@LDEXP_LIB@%$LDEXP_LIB%g -s%@TARGET_GETGROUPS_T@%$TARGET_GETGROUPS_T%g -s%@LIBICONV@%$LIBICONV%g -s%@gcc_cv_initfinit_array@%$gcc_cv_initfinit_array%g -s%@manext@%$manext%g -s%@objext@%$objext%g -s%@extra_modes_file@%$extra_modes_file%g -s%@FORBUILD@%$FORBUILD%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ALLOCA@%$ALLOCA%g -s%@GLIBC21@%$GLIBC21%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@INTLBISON@%$INTLBISON%g -s%@BUILD_INCLUDED_LIBINTL@%$BUILD_INCLUDED_LIBINTL%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLDEPS@%$INTLDEPS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POSUB@%$POSUB%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@GENCAT@%$GENCAT%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@INTL_LIBTOOL_SUFFIX_PREFIX@%$INTL_LIBTOOL_SUFFIX_PREFIX%g -s%@CROSS@%$CROSS%g -s%@ALL@%$ALL%g -s%@SYSTEM_HEADER_DIR@%$SYSTEM_HEADER_DIR%g -s%@inhibit_libc@%$inhibit_libc%g -s%@BUILD_PREFIX@%$BUILD_PREFIX%g -s%@BUILD_PREFIX_1@%$BUILD_PREFIX_1%g -s%@HOST_CC@%$HOST_CC%g -s%@HOST_CFLAGS@%$HOST_CFLAGS%g -s%@STMP_FIXINC@%$STMP_FIXINC%g -s%@STMP_FIXPROTO@%$STMP_FIXPROTO%g -s%@libgcc_visibility@%$libgcc_visibility%g -s%@gthread_flags@%$gthread_flags%g -s%@GGC@%$GGC%g -s%@zlibdir@%$zlibdir%g -s%@zlibinc@%$zlibinc%g -s%@MAINT@%$MAINT%g -s%@build_canonical@%$build_canonical%g -s%@host_canonical@%$host_canonical%g -s%@target_subdir@%$target_subdir%g -s%@gcc_tooldir@%$gcc_tooldir%g -s%@dollar@%$dollar%g -s%@slibdir@%$slibdir%g -s%@objdir@%$objdir%g -s%@subdirs@%$subdirs%g -s%@srcdir@%$srcdir%g -s%@all_boot_languages@%$all_boot_languages%g -s%@all_compilers@%$all_compilers%g -s%@all_gtfiles@%$all_gtfiles%g -s%@all_gtfiles_files_langs@%$all_gtfiles_files_langs%g -s%@all_gtfiles_files_files@%$all_gtfiles_files_files%g -s%@all_lang_makefiles@%$all_lang_makefiles%g -s%@all_languages@%$all_languages%g -s%@all_stagestuff@%$all_stagestuff%g -s%@build_exeext@%$build_exeext%g -s%@build_install_headers_dir@%$build_install_headers_dir%g -s%@build_xm_file_list@%$build_xm_file_list%g -s%@build_xm_file@%$build_xm_file%g -s%@build_xm_defines@%$build_xm_defines%g -s%@check_languages@%$check_languages%g -s%@cc_set_by_configure@%$cc_set_by_configure%g -s%@quoted_cc_set_by_configure@%$quoted_cc_set_by_configure%g -s%@cpp_install_dir@%$cpp_install_dir%g -s%@dep_host_xmake_file@%$dep_host_xmake_file%g -s%@dep_tmake_file@%$dep_tmake_file%g -s%@extra_headers_list@%$extra_headers_list%g -s%@extra_objs@%$extra_objs%g -s%@extra_parts@%$extra_parts%g -s%@extra_passes@%$extra_passes%g -s%@extra_programs@%$extra_programs%g -s%@float_h_file@%$float_h_file%g -s%@gcc_config_arguments@%$gcc_config_arguments%g -s%@gcc_gxx_include_dir@%$gcc_gxx_include_dir%g -s%@libstdcxx_incdir@%$libstdcxx_incdir%g -s%@gcc_version@%$gcc_version%g -s%@gcc_version_full@%$gcc_version_full%g -s%@gcc_version_trigger@%$gcc_version_trigger%g -s%@host_exeext@%$host_exeext%g -s%@host_extra_gcc_objs@%$host_extra_gcc_objs%g -s%@host_xm_file_list@%$host_xm_file_list%g -s%@host_xm_file@%$host_xm_file%g -s%@host_xm_defines@%$host_xm_defines%g -s%@install@%$install%g -s%@lang_options_files@%$lang_options_files%g -s%@lang_specs_files@%$lang_specs_files%g -s%@lang_tree_files@%$lang_tree_files%g -s%@local_prefix@%$local_prefix%g -s%@md_file@%$md_file%g -s%@objc_boehm_gc@%$objc_boehm_gc%g -s%@out_file@%$out_file%g -s%@out_object_file@%$out_object_file%g -s%@stage_prefix_set_by_configure@%$stage_prefix_set_by_configure%g -s%@quoted_stage_prefix_set_by_configure@%$quoted_stage_prefix_set_by_configure%g -s%@symbolic_link@%$symbolic_link%g -s%@thread_file@%$thread_file%g -s%@tm_file_list@%$tm_file_list%g -s%@tm_file@%$tm_file%g -s%@tm_defines@%$tm_defines%g -s%@tm_p_file_list@%$tm_p_file_list%g -s%@tm_p_file@%$tm_p_file%g -s%@xm_file@%$xm_file%g -s%@xm_defines@%$xm_defines%g -s%@c_target_objs@%$c_target_objs%g -s%@cxx_target_objs@%$cxx_target_objs%g -s%@target_cpu_default@%$target_cpu_default%g -/@target_overrides@/r $target_overrides -s%@target_overrides@%%g -/@host_overrides@/r $host_overrides -s%@host_overrides@%%g -/@language_fragments@/r $language_fragments -s%@language_fragments@%%g -/@language_hooks@/r $language_hooks -s%@language_hooks@%%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix fi -EOF -cat >> $CONFIG_STATUS </dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi -CONFIG_FILES=\${CONFIG_FILES-"$all_outputs"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - ac_dir_suffix= ac_dots= + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +subdirs='$subdirs' +symbolic_link='$symbolic_link' + + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "$all_outputs" ) CONFIG_FILES="$CONFIG_FILES $all_outputs" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "auto-host.h" ) CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@build_subdir@,$build_subdir,;t t +s,@host_subdir@,$host_subdir,;t t +s,@target_subdir@,$target_subdir,;t t +s,@GENINSRC@,$GENINSRC,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@NO_MINUS_C_MINUS_O@,$NO_MINUS_C_MINUS_O,;t t +s,@OUTPUT_OPTION@,$OUTPUT_OPTION,;t t +s,@CPP@,$CPP,;t t +s,@GNATBIND@,$GNATBIND,;t t +s,@ac_ct_GNATBIND@,$ac_ct_GNATBIND,;t t +s,@strict1_warn@,$strict1_warn,;t t +s,@warn_cflags@,$warn_cflags,;t t +s,@WERROR@,$WERROR,;t t +s,@nocommon_flag@,$nocommon_flag,;t t +s,@EGREP@,$EGREP,;t t +s,@valgrind_path@,$valgrind_path,;t t +s,@valgrind_path_defines@,$valgrind_path_defines,;t t +s,@valgrind_command@,$valgrind_command,;t t +s,@coverage_flags@,$coverage_flags,;t t +s,@enable_multilib@,$enable_multilib,;t t +s,@enable_shared@,$enable_shared,;t t +s,@TARGET_SYSTEM_ROOT@,$TARGET_SYSTEM_ROOT,;t t +s,@TARGET_SYSTEM_ROOT_DEFINE@,$TARGET_SYSTEM_ROOT_DEFINE,;t t +s,@CROSS_SYSTEM_HEADER_DIR@,$CROSS_SYSTEM_HEADER_DIR,;t t +s,@onestep@,$onestep,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@AWK@,$AWK,;t t +s,@LN@,$LN,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL@,$INSTALL,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@make_compare_target@,$make_compare_target,;t t +s,@have_mktemp_command@,$have_mktemp_command,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@BUILD_INFO@,$BUILD_INFO,;t t +s,@GENERATED_MANPAGES@,$GENERATED_MANPAGES,;t t +s,@FLEX@,$FLEX,;t t +s,@BISON@,$BISON,;t t +s,@stage1_cflags@,$stage1_cflags,;t t +s,@COLLECT2_LIBS@,$COLLECT2_LIBS,;t t +s,@GNAT_LIBEXC@,$GNAT_LIBEXC,;t t +s,@LDEXP_LIB@,$LDEXP_LIB,;t t +s,@TARGET_GETGROUPS_T@,$TARGET_GETGROUPS_T,;t t +s,@LIBICONV@,$LIBICONV,;t t +s,@LIBICONV_DEP@,$LIBICONV_DEP,;t t +s,@manext@,$manext,;t t +s,@objext@,$objext,;t t +s,@extra_modes_file@,$extra_modes_file,;t t +s,@FORBUILD@,$FORBUILD,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@LIBINTL@,$LIBINTL,;t t +s,@LIBINTL_DEP@,$LIBINTL_DEP,;t t +s,@INCINTL@,$INCINTL,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@POSUB@,$POSUB,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CROSS@,$CROSS,;t t +s,@ALL@,$ALL,;t t +s,@SYSTEM_HEADER_DIR@,$SYSTEM_HEADER_DIR,;t t +s,@inhibit_libc@,$inhibit_libc,;t t +s,@BUILD_PREFIX@,$BUILD_PREFIX,;t t +s,@BUILD_PREFIX_1@,$BUILD_PREFIX_1,;t t +s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t +s,@BUILD_CFLAGS@,$BUILD_CFLAGS,;t t +s,@STMP_FIXINC@,$STMP_FIXINC,;t t +s,@STMP_FIXPROTO@,$STMP_FIXPROTO,;t t +s,@libgcc_visibility@,$libgcc_visibility,;t t +s,@gthread_flags@,$gthread_flags,;t t +s,@GGC@,$GGC,;t t +s,@zlibdir@,$zlibdir,;t t +s,@zlibinc@,$zlibinc,;t t +s,@MAINT@,$MAINT,;t t +s,@gcc_tooldir@,$gcc_tooldir,;t t +s,@dollar@,$dollar,;t t +s,@slibdir@,$slibdir,;t t +s,@objdir@,$objdir,;t t +s,@subdirs@,$subdirs,;t t +s,@srcdir@,$srcdir,;t t +s,@all_boot_languages@,$all_boot_languages,;t t +s,@all_compilers@,$all_compilers,;t t +s,@all_gtfiles@,$all_gtfiles,;t t +s,@all_gtfiles_files_langs@,$all_gtfiles_files_langs,;t t +s,@all_gtfiles_files_files@,$all_gtfiles_files_files,;t t +s,@all_lang_makefrags@,$all_lang_makefrags,;t t +s,@all_lang_makefiles@,$all_lang_makefiles,;t t +s,@all_languages@,$all_languages,;t t +s,@all_stagestuff@,$all_stagestuff,;t t +s,@build_exeext@,$build_exeext,;t t +s,@build_install_headers_dir@,$build_install_headers_dir,;t t +s,@build_xm_file_list@,$build_xm_file_list,;t t +s,@build_xm_include_list@,$build_xm_include_list,;t t +s,@build_xm_defines@,$build_xm_defines,;t t +s,@check_languages@,$check_languages,;t t +s,@cc_set_by_configure@,$cc_set_by_configure,;t t +s,@quoted_cc_set_by_configure@,$quoted_cc_set_by_configure,;t t +s,@cpp_install_dir@,$cpp_install_dir,;t t +s,@xmake_file@,$xmake_file,;t t +s,@tmake_file@,$tmake_file,;t t +s,@extra_gcc_objs@,$extra_gcc_objs,;t t +s,@extra_headers_list@,$extra_headers_list,;t t +s,@extra_objs@,$extra_objs,;t t +s,@extra_parts@,$extra_parts,;t t +s,@extra_passes@,$extra_passes,;t t +s,@extra_programs@,$extra_programs,;t t +s,@float_h_file@,$float_h_file,;t t +s,@gcc_config_arguments@,$gcc_config_arguments,;t t +s,@gcc_gxx_include_dir@,$gcc_gxx_include_dir,;t t +s,@libstdcxx_incdir@,$libstdcxx_incdir,;t t +s,@gcc_version@,$gcc_version,;t t +s,@gcc_version_full@,$gcc_version_full,;t t +s,@gcc_version_trigger@,$gcc_version_trigger,;t t +s,@host_exeext@,$host_exeext,;t t +s,@host_xm_file_list@,$host_xm_file_list,;t t +s,@host_xm_include_list@,$host_xm_include_list,;t t +s,@host_xm_defines@,$host_xm_defines,;t t +s,@out_host_hook_obj@,$out_host_hook_obj,;t t +s,@install@,$install,;t t +s,@lang_opt_files@,$lang_opt_files,;t t +s,@lang_specs_files@,$lang_specs_files,;t t +s,@lang_tree_files@,$lang_tree_files,;t t +s,@local_prefix@,$local_prefix,;t t +s,@md_file@,$md_file,;t t +s,@objc_boehm_gc@,$objc_boehm_gc,;t t +s,@out_file@,$out_file,;t t +s,@out_object_file@,$out_object_file,;t t +s,@stage_prefix_set_by_configure@,$stage_prefix_set_by_configure,;t t +s,@quoted_stage_prefix_set_by_configure@,$quoted_stage_prefix_set_by_configure,;t t +s,@symbolic_link@,$symbolic_link,;t t +s,@thread_file@,$thread_file,;t t +s,@tm_file_list@,$tm_file_list,;t t +s,@tm_include_list@,$tm_include_list,;t t +s,@tm_defines@,$tm_defines,;t t +s,@tm_p_file_list@,$tm_p_file_list,;t t +s,@tm_p_include_list@,$tm_p_include_list,;t t +s,@xm_file_list@,$xm_file_list,;t t +s,@xm_include_list@,$xm_include_list,;t t +s,@xm_defines@,$xm_defines,;t t +s,@target_noncanonical@,$target_noncanonical,;t t +s,@c_target_objs@,$c_target_objs,;t t +s,@cxx_target_objs@,$cxx_target_objs,;t t +s,@target_cpu_default@,$target_cpu_default,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +/@language_hooks@/r $language_hooks +s,@language_hooks@,,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out fi - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -EOF +_ACEOF -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.defines >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines done -rm -f conftest.vals +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } -EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\_ACEOF -subdirs='$subdirs' -symbolic_link='$symbolic_link' +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - fi - ;; - esac - done +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi -case x$CONFIG_HEADERS in -xauto-host.h:config.in) -echo > cstamp-h ;; +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default ) +case ${CONFIG_HEADERS} in + *auto-host.h:config.in*) + echo > cstamp-h ;; +esac +# Make sure all the subdirs exist. +for d in $subdirs +do + test -d $d || mkdir $d +done # If the host supports symlinks, point stage[1234] at ../stage[1234] so # bootstrapping and the installation procedure can still use # CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, @@ -9146,28 +13136,48 @@ esac # This is virtually a duplicate of what happens in configure.lang; we do # an extra check to make sure this only happens if ln -s can be used. if test "$symbolic_link" = "ln -s"; then - for d in .. ${subdirs} fixinc ; do - if test $d != ..; then + for d in ${subdirs} fixinc ; do STARTDIR=`${PWDCMD-pwd}` cd $d - for t in stage1 stage2 stage3 stage4 include + for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include do rm -f $t $symbolic_link ../$t $t 2>/dev/null done cd $STARTDIR - fi done else true ; fi -# Avoid having to add intl to our include paths. -if test -f intl/libintl.h; then - echo creating libintl.h - echo '#include "intl/libintl.h"' >libintl.h + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } fi -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gcc/cp/except.c b/contrib/gcc/cp/except.c index 747cc1aaef69..c8112d1db130 100644 --- a/contrib/gcc/cp/except.c +++ b/contrib/gcc/cp/except.c @@ -1,30 +1,32 @@ /* Handle exceptional things in C++. Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Michael Tiemann Rewritten by Mike Stump , based upon an initial re-implementation courtesy Tad Hunt. -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. -GNU CC is distributed in the hope that it will be useful, +GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "tree.h" #include "rtl.h" #include "expr.h" @@ -36,29 +38,27 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "tree-inline.h" -static void push_eh_cleanup PARAMS ((tree)); -static tree prepare_eh_type PARAMS ((tree)); -static tree build_eh_type_type PARAMS ((tree)); -static tree do_begin_catch PARAMS ((void)); -static int dtor_nothrow PARAMS ((tree)); -static tree do_end_catch PARAMS ((tree)); -static void push_eh_cleanup PARAMS ((tree)); -static bool decl_is_java_type PARAMS ((tree decl, int err)); -static void initialize_handler_parm PARAMS ((tree, tree)); -static tree do_allocate_exception PARAMS ((tree)); -static tree stabilize_throw_expr PARAMS ((tree, tree *)); -static tree wrap_cleanups_r PARAMS ((tree *, int *, void *)); -static int complete_ptr_ref_or_void_ptr_p PARAMS ((tree, tree)); -static bool is_admissible_throw_operand PARAMS ((tree)); -static int can_convert_eh PARAMS ((tree, tree)); -static void check_handlers_1 PARAMS ((tree, tree)); -static tree cp_protect_cleanup_actions PARAMS ((void)); +static void push_eh_cleanup (tree); +static tree prepare_eh_type (tree); +static tree build_eh_type_type (tree); +static tree do_begin_catch (void); +static int dtor_nothrow (tree); +static tree do_end_catch (tree); +static bool decl_is_java_type (tree decl, int err); +static void initialize_handler_parm (tree, tree); +static tree do_allocate_exception (tree); +static tree wrap_cleanups_r (tree *, int *, void *); +static int complete_ptr_ref_or_void_ptr_p (tree, tree); +static bool is_admissible_throw_operand (tree); +static int can_convert_eh (tree, tree); +static void check_handlers_1 (tree, tree); +static tree cp_protect_cleanup_actions (void); /* Sets up all the global eh stuff that needs to be initialized at the start of compilation. */ void -init_exception_processing () +init_exception_processing (void) { tree tmp; @@ -88,7 +88,7 @@ init_exception_processing () propagated out of a cleanup region. */ static tree -cp_protect_cleanup_actions () +cp_protect_cleanup_actions (void) { /* [except.terminate] @@ -98,8 +98,7 @@ cp_protect_cleanup_actions () } static tree -prepare_eh_type (type) - tree type; +prepare_eh_type (tree type) { if (type == NULL_TREE) return type; @@ -107,8 +106,7 @@ prepare_eh_type (type) return error_mark_node; /* peel back references, so they match. */ - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); + type = non_reference (type); /* Peel off cv qualifiers. */ type = TYPE_MAIN_VARIANT (type); @@ -116,12 +114,9 @@ prepare_eh_type (type) return type; } -/* Build the address of a typeinfo decl for use in the runtime - matching field of the exception model. */ - -static tree -build_eh_type_type (type) - tree type; +/* Return the type info for TYPE as used by EH machinery. */ +tree +eh_type_info (tree type) { tree exp; @@ -133,14 +128,27 @@ build_eh_type_type (type) else exp = get_tinfo_decl (type); - mark_used (exp); - exp = build1 (ADDR_EXPR, ptr_type_node, exp); - return exp; } +/* Build the address of a typeinfo decl for use in the runtime + matching field of the exception model. */ + +static tree +build_eh_type_type (tree type) +{ + tree exp = eh_type_info (type); + + if (!exp) + return NULL; + + mark_used (exp); + + return build1 (ADDR_EXPR, ptr_type_node, exp); +} + tree -build_exc_ptr () +build_exc_ptr (void) { return build (EXC_PTR_EXPR, ptr_type_node); } @@ -149,14 +157,12 @@ build_exc_ptr () exception has been handled. */ static tree -do_begin_catch () +do_begin_catch (void) { tree fn; fn = get_identifier ("__cxa_begin_catch"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void* __cxa_begin_catch (void *). */ tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); @@ -171,8 +177,7 @@ do_begin_catch () NULL_TREE for a ... handler) will not throw an exception. */ static int -dtor_nothrow (type) - tree type; +dtor_nothrow (tree type) { if (type == NULL_TREE) return 0; @@ -187,15 +192,12 @@ dtor_nothrow (type) for the current catch block if no others are currently using it. */ static tree -do_end_catch (type) - tree type; +do_end_catch (tree type) { tree fn, cleanup; fn = get_identifier ("__cxa_end_catch"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void __cxa_end_catch (). */ fn = push_void_library_fn (fn, void_list_node); @@ -212,8 +214,7 @@ do_end_catch (type) /* This routine creates the cleanup for the current exception. */ static void -push_eh_cleanup (type) - tree type; +push_eh_cleanup (tree type) { finish_decl_cleanup (NULL_TREE, do_end_catch (type)); } @@ -222,9 +223,7 @@ push_eh_cleanup (type) throw. */ static bool -decl_is_java_type (decl, err) - tree decl; - int err; +decl_is_java_type (tree decl, int err) { bool r = (TREE_CODE (decl) == POINTER_TYPE && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE @@ -271,8 +270,7 @@ decl_is_java_type (decl, err) __gxx_personality_(sj|v)0 in init_exception_processing - should it be done here instead? */ void -choose_personality_routine (lang) - enum languages lang; +choose_personality_routine (enum languages lang) { static enum { chose_none, @@ -297,7 +295,7 @@ choose_personality_routine (lang) return; case chose_none: - ; /* proceed to language selection */ + ; /* Proceed to language selection. */ } switch (lang) @@ -326,9 +324,7 @@ choose_personality_routine (lang) /* Initialize the catch parameter DECL. */ static void -initialize_handler_parm (decl, exp) - tree decl; - tree exp; +initialize_handler_parm (tree decl, tree exp) { tree init; tree init_type; @@ -381,8 +377,7 @@ initialize_handler_parm (decl, exp) /* Call this to start a catch block. DECL is the catch parameter. */ tree -expand_start_catch_block (decl) - tree decl; +expand_start_catch_block (tree decl) { tree exp = NULL_TREE; tree type; @@ -449,7 +444,7 @@ expand_start_catch_block (decl) the label to jump to if this catch block didn't match. */ void -expand_end_catch_block () +expand_end_catch_block (void) { if (! doing_eh (1)) return; @@ -463,7 +458,7 @@ expand_end_catch_block () } tree -begin_eh_spec_block () +begin_eh_spec_block (void) { tree r = build_stmt (EH_SPEC_BLOCK, NULL_TREE, NULL_TREE); add_stmt (r); @@ -471,9 +466,7 @@ begin_eh_spec_block () } void -finish_eh_spec_block (raw_raises, eh_spec_block) - tree raw_raises; - tree eh_spec_block; +finish_eh_spec_block (tree raw_raises, tree eh_spec_block) { tree raises; @@ -483,8 +476,13 @@ finish_eh_spec_block (raw_raises, eh_spec_block) for (raises = NULL_TREE; raw_raises && TREE_VALUE (raw_raises); raw_raises = TREE_CHAIN (raw_raises)) - raises = tree_cons (NULL_TREE, prepare_eh_type (TREE_VALUE (raw_raises)), - raises); + { + tree type = prepare_eh_type (TREE_VALUE (raw_raises)); + tree tinfo = eh_type_info (type); + + mark_used (tinfo); + raises = tree_cons (NULL_TREE, type, raises); + } EH_SPEC_RAISES (eh_spec_block) = raises; } @@ -492,15 +490,12 @@ finish_eh_spec_block (raw_raises, eh_spec_block) /* Return a pointer to a buffer for an exception object of type TYPE. */ static tree -do_allocate_exception (type) - tree type; +do_allocate_exception (tree type) { tree fn; fn = get_identifier ("__cxa_allocate_exception"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void *__cxa_allocate_exception(size_t). */ tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); @@ -511,20 +506,16 @@ do_allocate_exception (type) NULL_TREE)); } -#if 0 /* Call __cxa_free_exception from a cleanup. This is never invoked directly, but see the comment for stabilize_throw_expr. */ static tree -do_free_exception (ptr) - tree ptr; +do_free_exception (tree ptr) { tree fn; fn = get_identifier ("__cxa_free_exception"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void __cxa_free_exception (void *). */ fn = push_void_library_fn (fn, tree_cons (NULL_TREE, ptr_type_node, @@ -533,16 +524,13 @@ do_free_exception (ptr) return build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE)); } -#endif /* Wrap all cleanups for TARGET_EXPRs in MUST_NOT_THROW_EXPR. Called from build_throw via walk_tree_without_duplicates. */ static tree -wrap_cleanups_r (tp, walk_subtrees, data) - tree *tp; - int *walk_subtrees ATTRIBUTE_UNUSED; - void *data ATTRIBUTE_UNUSED; +wrap_cleanups_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED) { tree exp = *tp; tree cleanup; @@ -559,7 +547,7 @@ wrap_cleanups_r (tp, walk_subtrees, data) cleanup = TARGET_EXPR_CLEANUP (exp); if (cleanup) { - cleanup = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (cleanup), cleanup); + cleanup = build1 (MUST_NOT_THROW_EXPR, void_type_node, cleanup); TARGET_EXPR_CLEANUP (exp) = cleanup; } @@ -567,65 +555,10 @@ wrap_cleanups_r (tp, walk_subtrees, data) return NULL_TREE; } -/* Like stabilize_expr, but specifically for a thrown expression. When - throwing a temporary class object, we want to construct it directly into - the thrown exception, so we look past the TARGET_EXPR and stabilize the - arguments of the call instead. - - The case where EXP is a call to a function returning a class is a bit of - a grey area in the standard; it's unclear whether or not it should be - allowed to throw. I'm going to say no, as that allows us to optimize - this case without worrying about deallocating the exception object if it - does. The alternatives would be either not optimizing this case, or - wrapping the initialization in a TRY_CATCH_EXPR to call do_free_exception - rather than in a MUST_NOT_THROW_EXPR, for this case only. */ - -static tree -stabilize_throw_expr (exp, initp) - tree exp; - tree *initp; -{ - tree init_expr; - - if (TREE_CODE (exp) == TARGET_EXPR - && TREE_CODE (TARGET_EXPR_INITIAL (exp)) == AGGR_INIT_EXPR - && flag_elide_constructors) - { - tree aggr_init = AGGR_INIT_EXPR_CHECK (TARGET_EXPR_INITIAL (exp)); - tree args = TREE_OPERAND (aggr_init, 1); - tree newargs = NULL_TREE; - tree *p = &newargs; - - init_expr = void_zero_node; - for (; args; args = TREE_CHAIN (args)) - { - tree arg = TREE_VALUE (args); - tree arg_init_expr; - - arg = stabilize_expr (arg, &arg_init_expr); - - if (TREE_SIDE_EFFECTS (arg_init_expr)) - init_expr = build (COMPOUND_EXPR, void_type_node, init_expr, - arg_init_expr); - *p = tree_cons (NULL_TREE, arg, NULL_TREE); - p = &TREE_CHAIN (*p); - } - TREE_OPERAND (aggr_init, 1) = newargs; - } - else - { - exp = stabilize_expr (exp, &init_expr); - } - - *initp = init_expr; - return exp; -} - /* Build a throw expression. */ tree -build_throw (exp) - tree exp; +build_throw (tree exp) { tree fn; @@ -633,7 +566,10 @@ build_throw (exp) return exp; if (processing_template_decl) - return build_min (THROW_EXPR, void_type_node, exp); + { + current_function_returns_abnormally = 1; + return build_min (THROW_EXPR, void_type_node, exp); + } if (exp == null_node) warning ("throwing NULL, which has integral, not pointer type"); @@ -650,16 +586,19 @@ build_throw (exp) if (exp && decl_is_java_type (TREE_TYPE (exp), 1)) { tree fn = get_identifier ("_Jv_Throw"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void _Jv_Throw (void *). */ tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = build_function_type (ptr_type_node, tmp); fn = push_throw_library_fn (fn, tmp); } - + else if (really_overloaded_fn (fn)) + { + error ("`%D' should never be overloaded", fn); + return error_mark_node; + } + fn = OVL_CURRENT (fn); exp = build_function_call (fn, tree_cons (NULL_TREE, exp, NULL_TREE)); } else if (exp) @@ -669,11 +608,10 @@ build_throw (exp) tree object, ptr; tree tmp; tree temp_expr, allocate_expr; + bool elided; fn = get_identifier ("__cxa_throw"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* The CLEANUP_TYPE is the internal type of a destructor. */ if (cleanup_type == NULL_TREE) @@ -711,11 +649,6 @@ build_throw (exp) the call to __cxa_allocate_exception first (which doesn't matter, since it can't throw). */ - /* Pre-evaluate the thrown expression first, since if we allocated - the space first we would have to deal with cleaning it up if - evaluating this expression throws. */ - exp = stabilize_throw_expr (exp, &temp_expr); - /* Allocate the space for the exception. */ allocate_expr = do_allocate_exception (TREE_TYPE (exp)); allocate_expr = get_target_expr (allocate_expr); @@ -723,6 +656,8 @@ build_throw (exp) object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr); object = build_indirect_ref (object, NULL); + elided = (TREE_CODE (exp) == TARGET_EXPR); + /* And initialize the exception object. */ exp = build_init (object, exp, LOOKUP_ONLYCONVERTING); if (exp == error_mark_node) @@ -731,10 +666,36 @@ build_throw (exp) return error_mark_node; } - exp = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (exp), exp); + /* Pre-evaluate the thrown expression first, since if we allocated + the space first we would have to deal with cleaning it up if + evaluating this expression throws. + + The case where EXP the initializer is a call to a constructor or a + function returning a class is a bit of a grey area in the + standard; it's unclear whether or not it should be allowed to + throw. We used to say no, as that allowed us to optimize this + case without worrying about deallocating the exception object if + it does. But that conflicted with expectations (PR 13944) and the + EDG compiler; now we wrap the initialization in a TRY_CATCH_EXPR + to call do_free_exception rather than in a MUST_NOT_THROW_EXPR, + for this case only. + + Note that we don't check the return value from stabilize_init + because it will only return false in cases where elided is true, + and therefore we don't need to work around the failure to + preevaluate. */ + temp_expr = NULL_TREE; + stabilize_init (exp, &temp_expr); + + if (elided) + exp = build (TRY_CATCH_EXPR, void_type_node, exp, + do_free_exception (ptr)); + else + exp = build1 (MUST_NOT_THROW_EXPR, void_type_node, exp); + /* Prepend the allocation. */ exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp); - if (temp_expr != void_zero_node) + if (temp_expr) { /* Prepend the calculation of the throw expression. Also, force any cleanups from the expression to be evaluated here so that @@ -778,9 +739,7 @@ build_throw (exp) /* Rethrow current exception. */ tree fn = get_identifier ("__cxa_rethrow"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else + if (!get_global_value_if_present (fn, &fn)) { /* Declare void __cxa_rethrow (void). */ fn = push_throw_library_fn @@ -803,9 +762,7 @@ build_throw (exp) the expr or decl from whence TYPE came, if available. */ static int -complete_ptr_ref_or_void_ptr_p (type, from) - tree type; - tree from; +complete_ptr_ref_or_void_ptr_p (tree type, tree from) { int is_ptr; @@ -833,8 +790,7 @@ complete_ptr_ref_or_void_ptr_p (type, from) a type or of an abstract class type. */ static bool -is_admissible_throw_operand (expr) - tree expr; +is_admissible_throw_operand (tree expr) { tree type = TREE_TYPE (expr); @@ -871,8 +827,7 @@ is_admissible_throw_operand (expr) #include "cfns.h" int -nothrow_libfn_p (fn) - tree fn; +nothrow_libfn_p (tree fn) { tree id; @@ -893,13 +848,10 @@ nothrow_libfn_p (fn) handler for type TO, as per [except.handle]. */ static int -can_convert_eh (to, from) - tree to, from; +can_convert_eh (tree to, tree from) { - if (TREE_CODE (to) == REFERENCE_TYPE) - to = TREE_TYPE (to); - if (TREE_CODE (from) == REFERENCE_TYPE) - from = TREE_TYPE (from); + to = non_reference (to); + from = non_reference (from); if (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE) { @@ -912,7 +864,7 @@ can_convert_eh (to, from) if (TREE_CODE (to) == VOID_TYPE) return 1; - /* else fall through */ + /* Else fall through. */ } if (CLASS_TYPE_P (to) && CLASS_TYPE_P (from) @@ -929,9 +881,7 @@ can_convert_eh (to, from) for B would catch an exception of type C. */ static void -check_handlers_1 (master, handlers) - tree master; - tree handlers; +check_handlers_1 (tree master, tree handlers) { tree type = TREE_TYPE (master); tree handler; @@ -940,10 +890,10 @@ check_handlers_1 (master, handlers) if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler))) { - lineno = STMT_LINENO (handler); + input_line = STMT_LINENO (handler); warning ("exception of type `%T' will be caught", TREE_TYPE (handler)); - lineno = STMT_LINENO (master); + input_line = STMT_LINENO (master); warning (" by earlier handler for `%T'", type); break; } @@ -952,23 +902,23 @@ check_handlers_1 (master, handlers) /* Given a chain of HANDLERs, make sure that they're OK. */ void -check_handlers (handlers) - tree handlers; +check_handlers (tree handlers) { tree handler; - int save_line = lineno; + int save_line = input_line; + for (handler = handlers; handler; handler = TREE_CHAIN (handler)) { if (TREE_CHAIN (handler) == NULL_TREE) /* No more handlers; nothing to shadow. */; else if (TREE_TYPE (handler) == NULL_TREE) { - lineno = STMT_LINENO (handler); + input_line = STMT_LINENO (handler); pedwarn ("`...' handler must be the last handler for its try block"); } else check_handlers_1 (handler, TREE_CHAIN (handler)); } - lineno = save_line; + input_line = save_line; } diff --git a/contrib/gcc/cppinit.c b/contrib/gcc/cppinit.c index 3b0175f49262..6ea1ca21d224 100644 --- a/contrib/gcc/cppinit.c +++ b/contrib/gcc/cppinit.c @@ -1,6 +1,6 @@ /* CPP Library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -25,99 +25,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "system.h" #include "cpplib.h" #include "cpphash.h" -#include "prefix.h" -#include "intl.h" #include "mkdeps.h" -#include "cppdefault.h" -/* Windows does not natively support inodes, and neither does MSDOS. - Cygwin's emulation can generate non-unique inodes, so don't use it. - VMS has non-numeric inodes. */ -#ifdef VMS -# define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A))) -# define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC)) -#else -# if (defined _WIN32 && ! defined (_UWIN)) || defined __MSDOS__ -# define INO_T_EQ(A, B) 0 -# else -# define INO_T_EQ(A, B) ((A) == (B)) -# endif -# define INO_T_COPY(DEST, SRC) (DEST) = (SRC) -#endif - -/* Internal structures and prototypes. */ - -/* A `struct pending_option' remembers one -D, -A, -U, -include, or - -imacros switch. */ -typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *)); -struct pending_option -{ - struct pending_option *next; - const char *arg; - cl_directive_handler handler; -}; - -/* The `pending' structure accumulates all the options that are not - actually processed until we hit cpp_read_main_file. It consists of - several lists, one for each type of option. We keep both head and - tail pointers for quick insertion. */ -struct cpp_pending -{ - struct pending_option *directive_head, *directive_tail; - - struct search_path *quote_head, *quote_tail; - struct search_path *brack_head, *brack_tail; - struct search_path *systm_head, *systm_tail; - struct search_path *after_head, *after_tail; - - struct pending_option *imacros_head, *imacros_tail; - struct pending_option *include_head, *include_tail; -}; - -#ifdef __STDC__ -#define APPEND(pend, list, elt) \ - do { if (!(pend)->list##_head) (pend)->list##_head = (elt); \ - else (pend)->list##_tail->next = (elt); \ - (pend)->list##_tail = (elt); \ - } while (0) -#else -#define APPEND(pend, list, elt) \ - do { if (!(pend)->list/**/_head) (pend)->list/**/_head = (elt); \ - else (pend)->list/**/_tail->next = (elt); \ - (pend)->list/**/_tail = (elt); \ - } while (0) -#endif - -static void path_include PARAMS ((cpp_reader *, - char *, int)); -static void init_library PARAMS ((void)); -static void init_builtins PARAMS ((cpp_reader *)); -static void mark_named_operators PARAMS ((cpp_reader *)); -static void append_include_chain PARAMS ((cpp_reader *, - char *, int, int)); -static struct search_path * remove_dup_dir PARAMS ((cpp_reader *, - struct search_path *, - struct search_path **)); -static struct search_path * remove_dup_nonsys_dirs PARAMS ((cpp_reader *, - struct search_path **, - struct search_path *)); -static struct search_path * remove_dup_dirs PARAMS ((cpp_reader *, - struct search_path **)); -static void merge_include_chains PARAMS ((cpp_reader *)); -static bool push_include PARAMS ((cpp_reader *, - struct pending_option *)); -static void free_chain PARAMS ((struct pending_option *)); -static void init_standard_includes PARAMS ((cpp_reader *)); -static void read_original_filename PARAMS ((cpp_reader *)); -static void new_pending_directive PARAMS ((struct cpp_pending *, - const char *, - cl_directive_handler)); -static int parse_option PARAMS ((const char *)); -static void post_options PARAMS ((cpp_reader *)); - -/* Fourth argument to append_include_chain: chain to use. - Note it's never asked to append to the quote chain. */ -enum { BRACKET = 0, SYSTEM, AFTER }; +static void init_library (void); +static void mark_named_operators (cpp_reader *); +static void read_original_filename (cpp_reader *); +static void read_original_directory (cpp_reader *); +static void post_options (cpp_reader *); /* If we have designated initializers (GCC >2.7) these tables can be initialized, constant data. Otherwise, they have to be filled in at @@ -134,7 +48,7 @@ __extension__ const uchar _cpp_trigraph_map[UCHAR_MAX + 1] = { #else #define TRIGRAPH_MAP uchar _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \ - static void init_trigraph_map PARAMS ((void)) { \ + static void init_trigraph_map (void) { \ unsigned char *x = _cpp_trigraph_map; #define END } @@ -152,281 +66,6 @@ END #undef END #undef TRIGRAPH_MAP -/* Given a colon-separated list of file names PATH, - add all the names to the search path for include files. */ -static void -path_include (pfile, list, path) - cpp_reader *pfile; - char *list; - int path; -{ - char *p, *q, *name; - - p = list; - - do - { - /* Find the end of this name. */ - q = p; - while (*q != 0 && *q != PATH_SEPARATOR) q++; - if (q == p) - { - /* An empty name in the path stands for the current directory. */ - name = (char *) xmalloc (2); - name[0] = '.'; - name[1] = 0; - } - else - { - /* Otherwise use the directory that is named. */ - name = (char *) xmalloc (q - p + 1); - memcpy (name, p, q - p); - name[q - p] = 0; - } - - append_include_chain (pfile, name, path, path == SYSTEM); - - /* Advance past this name. */ - if (*q == 0) - break; - p = q + 1; - } - while (1); -} - -/* Append DIR to include path PATH. DIR must be allocated on the - heap; this routine takes responsibility for freeing it. CXX_AWARE - is nonzero if the header contains extern "C" guards for C++, - otherwise it is zero. */ -static void -append_include_chain (pfile, dir, path, cxx_aware) - cpp_reader *pfile; - char *dir; - int path; - int cxx_aware; -{ - struct cpp_pending *pend = CPP_OPTION (pfile, pending); - struct search_path *new; - struct stat st; - unsigned int len; - - if (*dir == '\0') - { - free (dir); - dir = xstrdup ("."); - } - _cpp_simplify_pathname (dir); - - if (stat (dir, &st)) - { - /* Dirs that don't exist are silently ignored. */ - if (errno != ENOENT) - cpp_errno (pfile, DL_ERROR, dir); - else if (CPP_OPTION (pfile, verbose)) - fprintf (stderr, _("ignoring nonexistent directory \"%s\"\n"), dir); - free (dir); - return; - } - - if (!S_ISDIR (st.st_mode)) - { - cpp_error_with_line (pfile, DL_ERROR, 0, 0, "%s: Not a directory", dir); - free (dir); - return; - } - - len = strlen (dir); - if (len > pfile->max_include_len) - pfile->max_include_len = len; - - new = (struct search_path *) xmalloc (sizeof (struct search_path)); - new->name = dir; - new->len = len; - INO_T_COPY (new->ino, st.st_ino); - new->dev = st.st_dev; - /* Both systm and after include file lists should be treated as system - include files since these two lists are really just a concatenation - of one "system" list. */ - if (path == SYSTEM || path == AFTER) - new->sysp = cxx_aware ? 1 : 2; - else - new->sysp = 0; - new->name_map = NULL; - new->next = NULL; - - switch (path) - { - case BRACKET: APPEND (pend, brack, new); break; - case SYSTEM: APPEND (pend, systm, new); break; - case AFTER: APPEND (pend, after, new); break; - } -} - -/* Handle a duplicated include path. PREV is the link in the chain - before the duplicate, or NULL if the duplicate is at the head of - the chain. The duplicate is removed from the chain and freed. - Returns PREV. */ -static struct search_path * -remove_dup_dir (pfile, prev, head_ptr) - cpp_reader *pfile; - struct search_path *prev; - struct search_path **head_ptr; -{ - struct search_path *cur; - - if (prev != NULL) - { - cur = prev->next; - prev->next = cur->next; - } - else - { - cur = *head_ptr; - *head_ptr = cur->next; - } - - if (CPP_OPTION (pfile, verbose)) - fprintf (stderr, _("ignoring duplicate directory \"%s\"\n"), cur->name); - - free ((PTR) cur->name); - free (cur); - - return prev; -} - -/* Remove duplicate non-system directories for which there is an equivalent - system directory latter in the chain. The range for removal is between - *HEAD_PTR and END. Returns the directory before END, or NULL if none. - This algorithm is quadratic in the number system directories, which is - acceptable since there aren't usually that many of them. */ -static struct search_path * -remove_dup_nonsys_dirs (pfile, head_ptr, end) - cpp_reader *pfile; - struct search_path **head_ptr; - struct search_path *end; -{ - int sysdir = 0; - struct search_path *prev = NULL, *cur, *other; - - for (cur = *head_ptr; cur; cur = cur->next) - { - if (cur->sysp) - { - sysdir = 1; - for (other = *head_ptr, prev = NULL; - other != end; - other = other ? other->next : *head_ptr) - { - if (!other->sysp - && INO_T_EQ (cur->ino, other->ino) - && cur->dev == other->dev) - { - other = remove_dup_dir (pfile, prev, head_ptr); - if (CPP_OPTION (pfile, verbose)) - fprintf (stderr, - _(" as it is a non-system directory that duplicates a system directory\n")); - } - prev = other; - } - } - } - - if (!sysdir) - for (cur = *head_ptr; cur != end; cur = cur->next) - prev = cur; - - return prev; -} - -/* Remove duplicate directories from a chain. Returns the tail of the - chain, or NULL if the chain is empty. This algorithm is quadratic - in the number of -I switches, which is acceptable since there - aren't usually that many of them. */ -static struct search_path * -remove_dup_dirs (pfile, head_ptr) - cpp_reader *pfile; - struct search_path **head_ptr; -{ - struct search_path *prev = NULL, *cur, *other; - - for (cur = *head_ptr; cur; cur = cur->next) - { - for (other = *head_ptr; other != cur; other = other->next) - if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev) - { - cur = remove_dup_dir (pfile, prev, head_ptr); - break; - } - prev = cur; - } - - return prev; -} - -/* Merge the four include chains together in the order quote, bracket, - system, after. Remove duplicate dirs (as determined by - INO_T_EQ()). The system_include and after_include chains are never - referred to again after this function; all access is through the - bracket_include path. */ -static void -merge_include_chains (pfile) - cpp_reader *pfile; -{ - struct search_path *quote, *brack, *systm, *qtail; - - struct cpp_pending *pend = CPP_OPTION (pfile, pending); - - quote = pend->quote_head; - brack = pend->brack_head; - systm = pend->systm_head; - qtail = pend->quote_tail; - - /* Paste together bracket, system, and after include chains. */ - if (systm) - pend->systm_tail->next = pend->after_head; - else - systm = pend->after_head; - - if (brack) - pend->brack_tail->next = systm; - else - brack = systm; - - /* This is a bit tricky. First we drop non-system dupes of system - directories from the merged bracket-include list. Next we drop - dupes from the bracket and quote include lists. Then we drop - non-system dupes from the merged quote-include list. Finally, - if qtail and brack are the same directory, we cut out brack and - move brack up to point to qtail. - - We can't just merge the lists and then uniquify them because - then we may lose directories from the <> search path that should - be there; consider -Ifoo -Ibar -I- -Ifoo -Iquux. It is however - safe to treat -Ibar -Ifoo -I- -Ifoo -Iquux as if written - -Ibar -I- -Ifoo -Iquux. */ - - remove_dup_nonsys_dirs (pfile, &brack, systm); - remove_dup_dirs (pfile, &brack); - - if (quote) - { - qtail = remove_dup_dirs (pfile, "e); - qtail->next = brack; - - qtail = remove_dup_nonsys_dirs (pfile, "e, brack); - - /* If brack == qtail, remove brack as it's simpler. */ - if (qtail && brack && INO_T_EQ (qtail->ino, brack->ino) - && qtail->dev == brack->dev) - brack = remove_dup_dir (pfile, qtail, "e); - } - else - quote = brack; - - CPP_OPTION (pfile, quote_include) = quote; - CPP_OPTION (pfile, bracket_include) = brack; -} - /* A set of booleans indicating what CPP features each source language requires. */ struct lang_flags @@ -435,29 +74,25 @@ struct lang_flags char cplusplus; char extended_numbers; char std; - char dollars_in_ident; char cplusplus_comments; char digraphs; }; -/* ??? Enable $ in identifiers in assembly? */ static const struct lang_flags lang_defaults[] = -{ /* c99 c++ xnum std dollar c++comm digr */ - /* GNUC89 */ { 0, 0, 1, 0, 1, 1, 1 }, - /* GNUC99 */ { 1, 0, 1, 0, 1, 1, 1 }, - /* STDC89 */ { 0, 0, 0, 1, 0, 0, 0 }, - /* STDC94 */ { 0, 0, 0, 1, 0, 0, 1 }, - /* STDC99 */ { 1, 0, 1, 1, 0, 1, 1 }, - /* GNUCXX */ { 0, 1, 1, 0, 1, 1, 1 }, - /* CXX98 */ { 0, 1, 1, 1, 0, 1, 1 }, - /* ASM */ { 0, 0, 1, 0, 0, 1, 0 } +{ /* c99 c++ xnum std // digr */ + /* GNUC89 */ { 0, 0, 1, 0, 1, 1 }, + /* GNUC99 */ { 1, 0, 1, 0, 1, 1 }, + /* STDC89 */ { 0, 0, 0, 1, 0, 0 }, + /* STDC94 */ { 0, 0, 0, 1, 0, 1 }, + /* STDC99 */ { 1, 0, 1, 1, 1, 1 }, + /* GNUCXX */ { 0, 1, 1, 0, 1, 1 }, + /* CXX98 */ { 0, 1, 1, 1, 1, 1 }, + /* ASM */ { 0, 0, 1, 0, 1, 0 } }; /* Sets internal flags correctly for a given language. */ void -cpp_set_lang (pfile, lang) - cpp_reader *pfile; - enum c_lang lang; +cpp_set_lang (cpp_reader *pfile, enum c_lang lang) { const struct lang_flags *l = &lang_defaults[(int) lang]; @@ -468,28 +103,13 @@ cpp_set_lang (pfile, lang) CPP_OPTION (pfile, extended_numbers) = l->extended_numbers; CPP_OPTION (pfile, std) = l->std; CPP_OPTION (pfile, trigraphs) = l->std; - CPP_OPTION (pfile, dollars_in_ident) = l->dollars_in_ident; CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments; CPP_OPTION (pfile, digraphs) = l->digraphs; } -#ifdef HOST_EBCDIC -static int opt_comp PARAMS ((const void *, const void *)); - -/* Run-time sorting of options array. */ -static int -opt_comp (p1, p2) - const void *p1, *p2; -{ - return strcmp (((struct cl_option *) p1)->opt_text, - ((struct cl_option *) p2)->opt_text); -} -#endif - -/* init initializes library global state. It might not need to - do anything depending on the platform and compiler. */ +/* Initialize library global state. */ static void -init_library () +init_library (void) { static int initialized = 0; @@ -497,12 +117,6 @@ init_library () { initialized = 1; -#ifdef HOST_EBCDIC - /* For non-ASCII hosts, the cl_options array needs to be sorted at - runtime. */ - qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp); -#endif - /* Set up the trigraph map. This doesn't need to do anything if we were compiled with a compiler that supports C99 designated initializers. */ @@ -512,29 +126,28 @@ init_library () /* Initialize a cpp_reader structure. */ cpp_reader * -cpp_create_reader (lang) - enum c_lang lang; +cpp_create_reader (enum c_lang lang, hash_table *table) { cpp_reader *pfile; /* Initialize this instance of the library if it hasn't been already. */ init_library (); - pfile = (cpp_reader *) xcalloc (1, sizeof (cpp_reader)); + pfile = xcalloc (1, sizeof (cpp_reader)); cpp_set_lang (pfile, lang); - CPP_OPTION (pfile, warn_import) = 1; CPP_OPTION (pfile, warn_multichar) = 1; CPP_OPTION (pfile, discard_comments) = 1; CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1; CPP_OPTION (pfile, show_column) = 1; CPP_OPTION (pfile, tabstop) = 8; CPP_OPTION (pfile, operator_names) = 1; + CPP_OPTION (pfile, warn_trigraphs) = 2; CPP_OPTION (pfile, warn_endif_labels) = 1; + CPP_OPTION (pfile, warn_deprecated) = 1; CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99); - - CPP_OPTION (pfile, pending) = - (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending)); + CPP_OPTION (pfile, dollars_in_ident) = 1; + CPP_OPTION (pfile, warn_dollars) = 1; /* Default CPP arithmetic to something sensible for the host for the benefit of dumb users like fix-header. */ @@ -544,10 +157,22 @@ cpp_create_reader (lang) CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int); CPP_OPTION (pfile, unsigned_char) = 0; CPP_OPTION (pfile, unsigned_wchar) = 1; + CPP_OPTION (pfile, bytes_big_endian) = 1; /* does not matter */ + + /* Default to locale/UTF-8. */ + CPP_OPTION (pfile, narrow_charset) = _cpp_default_encoding (); + CPP_OPTION (pfile, wide_charset) = 0; + CPP_OPTION (pfile, input_charset) = _cpp_default_encoding (); + + /* A fake empty "directory" used as the starting point for files + looked up without a search path. Name cannot be '/' because we + don't want to prepend anything at all to filenames using it. All + other entries are correct zero-initialized. */ + pfile->no_search_path.name = (char *) ""; /* Initialize the line map. Start at logical line 1, so we can use a line number of zero for special states. */ - init_line_maps (&pfile->line_maps); + linemap_init (&pfile->line_maps); pfile->line = 1; /* Initialize lexer state. */ @@ -577,9 +202,13 @@ cpp_create_reader (lang) _cpp_expand_op_stack (pfile); /* Initialize the buffer obstack. */ - gcc_obstack_init (&pfile->buffer_ob); + _obstack_begin (&pfile->buffer_ob, 0, 0, + (void *(*) (long)) xmalloc, + (void (*) (void *)) free); - _cpp_init_includes (pfile); + _cpp_init_files (pfile); + + _cpp_init_hashtable (pfile, table); return pfile; } @@ -587,15 +216,11 @@ cpp_create_reader (lang) /* Free resources used by PFILE. Accessing PFILE after this function returns leads to undefined behavior. Returns the error count. */ void -cpp_destroy (pfile) - cpp_reader *pfile; +cpp_destroy (cpp_reader *pfile) { - struct search_path *dir, *dirn; cpp_context *context, *contextn; tokenrun *run, *runn; - free_chain (CPP_OPTION (pfile, pending)->include_head); - free (CPP_OPTION (pfile, pending)); free (pfile->op_stack); while (CPP_BUFFER (pfile) != NULL) @@ -606,7 +231,7 @@ cpp_destroy (pfile) if (pfile->macro_buffer) { - free ((PTR) pfile->macro_buffer); + free (pfile->macro_buffer); pfile->macro_buffer = NULL; pfile->macro_buffer_len = 0; } @@ -616,7 +241,8 @@ cpp_destroy (pfile) obstack_free (&pfile->buffer_ob, 0); _cpp_destroy_hashtable (pfile); - _cpp_cleanup_includes (pfile); + _cpp_cleanup_files (pfile); + _cpp_destroy_iconv (pfile); _cpp_free_buff (pfile->a_buff); _cpp_free_buff (pfile->u_buff); @@ -630,20 +256,13 @@ cpp_destroy (pfile) free (run); } - for (dir = CPP_OPTION (pfile, quote_include); dir; dir = dirn) - { - dirn = dir->next; - free ((PTR) dir->name); - free (dir); - } - for (context = pfile->base_context.next; context; context = contextn) { contextn = context->next; free (context); } - free_line_maps (&pfile->line_maps); + linemap_free (&pfile->line_maps); free (pfile); } @@ -701,8 +320,7 @@ static const struct builtin operator_array[] = /* Mark the C++ named operators in the hash table. */ static void -mark_named_operators (pfile) - cpp_reader *pfile; +mark_named_operators (cpp_reader *pfile) { const struct builtin *b; @@ -712,15 +330,16 @@ mark_named_operators (pfile) { cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len); hp->flags |= NODE_OPERATOR; - hp->value.operator = b->value; + hp->is_directive = 0; + hp->directive_index = b->value; } } -/* Subroutine of cpp_read_main_file; reads the builtins table above and - enters them, and language-specific macros, into the hash table. */ -static void -init_builtins (pfile) - cpp_reader *pfile; +/* Read the builtins table above and enter them, and language-specific + macros, into the hash table. HOSTED is true if this is a hosted + environment. */ +void +cpp_init_builtins (cpp_reader *pfile, int hosted) { const struct builtin *b; size_t n = ARRAY_SIZE (builtin_array); @@ -745,143 +364,20 @@ init_builtins (pfile) else if (CPP_OPTION (pfile, c99)) _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); + if (hosted) + _cpp_define_builtin (pfile, "__STDC_HOSTED__ 1"); + else + _cpp_define_builtin (pfile, "__STDC_HOSTED__ 0"); + if (CPP_OPTION (pfile, objc)) _cpp_define_builtin (pfile, "__OBJC__ 1"); - - if (pfile->cb.register_builtins) - (*pfile->cb.register_builtins) (pfile); -} - -/* And another subroutine. This one sets up the standard include path. */ -static void -init_standard_includes (pfile) - cpp_reader *pfile; -{ - char *path; - const struct default_include *p; - const char *specd_prefix = CPP_OPTION (pfile, include_prefix); - - /* Several environment variables may add to the include search path. - CPATH specifies an additional list of directories to be searched - as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, - etc. specify an additional list of directories to be searched as - if specified with -isystem, for the language indicated. */ - - GET_ENVIRONMENT (path, "CPATH"); - if (path != 0 && *path != 0) - path_include (pfile, path, BRACKET); - - switch ((CPP_OPTION (pfile, objc) << 1) + CPP_OPTION (pfile, cplusplus)) - { - case 0: - GET_ENVIRONMENT (path, "C_INCLUDE_PATH"); - break; - case 1: - GET_ENVIRONMENT (path, "CPLUS_INCLUDE_PATH"); - break; - case 2: - GET_ENVIRONMENT (path, "OBJC_INCLUDE_PATH"); - break; - case 3: - GET_ENVIRONMENT (path, "OBJCPLUS_INCLUDE_PATH"); - break; - } - if (path != 0 && *path != 0) - path_include (pfile, path, SYSTEM); - - /* Search "translated" versions of GNU directories. - These have /usr/local/lib/gcc... replaced by specd_prefix. */ - if (specd_prefix != 0 && cpp_GCC_INCLUDE_DIR_len) - { - /* Remove the `include' from /usr/local/lib/gcc.../include. - GCC_INCLUDE_DIR will always end in /include. */ - int default_len = cpp_GCC_INCLUDE_DIR_len; - char *default_prefix = (char *) alloca (default_len + 1); - int specd_len = strlen (specd_prefix); - - memcpy (default_prefix, cpp_GCC_INCLUDE_DIR, default_len); - default_prefix[default_len] = '\0'; - - for (p = cpp_include_defaults; p->fname; p++) - { - /* Some standard dirs are only for C++. */ - if (!p->cplusplus - || (CPP_OPTION (pfile, cplusplus) - && !CPP_OPTION (pfile, no_standard_cplusplus_includes))) - { - /* Does this dir start with the prefix? */ - if (!strncmp (p->fname, default_prefix, default_len)) - { - /* Yes; change prefix and add to search list. */ - int flen = strlen (p->fname); - int this_len = specd_len + flen - default_len; - char *str = (char *) xmalloc (this_len + 1); - memcpy (str, specd_prefix, specd_len); - memcpy (str + specd_len, - p->fname + default_len, - flen - default_len + 1); - - append_include_chain (pfile, str, SYSTEM, p->cxx_aware); - } - } - } - } - - /* Search ordinary names for GNU include directories. */ - for (p = cpp_include_defaults; p->fname; p++) - { - /* Some standard dirs are only for C++. */ - if (!p->cplusplus - || (CPP_OPTION (pfile, cplusplus) - && !CPP_OPTION (pfile, no_standard_cplusplus_includes))) - { - char *str = update_path (p->fname, p->component); - append_include_chain (pfile, str, SYSTEM, p->cxx_aware); - } - } -} - -/* Pushes a command line -imacro and -include file indicated by P onto - the buffer stack. Returns nonzero if successful. */ -static bool -push_include (pfile, p) - cpp_reader *pfile; - struct pending_option *p; -{ - cpp_token header; - - /* Later: maybe update this to use the #include "" search path - if cpp_read_file fails. */ - header.type = CPP_STRING; - header.val.str.text = (const unsigned char *) p->arg; - header.val.str.len = strlen (p->arg); - /* Make the command line directive take up a line. */ - pfile->line++; - - return _cpp_execute_include (pfile, &header, IT_CMDLINE); -} - -/* Frees a pending_option chain. */ -static void -free_chain (head) - struct pending_option *head; -{ - struct pending_option *next; - - while (head) - { - next = head->next; - free (head); - head = next; - } } /* Sanity-checks are dependent on command-line options, so it is called as a subroutine of cpp_read_main_file (). */ #if ENABLE_CHECKING -static void sanity_checks PARAMS ((cpp_reader *)); -static void sanity_checks (pfile) - cpp_reader *pfile; +static void sanity_checks (cpp_reader *); +static void sanity_checks (cpp_reader *pfile) { cppchar_t test = 0; size_t max_precision = 2 * CHAR_BIT * sizeof (cpp_num_part); @@ -890,36 +386,39 @@ static void sanity_checks (pfile) type precisions made by cpplib. */ test--; if (test < 1) - cpp_error (pfile, DL_ICE, "cppchar_t must be an unsigned type"); + cpp_error (pfile, CPP_DL_ICE, "cppchar_t must be an unsigned type"); if (CPP_OPTION (pfile, precision) > max_precision) - cpp_error (pfile, DL_ICE, - "preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits", + cpp_error (pfile, CPP_DL_ICE, + "preprocessor arithmetic has maximum precision of %lu bits;" + " target requires %lu bits", (unsigned long) max_precision, (unsigned long) CPP_OPTION (pfile, precision)); if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_precision)) - cpp_error (pfile, DL_ICE, + cpp_error (pfile, CPP_DL_ICE, "CPP arithmetic must be at least as precise as a target int"); if (CPP_OPTION (pfile, char_precision) < 8) - cpp_error (pfile, DL_ICE, "target char is less than 8 bits wide"); + cpp_error (pfile, CPP_DL_ICE, "target char is less than 8 bits wide"); if (CPP_OPTION (pfile, wchar_precision) < CPP_OPTION (pfile, char_precision)) - cpp_error (pfile, DL_ICE, + cpp_error (pfile, CPP_DL_ICE, "target wchar_t is narrower than target char"); if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision)) - cpp_error (pfile, DL_ICE, + cpp_error (pfile, CPP_DL_ICE, "target int is narrower than target char"); /* This is assumed in eval_token() and could be fixed if necessary. */ if (sizeof (cppchar_t) > sizeof (cpp_num_part)) - cpp_error (pfile, DL_ICE, "CPP half-integer narrower than CPP character"); + cpp_error (pfile, CPP_DL_ICE, + "CPP half-integer narrower than CPP character"); if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T) - cpp_error (pfile, DL_ICE, - "CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits", + cpp_error (pfile, CPP_DL_ICE, + "CPP on this host cannot handle wide character constants over" + " %lu bits, but the target requires %lu bits", (unsigned long) BITS_PER_CPPCHAR_T, (unsigned long) CPP_OPTION (pfile, wchar_precision)); } @@ -931,10 +430,7 @@ static void sanity_checks (pfile) cpp_read_main_file(). If no targets have been added before cpp_read_main_file(), then the default target is used. */ void -cpp_add_dependency_target (pfile, target, quote) - cpp_reader *pfile; - const char *target; - int quote; +cpp_add_dependency_target (cpp_reader *pfile, const char *target, int quote) { if (!pfile->deps) pfile->deps = deps_init (); @@ -943,44 +439,25 @@ cpp_add_dependency_target (pfile, target, quote) } /* This is called after options have been parsed, and partially - processed. Setup for processing input from the file named FNAME, - or stdin if it is the empty string. Return the original filename - on success (e.g. foo.i->foo.c), or NULL on failure. */ -const char * -cpp_read_main_file (pfile, fname, table) - cpp_reader *pfile; - const char *fname; - hash_table *table; + processed. */ +void +cpp_post_options (cpp_reader *pfile) { sanity_checks (pfile); post_options (pfile); - /* The front ends don't set up the hash table until they have - finished processing the command line options, so initializing the - hashtable is deferred until now. */ - _cpp_init_hashtable (pfile, table); - - /* Set up the include search path now. */ - if (! CPP_OPTION (pfile, no_standard_includes)) - init_standard_includes (pfile); - - merge_include_chains (pfile); - - /* With -v, print the list of dirs to search. */ - if (CPP_OPTION (pfile, verbose)) - { - struct search_path *l; - fprintf (stderr, _("#include \"...\" search starts here:\n")); - for (l = CPP_OPTION (pfile, quote_include); l; l = l->next) - { - if (l == CPP_OPTION (pfile, bracket_include)) - fprintf (stderr, _("#include <...> search starts here:\n")); - fprintf (stderr, " %s\n", l->name); - } - fprintf (stderr, _("End of search list.\n")); - } + /* Mark named operators before handling command line macros. */ + if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names)) + mark_named_operators (pfile); +} +/* Setup for processing input from the file named FNAME, or stdin if + it is the empty string. Return the original filename + on success (e.g. foo.i->foo.c), or NULL on failure. */ +const char * +cpp_read_main_file (cpp_reader *pfile, const char *fname) +{ if (CPP_OPTION (pfile, deps.style) != DEPS_NONE) { if (!pfile->deps) @@ -990,21 +467,21 @@ cpp_read_main_file (pfile, fname, table) deps_add_default_target (pfile->deps, fname); } - /* Open the main input file. */ - if (!_cpp_read_file (pfile, fname)) + pfile->main_file + = _cpp_find_file (pfile, fname, &pfile->no_search_path, false); + if (_cpp_find_failed (pfile->main_file)) return NULL; - /* Set this here so the client can change the option if it wishes, - and after stacking the main file so we don't trace the main - file. */ - pfile->line_maps.trace_includes = CPP_OPTION (pfile, print_include_names); + _cpp_stack_file (pfile, pfile->main_file, false); /* For foo.i, read the original filename foo.c now, for the benefit of the front ends. */ if (CPP_OPTION (pfile, preprocessed)) - read_original_filename (pfile); - - return pfile->map->to_file; + { + read_original_filename (pfile); + fname = pfile->map->to_file; + } + return fname; } /* For preprocessed files, if the first tokens are of the form # NUM. @@ -1012,8 +489,7 @@ cpp_read_main_file (pfile, fname, table) generate file_change callbacks, which the front ends must handle appropriately given their state of initialization. */ static void -read_original_filename (pfile) - cpp_reader *pfile; +read_original_filename (cpp_reader *pfile) { const cpp_token *token, *token1; @@ -1029,6 +505,7 @@ read_original_filename (pfile) if (token1->type == CPP_NUMBER) { _cpp_handle_directive (pfile, token->flags & PREV_WHITE); + read_original_directory (pfile); return; } } @@ -1037,83 +514,62 @@ read_original_filename (pfile) _cpp_backup_tokens (pfile, 1); } -/* Handle pending command line options: -D, -U, -A, -imacros and - -include. This should be called after debugging has been properly - set up in the front ends. */ -void -cpp_finish_options (pfile) - cpp_reader *pfile; +/* For preprocessed files, if the tokens following the first filename + line is of the form # "/path/name//", handle the + directive so we know the original current directory. */ +static void +read_original_directory (cpp_reader *pfile) { - /* Mark named operators before handling command line macros. */ - if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names)) - mark_named_operators (pfile); + const cpp_token *hash, *token; - /* Install builtins and process command line macros etc. in the order - they appeared, but only if not already preprocessed. */ - if (! CPP_OPTION (pfile, preprocessed)) + /* Lex ahead; if the first tokens are of the form # NUM, then + process the directive, otherwise back up. */ + hash = _cpp_lex_direct (pfile); + if (hash->type != CPP_HASH) { - struct pending_option *p; - - /* Prevent -Wunused-macros with command-line redefinitions. */ - pfile->first_unused_line = (unsigned int) -1; - _cpp_do_file_change (pfile, LC_RENAME, _(""), 1, 0); - init_builtins (pfile); - _cpp_do_file_change (pfile, LC_RENAME, _(""), 1, 0); - for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next) - (*p->handler) (pfile, p->arg); - - /* Scan -imacros files after -D, -U, but before -include. - pfile->next_include_file is NULL, so _cpp_pop_buffer does not - push -include files. */ - for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next) - if (push_include (pfile, p)) - cpp_scan_nooutput (pfile); - - pfile->next_include_file = &CPP_OPTION (pfile, pending)->include_head; - _cpp_maybe_push_include_file (pfile); + _cpp_backup_tokens (pfile, 1); + return; } - pfile->first_unused_line = pfile->line; + token = _cpp_lex_direct (pfile); - free_chain (CPP_OPTION (pfile, pending)->imacros_head); - free_chain (CPP_OPTION (pfile, pending)->directive_head); -} - -/* Push the next buffer on the stack given by -include, if any. */ -void -_cpp_maybe_push_include_file (pfile) - cpp_reader *pfile; -{ - if (pfile->next_include_file) + if (token->type != CPP_NUMBER) { - struct pending_option *head = *pfile->next_include_file; - - while (head && !push_include (pfile, head)) - head = head->next; - - if (head) - pfile->next_include_file = &head->next; - else - { - /* All done; restore the line map from . */ - _cpp_do_file_change (pfile, LC_RENAME, - pfile->line_maps.maps[0].to_file, 1, 0); - /* Don't come back here again. */ - pfile->next_include_file = NULL; - } + _cpp_backup_tokens (pfile, 2); + return; } + + token = _cpp_lex_direct (pfile); + + if (token->type != CPP_STRING + || ! (token->val.str.len >= 5 + && token->val.str.text[token->val.str.len-2] == '/' + && token->val.str.text[token->val.str.len-3] == '/')) + { + _cpp_backup_tokens (pfile, 3); + return; + } + + if (pfile->cb.dir_change) + { + char *debugdir = alloca (token->val.str.len - 3); + + memcpy (debugdir, (const char *) token->val.str.text + 1, + token->val.str.len - 4); + debugdir[token->val.str.len - 4] = '\0'; + + pfile->cb.dir_change (pfile, debugdir); + } } /* This is called at the end of preprocessing. It pops the last buffer and writes dependency output, and returns the number of errors. - + Maybe it should also reset state, such that you could call cpp_start_read with a new filename to restart processing. */ int -cpp_finish (pfile, deps_stream) - cpp_reader *pfile; - FILE *deps_stream; +cpp_finish (cpp_reader *pfile, FILE *deps_stream) { /* Warn about unused macros before popping the final buffer. */ if (CPP_OPTION (pfile, warn_unused_macros)) @@ -1144,308 +600,8 @@ cpp_finish (pfile, deps_stream) return pfile->errors; } -/* Add a directive to be handled later in the initialization phase. */ static void -new_pending_directive (pend, text, handler) - struct cpp_pending *pend; - const char *text; - cl_directive_handler handler; -{ - struct pending_option *o = (struct pending_option *) - xmalloc (sizeof (struct pending_option)); - - o->arg = text; - o->next = NULL; - o->handler = handler; - APPEND (pend, directive, o); -} - -/* Irix6 "cc -n32" and OSF4 cc have problems with char foo[] = ("string"); - I.e. a const string initializer with parens around it. That is - what N_("string") resolves to, so we make no_* be macros instead. */ -#define no_ass N_("assertion missing after %s") -#define no_dir N_("directory name missing after %s") -#define no_fil N_("file name missing after %s") -#define no_mac N_("macro name missing after %s") -#define no_pth N_("path name missing after %s") - -/* This is the list of all command line options, with the leading - "-" removed. It must be sorted in ASCII collating order. */ -#define COMMAND_LINE_OPTIONS \ - DEF_OPT("A", no_ass, OPT_A) \ - DEF_OPT("D", no_mac, OPT_D) \ - DEF_OPT("I", no_dir, OPT_I) \ - DEF_OPT("U", no_mac, OPT_U) \ - DEF_OPT("idirafter", no_dir, OPT_idirafter) \ - DEF_OPT("imacros", no_fil, OPT_imacros) \ - DEF_OPT("include", no_fil, OPT_include) \ - DEF_OPT("iprefix", no_pth, OPT_iprefix) \ - DEF_OPT("isystem", no_dir, OPT_isystem) \ - DEF_OPT("iwithprefix", no_dir, OPT_iwithprefix) \ - DEF_OPT("iwithprefixbefore", no_dir, OPT_iwithprefixbefore) - -#define DEF_OPT(text, msg, code) code, -enum opt_code -{ - COMMAND_LINE_OPTIONS - N_OPTS -}; -#undef DEF_OPT - -struct cl_option -{ - const char *opt_text; - const char *msg; - size_t opt_len; - enum opt_code opt_code; -}; - -#define DEF_OPT(text, msg, code) { text, msg, sizeof(text) - 1, code }, -#ifdef HOST_EBCDIC -static struct cl_option cl_options[] = -#else -static const struct cl_option cl_options[] = -#endif -{ - COMMAND_LINE_OPTIONS -}; -#undef DEF_OPT -#undef COMMAND_LINE_OPTIONS - -/* Perform a binary search to find which, if any, option the given - command-line matches. Returns its index in the option array, - negative on failure. Complications arise since some options can be - suffixed with an argument, and multiple complete matches can occur, - e.g. -pedantic and -pedantic-errors. */ -static int -parse_option (input) - const char *input; -{ - unsigned int md, mn, mx; - size_t opt_len; - int comp; - - mn = 0; - mx = N_OPTS; - - while (mx > mn) - { - md = (mn + mx) / 2; - - opt_len = cl_options[md].opt_len; - comp = strncmp (input, cl_options[md].opt_text, opt_len); - - if (comp > 0) - mn = md + 1; - else if (comp < 0) - mx = md; - else - { - if (input[opt_len] == '\0') - return md; - /* We were passed more text. If the option takes an argument, - we may match a later option or we may have been passed the - argument. The longest possible option match succeeds. - If the option takes no arguments we have not matched and - continue the search (e.g. input="stdc++" match was "stdc"). */ - mn = md + 1; - if (cl_options[md].msg) - { - /* Scan forwards. If we get an exact match, return it. - Otherwise, return the longest option-accepting match. - This loops no more than twice with current options. */ - mx = md; - for (; mn < (unsigned int) N_OPTS; mn++) - { - opt_len = cl_options[mn].opt_len; - if (strncmp (input, cl_options[mn].opt_text, opt_len)) - break; - if (input[opt_len] == '\0') - return mn; - if (cl_options[mn].msg) - mx = mn; - } - return mx; - } - } - } - - return -1; -} - -/* Handle one command-line option in (argc, argv). - Can be called multiple times, to handle multiple sets of options. - Returns number of strings consumed. */ -int -cpp_handle_option (pfile, argc, argv) - cpp_reader *pfile; - int argc; - char **argv; -{ - int i = 0; - struct cpp_pending *pend = CPP_OPTION (pfile, pending); - - { - enum opt_code opt_code; - int opt_index; - const char *arg = 0; - - /* Skip over '-'. */ - opt_index = parse_option (&argv[i][1]); - if (opt_index < 0) - return i; - - opt_code = cl_options[opt_index].opt_code; - if (cl_options[opt_index].msg) - { - arg = &argv[i][cl_options[opt_index].opt_len + 1]; - if (arg[0] == '\0') - { - arg = argv[++i]; - if (!arg) - { - cpp_error (pfile, DL_ERROR, - cl_options[opt_index].msg, argv[i - 1]); - return argc; - } - } - } - - switch (opt_code) - { - case N_OPTS: /* Shut GCC up. */ - break; - - case OPT_D: - new_pending_directive (pend, arg, cpp_define); - break; - case OPT_iprefix: - CPP_OPTION (pfile, include_prefix) = arg; - CPP_OPTION (pfile, include_prefix_len) = strlen (arg); - break; - - case OPT_A: - if (arg[0] == '-') - new_pending_directive (pend, arg + 1, cpp_unassert); - else - new_pending_directive (pend, arg, cpp_assert); - break; - case OPT_U: - new_pending_directive (pend, arg, cpp_undef); - break; - case OPT_I: /* Add directory to path for includes. */ - if (!strcmp (arg, "-")) - { - /* -I- means: - Use the preceding -I directories for #include "..." - but not #include <...>. - Don't search the directory of the present file - for #include "...". (Note that -I. -I- is not the same as - the default setup; -I. uses the compiler's working dir.) */ - if (! CPP_OPTION (pfile, ignore_srcdir)) - { - pend->quote_head = pend->brack_head; - pend->quote_tail = pend->brack_tail; - pend->brack_head = 0; - pend->brack_tail = 0; - CPP_OPTION (pfile, ignore_srcdir) = 1; - } - else - { - cpp_error (pfile, DL_ERROR, "-I- specified twice"); - return argc; - } - } - else - append_include_chain (pfile, xstrdup (arg), BRACKET, 0); - break; - case OPT_isystem: - /* Add directory to beginning of system include path, as a system - include directory. */ - append_include_chain (pfile, xstrdup (arg), SYSTEM, 0); - break; - case OPT_include: - case OPT_imacros: - { - struct pending_option *o = (struct pending_option *) - xmalloc (sizeof (struct pending_option)); - o->arg = arg; - o->next = NULL; - - if (opt_code == OPT_include) - APPEND (pend, include, o); - else - APPEND (pend, imacros, o); - } - break; - case OPT_iwithprefix: - /* Add directory to end of path for includes, - with the default prefix at the front of its name. */ - /* fall through */ - case OPT_iwithprefixbefore: - /* Add directory to main path for includes, - with the default prefix at the front of its name. */ - { - char *fname; - int len; - - len = strlen (arg); - - if (CPP_OPTION (pfile, include_prefix) != 0) - { - size_t ipl = CPP_OPTION (pfile, include_prefix_len); - fname = xmalloc (ipl + len + 1); - memcpy (fname, CPP_OPTION (pfile, include_prefix), ipl); - memcpy (fname + ipl, arg, len + 1); - } - else if (cpp_GCC_INCLUDE_DIR_len) - { - fname = xmalloc (cpp_GCC_INCLUDE_DIR_len + len + 1); - memcpy (fname, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len); - memcpy (fname + cpp_GCC_INCLUDE_DIR_len, arg, len + 1); - } - else - fname = xstrdup (arg); - - append_include_chain (pfile, fname, - opt_code == OPT_iwithprefix ? SYSTEM: BRACKET, 0); - } - break; - case OPT_idirafter: - /* Add directory to end of path for includes. */ - append_include_chain (pfile, xstrdup (arg), AFTER, 0); - break; - } - } - return i + 1; -} - -/* Handle command-line options in (argc, argv). - Can be called multiple times, to handle multiple sets of options. - Returns if an unrecognized option is seen. - Returns number of strings consumed. */ -int -cpp_handle_options (pfile, argc, argv) - cpp_reader *pfile; - int argc; - char **argv; -{ - int i; - int strings_processed; - - for (i = 0; i < argc; i += strings_processed) - { - strings_processed = cpp_handle_option (pfile, argc - i, argv + i); - if (strings_processed == 0) - break; - } - - return i; -} - -static void -post_options (pfile) - cpp_reader *pfile; +post_options (cpp_reader *pfile) { /* -Wtraditional is not useful in C++ mode. */ if (CPP_OPTION (pfile, cplusplus)) @@ -1459,7 +615,16 @@ post_options (pfile) CPP_OPTION (pfile, traditional) = 0; } - /* Traditional CPP does not accurately track column information. */ + if (CPP_OPTION (pfile, warn_trigraphs) == 2) + CPP_OPTION (pfile, warn_trigraphs) = !CPP_OPTION (pfile, trigraphs); + if (CPP_OPTION (pfile, traditional)) - CPP_OPTION (pfile, show_column) = 0; + { + CPP_OPTION (pfile, cplusplus_comments) = 0; + + /* Traditional CPP does not accurately track column information. */ + CPP_OPTION (pfile, show_column) = 0; + CPP_OPTION (pfile, trigraphs) = 0; + CPP_OPTION (pfile, warn_trigraphs) = 0; + } } diff --git a/contrib/gcc/dbxout.c b/contrib/gcc/dbxout.c index 8a8b5616082b..5a3c1354b950 100644 --- a/contrib/gcc/dbxout.c +++ b/contrib/gcc/dbxout.c @@ -1,6 +1,6 @@ /* Output dbx-format symbol table information from GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -70,6 +70,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "tree.h" #include "rtl.h" @@ -91,6 +93,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "xcoffout.h" #endif +#undef DBXOUT_DECR_NESTING +#define DBXOUT_DECR_NESTING \ + if (--debug_nesting == 0 && symbol_queue_index > 0) \ + { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); } + +#undef DBXOUT_DECR_NESTING_AND_RETURN +#define DBXOUT_DECR_NESTING_AND_RETURN(x) \ + do {--debug_nesting; return (x);} while (0) + #ifndef ASM_STABS_OP #define ASM_STABS_OP "\t.stabs\t" #endif @@ -135,25 +146,117 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define STABS_GCC_MARKER "gcc2_compiled." #endif -/* Typical USG systems don't have stab.h, and they also have - no use for DBX-format debugging info. */ +enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED}; -#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) +/* Structure recording information about a C data type. + The status element says whether we have yet output + the definition of the type. TYPE_XREF says we have + output it as a cross-reference only. + The file_number and type_number elements are used if DBX_USE_BINCL + is defined. */ + +struct typeinfo GTY(()) +{ + enum typestatus status; + int file_number; + int type_number; +}; + +/* Vector recording information about C data types. + When we first notice a data type (a tree node), + we assign it a number using next_type_number. + That is its index in this vector. */ + +static GTY ((length ("typevec_len"))) struct typeinfo *typevec; + +/* Number of elements of space allocated in `typevec'. */ + +static GTY(()) int typevec_len; + +/* In dbx output, each type gets a unique number. + This is the number for the next type output. + The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */ + +static GTY(()) int next_type_number; + +enum binclstatus {BINCL_NOT_REQUIRED, BINCL_PENDING, BINCL_PROCESSED}; + +/* When using N_BINCL in dbx output, each type number is actually a + pair of the file number and the type number within the file. + This is a stack of input files. */ + +struct dbx_file +{ + struct dbx_file *next; + int file_number; + int next_type_number; + enum binclstatus bincl_status; /* Keep track of lazy bincl. */ + const char *pending_bincl_name; /* Name of bincl. */ + struct dbx_file *prev; /* Chain to traverse all pending bincls. */ +}; + +/* This is the top of the stack. + + This is not saved for PCH, because restoring a PCH should not change it. + next_file_number does have to be saved, because the PCH may use some + file numbers; however, just before restoring a PCH, next_file_number + should always be 0 because we should not have needed any file numbers + yet. */ + +#if (defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)) \ + && defined (DBX_USE_BINCL) +static struct dbx_file *current_file; +#endif + +/* This is the next file number to use. */ + +static GTY(()) int next_file_number; + +/* A counter for dbxout_function_end. */ + +static GTY(()) int scope_labelno; + +/* A counter for dbxout_source_line. */ + +static GTY(()) int dbxout_source_line_counter; /* Nonzero if we have actually used any of the GDB extensions to the debugging format. The idea is that we use them for the first time only if there's a strong reason, but once we have done that, we use them whenever convenient. */ -static int have_used_extensions = 0; +static GTY(()) int have_used_extensions = 0; /* Number for the next N_SOL filename stabs label. The number 0 is reserved for the N_SO filename stabs label. */ -#if defined (DBX_DEBUGGING_INFO) && !defined (DBX_OUTPUT_SOURCE_FILENAME) -static int source_label_number = 1; +static GTY(()) int source_label_number = 1; + +/* Last source file name mentioned in a NOTE insn. */ + +static GTY(()) const char *lastfile; + +/* Used by PCH machinery to detect if 'lastfile' should be reset to + base_input_file. */ +static GTY(()) int lastfile_is_base; + +/* Typical USG systems don't have stab.h, and they also have + no use for DBX-format debugging info. */ + +#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) + +#ifdef DBX_USE_BINCL +/* If zero then there is no pending BINCL. */ +static int pending_bincls = 0; #endif +/* The original input file name. */ +static const char *base_input_file; + +/* Current working directory. */ + +static const char *cwd; + #ifdef DEBUG_SYMS_TEXT #define FORCE_TEXT function_section (current_function_decl); #else @@ -186,72 +289,6 @@ static int source_label_number = 1; static FILE *asmfile; -/* Last source file name mentioned in a NOTE insn. */ - -static const char *lastfile; - -/* Current working directory. */ - -static const char *cwd; - -enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED}; - -/* Structure recording information about a C data type. - The status element says whether we have yet output - the definition of the type. TYPE_XREF says we have - output it as a cross-reference only. - The file_number and type_number elements are used if DBX_USE_BINCL - is defined. */ - -struct typeinfo -{ - enum typestatus status; -#ifdef DBX_USE_BINCL - int file_number; - int type_number; -#endif -}; - -/* Vector recording information about C data types. - When we first notice a data type (a tree node), - we assign it a number using next_type_number. - That is its index in this vector. */ - -struct typeinfo *typevec; - -/* Number of elements of space allocated in `typevec'. */ - -static int typevec_len; - -/* In dbx output, each type gets a unique number. - This is the number for the next type output. - The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */ - -static int next_type_number; - -#ifdef DBX_USE_BINCL - -/* When using N_BINCL in dbx output, each type number is actually a - pair of the file number and the type number within the file. - This is a stack of input files. */ - -struct dbx_file -{ - struct dbx_file *next; - int file_number; - int next_type_number; -}; - -/* This is the top of the stack. */ - -static struct dbx_file *current_file; - -/* This is the next file number to use. */ - -static int next_file_number; - -#endif /* DBX_USE_BINCL */ - /* These variables are for dbxout_symbol to communicate to dbxout_finish_symbol. current_sym_code is the symbol-type-code, a symbol N_... define in stab.h. @@ -289,44 +326,51 @@ static int current_sym_nchars; #define CONTIN do { } while (0) #endif -static void dbxout_init PARAMS ((const char *)); -static void dbxout_finish PARAMS ((const char *)); -static void dbxout_start_source_file PARAMS ((unsigned, const char *)); -static void dbxout_end_source_file PARAMS ((unsigned)); -static void dbxout_typedefs PARAMS ((tree)); -static void dbxout_fptype_value PARAMS ((tree)); -static void dbxout_type_index PARAMS ((tree)); -#if DBX_CONTIN_LENGTH > 0 -static void dbxout_continue PARAMS ((void)); +#ifdef DBX_USE_BINCL +static void emit_bincl_stab (const char *c); +static void emit_pending_bincls (void); #endif -static void dbxout_args PARAMS ((tree)); -static void dbxout_type_fields PARAMS ((tree)); -static void dbxout_type_method_1 PARAMS ((tree, const char *)); -static void dbxout_type_methods PARAMS ((tree)); -static void dbxout_range_type PARAMS ((tree)); -static void dbxout_type PARAMS ((tree, int)); -static void print_int_cst_octal PARAMS ((tree)); -static void print_octal PARAMS ((unsigned HOST_WIDE_INT, int)); -static void print_wide_int PARAMS ((HOST_WIDE_INT)); -static void dbxout_type_name PARAMS ((tree)); -static void dbxout_class_name_qualifiers PARAMS ((tree)); -static int dbxout_symbol_location PARAMS ((tree, tree, const char *, rtx)); -static void dbxout_symbol_name PARAMS ((tree, const char *, int)); -static void dbxout_prepare_symbol PARAMS ((tree)); -static void dbxout_finish_symbol PARAMS ((tree)); -static void dbxout_block PARAMS ((tree, int, tree)); -static void dbxout_global_decl PARAMS ((tree)); +static inline void emit_pending_bincls_if_required (void); + +static void dbxout_init (const char *); +static void dbxout_finish (const char *); +static void dbxout_start_source_file (unsigned, const char *); +static void dbxout_end_source_file (unsigned); +static void dbxout_typedefs (tree); +static void dbxout_type_index (tree); +#if DBX_CONTIN_LENGTH > 0 +static void dbxout_continue (void); +#endif +static void dbxout_args (tree); +static void dbxout_type_fields (tree); +static void dbxout_type_method_1 (tree, const char *); +static void dbxout_type_methods (tree); +static void dbxout_range_type (tree); +static void dbxout_type (tree, int); +static bool print_int_cst_bounds_in_octal_p (tree); +static void print_int_cst_octal (tree); +static void print_octal (unsigned HOST_WIDE_INT, int); +static void print_wide_int (HOST_WIDE_INT); +static void dbxout_type_name (tree); +static void dbxout_class_name_qualifiers (tree); +static int dbxout_symbol_location (tree, tree, const char *, rtx); +static void dbxout_symbol_name (tree, const char *, int); +static void dbxout_prepare_symbol (tree); +static void dbxout_finish_symbol (tree); +static void dbxout_block (tree, int, tree); +static void dbxout_global_decl (tree); +static void dbxout_handle_pch (unsigned); /* The debug hooks structure. */ #if defined (DBX_DEBUGGING_INFO) -static void dbxout_source_line PARAMS ((unsigned int, const char *)); -static void dbxout_source_file PARAMS ((FILE *, const char *)); -static void dbxout_function_end PARAMS ((void)); -static void dbxout_begin_function PARAMS ((tree)); -static void dbxout_begin_block PARAMS ((unsigned, unsigned)); -static void dbxout_end_block PARAMS ((unsigned, unsigned)); -static void dbxout_function_decl PARAMS ((tree)); +static void dbxout_source_line (unsigned int, const char *); +static void dbxout_source_file (FILE *, const char *); +static void dbxout_function_end (void); +static void dbxout_begin_function (tree); +static void dbxout_begin_block (unsigned, unsigned); +static void dbxout_end_block (unsigned, unsigned); +static void dbxout_function_decl (tree); const struct gcc_debug_hooks dbx_debug_hooks = { @@ -353,7 +397,8 @@ const struct gcc_debug_hooks dbx_debug_hooks = dbxout_global_decl, /* global_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ - debug_nothing_rtx /* label */ + debug_nothing_rtx, /* label */ + dbxout_handle_pch /* handle_pch */ }; #endif /* DBX_DEBUGGING_INFO */ @@ -379,21 +424,21 @@ const struct gcc_debug_hooks xcoff_debug_hooks = dbxout_global_decl, /* global_decl */ debug_nothing_tree, /* deferred_inline_function */ debug_nothing_tree, /* outlining_inline_function */ - debug_nothing_rtx /* label */ + debug_nothing_rtx, /* label */ + dbxout_handle_pch /* handle_pch */ }; #endif /* XCOFF_DEBUGGING_INFO */ #if defined (DBX_DEBUGGING_INFO) static void -dbxout_function_end () +dbxout_function_end (void) { - static int scope_labelno = 0; char lscope_label_name[100]; /* Convert Ltext into the appropriate format for local labels in case the system doesn't insert underscores in front of user generated labels. */ ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno); - ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Lscope", scope_labelno); + (*targetm.asm_out.internal_label) (asmfile, "Lscope", scope_labelno); scope_labelno++; /* By convention, GCC will mark the end of a function with an N_FUN @@ -414,8 +459,7 @@ dbxout_function_end () Initialize `typevec' and output the standard data types of C. */ static void -dbxout_init (input_file_name) - const char *input_file_name; +dbxout_init (const char *input_file_name) { char ltext_label_name[100]; tree syms = (*lang_hooks.decls.getdecls) (); @@ -423,7 +467,7 @@ dbxout_init (input_file_name) asmfile = asm_out_file; typevec_len = 100; - typevec = (struct typeinfo *) xcalloc (typevec_len, sizeof typevec[0]); + typevec = ggc_calloc (typevec_len, sizeof typevec[0]); /* Convert Ltext into the appropriate format for local labels in case the system doesn't insert underscores in front of user generated @@ -431,12 +475,10 @@ dbxout_init (input_file_name) ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0); /* Put the current working directory in an N_SO symbol. */ -#ifndef DBX_WORKING_DIRECTORY /* Only some versions of DBX want this, - but GDB always does. */ if (use_gnu_debug_info_extensions) -#endif { - if (!cwd && (cwd = getpwd ()) && (!*cwd || cwd[strlen (cwd) - 1] != '/')) + if (!cwd && (cwd = get_src_pwd ()) + && (!*cwd || cwd[strlen (cwd) - 1] != '/')) cwd = concat (cwd, FILE_NAME_JOINER, NULL); if (cwd) { @@ -453,8 +495,6 @@ dbxout_init (input_file_name) } #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME - /* This should NOT be DBX_OUTPUT_SOURCE_FILENAME. That - would give us an N_SOL, and we want an N_SO. */ DBX_OUTPUT_MAIN_SOURCE_FILENAME (asmfile, input_file_name); #else /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */ /* We include outputting `Ltext:' here, @@ -466,7 +506,7 @@ dbxout_init (input_file_name) assemble_name (asmfile, ltext_label_name); fputc ('\n', asmfile); text_section (); - ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0); + (*targetm.asm_out.internal_label) (asmfile, "Ltext", 0); #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */ #ifdef DBX_OUTPUT_GCC_MARKER @@ -477,16 +517,19 @@ dbxout_init (input_file_name) ASM_STABS_OP, STABS_GCC_MARKER, N_OPT); #endif - lastfile = input_file_name; + base_input_file = lastfile = input_file_name; next_type_number = 1; #ifdef DBX_USE_BINCL - current_file = (struct dbx_file *) xmalloc (sizeof *current_file); + current_file = xmalloc (sizeof *current_file); current_file->next = NULL; current_file->file_number = 0; current_file->next_type_number = 1; next_file_number = 1; + current_file->prev = NULL; + current_file->bincl_status = BINCL_NOT_REQUIRED; + current_file->pending_bincl_name = NULL; #endif /* Make sure that types `int' and `char' have numbers 1 and 2. @@ -498,27 +541,22 @@ dbxout_init (input_file_name) #ifdef DBX_OUTPUT_STANDARD_TYPES DBX_OUTPUT_STANDARD_TYPES (syms); -#else - dbxout_symbol (TYPE_NAME (integer_type_node), 0); - dbxout_symbol (TYPE_NAME (char_type_node), 0); #endif - /* Get all permanent types that have typedef names, - and output them all, except for those already output. */ - + /* Get all permanent types that have typedef names, and output them + all, except for those already output. Some language front ends + put these declarations in the top-level scope; some do not. */ + dbxout_typedefs ((*lang_hooks.decls.builtin_type_decls) ()); dbxout_typedefs (syms); } -/* Output any typedef names for types described by TYPE_DECLs in SYMS, - in the reverse order from that which is found in SYMS. */ +/* Output any typedef names for types described by TYPE_DECLs in SYMS. */ static void -dbxout_typedefs (syms) - tree syms; +dbxout_typedefs (tree syms) { - if (syms) + for (; syms != NULL_TREE; syms = TREE_CHAIN (syms)) { - dbxout_typedefs (TREE_CHAIN (syms)); if (TREE_CODE (syms) == TYPE_DECL) { tree type = TREE_TYPE (syms); @@ -531,55 +569,140 @@ dbxout_typedefs (syms) } } +#ifdef DBX_USE_BINCL +/* Emit BINCL stab using given name. */ +static void +emit_bincl_stab (const char *name) +{ + fprintf (asmfile, "%s", ASM_STABS_OP); + output_quoted_string (asmfile, name); + fprintf (asmfile, ",%d,0,0,0\n", N_BINCL); +} + +/* If there are pending bincls then it is time to emit all of them. */ + +static inline void +emit_pending_bincls_if_required (void) +{ + if (pending_bincls) + emit_pending_bincls (); +} + +/* Emit all pending bincls. */ + +static void +emit_pending_bincls (void) +{ + struct dbx_file *f = current_file; + + /* Find first pending bincl. */ + while (f->bincl_status == BINCL_PENDING) + f = f->next; + + /* Now emit all bincls. */ + f = f->prev; + + while (f) + { + if (f->bincl_status == BINCL_PENDING) + { + emit_bincl_stab (f->pending_bincl_name); + + /* Update file number and status. */ + f->file_number = next_file_number++; + f->bincl_status = BINCL_PROCESSED; + } + if (f == current_file) + break; + f = f->prev; + } + + /* All pending bincls have been emitted. */ + pending_bincls = 0; +} + +#else + +static inline void +emit_pending_bincls_if_required (void) {} +#endif + /* Change to reading from a new source file. Generate a N_BINCL stab. */ static void -dbxout_start_source_file (line, filename) - unsigned int line ATTRIBUTE_UNUSED; - const char *filename ATTRIBUTE_UNUSED; +dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, + const char *filename ATTRIBUTE_UNUSED) { #ifdef DBX_USE_BINCL - struct dbx_file *n = (struct dbx_file *) xmalloc (sizeof *n); + struct dbx_file *n = xmalloc (sizeof *n); n->next = current_file; - n->file_number = next_file_number++; n->next_type_number = 1; + /* Do not assign file number now. + Delay it until we actually emit BINCL. */ + n->file_number = 0; + n->prev = NULL; + current_file->prev = n; + n->bincl_status = BINCL_PENDING; + n->pending_bincl_name = filename; + pending_bincls = 1; current_file = n; - fprintf (asmfile, "%s", ASM_STABS_OP); - output_quoted_string (asmfile, filename); - fprintf (asmfile, ",%d,0,0,0\n", N_BINCL); #endif } /* Revert to reading a previous source file. Generate a N_EINCL stab. */ static void -dbxout_end_source_file (line) - unsigned int line ATTRIBUTE_UNUSED; +dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED) { #ifdef DBX_USE_BINCL - struct dbx_file *next; - - fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL); - next = current_file->next; - free (current_file); - current_file = next; + /* Emit EINCL stab only if BINCL is not pending. */ + if (current_file->bincl_status == BINCL_PROCESSED) + fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL); + current_file->bincl_status = BINCL_NOT_REQUIRED; + current_file = current_file->next; #endif } +/* Handle a few odd cases that occur when trying to make PCH files work. */ + +static void +dbxout_handle_pch (unsigned at_end) +{ + if (! at_end) + { + /* When using the PCH, this file will be included, so we need to output + a BINCL. */ + dbxout_start_source_file (0, lastfile); + + /* The base file when using the PCH won't be the same as + the base file when it's being generated. */ + lastfile = NULL; + } + else + { + /* ... and an EINCL. */ + dbxout_end_source_file (0); + + /* Deal with cases where 'lastfile' was never actually changed. */ + lastfile_is_base = lastfile == NULL; + } +} + #if defined (DBX_DEBUGGING_INFO) /* Output debugging info to FILE to switch to sourcefile FILENAME. */ static void -dbxout_source_file (file, filename) - FILE *file; - const char *filename; +dbxout_source_file (FILE *file, const char *filename) { + if (lastfile == 0 && lastfile_is_base) + { + lastfile = base_input_file; + lastfile_is_base = 0; + } + if (filename && (lastfile == 0 || strcmp (filename, lastfile))) { -#ifdef DBX_OUTPUT_SOURCE_FILENAME - DBX_OUTPUT_SOURCE_FILENAME (file, filename); -#else char ltext_label_name[100]; ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", @@ -594,9 +717,8 @@ dbxout_source_file (file, filename) ; /* Don't change section amid function. */ else text_section (); - ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", source_label_number); + (*targetm.asm_out.internal_label) (file, "Ltext", source_label_number); source_label_number++; -#endif lastfile = filename; } } @@ -605,14 +727,13 @@ dbxout_source_file (file, filename) number LINENO. */ static void -dbxout_source_line (lineno, filename) - unsigned int lineno; - const char *filename; +dbxout_source_line (unsigned int lineno, const char *filename) { dbxout_source_file (asmfile, filename); #ifdef ASM_OUTPUT_SOURCE_LINE - ASM_OUTPUT_SOURCE_LINE (asmfile, lineno); + dbxout_source_line_counter += 1; + ASM_OUTPUT_SOURCE_LINE (asmfile, lineno, dbxout_source_line_counter); #else fprintf (asmfile, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno); #endif @@ -621,21 +742,19 @@ dbxout_source_line (lineno, filename) /* Describe the beginning of an internal block within a function. */ static void -dbxout_begin_block (line, n) - unsigned int line ATTRIBUTE_UNUSED; - unsigned int n; +dbxout_begin_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n) { - ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBB", n); + emit_pending_bincls_if_required (); + (*targetm.asm_out.internal_label) (asmfile, "LBB", n); } /* Describe the end line-number of an internal block within a function. */ static void -dbxout_end_block (line, n) - unsigned int line ATTRIBUTE_UNUSED; - unsigned int n; +dbxout_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n) { - ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBE", n); + emit_pending_bincls_if_required (); + (*targetm.asm_out.internal_label) (asmfile, "LBE", n); } /* Output dbx data for a function definition. @@ -645,9 +764,9 @@ dbxout_end_block (line, n) (including all the auto variables of the function). */ static void -dbxout_function_decl (decl) - tree decl; +dbxout_function_decl (tree decl) { + emit_pending_bincls_if_required (); #ifndef DBX_FUNCTION_FIRST dbxout_begin_function (decl); #endif @@ -668,13 +787,17 @@ dbxout_function_decl (decl) /* Debug information for a global DECL. Called from toplev.c after compilation proper has finished. */ static void -dbxout_global_decl (decl) - tree decl; +dbxout_global_decl (tree decl) { if (TREE_CODE (decl) == VAR_DECL && ! DECL_EXTERNAL (decl) && DECL_RTL_SET_P (decl)) /* Not necessary? */ - dbxout_symbol (decl, 0); + { + int saved_tree_used = TREE_USED (decl); + TREE_USED (decl) = 1; + dbxout_symbol (decl, 0); + TREE_USED (decl) = saved_tree_used; + } } /* At the end of compilation, finish writing the symbol table. @@ -682,74 +805,19 @@ dbxout_global_decl (decl) to do nothing. */ static void -dbxout_finish (filename) - const char *filename ATTRIBUTE_UNUSED; +dbxout_finish (const char *filename ATTRIBUTE_UNUSED) { #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END DBX_OUTPUT_MAIN_SOURCE_FILE_END (asmfile, filename); #endif /* DBX_OUTPUT_MAIN_SOURCE_FILE_END */ -} -/* Output floating point type values used by the 'R' stab letter. - These numbers come from include/aout/stab_gnu.h in binutils/gdb. - - There are only 3 real/complex types defined, and we need 7/6. - We use NF_SINGLE as a generic float type, and NF_COMPLEX as a generic - complex type. Since we have the type size anyways, we don't really need - to distinguish between different FP types, we only need to distinguish - between float and complex. This works fine with gdb. - - We only use this for complex types, to avoid breaking backwards - compatibility for real types. complex types aren't in ISO C90, so it is - OK if old debuggers don't understand the debug info we emit for them. */ - -/* ??? These are supposed to be IEEE types, but we don't check for that. - We could perhaps add additional numbers for non-IEEE types if we need - them. */ - -static void -dbxout_fptype_value (type) - tree type; -{ - char value = '0'; - enum machine_mode mode = TYPE_MODE (type); - - if (TREE_CODE (type) == REAL_TYPE) - { - if (mode == SFmode) - value = '1'; - else if (mode == DFmode) - value = '2'; - else if (mode == TFmode || mode == XFmode) - value = '6'; - else - /* Use NF_SINGLE as a generic real type for other sizes. */ - value = '1'; - } - else if (TREE_CODE (type) == COMPLEX_TYPE) - { - if (mode == SCmode) - value = '3'; - else if (mode == DCmode) - value = '4'; - else if (mode == TCmode || mode == XCmode) - value = '5'; - else - /* Use NF_COMPLEX as a generic complex type for other sizes. */ - value = '3'; - } - else - abort (); - - putc (value, asmfile); - CHARS (1); + debug_free_queue (); } /* Output the index of a type. */ static void -dbxout_type_index (type) - tree type; +dbxout_type_index (tree type) { #ifndef DBX_USE_BINCL fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type)); @@ -769,8 +837,9 @@ dbxout_type_index (type) .stabs "...rest",code,0,value */ static void -dbxout_continue () +dbxout_continue (void) { + emit_pending_bincls_if_required (); #ifdef DBX_CONTIN_CHAR fprintf (asmfile, "%c", DBX_CONTIN_CHAR); #else @@ -787,8 +856,7 @@ dbxout_continue () recursive calls. */ static void -dbxout_type_fields (type) - tree type; +dbxout_type_fields (tree type) { tree tem; @@ -796,6 +864,11 @@ dbxout_type_fields (type) field that we can support. */ for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) { + + /* If on of the nodes is an error_mark or its type is then return early. */ + if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node) + return; + /* Omit here local type decls until we know how to support them. */ if (TREE_CODE (tem) == TYPE_DECL /* Omit fields whose position or size are variable or too large to @@ -878,9 +951,7 @@ dbxout_type_fields (type) now. */ static void -dbxout_type_method_1 (decl, debug_name) - tree decl; - const char *debug_name; +dbxout_type_method_1 (tree decl, const char *debug_name) { char c1 = 'A', c2; @@ -925,8 +996,7 @@ dbxout_type_method_1 (decl, debug_name) in TYPE. */ static void -dbxout_type_methods (type) - tree type; +dbxout_type_methods (tree type) { /* C++: put out the method names and their parameter lists */ tree methods = TYPE_METHODS (type); @@ -1031,8 +1101,7 @@ dbxout_type_methods (type) TYPE is an INTEGER_TYPE. */ static void -dbxout_range_type (type) - tree type; +dbxout_range_type (tree type) { fprintf (asmfile, "r"); if (TREE_TYPE (type)) @@ -1064,7 +1133,10 @@ dbxout_range_type (type) { putc (';', asmfile); CHARS (1); - print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type), 0)); + if (print_int_cst_bounds_in_octal_p (type)) + print_int_cst_octal (TYPE_MIN_VALUE (type)); + else + print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type), 0)); } else { @@ -1077,7 +1149,10 @@ dbxout_range_type (type) { putc (';', asmfile); CHARS (1); - print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type), 0)); + if (print_int_cst_bounds_in_octal_p (type)) + print_int_cst_octal (TYPE_MAX_VALUE (type)); + else + print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type), 0)); putc (';', asmfile); CHARS (1); } @@ -1088,6 +1163,7 @@ dbxout_range_type (type) } } + /* Output a reference to a type. If the type has not yet been described in the dbx output, output its definition now. For a type already defined, just refer to its definition @@ -1099,9 +1175,7 @@ dbxout_range_type (type) using the number previously allocated. */ static void -dbxout_type (type, full) - tree type; - int full; +dbxout_type (tree type, int full) { tree tem; tree main_variant; @@ -1147,14 +1221,13 @@ dbxout_type (type, full) if (next_type_number == typevec_len) { typevec - = (struct typeinfo *) xrealloc (typevec, - typevec_len * 2 * sizeof typevec[0]); - memset ((char *) (typevec + typevec_len), 0, - typevec_len * sizeof typevec[0]); + = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0])); + memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]); typevec_len *= 2; } #ifdef DBX_USE_BINCL + emit_pending_bincls_if_required (); typevec[TYPE_SYMTAB_ADDRESS (type)].file_number = current_file->file_number; typevec[TYPE_SYMTAB_ADDRESS (type)].type_number @@ -1162,6 +1235,21 @@ dbxout_type (type, full) #endif } + if (flag_debug_only_used_symbols) + { + if ((TREE_CODE (type) == RECORD_TYPE + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) + && TYPE_STUB_DECL (type) + && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (type))) == 'd' + && ! DECL_IGNORED_P (TYPE_STUB_DECL (type))) + debug_queue_symbol (TYPE_STUB_DECL (type)); + else if (TYPE_NAME (type) + && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) + debug_queue_symbol (TYPE_NAME (type)); + } + /* Output the number of this type, to refer to it. */ dbxout_type_index (type); @@ -1245,6 +1333,18 @@ dbxout_type (type, full) } else if (main_variant != TYPE_MAIN_VARIANT (type)) { + if (flag_debug_only_used_symbols) + { + tree orig_type = DECL_ORIGINAL_TYPE (TYPE_NAME (type)); + + if ((TREE_CODE (orig_type) == RECORD_TYPE + || TREE_CODE (orig_type) == UNION_TYPE + || TREE_CODE (orig_type) == QUAL_UNION_TYPE + || TREE_CODE (orig_type) == ENUMERAL_TYPE) + && TYPE_STUB_DECL (orig_type) + && ! DECL_IGNORED_P (TYPE_STUB_DECL (orig_type))) + debug_queue_symbol (TYPE_STUB_DECL (orig_type)); + } /* 'type' is a typedef; output the type it refers to. */ dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0); return; @@ -1310,34 +1410,21 @@ dbxout_type (type, full) CHARS (5); } - /* If we can use GDB extensions and the size is wider than a - long (the size used by GDB to read them) or we may have - trouble writing the bounds the usual way, write them in - octal. Note the test is for the *target's* size of "long", - not that of the host. The host test is just to make sure we - can write it out in case the host wide int is narrower than the - target "long". */ - - /* For unsigned types, we use octal if they are the same size or - larger. This is because we print the bounds as signed decimal, - and hence they can't span same size unsigned types. */ - - if (use_gnu_debug_info_extensions - && TYPE_MIN_VALUE (type) != 0 - && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST - && TYPE_MAX_VALUE (type) != 0 - && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST - && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node) - || ((TYPE_PRECISION (type) - == TYPE_PRECISION (integer_type_node)) - && TREE_UNSIGNED (type)) - || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT - || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT - && TREE_UNSIGNED (type)))) + if (print_int_cst_bounds_in_octal_p (type)) { fprintf (asmfile, "r"); CHARS (1); - dbxout_type_index (type); + + /* If this type derives from another type, output type index of + parent type. This is particularly important when parent type + is an enumerated type, because not generating the parent type + index would transform the definition of this enumerated type + into a plain unsigned type. */ + if (TREE_TYPE (type) != 0) + dbxout_type_index (TREE_TYPE (type)); + else + dbxout_type_index (type); + fprintf (asmfile, ";"); CHARS (1); print_int_cst_octal (TYPE_MIN_VALUE (type)); @@ -1414,15 +1501,14 @@ dbxout_type (type, full) break; case COMPLEX_TYPE: - /* Differs from the REAL_TYPE by its new data type number */ + /* Differs from the REAL_TYPE by its new data type number. + R3 is NF_COMPLEX. We don't try to use any of the other NF_* + codes since gdb doesn't care anyway. */ if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) { - putc ('R', asmfile); - CHARS (1); - dbxout_fptype_value (type); - putc (';', asmfile); - CHARS (1); + fputs ("R3;", asmfile); + CHARS (3); print_wide_int (2 * int_size_in_bytes (TREE_TYPE (type))); fputs (";0;", asmfile); CHARS (3); @@ -1584,15 +1670,21 @@ dbxout_type (type, full) } for (i = 0; i < n_baseclasses; i++) { - tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i); + tree binfo = TYPE_BINFO (type); + tree child = BINFO_BASETYPE (binfo, i); + tree access = (BINFO_BASEACCESSES (binfo) + ? BINFO_BASEACCESS (binfo, i) : access_public_node); if (use_gnu_debug_info_extensions) { have_used_extensions = 1; - putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile); - putc (TREE_VIA_PUBLIC (child) ? '2' : '0', asmfile); + putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile); + putc (access == access_public_node ? '2' : + (access == access_protected_node ? '1' :'0'), + asmfile); CHARS (2); - if (TREE_VIA_VIRTUAL (child) && strcmp (lang_hooks.name, "GNU C++") == 0) + if (TREE_VIA_VIRTUAL (child) + && strcmp (lang_hooks.name, "GNU C++") == 0) /* For a virtual base, print the (negative) offset within the vtable where we must look to find the necessary adjustment. */ @@ -1685,9 +1777,6 @@ dbxout_type (type, full) CHARS (1); return; } -#ifdef DBX_OUTPUT_ENUM - DBX_OUTPUT_ENUM (asmfile, type); -#else if (use_gnu_debug_info_extensions && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node)) { @@ -1717,7 +1806,6 @@ dbxout_type (type, full) putc (';', asmfile); CHARS (1); -#endif break; case POINTER_TYPE: @@ -1782,12 +1870,44 @@ dbxout_type (type, full) } } +/* Return nonzero if the given type represents an integer whose bounds + should be printed in octal format. */ + +static bool +print_int_cst_bounds_in_octal_p (tree type) +{ + /* If we can use GDB extensions and the size is wider than a long + (the size used by GDB to read them) or we may have trouble writing + the bounds the usual way, write them in octal. Note the test is for + the *target's* size of "long", not that of the host. The host test + is just to make sure we can write it out in case the host wide int + is narrower than the target "long". + + For unsigned types, we use octal if they are the same size or larger. + This is because we print the bounds as signed decimal, and hence they + can't span same size unsigned types. */ + + if (use_gnu_debug_info_extensions + && TYPE_MIN_VALUE (type) != 0 + && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST + && TYPE_MAX_VALUE (type) != 0 + && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST + && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node) + || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) + && TREE_UNSIGNED (type)) + || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT + || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT + && TREE_UNSIGNED (type)))) + return TRUE; + else + return FALSE; +} + /* Print the value of integer constant C, in octal, handling double precision. */ static void -print_int_cst_octal (c) - tree c; +print_int_cst_octal (tree c) { unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (c); unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (c); @@ -1832,9 +1952,7 @@ print_int_cst_octal (c) } static void -print_octal (value, digits) - unsigned HOST_WIDE_INT value; - int digits; +print_octal (unsigned HOST_WIDE_INT value, int digits) { int i; @@ -1847,8 +1965,7 @@ print_octal (value, digits) /* Output C in decimal while adjusting the number of digits written. */ static void -print_wide_int (c) - HOST_WIDE_INT c; +print_wide_int (HOST_WIDE_INT c) { int digs = 0; @@ -1868,8 +1985,7 @@ print_wide_int (c) or by struct, enum and union tags. */ static void -dbxout_type_name (type) - tree type; +dbxout_type_name (tree type) { tree t; if (TYPE_NAME (type) == 0) @@ -1893,19 +2009,20 @@ dbxout_type_name (type) type whose scope is limited to a struct or class. */ static void -dbxout_class_name_qualifiers (decl) - tree decl; +dbxout_class_name_qualifiers (tree decl) { tree context = decl_type_context (decl); - if (context != NULL_TREE + if (context != NULL_TREE && TREE_CODE(context) == RECORD_TYPE - && TYPE_NAME (context) != 0 + && TYPE_NAME (context) != 0 && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE || (DECL_NAME (TYPE_NAME (context)) != 0))) { tree name = TYPE_NAME (context); + emit_pending_bincls_if_required (); + if (TREE_CODE (name) == TYPE_DECL) { dbxout_class_name_qualifiers (name); @@ -1923,24 +2040,77 @@ dbxout_class_name_qualifiers (decl) Return 1 if a stabs might have been emitted. */ int -dbxout_symbol (decl, local) - tree decl; - int local ATTRIBUTE_UNUSED; +dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) { tree type = TREE_TYPE (decl); tree context = NULL_TREE; int result = 0; - /* Cast avoids warning in old compilers. */ - current_sym_code = (STAB_CODE_TYPE) 0; - current_sym_value = 0; - current_sym_addr = 0; + /* "Intercept" dbxout_symbol() calls like we do all debug_hooks. */ + ++debug_nesting; /* Ignore nameless syms, but don't ignore type tags. */ if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL) || DECL_IGNORED_P (decl)) - return 0; + DBXOUT_DECR_NESTING_AND_RETURN (0); + + /* If we are to generate only the symbols actually used then such + symbol nodees are flagged with TREE_USED. Ignore any that + aren't flaged as TREE_USED. */ + + if (flag_debug_only_used_symbols) + { + tree t; + + if (!TREE_USED (decl) + && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))) + DBXOUT_DECR_NESTING_AND_RETURN (0); + + /* We now have a used symbol. We need to generate the info for + the symbol's type in addition to the symbol itself. These + type symbols are queued to be generated after were done with + the symbol itself (done because the symbol's info is generated + with fprintf's, etc. as it determines what's needed). + + Note, because the TREE_TYPE(type) might be something like a + pointer to a named type we need to look for the first name + we see following the TREE_TYPE chain. */ + + t = type; + while (POINTER_TYPE_P (t)) + t = TREE_TYPE (t); + + /* RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, and ENUMERAL_TYPE + need special treatment. The TYPE_STUB_DECL field in these + types generally represents the tag name type we want to + output. In addition there could be a typedef type with + a different name. In that case we also want to output + that. */ + + if ((TREE_CODE (t) == RECORD_TYPE + || TREE_CODE (t) == UNION_TYPE + || TREE_CODE (t) == QUAL_UNION_TYPE + || TREE_CODE (t) == ENUMERAL_TYPE) + && TYPE_STUB_DECL (t) + && TYPE_STUB_DECL (t) != decl + && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (t))) == 'd' + && ! DECL_IGNORED_P (TYPE_STUB_DECL (t))) + { + debug_queue_symbol (TYPE_STUB_DECL (t)); + if (TYPE_NAME (t) + && TYPE_NAME (t) != TYPE_STUB_DECL (t) + && TYPE_NAME (t) != decl + && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd') + debug_queue_symbol (TYPE_NAME (t)); + } + else if (TYPE_NAME (t) + && TYPE_NAME (t) != decl + && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd') + debug_queue_symbol (TYPE_NAME (t)); + } + + emit_pending_bincls_if_required (); dbxout_prepare_symbol (decl); @@ -1958,7 +2128,7 @@ dbxout_symbol (decl, local) case FUNCTION_DECL: if (DECL_RTL (decl) == 0) - return 0; + DBXOUT_DECR_NESTING_AND_RETURN (0); if (DECL_EXTERNAL (decl)) break; /* Don't mention a nested function under its parent. */ @@ -1995,22 +2165,10 @@ dbxout_symbol (decl, local) break; case TYPE_DECL: -#if 0 - /* This seems all wrong. Outputting most kinds of types gives no name - at all. A true definition gives no name; a cross-ref for a - structure can give the tag name, but not a type name. - It seems that no typedef name is defined by outputting a type. */ - - /* If this typedef name was defined by outputting the type, - don't duplicate it. */ - if (typevec[TYPE_SYMTAB_ADDRESS (type)].status == TYPE_DEFINED - && TYPE_NAME (TREE_TYPE (decl)) == decl) - return 0; -#endif /* Don't output the same typedef twice. And don't output what language-specific stuff doesn't want output. */ if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl)) - return 0; + DBXOUT_DECR_NESTING_AND_RETURN (0); FORCE_TEXT; result = 1; @@ -2036,6 +2194,8 @@ dbxout_symbol (decl, local) /* Distinguish the implicit typedefs of C++ from explicit ones that might be found in C. */ && DECL_ARTIFICIAL (decl) + /* Do not generate a tag for incomplete records. */ + && COMPLETE_TYPE_P (type) /* Do not generate a tag for records of variable size, since this type can not be properly described in the DBX format, and it confuses some tools such as objdump. */ @@ -2157,7 +2317,7 @@ dbxout_symbol (decl, local) /* Named return value, treat like a VAR_DECL. */ case VAR_DECL: if (! DECL_RTL_SET_P (decl)) - return 0; + DBXOUT_DECR_NESTING_AND_RETURN (0); /* Don't mention a variable that is external. Let the file that defines it describe it. */ if (DECL_EXTERNAL (decl)) @@ -2181,19 +2341,15 @@ dbxout_symbol (decl, local) || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) { HOST_WIDE_INT ival = tree_low_cst (DECL_INITIAL (decl), 0); -#ifdef DBX_OUTPUT_CONSTANT_SYMBOL - DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival); -#else - fprintf (asmfile, "%s\"%s:c=i", ASM_STABS_OP, name); - - fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, ival); - fprintf (asmfile, "\",0x%x,0,0,0\n", N_LSYM); -#endif + fprintf (asmfile, "%s\"%s:c=i" HOST_WIDE_INT_PRINT_DEC + "\",0x%x,0,0,0\n", + ASM_STABS_OP, name, ival, N_LSYM); + DBXOUT_DECR_NESTING; return 1; } else if (TREE_CODE (TREE_TYPE (decl)) == REAL_TYPE) { - /* don't know how to do this yet. */ + /* Don't know how to do this yet. */ } break; } @@ -2212,6 +2368,7 @@ dbxout_symbol (decl, local) default: break; } + DBXOUT_DECR_NESTING; return result; } @@ -2222,14 +2379,13 @@ dbxout_symbol (decl, local) Returns 1 if the stab was really emitted. */ static int -dbxout_symbol_location (decl, type, suffix, home) - tree decl, type; - const char *suffix; - rtx home; +dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home) { int letter = 0; int regno = -1; + emit_pending_bincls_if_required (); + /* Don't mention a variable at all if it was completely optimized into nothingness. @@ -2305,11 +2461,27 @@ dbxout_symbol_location (decl, type, suffix, home) if (GET_CODE (current_sym_addr) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (current_sym_addr)) { - rtx tmp = get_pool_constant (current_sym_addr); + bool marked; + rtx tmp = get_pool_constant_mark (current_sym_addr, &marked); - if (GET_CODE (tmp) == SYMBOL_REF - || GET_CODE (tmp) == LABEL_REF) - current_sym_addr = tmp; + if (GET_CODE (tmp) == SYMBOL_REF) + { + current_sym_addr = tmp; + if (CONSTANT_POOL_ADDRESS_P (current_sym_addr)) + get_pool_constant_mark (current_sym_addr, &marked); + else + marked = true; + } + else if (GET_CODE (tmp) == LABEL_REF) + { + current_sym_addr = tmp; + marked = true; + } + + /* If all references to the constant pool were optimized + out, we just ignore the symbol. */ + if (!marked) + return 0; } /* Ultrix `as' seems to need this. */ @@ -2419,10 +2591,6 @@ dbxout_symbol_location (decl, type, suffix, home) else dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0)); - /* Cast avoids warning in old compilers. */ - current_sym_code = (STAB_CODE_TYPE) 0; - current_sym_value = 0; - current_sym_addr = 0; dbxout_prepare_symbol (decl); if (WORDS_BIG_ENDIAN) @@ -2458,16 +2626,15 @@ dbxout_symbol_location (decl, type, suffix, home) Then output LETTER to indicate the kind of location the symbol has. */ static void -dbxout_symbol_name (decl, suffix, letter) - tree decl; - const char *suffix; - int letter; +dbxout_symbol_name (tree decl, const char *suffix, int letter) { const char *name; - if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) - /* One slight hitch: if this is a VAR_DECL which is a static - class member, we must put out the mangled name instead of the + if (DECL_CONTEXT (decl) + && (TYPE_P (DECL_CONTEXT (decl)) + || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)) + /* One slight hitch: if this is a VAR_DECL which is a class member + or a namespace member, we must put out the mangled name instead of the DECL_NAME. Note also that static member (variable) names DO NOT begin with underscores in .stabs directives. */ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); @@ -2486,19 +2653,25 @@ dbxout_symbol_name (decl, suffix, letter) } static void -dbxout_prepare_symbol (decl) - tree decl ATTRIBUTE_UNUSED; +dbxout_prepare_symbol (tree decl ATTRIBUTE_UNUSED) { #ifdef WINNING_GDB const char *filename = DECL_SOURCE_FILE (decl); dbxout_source_file (asmfile, filename); #endif + + /* Initialize variables used to communicate each symbol's debug + information to dbxout_finish_symbol with zeroes. */ + + /* Cast avoids warning in old compilers. */ + current_sym_code = (STAB_CODE_TYPE) 0; + current_sym_value = 0; + current_sym_addr = 0; } static void -dbxout_finish_symbol (sym) - tree sym; +dbxout_finish_symbol (tree sym) { #ifdef DBX_FINISH_SYMBOL DBX_FINISH_SYMBOL (sym); @@ -2520,8 +2693,7 @@ dbxout_finish_symbol (sym) anything was output */ int -dbxout_syms (syms) - tree syms; +dbxout_syms (tree syms) { int result = 0; while (syms) @@ -2545,9 +2717,12 @@ dbxout_syms (syms) of all the parms in PARMS, which is a chain of PARM_DECL nodes. */ void -dbxout_parms (parms) - tree parms; +dbxout_parms (tree parms) { + ++debug_nesting; + + emit_pending_bincls_if_required (); + for (; parms; parms = TREE_CHAIN (parms)) if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node) { @@ -2805,6 +2980,7 @@ dbxout_parms (parms) dbxout_finish_symbol (parms); } } + DBXOUT_DECR_NESTING; } /* Output definitions for the places where parms live during the function, @@ -2819,9 +2995,10 @@ dbxout_parms (parms) PARMS is a chain of PARM_DECL nodes. */ void -dbxout_reg_parms (parms) - tree parms; +dbxout_reg_parms (tree parms) { + ++debug_nesting; + for (; parms; parms = TREE_CHAIN (parms)) if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms)) { @@ -2842,14 +3019,14 @@ dbxout_reg_parms (parms) dbxout_symbol_location (parms, TREE_TYPE (parms), 0, DECL_RTL (parms)); } + DBXOUT_DECR_NESTING; } /* Given a chain of ..._TYPE nodes (as come in a parameter list), output definitions of those names, in raw form */ static void -dbxout_args (args) - tree args; +dbxout_args (tree args) { while (args) { @@ -2878,10 +3055,7 @@ dbxout_args (args) We handle them all in sequence. */ static void -dbxout_block (block, depth, args) - tree block; - int depth; - tree args; +dbxout_block (tree block, int depth, tree args) { int blocknum = -1; @@ -2900,9 +3074,6 @@ dbxout_block (block, depth, args) { int did_output; -#ifdef DBX_LBRAC_FIRST - did_output = 1; -#else /* In dbx format, the syms of a block come before the N_LBRAC. If nothing is output, we don't need the N_LBRAC, either. */ did_output = 0; @@ -2910,7 +3081,6 @@ dbxout_block (block, depth, args) did_output = dbxout_syms (BLOCK_VARS (block)); if (args) dbxout_reg_parms (args); -#endif /* Now output an N_LBRAC symbol to represent the beginning of the block. Use the block's tree-walk order to generate @@ -2928,14 +3098,10 @@ dbxout_block (block, depth, args) tree decl = BLOCK_VARS (block); while (decl) { -#ifdef DBX_OUTPUT_CATCH - DBX_OUTPUT_CATCH (asmfile, decl, buf); -#else fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP, IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH); assemble_name (asmfile, buf); fprintf (asmfile, "\n"); -#endif decl = TREE_CHAIN (decl); } } @@ -2953,15 +3119,6 @@ dbxout_block (block, depth, args) #endif } -#ifdef DBX_LBRAC_FIRST - /* On some weird machines, the syms of a block - come after the N_LBRAC. */ - if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0) - dbxout_syms (BLOCK_VARS (block)); - if (args) - dbxout_reg_parms (args); -#endif - /* Output the subblocks. */ dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE); @@ -2993,10 +3150,21 @@ dbxout_block (block, depth, args) #if defined (DBX_DEBUGGING_INFO) static void -dbxout_begin_function (decl) - tree decl; +dbxout_begin_function (tree decl) { - dbxout_symbol (decl, 0); + int saved_tree_used1 = TREE_USED (decl); + TREE_USED (decl) = 1; + if (DECL_NAME (DECL_RESULT (decl)) != 0) + { + int saved_tree_used2 = TREE_USED (DECL_RESULT (decl)); + TREE_USED (DECL_RESULT (decl)) = 1; + dbxout_symbol (decl, 0); + TREE_USED (DECL_RESULT (decl)) = saved_tree_used2; + } + else + dbxout_symbol (decl, 0); + TREE_USED (decl) = saved_tree_used1; + dbxout_parms (DECL_ARGUMENTS (decl)); if (DECL_NAME (DECL_RESULT (decl)) != 0) dbxout_symbol (DECL_RESULT (decl), 1); @@ -3004,3 +3172,5 @@ dbxout_begin_function (decl) #endif /* DBX_DEBUGGING_INFO */ #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */ + +#include "gt-dbxout.h" diff --git a/contrib/gcc/emit-rtl.c b/contrib/gcc/emit-rtl.c index 172a82d3b4b1..f6e44f9c27d5 100644 --- a/contrib/gcc/emit-rtl.c +++ b/contrib/gcc/emit-rtl.c @@ -1,6 +1,6 @@ -/* Emit RTL for the GNU C-Compiler expander. +/* Emit RTL for the GCC expander. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -37,6 +37,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "toplev.h" #include "rtl.h" #include "tree.h" @@ -67,7 +69,7 @@ enum machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ /* This is *not* reset after each function. It gives each CODE_LABEL in the entire compilation a unique label number. */ -static int label_num = 1; +static GTY(()) int label_num = 1; /* Highest label number in current function. Zero means use the value of label_num instead. @@ -75,7 +77,7 @@ static int label_num = 1; static int last_label_num; -/* Value label_num had when set_new_first_and_last_label_number was called. +/* Value label_num had when set_new_last_label_num was called. If label_num has not changed since then, last_label_num is valid. */ static int base_label_num; @@ -108,7 +110,14 @@ rtx const_true_rtx; REAL_VALUE_TYPE dconst0; REAL_VALUE_TYPE dconst1; REAL_VALUE_TYPE dconst2; +REAL_VALUE_TYPE dconst3; +REAL_VALUE_TYPE dconst10; REAL_VALUE_TYPE dconstm1; +REAL_VALUE_TYPE dconstm2; +REAL_VALUE_TYPE dconsthalf; +REAL_VALUE_TYPE dconstthird; +REAL_VALUE_TYPE dconstpi; +REAL_VALUE_TYPE dconste; /* All references to the following fixed hard registers go through these unique rtl objects. On machines where the frame-pointer and @@ -128,8 +137,6 @@ REAL_VALUE_TYPE dconstm1; In an inline procedure, the stack and frame pointer rtxs may not be used for anything else. */ -rtx struct_value_rtx; /* (REG:Pmode STRUCT_VALUE_REGNUM) */ -rtx struct_value_incoming_rtx; /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */ rtx static_chain_rtx; /* (REG:Pmode STATIC_CHAIN_REGNUM) */ rtx static_chain_incoming_rtx; /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */ rtx pic_offset_table_rtx; /* (REG:Pmode PIC_OFFSET_TABLE_REGNUM) */ @@ -155,6 +162,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) static GTY ((if_marked ("ggc_marked_p"), param_is (struct mem_attrs))) htab_t mem_attrs_htab; +/* A hash table storing register attribute structures. */ +static GTY ((if_marked ("ggc_marked_p"), param_is (struct reg_attrs))) + htab_t reg_attrs_htab; + /* A hash table storing all CONST_DOUBLEs. */ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) htab_t const_double_htab; @@ -162,34 +173,32 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) #define first_insn (cfun->emit->x_first_insn) #define last_insn (cfun->emit->x_last_insn) #define cur_insn_uid (cfun->emit->x_cur_insn_uid) -#define last_linenum (cfun->emit->x_last_linenum) -#define last_filename (cfun->emit->x_last_filename) +#define last_location (cfun->emit->x_last_location) #define first_label_num (cfun->emit->x_first_label_num) -static rtx make_jump_insn_raw PARAMS ((rtx)); -static rtx make_call_insn_raw PARAMS ((rtx)); -static rtx find_line_note PARAMS ((rtx)); -static rtx change_address_1 PARAMS ((rtx, enum machine_mode, rtx, - int)); -static void unshare_all_rtl_1 PARAMS ((rtx)); -static void unshare_all_decls PARAMS ((tree)); -static void reset_used_decls PARAMS ((tree)); -static void mark_label_nuses PARAMS ((rtx)); -static hashval_t const_int_htab_hash PARAMS ((const void *)); -static int const_int_htab_eq PARAMS ((const void *, - const void *)); -static hashval_t const_double_htab_hash PARAMS ((const void *)); -static int const_double_htab_eq PARAMS ((const void *, - const void *)); -static rtx lookup_const_double PARAMS ((rtx)); -static hashval_t mem_attrs_htab_hash PARAMS ((const void *)); -static int mem_attrs_htab_eq PARAMS ((const void *, - const void *)); -static mem_attrs *get_mem_attrs PARAMS ((HOST_WIDE_INT, tree, rtx, - rtx, unsigned int, - enum machine_mode)); -static tree component_ref_for_mem_expr PARAMS ((tree)); -static rtx gen_const_vector_0 PARAMS ((enum machine_mode)); +static rtx make_jump_insn_raw (rtx); +static rtx make_call_insn_raw (rtx); +static rtx find_line_note (rtx); +static rtx change_address_1 (rtx, enum machine_mode, rtx, int); +static void unshare_all_decls (tree); +static void reset_used_decls (tree); +static void mark_label_nuses (rtx); +static hashval_t const_int_htab_hash (const void *); +static int const_int_htab_eq (const void *, const void *); +static hashval_t const_double_htab_hash (const void *); +static int const_double_htab_eq (const void *, const void *); +static rtx lookup_const_double (rtx); +static hashval_t mem_attrs_htab_hash (const void *); +static int mem_attrs_htab_eq (const void *, const void *); +static mem_attrs *get_mem_attrs (HOST_WIDE_INT, tree, rtx, rtx, unsigned int, + enum machine_mode); +static hashval_t reg_attrs_htab_hash (const void *); +static int reg_attrs_htab_eq (const void *, const void *); +static reg_attrs *get_reg_attrs (tree, int); +static tree component_ref_for_mem_expr (tree); +static rtx gen_const_vector_0 (enum machine_mode); +static rtx gen_complex_constant_part (enum machine_mode, rtx, int); +static void copy_rtx_if_shared_1 (rtx *orig); /* Probability of the conditional branch currently proceeded by try_split. Set to -1 otherwise. */ @@ -198,10 +207,9 @@ int split_branch_probability = -1; /* Returns a hash code for X (which is a really a CONST_INT). */ static hashval_t -const_int_htab_hash (x) - const void *x; +const_int_htab_hash (const void *x) { - return (hashval_t) INTVAL ((struct rtx_def *) x); + return (hashval_t) INTVAL ((rtx) x); } /* Returns nonzero if the value represented by X (which is really a @@ -209,17 +217,14 @@ const_int_htab_hash (x) HOST_WIDE_INT *). */ static int -const_int_htab_eq (x, y) - const void *x; - const void *y; +const_int_htab_eq (const void *x, const void *y) { return (INTVAL ((rtx) x) == *((const HOST_WIDE_INT *) y)); } /* Returns a hash code for X (which is really a CONST_DOUBLE). */ static hashval_t -const_double_htab_hash (x) - const void *x; +const_double_htab_hash (const void *x) { rtx value = (rtx) x; hashval_t h; @@ -227,16 +232,18 @@ const_double_htab_hash (x) if (GET_MODE (value) == VOIDmode) h = CONST_DOUBLE_LOW (value) ^ CONST_DOUBLE_HIGH (value); else - h = real_hash (CONST_DOUBLE_REAL_VALUE (value)); + { + h = real_hash (CONST_DOUBLE_REAL_VALUE (value)); + /* MODE is used in the comparison, so it should be in the hash. */ + h ^= GET_MODE (value); + } return h; } /* Returns nonzero if the value represented by X (really a ...) is the same as that represented by Y (really a ...) */ static int -const_double_htab_eq (x, y) - const void *x; - const void *y; +const_double_htab_eq (const void *x, const void *y) { rtx a = (rtx)x, b = (rtx)y; @@ -253,8 +260,7 @@ const_double_htab_eq (x, y) /* Returns a hash code for X (which is a really a mem_attrs *). */ static hashval_t -mem_attrs_htab_hash (x) - const void *x; +mem_attrs_htab_hash (const void *x) { mem_attrs *p = (mem_attrs *) x; @@ -269,9 +275,7 @@ mem_attrs_htab_hash (x) mem_attrs *). */ static int -mem_attrs_htab_eq (x, y) - const void *x; - const void *y; +mem_attrs_htab_eq (const void *x, const void *y) { mem_attrs *p = (mem_attrs *) x; mem_attrs *q = (mem_attrs *) y; @@ -285,24 +289,20 @@ mem_attrs_htab_eq (x, y) MEM of mode MODE. */ static mem_attrs * -get_mem_attrs (alias, expr, offset, size, align, mode) - HOST_WIDE_INT alias; - tree expr; - rtx offset; - rtx size; - unsigned int align; - enum machine_mode mode; +get_mem_attrs (HOST_WIDE_INT alias, tree expr, rtx offset, rtx size, + unsigned int align, enum machine_mode mode) { mem_attrs attrs; void **slot; - /* If everything is the default, we can just return zero. */ + /* If everything is the default, we can just return zero. + This must match what the corresponding MEM_* macros return when the + field is not present. */ if (alias == 0 && expr == 0 && offset == 0 && (size == 0 || (mode != BLKmode && GET_MODE_SIZE (mode) == INTVAL (size))) - && (align == BITS_PER_UNIT - || (STRICT_ALIGNMENT - && mode != BLKmode && align == GET_MODE_ALIGNMENT (mode)))) + && (STRICT_ALIGNMENT && mode != BLKmode + ? align == GET_MODE_ALIGNMENT (mode) : align == BITS_PER_UNIT)) return 0; attrs.alias = alias; @@ -321,14 +321,61 @@ get_mem_attrs (alias, expr, offset, size, align, mode) return *slot; } +/* Returns a hash code for X (which is a really a reg_attrs *). */ + +static hashval_t +reg_attrs_htab_hash (const void *x) +{ + reg_attrs *p = (reg_attrs *) x; + + return ((p->offset * 1000) ^ (long) p->decl); +} + +/* Returns nonzero if the value represented by X (which is really a + reg_attrs *) is the same as that given by Y (which is also really a + reg_attrs *). */ + +static int +reg_attrs_htab_eq (const void *x, const void *y) +{ + reg_attrs *p = (reg_attrs *) x; + reg_attrs *q = (reg_attrs *) y; + + return (p->decl == q->decl && p->offset == q->offset); +} +/* Allocate a new reg_attrs structure and insert it into the hash table if + one identical to it is not already in the table. We are doing this for + MEM of mode MODE. */ + +static reg_attrs * +get_reg_attrs (tree decl, int offset) +{ + reg_attrs attrs; + void **slot; + + /* If everything is the default, we can just return zero. */ + if (decl == 0 && offset == 0) + return 0; + + attrs.decl = decl; + attrs.offset = offset; + + slot = htab_find_slot (reg_attrs_htab, &attrs, INSERT); + if (*slot == 0) + { + *slot = ggc_alloc (sizeof (reg_attrs)); + memcpy (*slot, &attrs, sizeof (reg_attrs)); + } + + return *slot; +} + /* Generate a new REG rtx. Make sure ORIGINAL_REGNO is set properly, and don't attempt to share with the various global pieces of rtl (such as frame_pointer_rtx). */ rtx -gen_raw_REG (mode, regno) - enum machine_mode mode; - int regno; +gen_raw_REG (enum machine_mode mode, int regno) { rtx x = gen_rtx_raw_REG (mode, regno); ORIGINAL_REGNO (x) = regno; @@ -340,9 +387,7 @@ gen_raw_REG (mode, regno) special_rtx in gengenrtl.c as well. */ rtx -gen_rtx_CONST_INT (mode, arg) - enum machine_mode mode ATTRIBUTE_UNUSED; - HOST_WIDE_INT arg; +gen_rtx_CONST_INT (enum machine_mode mode ATTRIBUTE_UNUSED, HOST_WIDE_INT arg) { void **slot; @@ -364,9 +409,7 @@ gen_rtx_CONST_INT (mode, arg) } rtx -gen_int_mode (c, mode) - HOST_WIDE_INT c; - enum machine_mode mode; +gen_int_mode (HOST_WIDE_INT c, enum machine_mode mode) { return GEN_INT (trunc_int_for_mode (c, mode)); } @@ -379,8 +422,7 @@ gen_int_mode (c, mode) hash table. If so, return its counterpart; otherwise add it to the hash table and return it. */ static rtx -lookup_const_double (real) - rtx real; +lookup_const_double (rtx real) { void **slot = htab_find_slot (const_double_htab, real, INSERT); if (*slot == 0) @@ -392,9 +434,7 @@ lookup_const_double (real) /* Return a CONST_DOUBLE rtx for a floating-point value specified by VALUE in mode MODE. */ rtx -const_double_from_real_value (value, mode) - REAL_VALUE_TYPE value; - enum machine_mode mode; +const_double_from_real_value (REAL_VALUE_TYPE value, enum machine_mode mode) { rtx real = rtx_alloc (CONST_DOUBLE); PUT_MODE (real, mode); @@ -410,9 +450,7 @@ const_double_from_real_value (value, mode) REAL_VALUE_TYPE and use CONST_DOUBLE_FROM_REAL_VALUE. */ rtx -immed_double_const (i0, i1, mode) - HOST_WIDE_INT i0, i1; - enum machine_mode mode; +immed_double_const (HOST_WIDE_INT i0, HOST_WIDE_INT i1, enum machine_mode mode) { rtx value; unsigned int i; @@ -495,9 +533,7 @@ immed_double_const (i0, i1, mode) } rtx -gen_rtx_REG (mode, regno) - enum machine_mode mode; - unsigned int regno; +gen_rtx_REG (enum machine_mode mode, unsigned int regno) { /* In case the MD file explicitly references the frame pointer, have all such references point to the same frame pointer. This is @@ -531,7 +567,7 @@ gen_rtx_REG (mode, regno) if (regno == RETURN_ADDRESS_POINTER_REGNUM) return return_address_pointer_rtx; #endif - if (regno == PIC_OFFSET_TABLE_REGNUM + if (regno == (unsigned) PIC_OFFSET_TABLE_REGNUM && fixed_regs[PIC_OFFSET_TABLE_REGNUM]) return pic_offset_table_rtx; if (regno == STACK_POINTER_REGNUM) @@ -562,9 +598,7 @@ gen_rtx_REG (mode, regno) } rtx -gen_rtx_MEM (mode, addr) - enum machine_mode mode; - rtx addr; +gen_rtx_MEM (enum machine_mode mode, rtx addr) { rtx rt = gen_rtx_raw_MEM (mode, addr); @@ -576,10 +610,7 @@ gen_rtx_MEM (mode, addr) } rtx -gen_rtx_SUBREG (mode, reg, offset) - enum machine_mode mode; - rtx reg; - int offset; +gen_rtx_SUBREG (enum machine_mode mode, rtx reg, int offset) { /* This is the most common failure type. Catch it early so we can see who does it. */ @@ -601,9 +632,7 @@ gen_rtx_SUBREG (mode, reg, offset) is smaller than mode of REG, otherwise paradoxical SUBREG. */ rtx -gen_lowpart_SUBREG (mode, reg) - enum machine_mode mode; - rtx reg; +gen_lowpart_SUBREG (enum machine_mode mode, rtx reg) { enum machine_mode inmode; @@ -642,15 +671,14 @@ gen_lowpart_SUBREG (mode, reg) /*VARARGS2*/ rtx -gen_rtx VPARAMS ((enum rtx_code code, enum machine_mode mode, ...)) +gen_rtx (enum rtx_code code, enum machine_mode mode, ...) { int i; /* Array indices... */ const char *fmt; /* Current rtx's format... */ rtx rt_val; /* RTX to return to caller... */ + va_list p; - VA_OPEN (p, mode); - VA_FIXEDARG (p, enum rtx_code, code); - VA_FIXEDARG (p, enum machine_mode, mode); + va_start (p, mode); switch (code) { @@ -684,7 +712,8 @@ gen_rtx VPARAMS ((enum rtx_code code, enum machine_mode mode, ...)) { switch (*fmt++) { - case '0': /* Unused field. */ + case '0': /* Field with unknown use. Zero it. */ + X0EXP (rt_val, i) = NULL_RTX; break; case 'i': /* An integer? */ @@ -723,7 +752,7 @@ gen_rtx VPARAMS ((enum rtx_code code, enum machine_mode mode, ...)) break; } - VA_CLOSE (p); + va_end (p); return rt_val; } @@ -735,33 +764,31 @@ gen_rtx VPARAMS ((enum rtx_code code, enum machine_mode mode, ...)) /*VARARGS1*/ rtvec -gen_rtvec VPARAMS ((int n, ...)) +gen_rtvec (int n, ...) { int i, save_n; rtx *vector; + va_list p; - VA_OPEN (p, n); - VA_FIXEDARG (p, int, n); + va_start (p, n); if (n == 0) return NULL_RTVEC; /* Don't allocate an empty rtvec... */ - vector = (rtx *) alloca (n * sizeof (rtx)); + vector = alloca (n * sizeof (rtx)); for (i = 0; i < n; i++) vector[i] = va_arg (p, rtx); /* The definition of VA_* in K&R C causes `n' to go out of scope. */ save_n = n; - VA_CLOSE (p); + va_end (p); return gen_rtvec_v (save_n, vector); } rtvec -gen_rtvec_v (n, argp) - int n; - rtx *argp; +gen_rtvec_v (int n, rtx *argp) { int i; rtvec rt_val; @@ -781,8 +808,7 @@ gen_rtvec_v (n, argp) This pseudo is assigned the next sequential register number. */ rtx -gen_reg_rtx (mode) - enum machine_mode mode; +gen_reg_rtx (enum machine_mode mode) { struct function *f = cfun; rtx val; @@ -809,7 +835,7 @@ gen_reg_rtx (mode) return gen_rtx_CONCAT (mode, realpart, imagpart); } - /* Make sure regno_pointer_align, regno_decl, and regno_reg_rtx are large + /* Make sure regno_pointer_align, and regno_reg_rtx are large enough to have an element for this pseudo reg number. */ if (reg_rtx_no == f->emit->regno_pointer_align_length) @@ -817,22 +843,16 @@ gen_reg_rtx (mode) int old_size = f->emit->regno_pointer_align_length; char *new; rtx *new1; - tree *new2; new = ggc_realloc (f->emit->regno_pointer_align, old_size * 2); memset (new + old_size, 0, old_size); f->emit->regno_pointer_align = (unsigned char *) new; - new1 = (rtx *) ggc_realloc (f->emit->x_regno_reg_rtx, - old_size * 2 * sizeof (rtx)); + new1 = ggc_realloc (f->emit->x_regno_reg_rtx, + old_size * 2 * sizeof (rtx)); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; - new2 = (tree *) ggc_realloc (f->emit->regno_decl, - old_size * 2 * sizeof (tree)); - memset (new2 + old_size, 0, old_size * sizeof (tree)); - f->emit->regno_decl = new2; - f->emit->regno_pointer_align_length = old_size * 2; } @@ -841,11 +861,90 @@ gen_reg_rtx (mode) return val; } +/* Generate a register with same attributes as REG, + but offsetted by OFFSET. */ + +rtx +gen_rtx_REG_offset (rtx reg, enum machine_mode mode, unsigned int regno, int offset) +{ + rtx new = gen_rtx_REG (mode, regno); + REG_ATTRS (new) = get_reg_attrs (REG_EXPR (reg), + REG_OFFSET (reg) + offset); + return new; +} + +/* Set the decl for MEM to DECL. */ + +void +set_reg_attrs_from_mem (rtx reg, rtx mem) +{ + if (MEM_OFFSET (mem) && GET_CODE (MEM_OFFSET (mem)) == CONST_INT) + REG_ATTRS (reg) + = get_reg_attrs (MEM_EXPR (mem), INTVAL (MEM_OFFSET (mem))); +} + +/* Set the register attributes for registers contained in PARM_RTX. + Use needed values from memory attributes of MEM. */ + +void +set_reg_attrs_for_parm (rtx parm_rtx, rtx mem) +{ + if (GET_CODE (parm_rtx) == REG) + set_reg_attrs_from_mem (parm_rtx, mem); + else if (GET_CODE (parm_rtx) == PARALLEL) + { + /* Check for a NULL entry in the first slot, used to indicate that the + parameter goes both on the stack and in registers. */ + int i = XEXP (XVECEXP (parm_rtx, 0, 0), 0) ? 0 : 1; + for (; i < XVECLEN (parm_rtx, 0); i++) + { + rtx x = XVECEXP (parm_rtx, 0, i); + if (GET_CODE (XEXP (x, 0)) == REG) + REG_ATTRS (XEXP (x, 0)) + = get_reg_attrs (MEM_EXPR (mem), + INTVAL (XEXP (x, 1))); + } + } +} + +/* Assign the RTX X to declaration T. */ +void +set_decl_rtl (tree t, rtx x) +{ + DECL_CHECK (t)->decl.rtl = x; + + if (!x) + return; + /* For register, we maintain the reverse information too. */ + if (GET_CODE (x) == REG) + REG_ATTRS (x) = get_reg_attrs (t, 0); + else if (GET_CODE (x) == SUBREG) + REG_ATTRS (SUBREG_REG (x)) + = get_reg_attrs (t, -SUBREG_BYTE (x)); + if (GET_CODE (x) == CONCAT) + { + if (REG_P (XEXP (x, 0))) + REG_ATTRS (XEXP (x, 0)) = get_reg_attrs (t, 0); + if (REG_P (XEXP (x, 1))) + REG_ATTRS (XEXP (x, 1)) + = get_reg_attrs (t, GET_MODE_UNIT_SIZE (GET_MODE (XEXP (x, 0)))); + } + if (GET_CODE (x) == PARALLEL) + { + int i; + for (i = 0; i < XVECLEN (x, 0); i++) + { + rtx y = XVECEXP (x, 0, i); + if (REG_P (XEXP (y, 0))) + REG_ATTRS (XEXP (y, 0)) = get_reg_attrs (t, INTVAL (XEXP (y, 1))); + } + } +} + /* Identify REG (which may be a CONCAT) as a user register. */ void -mark_user_reg (reg) - rtx reg; +mark_user_reg (rtx reg) { if (GET_CODE (reg) == CONCAT) { @@ -862,9 +961,7 @@ mark_user_reg (reg) as ALIGN, if nonzero. */ void -mark_reg_pointer (reg, align) - rtx reg; - int align; +mark_reg_pointer (rtx reg, int align) { if (! REG_POINTER (reg)) { @@ -874,14 +971,14 @@ mark_reg_pointer (reg, align) REGNO_POINTER_ALIGN (REGNO (reg)) = align; } else if (align && align < REGNO_POINTER_ALIGN (REGNO (reg))) - /* We can no-longer be sure just how aligned this pointer is */ + /* We can no-longer be sure just how aligned this pointer is. */ REGNO_POINTER_ALIGN (REGNO (reg)) = align; } /* Return 1 plus largest pseudo reg number used in the current function. */ int -max_reg_num () +max_reg_num (void) { return reg_rtx_no; } @@ -889,7 +986,7 @@ max_reg_num () /* Return 1 + the largest label number used so far in the current function. */ int -max_label_num () +max_label_num (void) { if (last_label_num && label_num == base_label_num) return last_label_num; @@ -899,7 +996,7 @@ max_label_num () /* Return first label number used in this function (if any were used). */ int -get_first_label_num () +get_first_label_num (void) { return first_label_num; } @@ -907,9 +1004,7 @@ get_first_label_num () /* Return the final regno of X, which is a SUBREG of a hard register. */ int -subreg_hard_regno (x, check_mode) - rtx x; - int check_mode; +subreg_hard_regno (rtx x, int check_mode) { enum machine_mode mode = GET_MODE (x); unsigned int byte_offset, base_regno, final_regno; @@ -927,7 +1022,7 @@ subreg_hard_regno (x, check_mode) abort (); #ifdef ENABLE_CHECKING if (!subreg_offset_representable_p (REGNO (reg), GET_MODE (reg), - SUBREG_BYTE (x), mode)) + SUBREG_BYTE (x), mode)) abort (); #endif /* Catch non-congruent offsets too. */ @@ -952,29 +1047,39 @@ subreg_hard_regno (x, check_mode) If this is not a case we can handle, return 0. */ rtx -gen_lowpart_common (mode, x) - enum machine_mode mode; - rtx x; +gen_lowpart_common (enum machine_mode mode, rtx x) { int msize = GET_MODE_SIZE (mode); - int xsize = GET_MODE_SIZE (GET_MODE (x)); + int xsize; int offset = 0; + enum machine_mode innermode; - if (GET_MODE (x) == mode) + /* Unfortunately, this routine doesn't take a parameter for the mode of X, + so we have to make one up. Yuk. */ + innermode = GET_MODE (x); + if (GET_CODE (x) == CONST_INT && msize <= HOST_BITS_PER_WIDE_INT) + innermode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0); + else if (innermode == VOIDmode) + innermode = mode_for_size (HOST_BITS_PER_WIDE_INT * 2, MODE_INT, 0); + + xsize = GET_MODE_SIZE (innermode); + + if (innermode == VOIDmode || innermode == BLKmode) + abort (); + + if (innermode == mode) return x; /* MODE must occupy no more words than the mode of X. */ - if (GET_MODE (x) != VOIDmode - && ((msize + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD - > ((xsize + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))) + if ((msize + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD + > ((xsize + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)) return 0; /* Don't allow generating paradoxical FLOAT_MODE subregs. */ - if (GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE (x) != VOIDmode && msize > xsize) + if (GET_MODE_CLASS (mode) == MODE_FLOAT && msize > xsize) return 0; - offset = subreg_lowpart_offset (mode, GET_MODE (x)); + offset = subreg_lowpart_offset (mode, innermode); if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND) && (GET_MODE_CLASS (mode) == MODE_INT @@ -990,163 +1095,58 @@ gen_lowpart_common (mode, x) if (GET_MODE (XEXP (x, 0)) == mode) return XEXP (x, 0); - else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (XEXP (x, 0)))) + else if (msize < GET_MODE_SIZE (GET_MODE (XEXP (x, 0)))) return gen_lowpart_common (mode, XEXP (x, 0)); - else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x))) + else if (msize < xsize) return gen_rtx_fmt_e (GET_CODE (x), mode, XEXP (x, 0)); } else if (GET_CODE (x) == SUBREG || GET_CODE (x) == REG - || GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR) - return simplify_gen_subreg (mode, x, GET_MODE (x), offset); - else if ((GET_MODE_CLASS (mode) == MODE_VECTOR_INT - || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) - && GET_MODE (x) == VOIDmode) - return simplify_gen_subreg (mode, x, int_mode_for_mode (mode), offset); - /* If X is a CONST_INT or a CONST_DOUBLE, extract the appropriate bits - from the low-order part of the constant. */ - else if ((GET_MODE_CLASS (mode) == MODE_INT - || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) - && GET_MODE (x) == VOIDmode - && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)) - { - /* If MODE is twice the host word size, X is already the desired - representation. Otherwise, if MODE is wider than a word, we can't - do this. If MODE is exactly a word, return just one CONST_INT. */ - - if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT) - return x; - else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT) - return 0; - else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_WIDE_INT) - return (GET_CODE (x) == CONST_INT ? x - : GEN_INT (CONST_DOUBLE_LOW (x))); - else - { - /* MODE must be narrower than HOST_BITS_PER_WIDE_INT. */ - HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x) - : CONST_DOUBLE_LOW (x)); - - /* Sign extend to HOST_WIDE_INT. */ - val = trunc_int_for_mode (val, mode); - - return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x - : GEN_INT (val)); - } - } - - /* The floating-point emulator can handle all conversions between - FP and integer operands. This simplifies reload because it - doesn't have to deal with constructs like (subreg:DI - (const_double:SF ...)) or (subreg:DF (const_int ...)). */ - /* Single-precision floats are always 32-bits and double-precision - floats are always 64-bits. */ - - else if (GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE_BITSIZE (mode) == 32 - && GET_CODE (x) == CONST_INT) - { - REAL_VALUE_TYPE r; - long i = INTVAL (x); - - real_from_target (&r, &i, mode); - return CONST_DOUBLE_FROM_REAL_VALUE (r, mode); - } - else if (GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE_BITSIZE (mode) == 64 - && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE) - && GET_MODE (x) == VOIDmode) - { - REAL_VALUE_TYPE r; - HOST_WIDE_INT low, high; - long i[2]; - - if (GET_CODE (x) == CONST_INT) - { - low = INTVAL (x); - high = low >> (HOST_BITS_PER_WIDE_INT - 1); - } - else - { - low = CONST_DOUBLE_LOW (x); - high = CONST_DOUBLE_HIGH (x); - } - - if (HOST_BITS_PER_WIDE_INT > 32) - high = low >> 31 >> 1; - - /* REAL_VALUE_TARGET_DOUBLE takes the addressing order of the - target machine. */ - if (WORDS_BIG_ENDIAN) - i[0] = high, i[1] = low; - else - i[0] = low, i[1] = high; - - real_from_target (&r, i, mode); - return CONST_DOUBLE_FROM_REAL_VALUE (r, mode); - } - else if ((GET_MODE_CLASS (mode) == MODE_INT - || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) - && GET_CODE (x) == CONST_DOUBLE - && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - { - REAL_VALUE_TYPE r; - long i[4]; /* Only the low 32 bits of each 'long' are used. */ - int endian = WORDS_BIG_ENDIAN ? 1 : 0; - - /* Convert 'r' into an array of four 32-bit words in target word - order. */ - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - switch (GET_MODE_BITSIZE (GET_MODE (x))) - { - case 32: - REAL_VALUE_TO_TARGET_SINGLE (r, i[3 * endian]); - i[1] = 0; - i[2] = 0; - i[3 - 3 * endian] = 0; - break; - case 64: - REAL_VALUE_TO_TARGET_DOUBLE (r, i + 2 * endian); - i[2 - 2 * endian] = 0; - i[3 - 2 * endian] = 0; - break; - case 96: - REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian); - i[3 - 3 * endian] = 0; - break; - case 128: - REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i); - break; - default: - abort (); - } - /* Now, pack the 32-bit elements of the array into a CONST_DOUBLE - and return it. */ -#if HOST_BITS_PER_WIDE_INT == 32 - return immed_double_const (i[3 * endian], i[1 + endian], mode); -#else - if (HOST_BITS_PER_WIDE_INT != 64) - abort (); - - return immed_double_const ((((unsigned long) i[3 * endian]) - | ((HOST_WIDE_INT) i[1 + endian] << 32)), - (((unsigned long) i[2 - endian]) - | ((HOST_WIDE_INT) i[3 - 3 * endian] << 32)), - mode); -#endif - } + || GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR + || GET_CODE (x) == CONST_DOUBLE || GET_CODE (x) == CONST_INT) + return simplify_gen_subreg (mode, x, innermode, offset); /* Otherwise, we can't do this. */ return 0; } +/* Return the constant real or imaginary part (which has mode MODE) + of a complex value X. The IMAGPART_P argument determines whether + the real or complex component should be returned. This function + returns NULL_RTX if the component isn't a constant. */ + +static rtx +gen_complex_constant_part (enum machine_mode mode, rtx x, int imagpart_p) +{ + tree decl, part; + + if (GET_CODE (x) == MEM + && GET_CODE (XEXP (x, 0)) == SYMBOL_REF) + { + decl = SYMBOL_REF_DECL (XEXP (x, 0)); + if (decl != NULL_TREE && TREE_CODE (decl) == COMPLEX_CST) + { + part = imagpart_p ? TREE_IMAGPART (decl) : TREE_REALPART (decl); + if (TREE_CODE (part) == REAL_CST + || TREE_CODE (part) == INTEGER_CST) + return expand_expr (part, NULL_RTX, mode, 0); + } + } + return NULL_RTX; +} + /* Return the real part (which has mode MODE) of a complex value X. This always comes at the low address in memory. */ rtx -gen_realpart (mode, x) - enum machine_mode mode; - rtx x; +gen_realpart (enum machine_mode mode, rtx x) { + rtx part; + + /* Handle complex constants. */ + part = gen_complex_constant_part (mode, x, 0); + if (part != NULL_RTX) + return part; + if (WORDS_BIG_ENDIAN && GET_MODE_BITSIZE (mode) < BITS_PER_WORD && REG_P (x) @@ -1163,10 +1163,15 @@ gen_realpart (mode, x) This always comes at the high address in memory. */ rtx -gen_imagpart (mode, x) - enum machine_mode mode; - rtx x; +gen_imagpart (enum machine_mode mode, rtx x) { + rtx part; + + /* Handle complex constants. */ + part = gen_complex_constant_part (mode, x, 1); + if (part != NULL_RTX) + return part; + if (WORDS_BIG_ENDIAN) return gen_lowpart (mode, x); else if (! WORDS_BIG_ENDIAN @@ -1185,14 +1190,13 @@ gen_imagpart (mode, x) regardless of WORDS_BIG_ENDIAN. */ int -subreg_realpart_p (x) - rtx x; +subreg_realpart_p (rtx x) { if (GET_CODE (x) != SUBREG) abort (); return ((unsigned int) SUBREG_BYTE (x) - < GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (x)))); + < (unsigned int) GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (x)))); } /* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value, @@ -1203,9 +1207,7 @@ subreg_realpart_p (x) If X is a MEM whose address is a QUEUED, the value may be so also. */ rtx -gen_lowpart (mode, x) - enum machine_mode mode; - rtx x; +gen_lowpart (enum machine_mode mode, rtx x) { rtx result = gen_lowpart_common (mode, x); @@ -1223,6 +1225,15 @@ gen_lowpart (mode, x) { /* The only additional case we can do is MEM. */ int offset = 0; + + /* The following exposes the use of "x" to CSE. */ + if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD + && SCALAR_INT_MODE_P (GET_MODE (x)) + && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), + GET_MODE_BITSIZE (GET_MODE (x))) + && ! no_new_pseudos) + return gen_lowpart (mode, force_reg (GET_MODE (x), x)); + if (WORDS_BIG_ENDIAN) offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD) - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)); @@ -1245,9 +1256,7 @@ gen_lowpart (mode, x) This is used to access the imaginary part of a complex number. */ rtx -gen_highpart (mode, x) - enum machine_mode mode; - rtx x; +gen_highpart (enum machine_mode mode, rtx x) { unsigned int msize = GET_MODE_SIZE (mode); rtx result; @@ -1255,7 +1264,7 @@ gen_highpart (mode, x) /* This case loses if X is a subreg. To catch bugs early, complain if an invalid MODE is used even in other cases. */ if (msize > UNITS_PER_WORD - && msize != GET_MODE_UNIT_SIZE (GET_MODE (x))) + && msize != (unsigned int) GET_MODE_UNIT_SIZE (GET_MODE (x))) abort (); result = simplify_gen_subreg (mode, x, GET_MODE (x), @@ -1272,12 +1281,10 @@ gen_highpart (mode, x) return result; } -/* Like gen_highpart_mode, but accept mode of EXP operand in case EXP can +/* Like gen_highpart, but accept mode of EXP operand in case EXP can be VOIDmode constant. */ rtx -gen_highpart_mode (outermode, innermode, exp) - enum machine_mode outermode, innermode; - rtx exp; +gen_highpart_mode (enum machine_mode outermode, enum machine_mode innermode, rtx exp) { if (GET_MODE (exp) != VOIDmode) { @@ -1293,8 +1300,7 @@ gen_highpart_mode (outermode, innermode, exp) of the value in mode INNERMODE stored in memory in target format. */ unsigned int -subreg_lowpart_offset (outermode, innermode) - enum machine_mode outermode, innermode; +subreg_lowpart_offset (enum machine_mode outermode, enum machine_mode innermode) { unsigned int offset = 0; int difference = (GET_MODE_SIZE (innermode) - GET_MODE_SIZE (outermode)); @@ -1313,8 +1319,7 @@ subreg_lowpart_offset (outermode, innermode) /* Return offset in bytes to get OUTERMODE high part of the value in mode INNERMODE stored in memory in target format. */ unsigned int -subreg_highpart_offset (outermode, innermode) - enum machine_mode outermode, innermode; +subreg_highpart_offset (enum machine_mode outermode, enum machine_mode innermode) { unsigned int offset = 0; int difference = (GET_MODE_SIZE (innermode) - GET_MODE_SIZE (outermode)); @@ -1338,8 +1343,7 @@ subreg_highpart_offset (outermode, innermode) If X is not a SUBREG, always return 1 (it is its own low part!). */ int -subreg_lowpart_p (x) - rtx x; +subreg_lowpart_p (rtx x) { if (GET_CODE (x) != SUBREG) return 1; @@ -1350,165 +1354,6 @@ subreg_lowpart_p (x) == SUBREG_BYTE (x)); } - -/* Helper routine for all the constant cases of operand_subword. - Some places invoke this directly. */ - -rtx -constant_subword (op, offset, mode) - rtx op; - int offset; - enum machine_mode mode; -{ - int size_ratio = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD; - HOST_WIDE_INT val; - - /* If OP is already an integer word, return it. */ - if (GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_SIZE (mode) == UNITS_PER_WORD) - return op; - - /* The output is some bits, the width of the target machine's word. - A wider-word host can surely hold them in a CONST_INT. A narrower-word - host can't. */ - if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD - && GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE_BITSIZE (mode) == 64 - && GET_CODE (op) == CONST_DOUBLE) - { - long k[2]; - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, op); - REAL_VALUE_TO_TARGET_DOUBLE (rv, k); - - /* We handle 32-bit and >= 64-bit words here. Note that the order in - which the words are written depends on the word endianness. - ??? This is a potential portability problem and should - be fixed at some point. - - We must exercise caution with the sign bit. By definition there - are 32 significant bits in K; there may be more in a HOST_WIDE_INT. - Consider a host with a 32-bit long and a 64-bit HOST_WIDE_INT. - So we explicitly mask and sign-extend as necessary. */ - if (BITS_PER_WORD == 32) - { - val = k[offset]; - val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; - return GEN_INT (val); - } -#if HOST_BITS_PER_WIDE_INT >= 64 - else if (BITS_PER_WORD >= 64 && offset == 0) - { - val = k[! WORDS_BIG_ENDIAN]; - val = (((val & 0xffffffff) ^ 0x80000000) - 0x80000000) << 32; - val |= (HOST_WIDE_INT) k[WORDS_BIG_ENDIAN] & 0xffffffff; - return GEN_INT (val); - } -#endif - else if (BITS_PER_WORD == 16) - { - val = k[offset >> 1]; - if ((offset & 1) == ! WORDS_BIG_ENDIAN) - val >>= 16; - val = ((val & 0xffff) ^ 0x8000) - 0x8000; - return GEN_INT (val); - } - else - abort (); - } - else if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD - && GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE_BITSIZE (mode) > 64 - && GET_CODE (op) == CONST_DOUBLE) - { - long k[4]; - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, op); - REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k); - - if (BITS_PER_WORD == 32) - { - val = k[offset]; - val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; - return GEN_INT (val); - } -#if HOST_BITS_PER_WIDE_INT >= 64 - else if (BITS_PER_WORD >= 64 && offset <= 1) - { - val = k[offset * 2 + ! WORDS_BIG_ENDIAN]; - val = (((val & 0xffffffff) ^ 0x80000000) - 0x80000000) << 32; - val |= (HOST_WIDE_INT) k[offset * 2 + WORDS_BIG_ENDIAN] & 0xffffffff; - return GEN_INT (val); - } -#endif - else - abort (); - } - - /* Single word float is a little harder, since single- and double-word - values often do not have the same high-order bits. We have already - verified that we want the only defined word of the single-word value. */ - if (GET_MODE_CLASS (mode) == MODE_FLOAT - && GET_MODE_BITSIZE (mode) == 32 - && GET_CODE (op) == CONST_DOUBLE) - { - long l; - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, op); - REAL_VALUE_TO_TARGET_SINGLE (rv, l); - - /* Sign extend from known 32-bit value to HOST_WIDE_INT. */ - val = l; - val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; - - if (BITS_PER_WORD == 16) - { - if ((offset & 1) == ! WORDS_BIG_ENDIAN) - val >>= 16; - val = ((val & 0xffff) ^ 0x8000) - 0x8000; - } - - return GEN_INT (val); - } - - /* The only remaining cases that we can handle are integers. - Convert to proper endianness now since these cases need it. - At this point, offset == 0 means the low-order word. - - We do not want to handle the case when BITS_PER_WORD <= HOST_BITS_PER_INT - in general. However, if OP is (const_int 0), we can just return - it for any word. */ - - if (op == const0_rtx) - return op; - - if (GET_MODE_CLASS (mode) != MODE_INT - || (GET_CODE (op) != CONST_INT && GET_CODE (op) != CONST_DOUBLE) - || BITS_PER_WORD > HOST_BITS_PER_WIDE_INT) - return 0; - - if (WORDS_BIG_ENDIAN) - offset = GET_MODE_SIZE (mode) / UNITS_PER_WORD - 1 - offset; - - /* Find out which word on the host machine this value is in and get - it from the constant. */ - val = (offset / size_ratio == 0 - ? (GET_CODE (op) == CONST_INT ? INTVAL (op) : CONST_DOUBLE_LOW (op)) - : (GET_CODE (op) == CONST_INT - ? (INTVAL (op) < 0 ? ~0 : 0) : CONST_DOUBLE_HIGH (op))); - - /* Get the value we want into the low bits of val. */ - if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT) - val = ((val >> ((offset % size_ratio) * BITS_PER_WORD))); - - val = trunc_int_for_mode (val, word_mode); - - return GEN_INT (val); -} - /* Return subword OFFSET of operand OP. The word number, OFFSET, is interpreted as the word number starting at the low-order address. OFFSET 0 is the low-order word if not @@ -1535,11 +1380,7 @@ constant_subword (op, offset, mode) */ rtx -operand_subword (op, offset, validate_address, mode) - rtx op; - unsigned int offset; - int validate_address; - enum machine_mode mode; +operand_subword (rtx op, unsigned int offset, int validate_address, enum machine_mode mode) { if (mode == VOIDmode) mode = GET_MODE (op); @@ -1585,10 +1426,7 @@ operand_subword (op, offset, validate_address, mode) MODE is the mode of OP, in case it is CONST_INT. */ rtx -operand_subword_force (op, offset, mode) - rtx op; - unsigned int offset; - enum machine_mode mode; +operand_subword_force (rtx op, unsigned int offset, enum machine_mode mode) { rtx result = operand_subword (op, offset, 1, mode); @@ -1616,8 +1454,7 @@ operand_subword_force (op, offset, mode) A test instruction is changed into a compare of 0 against the operand. */ void -reverse_comparison (insn) - rtx insn; +reverse_comparison (rtx insn) { rtx body = PATTERN (insn); rtx comp; @@ -1650,8 +1487,7 @@ reverse_comparison (insn) a NULL expression. */ static tree -component_ref_for_mem_expr (ref) - tree ref; +component_ref_for_mem_expr (tree ref) { tree inner = TREE_OPERAND (ref, 0); @@ -1684,17 +1520,48 @@ component_ref_for_mem_expr (ref) TREE_OPERAND (ref, 1)); } +/* Returns 1 if both MEM_EXPR can be considered equal + and 0 otherwise. */ + +int +mem_expr_equal_p (tree expr1, tree expr2) +{ + if (expr1 == expr2) + return 1; + + if (! expr1 || ! expr2) + return 0; + + if (TREE_CODE (expr1) != TREE_CODE (expr2)) + return 0; + + if (TREE_CODE (expr1) == COMPONENT_REF) + return + mem_expr_equal_p (TREE_OPERAND (expr1, 0), + TREE_OPERAND (expr2, 0)) + && mem_expr_equal_p (TREE_OPERAND (expr1, 1), /* field decl */ + TREE_OPERAND (expr2, 1)); + + if (TREE_CODE (expr1) == INDIRECT_REF) + return mem_expr_equal_p (TREE_OPERAND (expr1, 0), + TREE_OPERAND (expr2, 0)); + + /* Decls with different pointers can't be equal. */ + if (DECL_P (expr1)) + return 0; + + abort(); /* ARRAY_REFs, ARRAY_RANGE_REFs and BIT_FIELD_REFs should already + have been resolved here. */ +} + /* Given REF, a MEM, and T, either the type of X or the expression corresponding to REF, set the memory attributes. OBJECTP is nonzero if we are making a new object of this type. BITPOS is nonzero if there is an offset outstanding on T that will be applied later. */ void -set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) - rtx ref; - tree t; - int objectp; - HOST_WIDE_INT bitpos; +set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, + HOST_WIDE_INT bitpos) { HOST_WIDE_INT alias = MEM_ALIAS_SET (ref); tree expr = MEM_EXPR (ref); @@ -1711,6 +1578,8 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) return; type = TYPE_P (t) ? t : TREE_TYPE (t); + if (type == error_mark_node) + return; /* If we have already set DECL_RTL = ref, get_alias_set will get the wrong answer, as it assumes that DECL_RTL already has the right alias @@ -1827,11 +1696,9 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) /* If the index has a self-referential type, pass it to a WITH_RECORD_EXPR; if the component size is, pass our component to one. */ - if (! TREE_CONSTANT (index) - && contains_placeholder_p (index)) + if (CONTAINS_PLACEHOLDER_P (index)) index = build (WITH_RECORD_EXPR, TREE_TYPE (index), index, t2); - if (! TREE_CONSTANT (unit_size) - && contains_placeholder_p (unit_size)) + if (CONTAINS_PLACEHOLDER_P (unit_size)) unit_size = build (WITH_RECORD_EXPR, sizetype, unit_size, array); @@ -1854,7 +1721,7 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) HOST_WIDE_INT ioff = tree_low_cst (off_tree, 1); HOST_WIDE_INT aoff = (ioff & -ioff) * BITS_PER_UNIT; align = DECL_ALIGN (t2); - if (aoff && aoff < align) + if (aoff && (unsigned HOST_WIDE_INT) aoff < align) align = aoff; offset = GEN_INT (ioff); apply_bitpos = bitpos; @@ -1891,7 +1758,7 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) } } - /* If we modified OFFSET based on T, then subtract the outstanding + /* If we modified OFFSET based on T, then subtract the outstanding bit position offset. Similarly, increase the size of the accessed object to contain the negative offset. */ if (apply_bitpos) @@ -1918,20 +1785,26 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) } void -set_mem_attributes (ref, t, objectp) - rtx ref; - tree t; - int objectp; +set_mem_attributes (rtx ref, tree t, int objectp) { set_mem_attributes_minus_bitpos (ref, t, objectp, 0); } +/* Set the decl for MEM to DECL. */ + +void +set_mem_attrs_from_reg (rtx mem, rtx reg) +{ + MEM_ATTRS (mem) + = get_mem_attrs (MEM_ALIAS_SET (mem), REG_EXPR (reg), + GEN_INT (REG_OFFSET (reg)), + MEM_SIZE (mem), MEM_ALIGN (mem), GET_MODE (mem)); +} + /* Set the alias set of MEM to SET. */ void -set_mem_alias_set (mem, set) - rtx mem; - HOST_WIDE_INT set; +set_mem_alias_set (rtx mem, HOST_WIDE_INT set) { #ifdef ENABLE_CHECKING /* If the new and old alias sets don't conflict, something is wrong. */ @@ -1947,9 +1820,7 @@ set_mem_alias_set (mem, set) /* Set the alignment of MEM to ALIGN bits. */ void -set_mem_align (mem, align) - rtx mem; - unsigned int align; +set_mem_align (rtx mem, unsigned int align) { MEM_ATTRS (mem) = get_mem_attrs (MEM_ALIAS_SET (mem), MEM_EXPR (mem), MEM_OFFSET (mem), MEM_SIZE (mem), align, @@ -1959,9 +1830,7 @@ set_mem_align (mem, align) /* Set the expr for MEM to EXPR. */ void -set_mem_expr (mem, expr) - rtx mem; - tree expr; +set_mem_expr (rtx mem, tree expr) { MEM_ATTRS (mem) = get_mem_attrs (MEM_ALIAS_SET (mem), expr, MEM_OFFSET (mem), @@ -1971,8 +1840,7 @@ set_mem_expr (mem, expr) /* Set the offset of MEM to OFFSET. */ void -set_mem_offset (mem, offset) - rtx mem, offset; +set_mem_offset (rtx mem, rtx offset) { MEM_ATTRS (mem) = get_mem_attrs (MEM_ALIAS_SET (mem), MEM_EXPR (mem), offset, MEM_SIZE (mem), MEM_ALIGN (mem), @@ -1982,8 +1850,7 @@ set_mem_offset (mem, offset) /* Set the size of MEM to SIZE. */ void -set_mem_size (mem, size) - rtx mem, size; +set_mem_size (rtx mem, rtx size) { MEM_ATTRS (mem) = get_mem_attrs (MEM_ALIAS_SET (mem), MEM_EXPR (mem), MEM_OFFSET (mem), size, MEM_ALIGN (mem), @@ -1997,11 +1864,7 @@ set_mem_size (mem, size) attributes are not changed. */ static rtx -change_address_1 (memref, mode, addr, validate) - rtx memref; - enum machine_mode mode; - rtx addr; - int validate; +change_address_1 (rtx memref, enum machine_mode mode, rtx addr, int validate) { rtx new; @@ -2011,6 +1874,9 @@ change_address_1 (memref, mode, addr, validate) mode = GET_MODE (memref); if (addr == 0) addr = XEXP (memref, 0); + if (mode == GET_MODE (memref) && addr == XEXP (memref, 0) + && (!validate || memory_address_p (mode, addr))) + return memref; if (validate) { @@ -2035,20 +1901,31 @@ change_address_1 (memref, mode, addr, validate) way we are changing MEMREF, so we only preserve the alias set. */ rtx -change_address (memref, mode, addr) - rtx memref; - enum machine_mode mode; - rtx addr; +change_address (rtx memref, enum machine_mode mode, rtx addr) { - rtx new = change_address_1 (memref, mode, addr, 1); + rtx new = change_address_1 (memref, mode, addr, 1), size; enum machine_mode mmode = GET_MODE (new); + unsigned int align; + + size = mmode == BLKmode ? 0 : GEN_INT (GET_MODE_SIZE (mmode)); + align = mmode == BLKmode ? BITS_PER_UNIT : GET_MODE_ALIGNMENT (mmode); + + /* If there are no changes, just return the original memory reference. */ + if (new == memref) + { + if (MEM_ATTRS (memref) == 0 + || (MEM_EXPR (memref) == NULL + && MEM_OFFSET (memref) == NULL + && MEM_SIZE (memref) == size + && MEM_ALIGN (memref) == align)) + return new; + + new = gen_rtx_MEM (mmode, XEXP (memref, 0)); + MEM_COPY_ATTRIBUTES (new, memref); + } MEM_ATTRS (new) - = get_mem_attrs (MEM_ALIAS_SET (memref), 0, 0, - mmode == BLKmode ? 0 : GEN_INT (GET_MODE_SIZE (mmode)), - (mmode == BLKmode ? BITS_PER_UNIT - : GET_MODE_ALIGNMENT (mmode)), - mmode); + = get_mem_attrs (MEM_ALIAS_SET (memref), 0, 0, size, align, mmode); return new; } @@ -2060,11 +1937,8 @@ change_address (memref, mode, addr) and caller is responsible for adjusting MEMREF base register. */ rtx -adjust_address_1 (memref, mode, offset, validate, adjust) - rtx memref; - enum machine_mode mode; - HOST_WIDE_INT offset; - int validate, adjust; +adjust_address_1 (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset, + int validate, int adjust) { rtx addr = XEXP (memref, 0); rtx new; @@ -2072,6 +1946,11 @@ adjust_address_1 (memref, mode, offset, validate, adjust) rtx size = 0; unsigned int memalign = MEM_ALIGN (memref); + /* If there are no changes, just return the original memory reference. */ + if (mode == GET_MODE (memref) && !offset + && (!validate || memory_address_p (mode, addr))) + return memref; + /* ??? Prefer to create garbage instead of creating shared rtl. This may happen even if offset is nonzero -- consider (plus (plus reg reg) const_int) -- so do this always. */ @@ -2126,12 +2005,8 @@ adjust_address_1 (memref, mode, offset, validate, adjust) nonzero, the memory address is forced to be valid. */ rtx -adjust_automodify_address_1 (memref, mode, addr, offset, validate) - rtx memref; - enum machine_mode mode; - rtx addr; - HOST_WIDE_INT offset; - int validate; +adjust_automodify_address_1 (rtx memref, enum machine_mode mode, rtx addr, + HOST_WIDE_INT offset, int validate) { memref = change_address_1 (memref, VOIDmode, addr, validate); return adjust_address_1 (memref, mode, offset, validate, 0); @@ -2142,17 +2017,14 @@ adjust_automodify_address_1 (memref, mode, addr, offset, validate) known to be in OFFSET (possibly 1). */ rtx -offset_address (memref, offset, pow2) - rtx memref; - rtx offset; - HOST_WIDE_INT pow2; +offset_address (rtx memref, rtx offset, unsigned HOST_WIDE_INT pow2) { rtx new, addr = XEXP (memref, 0); new = simplify_gen_binary (PLUS, Pmode, addr, offset); /* At this point we don't know _why_ the address is invalid. It - could have secondary memory refereces, multiplies or anything. + could have secondary memory references, multiplies or anything. However, if we did go and rearrange things, we can wind up not being able to recognize the magic around pic_offset_table_rtx. @@ -2169,12 +2041,15 @@ offset_address (memref, offset, pow2) update_temp_slot_address (XEXP (memref, 0), new); new = change_address_1 (memref, VOIDmode, new, 1); + /* If there are no changes, just return the original memory reference. */ + if (new == memref) + return new; + /* Update the alignment to reflect the offset. Reset the offset, which we don't know. */ MEM_ATTRS (new) = get_mem_attrs (MEM_ALIAS_SET (memref), MEM_EXPR (memref), 0, 0, - MIN (MEM_ALIGN (memref), - (unsigned HOST_WIDE_INT) pow2 * BITS_PER_UNIT), + MIN (MEM_ALIGN (memref), pow2 * BITS_PER_UNIT), GET_MODE (new)); return new; } @@ -2185,9 +2060,7 @@ offset_address (memref, offset, pow2) by putting something into a register. */ rtx -replace_equiv_address (memref, addr) - rtx memref; - rtx addr; +replace_equiv_address (rtx memref, rtx addr) { /* change_address_1 copies the memory attribute structure without change and that's exactly what we want here. */ @@ -2198,9 +2071,7 @@ replace_equiv_address (memref, addr) /* Likewise, but the reference is not required to be valid. */ rtx -replace_equiv_address_nv (memref, addr) - rtx memref; - rtx addr; +replace_equiv_address_nv (rtx memref, rtx addr) { return change_address_1 (memref, VOIDmode, addr, 0); } @@ -2211,16 +2082,17 @@ replace_equiv_address_nv (memref, addr) operations plus masking logic. */ rtx -widen_memory_access (memref, mode, offset) - rtx memref; - enum machine_mode mode; - HOST_WIDE_INT offset; +widen_memory_access (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset) { rtx new = adjust_address_1 (memref, mode, offset, 1, 1); tree expr = MEM_EXPR (new); rtx memoffset = MEM_OFFSET (new); unsigned int size = GET_MODE_SIZE (mode); + /* If there are no changes, just return the original memory reference. */ + if (new == memref) + return new; + /* If we don't know what offset we were at within the expression, then we can't know if we've overstepped the bounds. */ if (! memoffset) @@ -2288,10 +2160,10 @@ widen_memory_access (memref, mode, offset) /* Return a newly created CODE_LABEL rtx with a unique label number. */ rtx -gen_label_rtx () +gen_label_rtx (void) { return gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX, - NULL, label_num++, NULL); + NULL, label_num++, NULL); } /* For procedure integration. */ @@ -2301,8 +2173,7 @@ gen_label_rtx () Used for an inline-procedure after copying the insn chain. */ void -set_new_first_and_last_insn (first, last) - rtx first, last; +set_new_first_and_last_insn (rtx first, rtx last) { rtx insn; @@ -2316,24 +2187,11 @@ set_new_first_and_last_insn (first, last) cur_insn_uid++; } -/* Set the range of label numbers found in the current function. - This is used when belatedly compiling an inline function. */ - -void -set_new_first_and_last_label_num (first, last) - int first, last; -{ - base_label_num = label_num; - first_label_num = first; - last_label_num = last; -} - /* Set the last label number found in the current function. This is used when belatedly compiling an inline function. */ void -set_new_last_label_num (last) - int last; +set_new_last_label_num (int last) { base_label_num = label_num; last_label_num = last; @@ -2343,8 +2201,7 @@ set_new_last_label_num (last) This is used after a nested function. */ void -restore_emit_status (p) - struct function *p ATTRIBUTE_UNUSED; +restore_emit_status (struct function *p ATTRIBUTE_UNUSED) { last_label_num = 0; } @@ -2353,9 +2210,7 @@ restore_emit_status (p) structure. This routine should only be called once. */ void -unshare_all_rtl (fndecl, insn) - tree fndecl; - rtx insn; +unshare_all_rtl (tree fndecl, rtx insn) { tree decl; @@ -2367,7 +2222,7 @@ unshare_all_rtl (fndecl, insn) unshare_all_decls (DECL_INITIAL (fndecl)); /* Unshare just about everything else. */ - unshare_all_rtl_1 (insn); + unshare_all_rtl_in_chain (insn); /* Make sure the addresses of stack slots found outside the insn chain (such as, in DECL_RTL of a variable) are not shared @@ -2384,8 +2239,7 @@ unshare_all_rtl (fndecl, insn) should be done sparingly. */ void -unshare_all_rtl_again (insn) - rtx insn; +unshare_all_rtl_again (rtx insn) { rtx p; tree decl; @@ -2410,12 +2264,138 @@ unshare_all_rtl_again (insn) unshare_all_rtl (cfun->decl, insn); } +/* Check that ORIG is not marked when it should not be and mark ORIG as in use, + Recursively does the same for subexpressions. */ + +static void +verify_rtx_sharing (rtx orig, rtx insn) +{ + rtx x = orig; + int i; + enum rtx_code code; + const char *format_ptr; + + if (x == 0) + return; + + code = GET_CODE (x); + + /* These types may be freely shared. */ + + switch (code) + { + case REG: + case QUEUED: + case CONST_INT: + case CONST_DOUBLE: + case CONST_VECTOR: + case SYMBOL_REF: + case LABEL_REF: + case CODE_LABEL: + case PC: + case CC0: + case SCRATCH: + /* SCRATCH must be shared because they represent distinct values. */ + return; + + case CONST: + /* CONST can be shared if it contains a SYMBOL_REF. If it contains + a LABEL_REF, it isn't sharable. */ + if (GET_CODE (XEXP (x, 0)) == PLUS + && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF + && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT) + return; + break; + + case MEM: + /* A MEM is allowed to be shared if its address is constant. */ + if (CONSTANT_ADDRESS_P (XEXP (x, 0)) + || reload_completed || reload_in_progress) + return; + + break; + + default: + break; + } + + /* This rtx may not be shared. If it has already been seen, + replace it with a copy of itself. */ + + if (RTX_FLAG (x, used)) + { + error ("Invalid rtl sharing found in the insn"); + debug_rtx (insn); + error ("Shared rtx"); + debug_rtx (x); + abort (); + } + RTX_FLAG (x, used) = 1; + + /* Now scan the subexpressions recursively. */ + + format_ptr = GET_RTX_FORMAT (code); + + for (i = 0; i < GET_RTX_LENGTH (code); i++) + { + switch (*format_ptr++) + { + case 'e': + verify_rtx_sharing (XEXP (x, i), insn); + break; + + case 'E': + if (XVEC (x, i) != NULL) + { + int j; + int len = XVECLEN (x, i); + + for (j = 0; j < len; j++) + { + /* We allow sharing of ASM_OPERANDS inside single instruction. */ + if (j && GET_CODE (XVECEXP (x, i, j)) == SET + && GET_CODE (SET_SRC (XVECEXP (x, i, j))) == ASM_OPERANDS) + verify_rtx_sharing (SET_DEST (XVECEXP (x, i, j)), insn); + else + verify_rtx_sharing (XVECEXP (x, i, j), insn); + } + } + break; + } + } + return; +} + +/* Go through all the RTL insn bodies and check that there is no unexpected + sharing in between the subexpressions. */ + +void +verify_rtl_sharing (void) +{ + rtx p; + + for (p = get_insns (); p; p = NEXT_INSN (p)) + if (INSN_P (p)) + { + reset_used_flags (PATTERN (p)); + reset_used_flags (REG_NOTES (p)); + reset_used_flags (LOG_LINKS (p)); + } + + for (p = get_insns (); p; p = NEXT_INSN (p)) + if (INSN_P (p)) + { + verify_rtx_sharing (PATTERN (p), p); + verify_rtx_sharing (REG_NOTES (p), p); + verify_rtx_sharing (LOG_LINKS (p), p); + } +} + /* Go through all the RTL insn bodies and copy any invalid shared structure. Assumes the mark bits are cleared at entry. */ -static void -unshare_all_rtl_1 (insn) - rtx insn; +void +unshare_all_rtl_in_chain (rtx insn) { for (; insn; insn = NEXT_INSN (insn)) if (INSN_P (insn)) @@ -2429,8 +2409,7 @@ unshare_all_rtl_1 (insn) /* Go through all virtual stack slots of a function and copy any shared structure. */ static void -unshare_all_decls (blk) - tree blk; +unshare_all_decls (tree blk) { tree t; @@ -2447,8 +2426,7 @@ unshare_all_decls (blk) /* Go through all virtual stack slots of a function and mark them as not shared. */ static void -reset_used_decls (blk) - tree blk; +reset_used_decls (tree blk) { tree t; @@ -2467,9 +2445,7 @@ reset_used_decls (blk) either a MEM of an EXPR_LIST of MEMs. */ rtx -copy_most_rtx (orig, may_share) - rtx orig; - rtx may_share; +copy_most_rtx (rtx orig, rtx may_share) { rtx copy; int i, j; @@ -2554,8 +2530,7 @@ copy_most_rtx (orig, may_share) break; case '0': - /* Copy this through the wide int field; that's safest. */ - X0WINT (copy, i) = X0WINT (orig, i); + X0ANY (copy, i) = X0ANY (orig, i); break; default: @@ -2566,20 +2541,36 @@ copy_most_rtx (orig, may_share) } /* Mark ORIG as in use, and return a copy of it if it was already in use. - Recursively does the same for subexpressions. */ + Recursively does the same for subexpressions. Uses + copy_rtx_if_shared_1 to reduce stack space. */ rtx -copy_rtx_if_shared (orig) - rtx orig; +copy_rtx_if_shared (rtx orig) { - rtx x = orig; + copy_rtx_if_shared_1 (&orig); + return orig; +} + +/* Mark *ORIG1 as in use, and set it to a copy of it if it was already in + use. Recursively does the same for subexpressions. */ + +static void +copy_rtx_if_shared_1 (rtx *orig1) +{ + rtx x; int i; enum rtx_code code; + rtx *last_ptr; const char *format_ptr; int copied = 0; + int length; + + /* Repeat is used to turn tail-recursion into iteration. */ +repeat: + x = *orig1; if (x == 0) - return 0; + return; code = GET_CODE (x); @@ -2593,12 +2584,13 @@ copy_rtx_if_shared (orig) case CONST_DOUBLE: case CONST_VECTOR: case SYMBOL_REF: + case LABEL_REF: case CODE_LABEL: case PC: case CC0: case SCRATCH: /* SCRATCH must be shared because they represent distinct values. */ - return x; + return; case CONST: /* CONST can be shared if it contains a SYMBOL_REF. If it contains @@ -2606,7 +2598,7 @@ copy_rtx_if_shared (orig) if (GET_CODE (XEXP (x, 0)) == PLUS && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT) - return x; + return; break; case INSN: @@ -2615,21 +2607,7 @@ copy_rtx_if_shared (orig) case NOTE: case BARRIER: /* The chain of insns is not being copied. */ - return x; - - case MEM: - /* A MEM is allowed to be shared if its address is constant. - - We used to allow sharing of MEMs which referenced - virtual_stack_vars_rtx or virtual_incoming_args_rtx, but - that can lose. instantiate_virtual_regs will not unshare - the MEMs, and combine may change the structure of the address - because it looks safe and profitable in one context, but - in some other context it creates unrecognizable RTL. */ - if (CONSTANT_ADDRESS_P (XEXP (x, 0))) - return x; - - break; + return; default: break; @@ -2643,9 +2621,7 @@ copy_rtx_if_shared (orig) rtx copy; copy = rtx_alloc (code); - memcpy (copy, x, - (sizeof (*copy) - sizeof (copy->fld) - + sizeof (copy->fld[0]) * GET_RTX_LENGTH (code))); + memcpy (copy, x, RTX_SIZE (code)); x = copy; copied = 1; } @@ -2657,13 +2633,17 @@ copy_rtx_if_shared (orig) must be copied if X was copied. */ format_ptr = GET_RTX_FORMAT (code); - - for (i = 0; i < GET_RTX_LENGTH (code); i++) + length = GET_RTX_LENGTH (code); + last_ptr = NULL; + + for (i = 0; i < length; i++) { switch (*format_ptr++) { case 'e': - XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i)); + if (last_ptr) + copy_rtx_if_shared_1 (last_ptr); + last_ptr = &XEXP (x, i); break; case 'E': @@ -2671,24 +2651,110 @@ copy_rtx_if_shared (orig) { int j; int len = XVECLEN (x, i); - + + /* Copy the vector iff I copied the rtx and the length + is nonzero. */ if (copied && len > 0) XVEC (x, i) = gen_rtvec_v (len, XVEC (x, i)->elem); + + /* Call recursively on all inside the vector. */ for (j = 0; j < len; j++) - XVECEXP (x, i, j) = copy_rtx_if_shared (XVECEXP (x, i, j)); + { + if (last_ptr) + copy_rtx_if_shared_1 (last_ptr); + last_ptr = &XVECEXP (x, i, j); + } } break; } } - return x; + *orig1 = x; + if (last_ptr) + { + orig1 = last_ptr; + goto repeat; + } + return; } /* Clear all the USED bits in X to allow copy_rtx_if_shared to be used to look for shared sub-parts. */ void -reset_used_flags (x) - rtx x; +reset_used_flags (rtx x) +{ + int i, j; + enum rtx_code code; + const char *format_ptr; + int length; + + /* Repeat is used to turn tail-recursion into iteration. */ +repeat: + if (x == 0) + return; + + code = GET_CODE (x); + + /* These types may be freely shared so we needn't do any resetting + for them. */ + + switch (code) + { + case REG: + case QUEUED: + case CONST_INT: + case CONST_DOUBLE: + case CONST_VECTOR: + case SYMBOL_REF: + case CODE_LABEL: + case PC: + case CC0: + return; + + case INSN: + case JUMP_INSN: + case CALL_INSN: + case NOTE: + case LABEL_REF: + case BARRIER: + /* The chain of insns is not being copied. */ + return; + + default: + break; + } + + RTX_FLAG (x, used) = 0; + + format_ptr = GET_RTX_FORMAT (code); + length = GET_RTX_LENGTH (code); + + for (i = 0; i < length; i++) + { + switch (*format_ptr++) + { + case 'e': + if (i == length-1) + { + x = XEXP (x, i); + goto repeat; + } + reset_used_flags (XEXP (x, i)); + break; + + case 'E': + for (j = 0; j < XVECLEN (x, i); j++) + reset_used_flags (XVECEXP (x, i, j)); + break; + } + } +} + +/* Set all the USED bits in X to allow copy_rtx_if_shared to be used + to look for shared sub-parts. */ + +void +set_used_flags (rtx x) { int i, j; enum rtx_code code; @@ -2728,7 +2794,7 @@ reset_used_flags (x) break; } - RTX_FLAG (x, used) = 0; + RTX_FLAG (x, used) = 1; format_ptr = GET_RTX_FORMAT (code); for (i = 0; i < GET_RTX_LENGTH (code); i++) @@ -2736,12 +2802,12 @@ reset_used_flags (x) switch (*format_ptr++) { case 'e': - reset_used_flags (XEXP (x, i)); + set_used_flags (XEXP (x, i)); break; case 'E': for (j = 0; j < XVECLEN (x, i); j++) - reset_used_flags (XVECEXP (x, i, j)); + set_used_flags (XVECEXP (x, i, j)); break; } } @@ -2752,8 +2818,7 @@ reset_used_flags (x) OTHER must be valid as a SET_DEST. */ rtx -make_safe_from (x, other) - rtx x, other; +make_safe_from (rtx x, rtx other) { while (1) switch (GET_CODE (other)) @@ -2790,7 +2855,7 @@ make_safe_from (x, other) /* Return the first insn of the current sequence or current function. */ rtx -get_insns () +get_insns (void) { return first_insn; } @@ -2798,8 +2863,7 @@ get_insns () /* Specify a new insn as the first in the chain. */ void -set_first_insn (insn) - rtx insn; +set_first_insn (rtx insn) { if (PREV_INSN (insn) != 0) abort (); @@ -2809,7 +2873,7 @@ set_first_insn (insn) /* Return the last insn emitted in current sequence or current function. */ rtx -get_last_insn () +get_last_insn (void) { return last_insn; } @@ -2817,8 +2881,7 @@ get_last_insn () /* Specify a new insn as the last in the chain. */ void -set_last_insn (insn) - rtx insn; +set_last_insn (rtx insn) { if (NEXT_INSN (insn) != 0) abort (); @@ -2828,7 +2891,7 @@ set_last_insn (insn) /* Return the last insn emitted, even if it is in a sequence now pushed. */ rtx -get_last_insn_anywhere () +get_last_insn_anywhere (void) { struct sequence_stack *stack; if (last_insn) @@ -2843,7 +2906,7 @@ get_last_insn_anywhere () function. This routine looks inside SEQUENCEs. */ rtx -get_first_nonnote_insn () +get_first_nonnote_insn (void) { rtx insn = first_insn; @@ -2861,7 +2924,7 @@ get_first_nonnote_insn () function. This routine looks inside SEQUENCEs. */ rtx -get_last_nonnote_insn () +get_last_nonnote_insn (void) { rtx insn = last_insn; @@ -2878,7 +2941,7 @@ get_last_nonnote_insn () /* Return a number larger than any instruction's uid in this function. */ int -get_max_uid () +get_max_uid (void) { return cur_insn_uid; } @@ -2886,8 +2949,7 @@ get_max_uid () /* Renumber instructions so that no instruction UIDs are wasted. */ void -renumber_insns (stream) - FILE *stream; +renumber_insns (FILE *stream) { rtx insn; @@ -2915,8 +2977,7 @@ renumber_insns (stream) of the sequence. */ rtx -next_insn (insn) - rtx insn; +next_insn (rtx insn) { if (insn) { @@ -2933,8 +2994,7 @@ next_insn (insn) of the sequence. */ rtx -previous_insn (insn) - rtx insn; +previous_insn (rtx insn) { if (insn) { @@ -2951,8 +3011,7 @@ previous_insn (insn) look inside SEQUENCEs. */ rtx -next_nonnote_insn (insn) - rtx insn; +next_nonnote_insn (rtx insn) { while (insn) { @@ -2968,8 +3027,7 @@ next_nonnote_insn (insn) not look inside SEQUENCEs. */ rtx -prev_nonnote_insn (insn) - rtx insn; +prev_nonnote_insn (rtx insn) { while (insn) { @@ -2986,8 +3044,7 @@ prev_nonnote_insn (insn) SEQUENCEs. */ rtx -next_real_insn (insn) - rtx insn; +next_real_insn (rtx insn) { while (insn) { @@ -3005,8 +3062,7 @@ next_real_insn (insn) SEQUENCEs. */ rtx -prev_real_insn (insn) - rtx insn; +prev_real_insn (rtx insn) { while (insn) { @@ -3019,13 +3075,28 @@ prev_real_insn (insn) return insn; } +/* Return the last CALL_INSN in the current list, or 0 if there is none. + This routine does not look inside SEQUENCEs. */ + +rtx +last_call_insn (void) +{ + rtx insn; + + for (insn = get_last_insn (); + insn && GET_CODE (insn) != CALL_INSN; + insn = PREV_INSN (insn)) + ; + + return insn; +} + /* Find the next insn after INSN that really does something. This routine does not look inside SEQUENCEs. Until reload has completed, this is the same as next_real_insn. */ int -active_insn_p (insn) - rtx insn; +active_insn_p (rtx insn) { return (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN || (GET_CODE (insn) == INSN @@ -3035,8 +3106,7 @@ active_insn_p (insn) } rtx -next_active_insn (insn) - rtx insn; +next_active_insn (rtx insn) { while (insn) { @@ -3053,8 +3123,7 @@ next_active_insn (insn) same as prev_real_insn. */ rtx -prev_active_insn (insn) - rtx insn; +prev_active_insn (rtx insn) { while (insn) { @@ -3069,8 +3138,7 @@ prev_active_insn (insn) /* Return the next CODE_LABEL after the insn INSN, or 0 if there is none. */ rtx -next_label (insn) - rtx insn; +next_label (rtx insn) { while (insn) { @@ -3085,8 +3153,7 @@ next_label (insn) /* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */ rtx -prev_label (insn) - rtx insn; +prev_label (rtx insn) { while (insn) { @@ -3103,8 +3170,7 @@ prev_label (insn) and REG_CC_USER notes so we can find it. */ void -link_cc0_insns (insn) - rtx insn; +link_cc0_insns (rtx insn) { rtx user = next_nonnote_insn (insn); @@ -3126,8 +3192,7 @@ link_cc0_insns (insn) Return 0 if we can't find the insn. */ rtx -next_cc0_user (insn) - rtx insn; +next_cc0_user (rtx insn) { rtx note = find_reg_note (insn, REG_CC_USER, NULL_RTX); @@ -3148,8 +3213,7 @@ next_cc0_user (insn) note, it is the previous insn. */ rtx -prev_cc0_setter (insn) - rtx insn; +prev_cc0_setter (rtx insn) { rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX); @@ -3167,15 +3231,14 @@ prev_cc0_setter (insn) /* Increment the label uses for all labels present in rtx. */ static void -mark_label_nuses (x) - rtx x; +mark_label_nuses (rtx x) { enum rtx_code code; int i, j; const char *fmt; code = GET_CODE (x); - if (code == LABEL_REF) + if (code == LABEL_REF && LABEL_P (XEXP (x, 0))) LABEL_NUSES (XEXP (x, 0))++; fmt = GET_RTX_FORMAT (code); @@ -3200,9 +3263,7 @@ mark_label_nuses (x) returns TRIAL. If the insn to be returned can be split, it will be. */ rtx -try_split (pat, trial, last) - rtx pat, trial; - int last; +try_split (rtx pat, rtx trial, int last) { rtx before = PREV_INSN (trial); rtx after = NEXT_INSN (trial); @@ -3278,8 +3339,10 @@ try_split (pat, trial, last) for (insn = insn_last; insn ; insn = PREV_INSN (insn)) if (GET_CODE (insn) == CALL_INSN) { - CALL_INSN_FUNCTION_USAGE (insn) - = CALL_INSN_FUNCTION_USAGE (trial); + rtx *p = &CALL_INSN_FUNCTION_USAGE (insn); + while (*p) + p = &XEXP (*p, 1); + *p = CALL_INSN_FUNCTION_USAGE (trial); SIBLING_CALL_P (insn) = SIBLING_CALL_P (trial); } } @@ -3351,7 +3414,7 @@ try_split (pat, trial, last) } } - tem = emit_insn_after_scope (seq, trial, INSN_SCOPE (trial)); + tem = emit_insn_after_setloc (seq, trial, INSN_LOCATOR (trial)); delete_insn (trial); if (has_barrier) @@ -3377,8 +3440,7 @@ try_split (pat, trial, last) Store PATTERN in the pattern slots. */ rtx -make_insn_raw (pattern) - rtx pattern; +make_insn_raw (rtx pattern) { rtx insn; @@ -3389,7 +3451,7 @@ make_insn_raw (pattern) INSN_CODE (insn) = -1; LOG_LINKS (insn) = NULL; REG_NOTES (insn) = NULL; - INSN_SCOPE (insn) = NULL; + INSN_LOCATOR (insn) = 0; BLOCK_FOR_INSN (insn) = NULL; #ifdef ENABLE_RTL_CHECKING @@ -3410,8 +3472,7 @@ make_insn_raw (pattern) /* Like `make_insn_raw' but make a JUMP_INSN instead of an insn. */ static rtx -make_jump_insn_raw (pattern) - rtx pattern; +make_jump_insn_raw (rtx pattern) { rtx insn; @@ -3423,7 +3484,7 @@ make_jump_insn_raw (pattern) LOG_LINKS (insn) = NULL; REG_NOTES (insn) = NULL; JUMP_LABEL (insn) = NULL; - INSN_SCOPE (insn) = NULL; + INSN_LOCATOR (insn) = 0; BLOCK_FOR_INSN (insn) = NULL; return insn; @@ -3432,8 +3493,7 @@ make_jump_insn_raw (pattern) /* Like `make_insn_raw' but make a CALL_INSN instead of an insn. */ static rtx -make_call_insn_raw (pattern) - rtx pattern; +make_call_insn_raw (rtx pattern) { rtx insn; @@ -3445,7 +3505,7 @@ make_call_insn_raw (pattern) LOG_LINKS (insn) = NULL; REG_NOTES (insn) = NULL; CALL_INSN_FUNCTION_USAGE (insn) = NULL; - INSN_SCOPE (insn) = NULL; + INSN_LOCATOR (insn) = 0; BLOCK_FOR_INSN (insn) = NULL; return insn; @@ -3455,8 +3515,7 @@ make_call_insn_raw (pattern) INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE. */ void -add_insn (insn) - rtx insn; +add_insn (rtx insn) { PREV_INSN (insn) = last_insn; NEXT_INSN (insn) = 0; @@ -3476,8 +3535,7 @@ add_insn (insn) SEQUENCE. */ void -add_insn_after (insn, after) - rtx insn, after; +add_insn_after (rtx insn, rtx after) { rtx next = NEXT_INSN (after); basic_block bb; @@ -3520,12 +3578,12 @@ add_insn_after (insn, after) bb->flags |= BB_DIRTY; /* Should not happen as first in the BB is always either NOTE or LABEL. */ - if (bb->end == after + if (BB_END (bb) == after /* Avoid clobbering of structure when creating new BB. */ && GET_CODE (insn) != BARRIER && (GET_CODE (insn) != NOTE || NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK)) - bb->end = insn; + BB_END (bb) = insn; } NEXT_INSN (after) = insn; @@ -3542,8 +3600,7 @@ add_insn_after (insn, after) SEQUENCE. */ void -add_insn_before (insn, before) - rtx insn, before; +add_insn_before (rtx insn, rtx before) { rtx prev = PREV_INSN (before); basic_block bb; @@ -3589,7 +3646,7 @@ add_insn_before (insn, before) bb->flags |= BB_DIRTY; /* Should not happen as first in the BB is always either NOTE or LABEl. */ - if (bb->head == insn + if (BB_HEAD (bb) == insn /* Avoid clobbering of structure when creating new BB. */ && GET_CODE (insn) != BARRIER && (GET_CODE (insn) != NOTE @@ -3605,8 +3662,7 @@ add_insn_before (insn, before) /* Remove an insn from its doubly-linked list. This function knows how to handle sequences. */ void -remove_insn (insn) - rtx insn; +remove_insn (rtx insn) { rtx next = NEXT_INSN (insn); rtx prev = PREV_INSN (insn); @@ -3665,25 +3721,48 @@ remove_insn (insn) { if (INSN_P (insn)) bb->flags |= BB_DIRTY; - if (bb->head == insn) + if (BB_HEAD (bb) == insn) { /* Never ever delete the basic block note without deleting whole basic block. */ if (GET_CODE (insn) == NOTE) abort (); - bb->head = next; + BB_HEAD (bb) = next; } - if (bb->end == insn) - bb->end = prev; + if (BB_END (bb) == insn) + BB_END (bb) = prev; } } +/* Append CALL_FUSAGE to the CALL_INSN_FUNCTION_USAGE for CALL_INSN. */ + +void +add_function_usage_to (rtx call_insn, rtx call_fusage) +{ + if (! call_insn || GET_CODE (call_insn) != CALL_INSN) + abort (); + + /* Put the register usage information on the CALL. If there is already + some usage information, put ours at the end. */ + if (CALL_INSN_FUNCTION_USAGE (call_insn)) + { + rtx link; + + for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0; + link = XEXP (link, 1)) + ; + + XEXP (link, 1) = call_fusage; + } + else + CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage; +} + /* Delete all insns made since FROM. FROM becomes the new last instruction. */ void -delete_insns_since (from) - rtx from; +delete_insns_since (rtx from) { if (from == 0) first_insn = 0; @@ -3703,8 +3782,7 @@ delete_insns_since (from) called after delay-slot filling has been done. */ void -reorder_insns_nobb (from, to, after) - rtx from, to, after; +reorder_insns_nobb (rtx from, rtx to, rtx after) { /* Splice this bunch out of where it is now. */ if (PREV_INSN (from)) @@ -3729,8 +3807,7 @@ reorder_insns_nobb (from, to, after) /* Same as function above, but take care to update BB boundaries. */ void -reorder_insns (from, to, after) - rtx from, to, after; +reorder_insns (rtx from, rtx to, rtx after) { rtx prev = PREV_INSN (from); basic_block bb, bb2; @@ -3746,13 +3823,13 @@ reorder_insns (from, to, after) if (GET_CODE (from) != BARRIER && (bb2 = BLOCK_FOR_INSN (from))) { - if (bb2->end == to) - bb2->end = prev; + if (BB_END (bb2) == to) + BB_END (bb2) = prev; bb2->flags |= BB_DIRTY; } - if (bb->end == after) - bb->end = to; + if (BB_END (bb) == after) + BB_END (bb) = to; for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x)) set_block_for_insn (x, bb); @@ -3762,8 +3839,7 @@ reorder_insns (from, to, after) /* Return the line note insn preceding INSN. */ static rtx -find_line_note (insn) - rtx insn; +find_line_note (rtx insn) { if (no_line_numbers) return 0; @@ -3781,8 +3857,7 @@ find_line_note (insn) and FROM, and another one after TO. */ void -reorder_insns_with_line_notes (from, to, after) - rtx from, to, after; +reorder_insns_with_line_notes (rtx from, rtx to, rtx after) { rtx from_line = find_line_note (from); rtx after_line = find_line_note (after); @@ -3793,19 +3868,15 @@ reorder_insns_with_line_notes (from, to, after) return; if (from_line) - emit_line_note_after (NOTE_SOURCE_FILE (from_line), - NOTE_LINE_NUMBER (from_line), - after); + emit_note_copy_after (from_line, after); if (after_line) - emit_line_note_after (NOTE_SOURCE_FILE (after_line), - NOTE_LINE_NUMBER (after_line), - to); + emit_note_copy_after (after_line, to); } /* Remove unnecessary notes from the instruction stream. */ void -remove_unnecessary_notes () +remove_unnecessary_notes (void) { rtx block_stack = NULL_RTX; rtx eh_stack = NULL_RTX; @@ -3943,8 +4014,7 @@ remove_unnecessary_notes () /* Make X be output before the instruction BEFORE. */ rtx -emit_insn_before (x, before) - rtx x, before; +emit_insn_before_noloc (rtx x, rtx before) { rtx last = before; rtx insn; @@ -3994,8 +4064,7 @@ emit_insn_before (x, before) and output it before the instruction BEFORE. */ rtx -emit_jump_insn_before (x, before) - rtx x, before; +emit_jump_insn_before_noloc (rtx x, rtx before) { rtx insn, last = NULL_RTX; @@ -4041,8 +4110,7 @@ emit_jump_insn_before (x, before) and output it before the instruction BEFORE. */ rtx -emit_call_insn_before (x, before) - rtx x, before; +emit_call_insn_before_noloc (rtx x, rtx before) { rtx last = NULL_RTX, insn; @@ -4088,8 +4156,7 @@ emit_call_insn_before (x, before) and output it before the insn BEFORE. */ rtx -emit_barrier_before (before) - rtx before; +emit_barrier_before (rtx before) { rtx insn = rtx_alloc (BARRIER); @@ -4102,8 +4169,7 @@ emit_barrier_before (before) /* Emit the label LABEL before the insn BEFORE. */ rtx -emit_label_before (label, before) - rtx label, before; +emit_label_before (rtx label, rtx before) { /* This can be called twice for the same label as a result of the confusion that follows a syntax error! So make it harmless. */ @@ -4119,9 +4185,7 @@ emit_label_before (label, before) /* Emit a note of subtype SUBTYPE before the insn BEFORE. */ rtx -emit_note_before (subtype, before) - int subtype; - rtx before; +emit_note_before (int subtype, rtx before) { rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; @@ -4136,11 +4200,10 @@ emit_note_before (subtype, before) /* Helper for emit_insn_after, handles lists of instructions efficiently. */ -static rtx emit_insn_after_1 PARAMS ((rtx, rtx)); +static rtx emit_insn_after_1 (rtx, rtx); static rtx -emit_insn_after_1 (first, after) - rtx first, after; +emit_insn_after_1 (rtx first, rtx after) { rtx last; rtx after_after; @@ -4155,8 +4218,8 @@ emit_insn_after_1 (first, after) set_block_for_insn (last, bb); if (GET_CODE (last) != BARRIER) set_block_for_insn (last, bb); - if (bb->end == after) - bb->end = last; + if (BB_END (bb) == after) + BB_END (bb) = last; } else for (last = first; NEXT_INSN (last); last = NEXT_INSN (last)) @@ -4178,8 +4241,7 @@ emit_insn_after_1 (first, after) /* Make X be output after the insn AFTER. */ rtx -emit_insn_after (x, after) - rtx x, after; +emit_insn_after_noloc (rtx x, rtx after) { rtx last = after; @@ -4221,30 +4283,24 @@ emit_insn_after (x, after) as to act as if this insn were at FROM. */ void -emit_insn_after_with_line_notes (x, after, from) - rtx x, after, from; +emit_insn_after_with_line_notes (rtx x, rtx after, rtx from) { rtx from_line = find_line_note (from); rtx after_line = find_line_note (after); rtx insn = emit_insn_after (x, after); if (from_line) - emit_line_note_after (NOTE_SOURCE_FILE (from_line), - NOTE_LINE_NUMBER (from_line), - after); + emit_note_copy_after (from_line, after); if (after_line) - emit_line_note_after (NOTE_SOURCE_FILE (after_line), - NOTE_LINE_NUMBER (after_line), - insn); + emit_note_copy_after (after_line, insn); } /* Make an insn of code JUMP_INSN with body X and output it after the insn AFTER. */ rtx -emit_jump_insn_after (x, after) - rtx x, after; +emit_jump_insn_after_noloc (rtx x, rtx after) { rtx last; @@ -4283,8 +4339,7 @@ emit_jump_insn_after (x, after) and output it after the instruction AFTER. */ rtx -emit_call_insn_after (x, after) - rtx x, after; +emit_call_insn_after_noloc (rtx x, rtx after) { rtx last; @@ -4323,8 +4378,7 @@ emit_call_insn_after (x, after) and output it after the insn AFTER. */ rtx -emit_barrier_after (after) - rtx after; +emit_barrier_after (rtx after) { rtx insn = rtx_alloc (BARRIER); @@ -4337,8 +4391,7 @@ emit_barrier_after (after) /* Emit the label LABEL after the insn AFTER. */ rtx -emit_label_after (label, after) - rtx label, after; +emit_label_after (rtx label, rtx after) { /* This can be called twice for the same label as a result of the confusion that follows a syntax error! @@ -4355,9 +4408,7 @@ emit_label_after (label, after) /* Emit a note of subtype SUBTYPE after the insn AFTER. */ rtx -emit_note_after (subtype, after) - int subtype; - rtx after; +emit_note_after (int subtype, rtx after) { rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; @@ -4368,17 +4419,14 @@ emit_note_after (subtype, after) return note; } -/* Emit a line note for FILE and LINE after the insn AFTER. */ +/* Emit a copy of note ORIG after the insn AFTER. */ rtx -emit_line_note_after (file, line, after) - const char *file; - int line; - rtx after; +emit_note_copy_after (rtx orig, rtx after) { rtx note; - if (no_line_numbers && line > 0) + if (NOTE_LINE_NUMBER (orig) >= 0 && no_line_numbers) { cur_insn_uid++; return 0; @@ -4386,26 +4434,27 @@ emit_line_note_after (file, line, after) note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; - NOTE_SOURCE_FILE (note) = file; - NOTE_LINE_NUMBER (note) = line; + NOTE_LINE_NUMBER (note) = NOTE_LINE_NUMBER (orig); + NOTE_DATA (note) = NOTE_DATA (orig); BLOCK_FOR_INSN (note) = NULL; add_insn_after (note, after); return note; } -/* Like emit_insn_after, but set INSN_SCOPE according to SCOPE. */ +/* Like emit_insn_after_noloc, but set INSN_LOCATOR according to SCOPE. */ rtx -emit_insn_after_scope (pattern, after, scope) - rtx pattern, after; - tree scope; +emit_insn_after_setloc (rtx pattern, rtx after, int loc) { - rtx last = emit_insn_after (pattern, after); + rtx last = emit_insn_after_noloc (pattern, after); + + if (pattern == NULL_RTX || !loc) + return last; after = NEXT_INSN (after); while (1) { - if (active_insn_p (after)) - INSN_SCOPE (after) = scope; + if (active_insn_p (after) && !INSN_LOCATOR (after)) + INSN_LOCATOR (after) = loc; if (after == last) break; after = NEXT_INSN (after); @@ -4413,19 +4462,30 @@ emit_insn_after_scope (pattern, after, scope) return last; } -/* Like emit_jump_insn_after, but set INSN_SCOPE according to SCOPE. */ +/* Like emit_insn_after_noloc, but set INSN_LOCATOR according to AFTER. */ rtx -emit_jump_insn_after_scope (pattern, after, scope) - rtx pattern, after; - tree scope; +emit_insn_after (rtx pattern, rtx after) { - rtx last = emit_jump_insn_after (pattern, after); + if (INSN_P (after)) + return emit_insn_after_setloc (pattern, after, INSN_LOCATOR (after)); + else + return emit_insn_after_noloc (pattern, after); +} + +/* Like emit_jump_insn_after_noloc, but set INSN_LOCATOR according to SCOPE. */ +rtx +emit_jump_insn_after_setloc (rtx pattern, rtx after, int loc) +{ + rtx last = emit_jump_insn_after_noloc (pattern, after); + + if (pattern == NULL_RTX || !loc) + return last; after = NEXT_INSN (after); while (1) { - if (active_insn_p (after)) - INSN_SCOPE (after) = scope; + if (active_insn_p (after) && !INSN_LOCATOR (after)) + INSN_LOCATOR (after) = loc; if (after == last) break; after = NEXT_INSN (after); @@ -4433,19 +4493,30 @@ emit_jump_insn_after_scope (pattern, after, scope) return last; } -/* Like emit_call_insn_after, but set INSN_SCOPE according to SCOPE. */ +/* Like emit_jump_insn_after_noloc, but set INSN_LOCATOR according to AFTER. */ rtx -emit_call_insn_after_scope (pattern, after, scope) - rtx pattern, after; - tree scope; +emit_jump_insn_after (rtx pattern, rtx after) { - rtx last = emit_call_insn_after (pattern, after); + if (INSN_P (after)) + return emit_jump_insn_after_setloc (pattern, after, INSN_LOCATOR (after)); + else + return emit_jump_insn_after_noloc (pattern, after); +} + +/* Like emit_call_insn_after_noloc, but set INSN_LOCATOR according to SCOPE. */ +rtx +emit_call_insn_after_setloc (rtx pattern, rtx after, int loc) +{ + rtx last = emit_call_insn_after_noloc (pattern, after); + + if (pattern == NULL_RTX || !loc) + return last; after = NEXT_INSN (after); while (1) { - if (active_insn_p (after)) - INSN_SCOPE (after) = scope; + if (active_insn_p (after) && !INSN_LOCATOR (after)) + INSN_LOCATOR (after) = loc; if (after == last) break; after = NEXT_INSN (after); @@ -4453,26 +4524,112 @@ emit_call_insn_after_scope (pattern, after, scope) return last; } -/* Like emit_insn_before, but set INSN_SCOPE according to SCOPE. */ +/* Like emit_call_insn_after_noloc, but set INSN_LOCATOR according to AFTER. */ rtx -emit_insn_before_scope (pattern, before, scope) - rtx pattern, before; - tree scope; +emit_call_insn_after (rtx pattern, rtx after) +{ + if (INSN_P (after)) + return emit_call_insn_after_setloc (pattern, after, INSN_LOCATOR (after)); + else + return emit_call_insn_after_noloc (pattern, after); +} + +/* Like emit_insn_before_noloc, but set INSN_LOCATOR according to SCOPE. */ +rtx +emit_insn_before_setloc (rtx pattern, rtx before, int loc) { rtx first = PREV_INSN (before); - rtx last = emit_insn_before (pattern, before); + rtx last = emit_insn_before_noloc (pattern, before); + + if (pattern == NULL_RTX || !loc) + return last; first = NEXT_INSN (first); while (1) { - if (active_insn_p (first)) - INSN_SCOPE (first) = scope; + if (active_insn_p (first) && !INSN_LOCATOR (first)) + INSN_LOCATOR (first) = loc; if (first == last) break; first = NEXT_INSN (first); } return last; } + +/* Like emit_insn_before_noloc, but set INSN_LOCATOR according to BEFORE. */ +rtx +emit_insn_before (rtx pattern, rtx before) +{ + if (INSN_P (before)) + return emit_insn_before_setloc (pattern, before, INSN_LOCATOR (before)); + else + return emit_insn_before_noloc (pattern, before); +} + +/* like emit_insn_before_noloc, but set insn_locator according to scope. */ +rtx +emit_jump_insn_before_setloc (rtx pattern, rtx before, int loc) +{ + rtx first = PREV_INSN (before); + rtx last = emit_jump_insn_before_noloc (pattern, before); + + if (pattern == NULL_RTX) + return last; + + first = NEXT_INSN (first); + while (1) + { + if (active_insn_p (first) && !INSN_LOCATOR (first)) + INSN_LOCATOR (first) = loc; + if (first == last) + break; + first = NEXT_INSN (first); + } + return last; +} + +/* Like emit_jump_insn_before_noloc, but set INSN_LOCATOR according to BEFORE. */ +rtx +emit_jump_insn_before (rtx pattern, rtx before) +{ + if (INSN_P (before)) + return emit_jump_insn_before_setloc (pattern, before, INSN_LOCATOR (before)); + else + return emit_jump_insn_before_noloc (pattern, before); +} + +/* like emit_insn_before_noloc, but set insn_locator according to scope. */ +rtx +emit_call_insn_before_setloc (rtx pattern, rtx before, int loc) +{ + rtx first = PREV_INSN (before); + rtx last = emit_call_insn_before_noloc (pattern, before); + + if (pattern == NULL_RTX) + return last; + + first = NEXT_INSN (first); + while (1) + { + if (active_insn_p (first) && !INSN_LOCATOR (first)) + INSN_LOCATOR (first) = loc; + if (first == last) + break; + first = NEXT_INSN (first); + } + return last; +} + +/* like emit_call_insn_before_noloc, + but set insn_locator according to before. */ +rtx +emit_call_insn_before (rtx pattern, rtx before) +{ + if (INSN_P (before)) + return emit_call_insn_before_setloc (pattern, before, INSN_LOCATOR (before)); + else + return emit_call_insn_before_noloc (pattern, before); +} /* Take X and emit it at the end of the doubly-linked INSN list. @@ -4480,8 +4637,7 @@ emit_insn_before_scope (pattern, before, scope) Returns the last insn emitted. */ rtx -emit_insn (x) - rtx x; +emit_insn (rtx x) { rtx last = last_insn; rtx insn; @@ -4526,8 +4682,7 @@ emit_insn (x) and add it to the end of the doubly-linked list. */ rtx -emit_jump_insn (x) - rtx x; +emit_jump_insn (rtx x) { rtx last = NULL_RTX, insn; @@ -4568,8 +4723,7 @@ emit_jump_insn (x) and add it to the end of the doubly-linked list. */ rtx -emit_call_insn (x) - rtx x; +emit_call_insn (rtx x) { rtx insn; @@ -4602,8 +4756,7 @@ emit_call_insn (x) /* Add the label LABEL to the end of the doubly-linked list. */ rtx -emit_label (label) - rtx label; +emit_label (rtx label) { /* This can be called twice for the same label as a result of the confusion that follows a syntax error! @@ -4620,7 +4773,7 @@ emit_label (label) and add it to the end of the doubly-linked list. */ rtx -emit_barrier () +emit_barrier (void) { rtx barrier = rtx_alloc (BARRIER); INSN_UID (barrier) = cur_insn_uid++; @@ -4628,90 +4781,90 @@ emit_barrier () return barrier; } -/* Make an insn of code NOTE - with data-fields specified by FILE and LINE - and add it to the end of the doubly-linked list, - but only if line-numbers are desired for debugging info. */ +/* Make line numbering NOTE insn for LOCATION add it to the end + of the doubly-linked list, but only if line-numbers are desired for + debugging info and it doesn't match the previous one. */ rtx -emit_line_note (file, line) - const char *file; - int line; +emit_line_note (location_t location) { - set_file_and_line_for_stmt (file, line); - -#if 0 + rtx note; + + set_file_and_line_for_stmt (location); + + if (location.file && last_location.file + && !strcmp (location.file, last_location.file) + && location.line == last_location.line) + return NULL_RTX; + last_location = location; + if (no_line_numbers) - return 0; -#endif + { + cur_insn_uid++; + return NULL_RTX; + } - return emit_note (file, line); + note = emit_note (location.line); + NOTE_SOURCE_FILE (note) = location.file; + + return note; } -/* Make an insn of code NOTE - with data-fields specified by FILE and LINE - and add it to the end of the doubly-linked list. - If it is a line-number NOTE, omit it if it matches the previous one. */ +/* Emit a copy of note ORIG. */ rtx -emit_note (file, line) - const char *file; - int line; +emit_note_copy (rtx orig) +{ + rtx note; + + if (NOTE_LINE_NUMBER (orig) >= 0 && no_line_numbers) + { + cur_insn_uid++; + return NULL_RTX; + } + + note = rtx_alloc (NOTE); + + INSN_UID (note) = cur_insn_uid++; + NOTE_DATA (note) = NOTE_DATA (orig); + NOTE_LINE_NUMBER (note) = NOTE_LINE_NUMBER (orig); + BLOCK_FOR_INSN (note) = NULL; + add_insn (note); + + return note; +} + +/* Make an insn of code NOTE or type NOTE_NO + and add it to the end of the doubly-linked list. */ + +rtx +emit_note (int note_no) { rtx note; - if (line > 0) - { - if (file && last_filename && !strcmp (file, last_filename) - && line == last_linenum) - return 0; - last_filename = file; - last_linenum = line; - } - - if (no_line_numbers && line > 0) - { - cur_insn_uid++; - return 0; - } - note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; - NOTE_SOURCE_FILE (note) = file; - NOTE_LINE_NUMBER (note) = line; + NOTE_LINE_NUMBER (note) = note_no; + memset (&NOTE_DATA (note), 0, sizeof (NOTE_DATA (note))); BLOCK_FOR_INSN (note) = NULL; add_insn (note); return note; } -/* Emit a NOTE, and don't omit it even if LINE is the previous note. */ - -rtx -emit_line_note_force (file, line) - const char *file; - int line; -{ - last_linenum = -1; - return emit_line_note (file, line); -} - /* Cause next statement to emit a line note even if the line number - has not changed. This is used at the beginning of a function. */ + has not changed. */ void -force_next_line_note () +force_next_line_note (void) { - last_linenum = -1; + last_location.line = -1; } /* Place a note of KIND on insn INSN with DATUM as the datum. If a note of this type already exists, remove it first. */ rtx -set_unique_reg_note (insn, kind, datum) - rtx insn; - enum reg_note kind; - rtx datum; +set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum) { rtx note = find_reg_note (insn, kind, NULL_RTX); @@ -4754,8 +4907,7 @@ set_unique_reg_note (insn, kind, datum) The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */ enum rtx_code -classify_insn (x) - rtx x; +classify_insn (rtx x) { if (GET_CODE (x) == CODE_LABEL) return CODE_LABEL; @@ -4792,8 +4944,7 @@ classify_insn (x) If X is a label, it is simply added into the insn chain. */ rtx -emit (x) - rtx x; +emit (rtx x) { enum rtx_code code = classify_insn (x); @@ -4826,7 +4977,7 @@ static GTY ((deletable (""))) struct sequence_stack *free_sequence_stack; emitted in the middle of this sequence. */ void -start_sequence () +start_sequence (void) { struct sequence_stack *tem; @@ -4836,7 +4987,7 @@ start_sequence () free_sequence_stack = tem->next; } else - tem = (struct sequence_stack *) ggc_alloc (sizeof (struct sequence_stack)); + tem = ggc_alloc (sizeof (struct sequence_stack)); tem->next = seq_stack; tem->first = first_insn; @@ -4854,8 +5005,7 @@ start_sequence () information about how to use this function. */ void -start_sequence_for_rtl_expr (t) - tree t; +start_sequence_for_rtl_expr (tree t) { start_sequence (); @@ -4867,8 +5017,7 @@ start_sequence_for_rtl_expr (t) start_sequence for more information about how to use this function. */ void -push_to_sequence (first) - rtx first; +push_to_sequence (rtx first) { rtx last; @@ -4883,8 +5032,7 @@ push_to_sequence (first) /* Set up the insn chain from a chain stort in FIRST to LAST. */ void -push_to_full_sequence (first, last) - rtx first, last; +push_to_full_sequence (rtx first, rtx last) { start_sequence (); first_insn = first; @@ -4898,7 +5046,7 @@ push_to_full_sequence (first, last) as the current sequence, saving the previously current one. */ void -push_topmost_sequence () +push_topmost_sequence (void) { struct sequence_stack *stack, *top = NULL; @@ -4916,7 +5064,7 @@ push_topmost_sequence () insn chain, and restore the previous saved state. */ void -pop_topmost_sequence () +pop_topmost_sequence (void) { struct sequence_stack *stack, *top = NULL; @@ -4944,7 +5092,7 @@ pop_topmost_sequence () information about deferred popping of arguments. */ void -end_sequence () +end_sequence (void) { struct sequence_stack *tem = seq_stack; @@ -4962,8 +5110,7 @@ end_sequence () and LAST. */ void -end_full_sequence (first, last) - rtx *first, *last; +end_full_sequence (rtx *first, rtx *last) { *first = first_insn; *last = last_insn; @@ -4973,7 +5120,7 @@ end_full_sequence (first, last) /* Return 1 if currently emitting into a sequence. */ int -in_sequence_p () +in_sequence_p (void) { return seq_stack != 0; } @@ -4981,8 +5128,7 @@ in_sequence_p () /* Put the various virtual registers into REGNO_REG_RTX. */ void -init_virtual_regs (es) - struct emit_status *es; +init_virtual_regs (struct emit_status *es) { rtx *ptr = es->x_regno_reg_rtx; ptr[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx; @@ -5021,8 +5167,7 @@ static rtvec copy_asm_constraints_vector; SCRATCHes. */ rtx -copy_insn_1 (orig) - rtx orig; +copy_insn_1 (rtx orig) { rtx copy; int i, j; @@ -5075,7 +5220,7 @@ copy_insn_1 (orig) all fields need copying, and then clear the fields that should not be copied. That is the sensible default behavior, and forces us to explicitly document why we are *not* copying a flag. */ - memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion)); + memcpy (copy, orig, RTX_HDR_SIZE); /* We do not copy the USED flag, which is used as a mark bit during walks over the RTL. */ @@ -5093,7 +5238,7 @@ copy_insn_1 (orig) for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) { - copy->fld[i] = orig->fld[i]; + copy->u.fld[i] = orig->u.fld[i]; switch (*format_ptr++) { case 'e': @@ -5155,8 +5300,7 @@ copy_insn_1 (orig) INSN doesn't really have to be a full INSN; it could be just the pattern. */ rtx -copy_insn (insn) - rtx insn; +copy_insn (rtx insn) { copy_insn_n_scratches = 0; orig_asm_operands_vector = 0; @@ -5170,18 +5314,18 @@ copy_insn (insn) before generating rtl for each function. */ void -init_emit () +init_emit (void) { struct function *f = cfun; - f->emit = (struct emit_status *) ggc_alloc (sizeof (struct emit_status)); + f->emit = ggc_alloc (sizeof (struct emit_status)); first_insn = NULL; last_insn = NULL; seq_rtl_expr = NULL; cur_insn_uid = 1; reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; - last_linenum = 0; - last_filename = 0; + last_location.line = 0; + last_location.file = 0; first_label_num = label_num; last_label_num = 0; seq_stack = NULL; @@ -5191,16 +5335,11 @@ init_emit () f->emit->regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; f->emit->regno_pointer_align - = (unsigned char *) ggc_alloc_cleared (f->emit->regno_pointer_align_length - * sizeof (unsigned char)); + = ggc_alloc_cleared (f->emit->regno_pointer_align_length + * sizeof (unsigned char)); regno_reg_rtx - = (rtx *) ggc_alloc_cleared (f->emit->regno_pointer_align_length - * sizeof (rtx)); - - f->emit->regno_decl - = (tree *) ggc_alloc_cleared (f->emit->regno_pointer_align_length - * sizeof (tree)); + = ggc_alloc (f->emit->regno_pointer_align_length * sizeof (rtx)); /* Put copies of all the hard registers into regno_reg_rtx. */ memcpy (regno_reg_rtx, @@ -5244,8 +5383,7 @@ init_emit () /* Generate the constant 0. */ static rtx -gen_const_vector_0 (mode) - enum machine_mode mode; +gen_const_vector_0 (enum machine_mode mode) { rtx tem; rtvec v; @@ -5271,9 +5409,7 @@ gen_const_vector_0 (mode) /* Generate a vector like gen_rtx_raw_CONST_VEC, but use the zero vector when all elements are zero. */ rtx -gen_rtx_CONST_VECTOR (mode, v) - enum machine_mode mode; - rtvec v; +gen_rtx_CONST_VECTOR (enum machine_mode mode, rtvec v) { rtx inner_zero = CONST0_RTX (GET_MODE_INNER (mode)); int i; @@ -5288,23 +5424,27 @@ gen_rtx_CONST_VECTOR (mode, v) LINE_NUMBERS is nonzero if line numbers are to be generated. */ void -init_emit_once (line_numbers) - int line_numbers; +init_emit_once (int line_numbers) { int i; enum machine_mode mode; enum machine_mode double_mode; + /* We need reg_raw_mode, so initialize the modes now. */ + init_reg_modes_once (); + /* Initialize the CONST_INT, CONST_DOUBLE, and memory attribute hash tables. */ - const_int_htab = htab_create (37, const_int_htab_hash, - const_int_htab_eq, NULL); + const_int_htab = htab_create_ggc (37, const_int_htab_hash, + const_int_htab_eq, NULL); - const_double_htab = htab_create (37, const_double_htab_hash, - const_double_htab_eq, NULL); + const_double_htab = htab_create_ggc (37, const_double_htab_hash, + const_double_htab_eq, NULL); - mem_attrs_htab = htab_create (37, mem_attrs_htab_hash, - mem_attrs_htab_eq, NULL); + mem_attrs_htab = htab_create_ggc (37, mem_attrs_htab_hash, + mem_attrs_htab_eq, NULL); + reg_attrs_htab = htab_create_ggc (37, reg_attrs_htab_hash, + reg_attrs_htab_eq, NULL); no_line_numbers = ! line_numbers; @@ -5389,9 +5529,24 @@ init_emit_once (line_numbers) REAL_VALUE_FROM_INT (dconst0, 0, 0, double_mode); REAL_VALUE_FROM_INT (dconst1, 1, 0, double_mode); REAL_VALUE_FROM_INT (dconst2, 2, 0, double_mode); + REAL_VALUE_FROM_INT (dconst3, 3, 0, double_mode); + REAL_VALUE_FROM_INT (dconst10, 10, 0, double_mode); REAL_VALUE_FROM_INT (dconstm1, -1, -1, double_mode); + REAL_VALUE_FROM_INT (dconstm2, -2, -1, double_mode); - for (i = 0; i <= 2; i++) + dconsthalf = dconst1; + dconsthalf.exp--; + + real_arithmetic (&dconstthird, RDIV_EXPR, &dconst1, &dconst3); + + /* Initialize mathematical constants for constant folding builtins. + These constants need to be given to at least 160 bits precision. */ + real_from_string (&dconstpi, + "3.1415926535897932384626433832795028841971693993751058209749445923078"); + real_from_string (&dconste, + "2.7182818284590452353602874713526624977572470936999595749669676277241"); + + for (i = 0; i < (int) ARRAY_SIZE (const_tiny_rtx); i++) { REAL_VALUE_TYPE *r = (i == 0 ? &dconst0 : i == 1 ? &dconst1 : &dconst2); @@ -5436,23 +5591,6 @@ init_emit_once (line_numbers) = gen_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM); #endif -#ifdef STRUCT_VALUE - struct_value_rtx = STRUCT_VALUE; -#else - struct_value_rtx = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM); -#endif - -#ifdef STRUCT_VALUE_INCOMING - struct_value_incoming_rtx = STRUCT_VALUE_INCOMING; -#else -#ifdef STRUCT_VALUE_INCOMING_REGNUM - struct_value_incoming_rtx - = gen_rtx_REG (Pmode, STRUCT_VALUE_INCOMING_REGNUM); -#else - struct_value_incoming_rtx = struct_value_rtx; -#endif -#endif - #ifdef STATIC_CHAIN_REGNUM static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); @@ -5475,7 +5613,7 @@ init_emit_once (line_numbers) #endif #endif - if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) + if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) pic_offset_table_rtx = gen_raw_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); } @@ -5484,7 +5622,7 @@ init_emit_once (line_numbers) warnings about unreachable code. */ int -force_line_numbers () +force_line_numbers (void) { int old = no_line_numbers; @@ -5495,8 +5633,7 @@ force_line_numbers () } void -restore_line_number_status (old_value) - int old_value; +restore_line_number_status (int old_value) { no_line_numbers = old_value; } @@ -5505,8 +5642,7 @@ restore_line_number_status (old_value) Care updating of libcall regions if present. */ rtx -emit_copy_of_insn_after (insn, after) - rtx insn, after; +emit_copy_of_insn_after (rtx insn, rtx after) { rtx new; rtx note1, note2, link; @@ -5537,7 +5673,7 @@ emit_copy_of_insn_after (insn, after) /* Update LABEL_NUSES. */ mark_jump_label (PATTERN (new), new, 0); - INSN_SCOPE (new) = INSN_SCOPE (insn); + INSN_LOCATOR (new) = INSN_LOCATOR (insn); /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will make them. */ @@ -5565,6 +5701,7 @@ emit_copy_of_insn_after (insn, after) XEXP (note1, 0) = p; XEXP (note2, 0) = new; } + INSN_CODE (new) = INSN_CODE (insn); return new; } diff --git a/contrib/gcc/final.c b/contrib/gcc/final.c index 94a0f4c53a4b..dd5b64ec53f5 100644 --- a/contrib/gcc/final.c +++ b/contrib/gcc/final.c @@ -1,6 +1,6 @@ /* Convert RTL to assembler code and output it, for GNU compiler. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -46,6 +46,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "tree.h" #include "rtl.h" @@ -68,7 +70,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "target.h" #include "debug.h" #include "expr.h" -#include "profile.h" #include "cfglayout.h" #ifdef XCOFF_DEBUGGING_INFO @@ -80,6 +81,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "dwarf2out.h" #endif +#ifdef DBX_DEBUGGING_INFO +#include "dbxout.h" +#endif + /* If we aren't using cc0, CC_STATUS_INIT shouldn't exist. So define a null default for it to save conditionalization later. */ #ifndef CC_STATUS_INIT @@ -106,6 +111,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define HAVE_READONLY_DATA_SECTION 0 #endif +/* Bitflags used by final_scan_insn. */ +#define SEEN_BB 1 +#define SEEN_NOTE 2 +#define SEEN_EMITTED 4 + /* Last insn processed by final_scan_insn. */ static rtx debug_insn; rtx current_output_insn; @@ -136,10 +146,6 @@ static unsigned int insn_noperands; static rtx last_ignored_compare = 0; -/* Flag indicating this insn is the start of a new basic block. */ - -static int new_block = 1; - /* Assign a unique number to each insn that is output. This can be used to generate unique local labels. */ @@ -169,9 +175,15 @@ CC_STATUS cc_prev_status; char regs_ever_live[FIRST_PSEUDO_REGISTER]; +/* Like regs_ever_live, but 1 if a reg is set or clobbered from an asm. + Unlike regs_ever_live, elements of this array corresponding to + eliminable regs like the frame pointer are set if an asm sets them. */ + +char regs_asm_clobbered[FIRST_PSEUDO_REGISTER]; + /* Nonzero means current function must be given a frame pointer. - Set in stmt.c if anything is allocated on the stack there. - Set in reload1.c if anything is allocated on the stack there. */ + Initialized in function.c to 0. Set only in reload1.c as per + the needs of the function. */ int frame_pointer_needed; @@ -194,56 +206,40 @@ rtx final_sequence; static int dialect_number; #endif -/* Indexed by line number, nonzero if there is a note for that line. */ - -static char *line_note_exists; - #ifdef HAVE_conditional_execution /* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */ rtx current_insn_predicate; #endif -struct function_list -{ - struct function_list *next; /* next function */ - const char *name; /* function name */ - long cfg_checksum; /* function checksum */ - long count_edges; /* number of intrumented edges in this function */ -}; - -static struct function_list *functions_head = 0; -static struct function_list **functions_tail = &functions_head; - #ifdef HAVE_ATTR_length -static int asm_insn_count PARAMS ((rtx)); +static int asm_insn_count (rtx); #endif -static void profile_function PARAMS ((FILE *)); -static void profile_after_prologue PARAMS ((FILE *)); -static void notice_source_line PARAMS ((rtx)); -static rtx walk_alter_subreg PARAMS ((rtx *)); -static void output_asm_name PARAMS ((void)); -static void output_alternate_entry_point PARAMS ((FILE *, rtx)); -static tree get_mem_expr_from_op PARAMS ((rtx, int *)); -static void output_asm_operand_names PARAMS ((rtx *, int *, int)); -static void output_operand PARAMS ((rtx, int)); +static void profile_function (FILE *); +static void profile_after_prologue (FILE *); +static bool notice_source_line (rtx); +static rtx walk_alter_subreg (rtx *); +static void output_asm_name (void); +static void output_alternate_entry_point (FILE *, rtx); +static tree get_mem_expr_from_op (rtx, int *); +static void output_asm_operand_names (rtx *, int *, int); +static void output_operand (rtx, int); #ifdef LEAF_REGISTERS -static void leaf_renumber_regs PARAMS ((rtx)); +static void leaf_renumber_regs (rtx); #endif #ifdef HAVE_cc0 -static int alter_cond PARAMS ((rtx)); +static int alter_cond (rtx); #endif #ifndef ADDR_VEC_ALIGN -static int final_addr_vec_align PARAMS ((rtx)); +static int final_addr_vec_align (rtx); #endif #ifdef HAVE_ATTR_length -static int align_fuzz PARAMS ((rtx, rtx, int, unsigned)); +static int align_fuzz (rtx, rtx, int, unsigned); #endif /* Initialize data in final at the beginning of a compilation. */ void -init_final (filename) - const char *filename ATTRIBUTE_UNUSED; +init_final (const char *filename ATTRIBUTE_UNUSED) { app_on = 0; final_sequence = 0; @@ -253,287 +249,19 @@ init_final (filename) #endif } -/* Called at end of source file, - to output the arc-profiling table for this entire compilation. */ - -void -end_final (filename) - const char *filename; -{ - if (profile_arc_flag && profile_info.count_instrumented_edges) - { - char name[20]; - tree string_type, string_cst; - tree structure_decl, structure_value, structure_pointer_type; - tree field_decl, decl_chain, value_chain; - tree sizeof_field_value, domain_type; - - /* Build types. */ - string_type = build_pointer_type (char_type_node); - - /* Libgcc2 bb structure. */ - structure_decl = make_node (RECORD_TYPE); - structure_pointer_type = build_pointer_type (structure_decl); - - /* Output the main header, of 7 words: - 0: 1 if this file is initialized, else 0. - 1: address of file name (LPBX1). - 2: address of table of counts (LPBX2). - 3: number of counts in the table. - 4: always 0, libgcc2 uses this as a pointer to next ``struct bb'' - - The following are GNU extensions: - - 5: Number of bytes in this header. - 6: address of table of function checksums (LPBX7). */ - - /* The zero word. */ - decl_chain = - build_decl (FIELD_DECL, get_identifier ("zero_word"), - long_integer_type_node); - value_chain = build_tree_list (decl_chain, - convert (long_integer_type_node, - integer_zero_node)); - - /* Address of filename. */ - { - char *cwd, *da_filename; - int da_filename_len; - - field_decl = - build_decl (FIELD_DECL, get_identifier ("filename"), string_type); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - - cwd = getpwd (); - da_filename_len = strlen (filename) + strlen (cwd) + 4 + 1; - da_filename = (char *) alloca (da_filename_len); - strcpy (da_filename, cwd); - strcat (da_filename, "/"); - strcat (da_filename, filename); - strcat (da_filename, ".da"); - da_filename_len = strlen (da_filename); - string_cst = build_string (da_filename_len + 1, da_filename); - domain_type = build_index_type (build_int_2 (da_filename_len, 0)); - TREE_TYPE (string_cst) - = build_array_type (char_type_node, domain_type); - value_chain = tree_cons (field_decl, - build1 (ADDR_EXPR, string_type, string_cst), - value_chain); - } - - /* Table of counts. */ - { - tree gcov_type_type = make_unsigned_type (GCOV_TYPE_SIZE); - tree gcov_type_pointer_type = build_pointer_type (gcov_type_type); - tree domain_tree - = build_index_type (build_int_2 (profile_info. - count_instrumented_edges - 1, 0)); - tree gcov_type_array_type - = build_array_type (gcov_type_type, domain_tree); - tree gcov_type_array_pointer_type - = build_pointer_type (gcov_type_array_type); - tree counts_table; - - field_decl = - build_decl (FIELD_DECL, get_identifier ("counts"), - gcov_type_pointer_type); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - - /* No values. */ - counts_table - = build (VAR_DECL, gcov_type_array_type, NULL_TREE, NULL_TREE); - TREE_STATIC (counts_table) = 1; - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2); - DECL_NAME (counts_table) = get_identifier (name); - assemble_variable (counts_table, 0, 0, 0); - - value_chain = tree_cons (field_decl, - build1 (ADDR_EXPR, - gcov_type_array_pointer_type, - counts_table), value_chain); - } - - /* Count of the # of instrumented arcs. */ - field_decl - = build_decl (FIELD_DECL, get_identifier ("ncounts"), - long_integer_type_node); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - - value_chain = tree_cons (field_decl, - convert (long_integer_type_node, - build_int_2 (profile_info. - count_instrumented_edges, - 0)), value_chain); - /* Pointer to the next bb. */ - field_decl - = build_decl (FIELD_DECL, get_identifier ("next"), - structure_pointer_type); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - - value_chain = tree_cons (field_decl, null_pointer_node, value_chain); - - /* sizeof(struct bb). We'll set this after entire structure - is laid out. */ - field_decl - = build_decl (FIELD_DECL, get_identifier ("sizeof_bb"), - long_integer_type_node); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - - sizeof_field_value = tree_cons (field_decl, NULL, value_chain); - value_chain = sizeof_field_value; - - /* struct bb_function []. */ - { - struct function_list *item; - int num_nodes; - tree checksum_field, arc_count_field, name_field; - tree domain; - tree array_value_chain = NULL_TREE; - tree bb_fn_struct_type; - tree bb_fn_struct_array_type; - tree bb_fn_struct_array_pointer_type; - tree bb_fn_struct_pointer_type; - tree field_value, field_value_chain; - - bb_fn_struct_type = make_node (RECORD_TYPE); - - checksum_field = build_decl (FIELD_DECL, get_identifier ("checksum"), - long_integer_type_node); - - arc_count_field - = build_decl (FIELD_DECL, get_identifier ("arc_count"), - integer_type_node); - TREE_CHAIN (checksum_field) = arc_count_field; - - name_field - = build_decl (FIELD_DECL, get_identifier ("name"), string_type); - TREE_CHAIN (arc_count_field) = name_field; - - TYPE_FIELDS (bb_fn_struct_type) = checksum_field; - - num_nodes = 0; - - for (item = functions_head; item != 0; item = item->next) - num_nodes++; - - /* Note that the array contains a terminator, hence no - 1. */ - domain = build_index_type (build_int_2 (num_nodes, 0)); - - bb_fn_struct_pointer_type = build_pointer_type (bb_fn_struct_type); - bb_fn_struct_array_type - = build_array_type (bb_fn_struct_type, domain); - bb_fn_struct_array_pointer_type - = build_pointer_type (bb_fn_struct_array_type); - - layout_type (bb_fn_struct_type); - layout_type (bb_fn_struct_pointer_type); - layout_type (bb_fn_struct_array_type); - layout_type (bb_fn_struct_array_pointer_type); - - for (item = functions_head; item != 0; item = item->next) - { - size_t name_len; - - /* create constructor for structure. */ - field_value_chain - = build_tree_list (checksum_field, - convert (long_integer_type_node, - build_int_2 (item->cfg_checksum, 0))); - field_value_chain - = tree_cons (arc_count_field, - convert (integer_type_node, - build_int_2 (item->count_edges, 0)), - field_value_chain); - - name_len = strlen (item->name); - string_cst = build_string (name_len + 1, item->name); - domain_type = build_index_type (build_int_2 (name_len, 0)); - TREE_TYPE (string_cst) - = build_array_type (char_type_node, domain_type); - field_value_chain = tree_cons (name_field, - build1 (ADDR_EXPR, string_type, - string_cst), - field_value_chain); - - /* Add to chain. */ - array_value_chain - = tree_cons (NULL_TREE, build (CONSTRUCTOR, - bb_fn_struct_type, NULL_TREE, - nreverse (field_value_chain)), - array_value_chain); - } - - /* Add terminator. */ - field_value = build_tree_list (arc_count_field, - convert (integer_type_node, - build_int_2 (-1, 0))); - - array_value_chain = tree_cons (NULL_TREE, - build (CONSTRUCTOR, bb_fn_struct_type, - NULL_TREE, field_value), - array_value_chain); - - - /* Create constructor for array. */ - field_decl - = build_decl (FIELD_DECL, get_identifier ("function_infos"), - bb_fn_struct_pointer_type); - value_chain = tree_cons (field_decl, - build1 (ADDR_EXPR, - bb_fn_struct_array_pointer_type, - build (CONSTRUCTOR, - bb_fn_struct_array_type, - NULL_TREE, - nreverse - (array_value_chain))), - value_chain); - TREE_CHAIN (field_decl) = decl_chain; - decl_chain = field_decl; - } - - /* Finish structure. */ - TYPE_FIELDS (structure_decl) = nreverse (decl_chain); - layout_type (structure_decl); - - structure_value - = build (VAR_DECL, structure_decl, NULL_TREE, NULL_TREE); - DECL_INITIAL (structure_value) - = build (CONSTRUCTOR, structure_decl, NULL_TREE, - nreverse (value_chain)); - TREE_STATIC (structure_value) = 1; - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0); - DECL_NAME (structure_value) = get_identifier (name); - - /* Size of this structure. */ - TREE_VALUE (sizeof_field_value) - = convert (long_integer_type_node, - build_int_2 (int_size_in_bytes (structure_decl), 0)); - - /* Build structure. */ - assemble_variable (structure_value, 0, 0, 0); - } -} - /* Default target function prologue and epilogue assembler output. If not overridden for epilogue code, then the function body itself contains return instructions wherever needed. */ void -default_function_pro_epilogue (file, size) - FILE *file ATTRIBUTE_UNUSED; - HOST_WIDE_INT size ATTRIBUTE_UNUSED; +default_function_pro_epilogue (FILE *file ATTRIBUTE_UNUSED, + HOST_WIDE_INT size ATTRIBUTE_UNUSED) { } /* Default target hook that outputs nothing to a stream. */ void -no_asm_to_stream (file) - FILE *file ATTRIBUTE_UNUSED; +no_asm_to_stream (FILE *file ATTRIBUTE_UNUSED) { } @@ -541,7 +269,7 @@ no_asm_to_stream (file) Used before the output from an `asm' statement. */ void -app_enable () +app_enable (void) { if (! app_on) { @@ -554,7 +282,7 @@ app_enable () Called from varasm.c before most kinds of output. */ void -app_disable () +app_disable (void) { if (app_on) { @@ -569,7 +297,7 @@ app_disable () #ifdef DELAY_SLOTS int -dbr_sequence_length () +dbr_sequence_length (void) { if (final_sequence != 0) return XVECLEN (final_sequence, 0) - 1; @@ -622,7 +350,7 @@ static struct label_alignment *label_align; /* Indicate that branch shortening hasn't yet been done. */ void -init_insn_lengths () +init_insn_lengths (void) { if (uid_shuid) { @@ -649,8 +377,7 @@ init_insn_lengths () get its actual length. Otherwise, get its maximum length. */ int -get_attr_length (insn) - rtx insn ATTRIBUTE_UNUSED; +get_attr_length (rtx insn ATTRIBUTE_UNUSED) { #ifdef HAVE_ATTR_length rtx body; @@ -784,8 +511,7 @@ get_attr_length (insn) #ifndef ADDR_VEC_ALIGN static int -final_addr_vec_align (addr_vec) - rtx addr_vec; +final_addr_vec_align (rtx addr_vec) { int align = GET_MODE_SIZE (GET_MODE (PATTERN (addr_vec))); @@ -815,8 +541,7 @@ static int min_labelno, max_labelno; /* For the benefit of port specific code do this also as a function. */ int -label_to_alignment (label) - rtx label; +label_to_alignment (rtx label) { return LABEL_TO_ALIGNMENT (label); } @@ -851,10 +576,7 @@ label_to_alignment (label) The return value is undefined for any other value of GROWTH. */ static int -align_fuzz (start, end, known_align_log, growth) - rtx start, end; - int known_align_log; - unsigned growth; +align_fuzz (rtx start, rtx end, int known_align_log, unsigned int growth) { int uid = INSN_UID (start); rtx align_label; @@ -893,8 +615,7 @@ align_fuzz (start, end, known_align_log, growth) to exclude the branch size. */ int -insn_current_reference_address (branch) - rtx branch; +insn_current_reference_address (rtx branch) { rtx dest, seq; int seq_uid; @@ -931,7 +652,7 @@ insn_current_reference_address (branch) #endif /* HAVE_ATTR_length */ void -compute_alignments () +compute_alignments (void) { int log, max_skip, max_log; basic_block bb; @@ -944,8 +665,8 @@ compute_alignments () max_labelno = max_label_num (); min_labelno = get_first_label_num (); - label_align = (struct label_alignment *) - xcalloc (max_labelno - min_labelno + 1, sizeof (struct label_alignment)); + label_align = xcalloc (max_labelno - min_labelno + 1, + sizeof (struct label_alignment)); /* If not optimizing or optimizing for size, don't assign any alignments. */ if (! optimize || optimize_size) @@ -953,11 +674,12 @@ compute_alignments () FOR_EACH_BB (bb) { - rtx label = bb->head; + rtx label = BB_HEAD (bb); int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0; edge e; - if (GET_CODE (label) != CODE_LABEL) + if (GET_CODE (label) != CODE_LABEL + || probably_never_executed_bb_p (bb)) continue; max_log = LABEL_ALIGN (label); max_skip = LABEL_ALIGN_MAX_SKIP; @@ -996,6 +718,7 @@ compute_alignments () /* In case block is frequent and reached mostly by non-fallthru edge, align it. It is most likely a first block of loop. */ if (has_fallthru + && maybe_hot_bb_p (bb) && branch_frequency + fallthru_frequency > BB_FREQ_MAX / 10 && branch_frequency > fallthru_frequency * 2) { @@ -1014,12 +737,6 @@ compute_alignments () /* Make a pass over all insns and compute their actual lengths by shortening any branches of variable length if possible. */ -/* Give a default value for the lowest address in a function. */ - -#ifndef FIRST_INSN_ADDRESS -#define FIRST_INSN_ADDRESS 0 -#endif - /* shorten_branches might be called multiple times: for example, the SH port splits out-of-range conditional branches in MACHINE_DEPENDENT_REORG. In order to do this, it needs proper length information, which it obtains @@ -1029,8 +746,7 @@ compute_alignments () slots. */ void -shorten_branches (first) - rtx first ATTRIBUTE_UNUSED; +shorten_branches (rtx first ATTRIBUTE_UNUSED) { rtx insn; int max_uid; @@ -1051,7 +767,7 @@ shorten_branches (first) /* Compute maximum UID and allocate label_align / uid_shuid. */ max_uid = get_max_uid (); - uid_shuid = (int *) xmalloc (max_uid * sizeof *uid_shuid); + uid_shuid = xmalloc (max_uid * sizeof *uid_shuid); if (max_labelno != max_label_num ()) { @@ -1064,8 +780,8 @@ shorten_branches (first) n_labels = max_labelno - min_labelno + 1; n_old_labels = old - min_labelno + 1; - label_align = (struct label_alignment *) xrealloc - (label_align, n_labels * sizeof (struct label_alignment)); + label_align = xrealloc (label_align, + n_labels * sizeof (struct label_alignment)); /* Range of labels grows monotonically in the function. Abort here means that the initialization of array got lost. */ @@ -1160,20 +876,20 @@ shorten_branches (first) #ifdef HAVE_ATTR_length /* Allocate the rest of the arrays. */ - insn_lengths = (int *) xmalloc (max_uid * sizeof (*insn_lengths)); + insn_lengths = xmalloc (max_uid * sizeof (*insn_lengths)); insn_lengths_max_uid = max_uid; /* Syntax errors can lead to labels being outside of the main insn stream. Initialize insn_addresses, so that we get reproducible results. */ INSN_ADDRESSES_ALLOC (max_uid); - varying_length = (char *) xcalloc (max_uid, sizeof (char)); + varying_length = xcalloc (max_uid, sizeof (char)); /* Initialize uid_align. We scan instructions from end to start, and keep in align_tab[n] the last seen insn that does an alignment of at least n+1, i.e. the successor in the alignment chain for an insn that does / has a known alignment of n. */ - uid_align = (rtx *) xcalloc (max_uid, sizeof *uid_align); + uid_align = xcalloc (max_uid, sizeof *uid_align); for (i = MAX_CODE_ALIGN; --i >= 0;) align_tab[i] = NULL_RTX; @@ -1250,7 +966,7 @@ shorten_branches (first) #endif /* CASE_VECTOR_SHORTEN_MODE */ /* Compute initial lengths, addresses, and varying flags for each insn. */ - for (insn_current_address = FIRST_INSN_ADDRESS, insn = first; + for (insn_current_address = 0, insn = first; insn != 0; insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn)) { @@ -1351,7 +1067,7 @@ shorten_branches (first) { something_changed = 0; insn_current_align = MAX_CODE_ALIGN - 1; - for (insn_current_address = FIRST_INSN_ADDRESS, insn = first; + for (insn_current_address = 0, insn = first; insn != 0; insn = NEXT_INSN (insn)) { @@ -1585,8 +1301,7 @@ shorten_branches (first) This is used to compute its length. */ static int -asm_insn_count (body) - rtx body; +asm_insn_count (rtx body) { const char *template; int count = 1; @@ -1615,30 +1330,16 @@ asm_insn_count (body) test and compare insns. */ void -final_start_function (first, file, optimize) - rtx first; - FILE *file; - int optimize ATTRIBUTE_UNUSED; +final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file, + int optimize ATTRIBUTE_UNUSED) { block_depth = 0; this_is_asm_operands = 0; -#ifdef NON_SAVING_SETJMP - /* A function that calls setjmp should save and restore all the - call-saved registers on a system where longjmp clobbers them. */ - if (NON_SAVING_SETJMP && current_function_calls_setjmp) - { - int i; + last_filename = locator_file (prologue_locator); + last_linenum = locator_line (prologue_locator); - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (!call_used_regs[i]) - regs_ever_live[i] = 1; - } -#endif - - if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED) - notice_source_line (first); high_block_linenum = high_function_linenum = last_linenum; (*debug_hooks->begin_prologue) (last_linenum, last_filename); @@ -1670,7 +1371,7 @@ final_start_function (first, file, optimize) if (write_symbols) { remove_unnecessary_notes (); - scope_to_insns_finalize (); + reemit_insn_block_notes (); number_blocks (current_function_decl); /* We never actually put out begin/end notes for the top-level block in the function. But, conceptually, that block is @@ -1690,8 +1391,7 @@ final_start_function (first, file, optimize) } static void -profile_after_prologue (file) - FILE *file ATTRIBUTE_UNUSED; +profile_after_prologue (FILE *file ATTRIBUTE_UNUSED) { #ifndef PROFILE_BEFORE_PROLOGUE if (current_function_profile) @@ -1700,40 +1400,33 @@ profile_after_prologue (file) } static void -profile_function (file) - FILE *file ATTRIBUTE_UNUSED; +profile_function (FILE *file ATTRIBUTE_UNUSED) { #ifndef NO_PROFILE_COUNTERS - int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE); +# define NO_PROFILE_COUNTERS 0 #endif #if defined(ASM_OUTPUT_REG_PUSH) -#if defined(STRUCT_VALUE_INCOMING_REGNUM) || defined(STRUCT_VALUE_REGNUM) int sval = current_function_returns_struct; -#endif + rtx svrtx = targetm.calls.struct_value_rtx (TREE_TYPE (current_function_decl), 1); #if defined(STATIC_CHAIN_INCOMING_REGNUM) || defined(STATIC_CHAIN_REGNUM) int cxt = current_function_needs_context; #endif #endif /* ASM_OUTPUT_REG_PUSH */ -#ifndef NO_PROFILE_COUNTERS - data_section (); - ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); - ASM_OUTPUT_INTERNAL_LABEL (file, "LP", current_function_funcdef_no); - assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1); -#endif + if (! NO_PROFILE_COUNTERS) + { + int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE); + data_section (); + ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); + (*targetm.asm_out.internal_label) (file, "LP", current_function_funcdef_no); + assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1); + } function_section (current_function_decl); -#if defined(STRUCT_VALUE_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (sval) - ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_INCOMING_REGNUM); -#else -#if defined(STRUCT_VALUE_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (sval) - { - ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_REGNUM); - } -#endif +#if defined(ASM_OUTPUT_REG_PUSH) + if (sval && svrtx != NULL_RTX && GET_CODE (svrtx) == REG) + ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx)); #endif #if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) @@ -1762,16 +1455,9 @@ profile_function (file) #endif #endif -#if defined(STRUCT_VALUE_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (sval) - ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_INCOMING_REGNUM); -#else -#if defined(STRUCT_VALUE_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (sval) - { - ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_REGNUM); - } -#endif +#if defined(ASM_OUTPUT_REG_PUSH) + if (sval && svrtx != NULL_RTX && GET_CODE (svrtx) == REG) + ASM_OUTPUT_REG_POP (file, REGNO (svrtx)); #endif } @@ -1780,7 +1466,7 @@ profile_function (file) even though not all of them are needed. */ void -final_end_function () +final_end_function (void) { app_disable (); @@ -1812,24 +1498,18 @@ final_end_function () Prescanning is done only on certain machines. */ void -final (first, file, optimize, prescan) - rtx first; - FILE *file; - int optimize; - int prescan; +final (rtx first, FILE *file, int optimize, int prescan) { rtx insn; - int max_line = 0; int max_uid = 0; + int seen = 0; last_ignored_compare = 0; - new_block = 1; - /* Make a map indicating which line numbers appear in this function. - When producing SDB debugging info, delete troublesome line number +#ifdef SDB_DEBUGGING_INFO + /* When producing SDB debugging info, delete troublesome line number notes from inlined functions in other files as well as duplicate line number notes. */ -#ifdef SDB_DEBUGGING_INFO if (write_symbols == SDB_DEBUG) { rtx last = 0; @@ -1838,34 +1518,22 @@ final (first, file, optimize, prescan) { if ((RTX_INTEGRATED_P (insn) && strcmp (NOTE_SOURCE_FILE (insn), main_input_filename) != 0) - || (last != 0 - && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last) - && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last))) + || (last != 0 + && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last) + && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last))) { delete_insn (insn); /* Use delete_note. */ continue; } last = insn; - if (NOTE_LINE_NUMBER (insn) > max_line) - max_line = NOTE_LINE_NUMBER (insn); } } - else #endif - { - for (insn = first; insn; insn = NEXT_INSN (insn)) - if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > max_line) - max_line = NOTE_LINE_NUMBER (insn); - } - - line_note_exists = (char *) xcalloc (max_line + 1, sizeof (char)); for (insn = first; insn; insn = NEXT_INSN (insn)) { - if (INSN_UID (insn) > max_uid) /* find largest UID */ + if (INSN_UID (insn) > max_uid) /* Find largest UID. */ max_uid = INSN_UID (insn); - if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) - line_note_exists[NOTE_LINE_NUMBER (insn)] = 1; #ifdef HAVE_cc0 /* If CC tracking across branches is enabled, record the insn which jumps to each branch only reached from one place. */ @@ -1901,46 +1569,23 @@ final (first, file, optimize, prescan) insn_current_address = INSN_ADDRESSES (INSN_UID (insn)); #endif /* HAVE_ATTR_length */ - insn = final_scan_insn (insn, file, optimize, prescan, 0); + insn = final_scan_insn (insn, file, optimize, prescan, 0, &seen); } - - /* Store function names for edge-profiling. */ - /* ??? Probably should re-use the existing struct function. */ - - if (cfun->arc_profile) - { - struct function_list *new_item = xmalloc (sizeof (struct function_list)); - - *functions_tail = new_item; - functions_tail = &new_item->next; - - new_item->next = 0; - new_item->name = xstrdup (IDENTIFIER_POINTER - (DECL_ASSEMBLER_NAME (current_function_decl))); - new_item->cfg_checksum = profile_info.current_function_cfg_checksum; - new_item->count_edges = profile_info.count_edges_instrumented_now; - } - - free (line_note_exists); - line_note_exists = NULL; } const char * -get_insn_template (code, insn) - int code; - rtx insn; +get_insn_template (int code, rtx insn) { - const void *output = insn_data[code].output; switch (insn_data[code].output_format) { case INSN_OUTPUT_FORMAT_SINGLE: - return (const char *) output; + return insn_data[code].output.single; case INSN_OUTPUT_FORMAT_MULTI: - return ((const char *const *) output)[which_alternative]; + return insn_data[code].output.multi[which_alternative]; case INSN_OUTPUT_FORMAT_FUNCTION: if (insn == NULL) abort (); - return (*(insn_output_fn) output) (recog_data.operand, insn); + return (*insn_data[code].output.function) (recog_data.operand, insn); default: abort (); @@ -1953,9 +1598,7 @@ get_insn_template (code, insn) The case fall-through in this function is intentional. */ static void -output_alternate_entry_point (file, insn) - FILE *file; - rtx insn; +output_alternate_entry_point (FILE *file, rtx insn) { const char *name = LABEL_NAME (insn); @@ -1986,15 +1629,18 @@ output_alternate_entry_point (file, insn) Value returned is the next insn to be scanned. NOPEEPHOLES is the flag to disallow peephole processing (currently - used for within delayed branch sequence output). */ + used for within delayed branch sequence output). + + SEEN is used to track the end of the prologue, for emitting + debug information. We force the emission of a line note after + both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG, or + at the beginning of the second basic block, whichever comes + first. */ rtx -final_scan_insn (insn, file, optimize, prescan, nopeepholes) - rtx insn; - FILE *file; - int optimize ATTRIBUTE_UNUSED; - int prescan; - int nopeepholes ATTRIBUTE_UNUSED; +final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, + int prescan, int nopeepholes ATTRIBUTE_UNUSED, + int *seen) { #ifdef HAVE_cc0 rtx set; @@ -2033,6 +1679,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (flag_debug_asm) fprintf (asm_out_file, "\t%s basic block %d\n", ASM_COMMENT_START, NOTE_BASIC_BLOCK (insn)->index); + + if ((*seen & (SEEN_EMITTED | SEEN_BB)) == SEEN_BB) + { + *seen |= SEEN_EMITTED; + last_filename = NULL; + } + else + *seen |= SEEN_BB; + break; case NOTE_INSN_EH_REGION_BEG: @@ -2048,6 +1703,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) case NOTE_INSN_PROLOGUE_END: (*targetm.asm_out.function_end_prologue) (file); profile_after_prologue (file); + + if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE) + { + *seen |= SEEN_EMITTED; + last_filename = NULL; + } + else + *seen |= SEEN_NOTE; + break; case NOTE_INSN_EPILOGUE_BEG: @@ -2057,6 +1721,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) case NOTE_INSN_FUNCTION_BEG: app_disable (); (*debug_hooks->end_prologue) (last_linenum, last_filename); + + if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE) + { + *seen |= SEEN_EMITTED; + last_filename = NULL; + } + else + *seen |= SEEN_NOTE; + break; case NOTE_INSN_BLOCK_BEG: @@ -2115,51 +1788,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) default: if (NOTE_LINE_NUMBER (insn) <= 0) abort (); - - /* This note is a line-number. */ - { - rtx note; - int note_after = 0; - - /* If there is anything real after this note, output it. - If another line note follows, omit this one. */ - for (note = NEXT_INSN (insn); note; note = NEXT_INSN (note)) - { - if (GET_CODE (note) != NOTE && GET_CODE (note) != CODE_LABEL) - break; - - /* These types of notes can be significant - so make sure the preceding line number stays. */ - else if (GET_CODE (note) == NOTE - && (NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_BEG - || NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_END - || NOTE_LINE_NUMBER (note) == NOTE_INSN_FUNCTION_BEG)) - break; - else if (GET_CODE (note) == NOTE && NOTE_LINE_NUMBER (note) > 0) - { - /* Another line note follows; we can delete this note - if no intervening line numbers have notes elsewhere. */ - int num; - for (num = NOTE_LINE_NUMBER (insn) + 1; - num < NOTE_LINE_NUMBER (note); - num++) - if (line_note_exists[num]) - break; - - if (num >= NOTE_LINE_NUMBER (note)) - note_after = 1; - break; - } - } - - /* Output this line note if it is the first or the last line - note in a row. */ - if (!note_after) - { - notice_source_line (insn); - (*debug_hooks->source_line) (last_linenum, last_filename); - } - } break; } break; @@ -2223,11 +1851,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) #endif if (prescan > 0) break; - new_block = 1; - -#ifdef FINAL_PRESCAN_LABEL - FINAL_PRESCAN_INSN (insn, NULL, 0); -#endif if (LABEL_NAME (insn)) (*debug_hooks->label) (insn); @@ -2274,7 +1897,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn), NEXT_INSN (insn)); #else - ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn)); + (*targetm.asm_out.internal_label) (file, "L", CODE_LABEL_NUMBER (insn)); #endif #endif break; @@ -2283,7 +1906,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (LABEL_ALT_ENTRY_P (insn)) output_alternate_entry_point (file, insn); else - ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn)); + (*targetm.asm_out.internal_label) (file, "L", CODE_LABEL_NUMBER (insn)); break; default: @@ -2296,7 +1919,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) /* An INSN, JUMP_INSN or CALL_INSN. First check for special kinds that recog doesn't recognize. */ - if (GET_CODE (body) == USE /* These are just declarations */ + if (GET_CODE (body) == USE /* These are just declarations. */ || GET_CODE (body) == CLOBBER) break; @@ -2386,6 +2009,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) break; } + /* Output this line note if it is the first or the last line + note in a row. */ + if (notice_source_line (insn)) + { + (*debug_hooks->source_line) (last_linenum, last_filename); + } if (GET_CODE (body) == ASM_INPUT) { @@ -2412,7 +2041,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (asm_noperands (body) >= 0) { unsigned int noperands = asm_noperands (body); - rtx *ops = (rtx *) alloca (noperands * sizeof (rtx)); + rtx *ops = alloca (noperands * sizeof (rtx)); const char *string; /* There's no telling what that did to the condition codes. */ @@ -2426,6 +2055,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) insn_noperands = noperands; this_is_asm_operands = insn; +#ifdef FINAL_PRESCAN_INSN + FINAL_PRESCAN_INSN (insn, ops, insn_noperands); +#endif + /* Output the insn using them. */ if (string[0]) { @@ -2457,12 +2090,20 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) break; final_sequence = body; + /* Record the delay slots' frame information before the branch. + This is needed for delayed calls: see execute_cfa_program(). */ +#if defined (DWARF2_UNWIND_INFO) + if (dwarf2out_do_frame ()) + for (i = 1; i < XVECLEN (body, 0); i++) + dwarf2out_frame_debug (XVECEXP (body, 0, i)); +#endif + /* The first insn in this SEQUENCE might be a JUMP_INSN that will force the restoration of a comparison that was previously thought unnecessary. If that happens, cancel this sequence and cause that insn to be restored. */ - next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, prescan, 1); + next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, prescan, 1, seen); if (next != XVECEXP (body, 0, 1)) { final_sequence = 0; @@ -2476,7 +2117,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) /* We loop in case any instruction in a delay slot gets split. */ do - insn = final_scan_insn (insn, file, 0, prescan, 1); + insn = final_scan_insn (insn, file, 0, prescan, 1, seen); while (insn != next); } #ifdef DBR_OUTPUT_SEQEND @@ -2513,10 +2154,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (optimize) { -#if 0 - rtx set = single_set (insn); -#endif - if (set && GET_CODE (SET_DEST (set)) == CC0 && insn != last_ignored_compare) @@ -2684,7 +2321,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) for (note = NEXT_INSN (insn); note != next; note = NEXT_INSN (note)) - final_scan_insn (note, file, optimize, prescan, nopeepholes); + final_scan_insn (note, file, optimize, prescan, nopeepholes, seen); /* In case this is prescan, put the notes in proper position for later rescan. */ @@ -2765,7 +2402,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) if (prev_nonnote_insn (insn) != last_ignored_compare) abort (); - new_block = 0; /* We have already processed the notes between the setter and the user. Make sure we don't process them again, this is @@ -2799,7 +2435,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) abort (); #endif - new_block = 0; return new; } @@ -2813,22 +2448,23 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) output_asm_insn (template, recog_data.operand); + /* If necessary, report the effect that the instruction has on + the unwind info. We've already done this for delay slots + and call instructions. */ #if defined (DWARF2_UNWIND_INFO) -#if defined (HAVE_prologue) - if (GET_CODE (insn) == INSN && dwarf2out_do_frame ()) - dwarf2out_frame_debug (insn); -#else - if (!ACCUMULATE_OUTGOING_ARGS - && GET_CODE (insn) == INSN + if (GET_CODE (insn) == INSN +#if !defined (HAVE_prologue) + && !ACCUMULATE_OUTGOING_ARGS +#endif + && final_sequence == 0 && dwarf2out_do_frame ()) dwarf2out_frame_debug (insn); #endif -#endif #if 0 - /* It's not at all clear why we did this and doing so interferes - with tests we'd like to do to use REG_WAS_0 notes, so let's try - with this out. */ + /* It's not at all clear why we did this and doing so used to + interfere with tests that used REG_WAS_0 notes, which are + now gone, so let's try with this out. */ /* Mark this insn as having been output. */ INSN_DELETED_P (insn) = 1; @@ -2836,9 +2472,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) /* Emit information for vtable gc. */ note = find_reg_note (insn, REG_VTABLE_REF, NULL_RTX); - if (note) - assemble_vtable_entry (XEXP (XEXP (note, 0), 0), - INTVAL (XEXP (XEXP (note, 0), 1))); current_output_insn = debug_insn = 0; } @@ -2849,30 +2482,34 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) /* Output debugging info to the assembler file FILE based on the NOTE-insn INSN, assumed to be a line number. */ -static void -notice_source_line (insn) - rtx insn; +static bool +notice_source_line (rtx insn) { - const char *filename = NOTE_SOURCE_FILE (insn); + const char *filename = insn_file (insn); + int linenum = insn_line (insn); - last_filename = filename; - last_linenum = NOTE_LINE_NUMBER (insn); - high_block_linenum = MAX (last_linenum, high_block_linenum); - high_function_linenum = MAX (last_linenum, high_function_linenum); + if (filename && (filename != last_filename || last_linenum != linenum)) + { + last_filename = filename; + last_linenum = linenum; + high_block_linenum = MAX (last_linenum, high_block_linenum); + high_function_linenum = MAX (last_linenum, high_function_linenum); + return true; + } + return false; } /* For each operand in INSN, simplify (subreg (reg)) so that it refers directly to the desired hard register. */ void -cleanup_subreg_operands (insn) - rtx insn; +cleanup_subreg_operands (rtx insn) { int i; extract_insn_cached (insn); for (i = 0; i < recog_data.n_operands; i++) { - /* The following test cannot use recog_data.operand when tesing + /* The following test cannot use recog_data.operand when testing for a SUBREG: the underlying object might have been changed already if we are inside a match_operator expression that matches the else clause. Instead we test the underlying @@ -2900,8 +2537,7 @@ cleanup_subreg_operands (insn) based on the thing it is a subreg of. */ rtx -alter_subreg (xp) - rtx *xp; +alter_subreg (rtx *xp) { rtx x = *xp; rtx y = SUBREG_REG (x); @@ -2921,12 +2557,7 @@ alter_subreg (xp) else if (GET_CODE (y) == REG) { unsigned int regno = subreg_hard_regno (x, 1); - PUT_CODE (x, REG); - REGNO (x) = regno; - ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y); - /* This field has a different meaning for REGs and SUBREGs. Make - sure to clear it! */ - RTX_FLAG (x, used) = 0; + *xp = gen_rtx_REG_offset (y, GET_MODE (x), regno, SUBREG_BYTE (x)); } else abort (); @@ -2938,8 +2569,7 @@ alter_subreg (xp) /* Do alter_subreg on all the SUBREGs contained in X. */ static rtx -walk_alter_subreg (xp) - rtx *xp; +walk_alter_subreg (rtx *xp) { rtx x = *xp; switch (GET_CODE (x)) @@ -2976,8 +2606,7 @@ walk_alter_subreg (xp) 2 means that COND has been altered. */ static int -alter_cond (cond) - rtx cond; +alter_cond (rtx cond) { int value = 0; @@ -3130,13 +2759,14 @@ alter_cond (cond) In an `asm', it's the user's fault; otherwise, the compiler's fault. */ void -output_operand_lossage VPARAMS ((const char *msgid, ...)) +output_operand_lossage (const char *msgid, ...) { char *fmt_string; char *new_message; const char *pfx_str; - VA_OPEN (ap, msgid); - VA_FIXEDARG (ap, const char *, msgid); + va_list ap; + + va_start (ap, msgid); pfx_str = this_is_asm_operands ? _("invalid `asm': ") : "output_operand: "; asprintf (&fmt_string, "%s%s", pfx_str, _(msgid)); @@ -3149,7 +2779,7 @@ output_operand_lossage VPARAMS ((const char *msgid, ...)) free (fmt_string); free (new_message); - VA_CLOSE (ap); + va_end (ap); } /* Output of assembler code from a template, and its subroutines. */ @@ -3158,7 +2788,7 @@ output_operand_lossage VPARAMS ((const char *msgid, ...)) alternative used. */ static void -output_asm_name () +output_asm_name (void) { if (debug_insn) { @@ -3183,20 +2813,15 @@ output_asm_name () corresponds to the address of the object and 0 if to the object. */ static tree -get_mem_expr_from_op (op, paddressp) - rtx op; - int *paddressp; +get_mem_expr_from_op (rtx op, int *paddressp) { tree expr; int inner_addressp; *paddressp = 0; - if (op == NULL) - return 0; - - if (GET_CODE (op) == REG && ORIGINAL_REGNO (op) >= FIRST_PSEUDO_REGISTER) - return REGNO_DECL (ORIGINAL_REGNO (op)); + if (GET_CODE (op) == REG) + return REG_EXPR (op); else if (GET_CODE (op) != MEM) return 0; @@ -3229,10 +2854,7 @@ get_mem_expr_from_op (op, paddressp) is the number of operands to write. */ static void -output_asm_operand_names (operands, oporder, nops) - rtx *operands; - int *oporder; - int nops; +output_asm_operand_names (rtx *operands, int *oporder, int nops) { int wrote = 0; int i; @@ -3240,16 +2862,22 @@ output_asm_operand_names (operands, oporder, nops) for (i = 0; i < nops; i++) { int addressp; - tree expr = get_mem_expr_from_op (operands[oporder[i]], &addressp); + rtx op = operands[oporder[i]]; + tree expr = get_mem_expr_from_op (op, &addressp); + fprintf (asm_out_file, "%c%s", + wrote ? ',' : '\t', wrote ? "" : ASM_COMMENT_START); + wrote = 1; if (expr) { - fprintf (asm_out_file, "%c%s %s", - wrote ? ',' : '\t', wrote ? "" : ASM_COMMENT_START, + fprintf (asm_out_file, "%s", addressp ? "*" : ""); print_mem_expr (asm_out_file, expr); wrote = 1; } + else if (REG_P (op) && ORIGINAL_REGNO (op) + && ORIGINAL_REGNO (op) != REGNO (op)) + fprintf (asm_out_file, " tmp%i", ORIGINAL_REGNO (op)); } } @@ -3270,9 +2898,7 @@ output_asm_operand_names (operands, oporder, nops) of the operand, with no other punctuation. */ void -output_asm_insn (template, operands) - const char *template; - rtx *operands; +output_asm_insn (const char *template, rtx *operands) { const char *p; int c; @@ -3478,8 +3104,7 @@ output_asm_insn (template, operands) /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */ void -output_asm_label (x) - rtx x; +output_asm_label (rtx x) { char buf[256]; @@ -3506,9 +3131,7 @@ output_asm_label (x) by PRINT_OPERAND. */ static void -output_operand (x, code) - rtx x; - int code ATTRIBUTE_UNUSED; +output_operand (rtx x, int code ATTRIBUTE_UNUSED) { if (x && GET_CODE (x) == SUBREG) x = alter_subreg (&x); @@ -3527,8 +3150,7 @@ output_operand (x, code) The macro PRINT_OPERAND_ADDRESS exists just to control this function. */ void -output_address (x) - rtx x; +output_address (rtx x) { walk_alter_subreg (&x); PRINT_OPERAND_ADDRESS (asm_out_file, x); @@ -3539,9 +3161,7 @@ output_address (x) that may appear in these expressions. */ void -output_addr_const (file, x) - FILE *file; - rtx x; +output_addr_const (FILE *file, rtx x) { char buf[256]; @@ -3663,19 +3283,18 @@ output_addr_const (file, x) %U prints the value of USER_LABEL_PREFIX. %I prints the value of IMMEDIATE_PREFIX. %O runs ASM_OUTPUT_OPCODE to transform what follows in the string. - Also supported are %d, %x, %s, %e, %f, %g and %%. + Also supported are %d, %i, %u, %x, %X, %o, %c, %s and %%. We handle alternate assembler dialects here, just like output_asm_insn. */ void -asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) +asm_fprintf (FILE *file, const char *p, ...) { char buf[10]; char *q, c; + va_list argptr; - VA_OPEN (argptr, p); - VA_FIXEDARG (argptr, FILE *, file); - VA_FIXEDARG (argptr, const char *, p); + va_start (argptr, p); buf[0] = '%'; @@ -3713,6 +3332,11 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) case '%': c = *p++; q = &buf[1]; + while (strchr ("-+ #0", c)) + { + *q++ = c; + c = *p++; + } while (ISDIGIT (c) || c == '.') { *q++ = c; @@ -3721,32 +3345,24 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) switch (c) { case '%': - fprintf (file, "%%"); + putc ('%', file); break; case 'd': case 'i': case 'u': - case 'x': case 'p': case 'X': - case 'o': + case 'x': case 'X': case 'o': + case 'c': *q++ = c; *q = 0; fprintf (file, buf, va_arg (argptr, int)); break; case 'w': - /* This is a prefix to the 'd', 'i', 'u', 'x', 'p', and 'X' cases, - but we do not check for those cases. It means that the value - is a HOST_WIDE_INT, which may be either `int' or `long'. */ - -#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT -#else -#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG - *q++ = 'l'; -#else - *q++ = 'l'; - *q++ = 'l'; -#endif -#endif - + /* This is a prefix to the 'd', 'i', 'u', 'x', 'X', and + 'o' cases, but we do not check for those cases. It + means that the value is a HOST_WIDE_INT, which may be + either `long' or `long long'. */ + memcpy (q, HOST_WIDE_INT_PRINT, strlen (HOST_WIDE_INT_PRINT)); + q += strlen (HOST_WIDE_INT_PRINT); *q++ = *p++; *q = 0; fprintf (file, buf, va_arg (argptr, HOST_WIDE_INT)); @@ -3754,17 +3370,22 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) case 'l': *q++ = c; - *q++ = *p++; - *q = 0; - fprintf (file, buf, va_arg (argptr, long)); - break; +#ifdef HAVE_LONG_LONG + if (*p == 'l') + { + *q++ = *p++; + *q++ = *p++; + *q = 0; + fprintf (file, buf, va_arg (argptr, long long)); + } + else +#endif + { + *q++ = *p++; + *q = 0; + fprintf (file, buf, va_arg (argptr, long)); + } - case 'e': - case 'f': - case 'g': - *q++ = c; - *q = 0; - fprintf (file, buf, va_arg (argptr, double)); break; case 's': @@ -3802,7 +3423,7 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) break; #ifdef ASM_FPRINTF_EXTENSIONS - /* Upper case letters are reserved for general use by asm_fprintf + /* Uppercase letters are reserved for general use by asm_fprintf and so are not available to target specific code. In order to prevent the ASM_FPRINTF_EXTENSIONS macro from using them then, they are defined here. As they get turned into real extensions @@ -3821,9 +3442,9 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) break; default: - fputc (c, file); + putc (c, file); } - VA_CLOSE (argptr); + va_end (argptr); } /* Split up a CONST_DOUBLE or integer constant rtx @@ -3832,9 +3453,7 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...)) and in *SECOND the other. */ void -split_double (value, first, second) - rtx value; - rtx *first, *second; +split_double (rtx value, rtx *first, rtx *second) { if (GET_CODE (value) == CONST_INT) { @@ -3973,7 +3592,7 @@ split_double (value, first, second) /* Return nonzero if this function has no function calls. */ int -leaf_function_p () +leaf_function_p (void) { rtx insn; rtx link; @@ -4016,8 +3635,7 @@ leaf_function_p () output templates to customary add branch prediction hints. */ int -final_forward_branch_p (insn) - rtx insn; +final_forward_branch_p (rtx insn) { int insn_id, label_id; if (!uid_shuid) @@ -4045,10 +3663,10 @@ final_forward_branch_p (insn) safely renumbered. */ int -only_leaf_regs_used () +only_leaf_regs_used (void) { int i; - char *permitted_reg_in_leaf_functions = LEAF_REGISTERS; + const char *const permitted_reg_in_leaf_functions = LEAF_REGISTERS; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if ((regs_ever_live[i] || global_regs[i]) @@ -4068,8 +3686,7 @@ only_leaf_regs_used () available in leaf functions. */ static void -leaf_renumber_regs (first) - rtx first; +leaf_renumber_regs (rtx first) { rtx insn; @@ -4090,8 +3707,7 @@ leaf_renumber_regs (first) available in leaf functions. */ void -leaf_renumber_regs_insn (in_rtx) - rtx in_rtx; +leaf_renumber_regs_insn (rtx in_rtx) { int i, j; const char *format_ptr; @@ -4168,3 +3784,85 @@ leaf_renumber_regs_insn (in_rtx) } } #endif + + +/* When -gused is used, emit debug info for only used symbols. But in + addition to the standard intercepted debug_hooks there are some direct + calls into this file, i.e., dbxout_symbol, dbxout_parms, and dbxout_reg_params. + Those routines may also be called from a higher level intercepted routine. So + to prevent recording data for an inner call to one of these for an intercept, + we maintain an intercept nesting counter (debug_nesting). We only save the + intercepted arguments if the nesting is 1. */ +int debug_nesting = 0; + +static tree *symbol_queue; +int symbol_queue_index = 0; +static int symbol_queue_size = 0; + +/* Generate the symbols for any queued up type symbols we encountered + while generating the type info for some originally used symbol. + This might generate additional entries in the queue. Only when + the nesting depth goes to 0 is this routine called. */ + +void +debug_flush_symbol_queue (void) +{ + int i; + + /* Make sure that additionally queued items are not flushed + prematurely. */ + + ++debug_nesting; + + for (i = 0; i < symbol_queue_index; ++i) + { + /* If we pushed queued symbols then such symbols are must be + output no matter what anyone else says. Specifically, + we need to make sure dbxout_symbol() thinks the symbol was + used and also we need to override TYPE_DECL_SUPPRESS_DEBUG + which may be set for outside reasons. */ + int saved_tree_used = TREE_USED (symbol_queue[i]); + int saved_suppress_debug = TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]); + TREE_USED (symbol_queue[i]) = 1; + TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = 0; + +#ifdef DBX_DEBUGGING_INFO + dbxout_symbol (symbol_queue[i], 0); +#endif + + TREE_USED (symbol_queue[i]) = saved_tree_used; + TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = saved_suppress_debug; + } + + symbol_queue_index = 0; + --debug_nesting; +} + +/* Queue a type symbol needed as part of the definition of a decl + symbol. These symbols are generated when debug_flush_symbol_queue() + is called. */ + +void +debug_queue_symbol (tree decl) +{ + if (symbol_queue_index >= symbol_queue_size) + { + symbol_queue_size += 10; + symbol_queue = xrealloc (symbol_queue, + symbol_queue_size * sizeof (tree)); + } + + symbol_queue[symbol_queue_index++] = decl; +} + +/* Free symbol queue. */ +void +debug_free_queue (void) +{ + if (symbol_queue) + { + free (symbol_queue); + symbol_queue = NULL; + symbol_queue_size = 0; + } +} diff --git a/contrib/gcc/flags.h b/contrib/gcc/flags.h index 0a8979d2dc9e..e947f2a66bb2 100644 --- a/contrib/gcc/flags.h +++ b/contrib/gcc/flags.h @@ -1,5 +1,6 @@ /* Compilation switch flag definitions for GCC. - Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 + Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, + 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -22,9 +23,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef GCC_FLAGS_H #define GCC_FLAGS_H -/* Name of the input .c file being compiled. */ -extern const char *main_input_filename; - enum debug_info_type { NO_DEBUG, /* Write no debug info. */ @@ -41,6 +39,9 @@ enum debug_info_type /* Specify which kind of debugging info to generate. */ extern enum debug_info_type write_symbols; +/* Names of debug_info_type, for error messages. */ +extern const char *const debug_type_names[]; + enum debug_info_level { DINFO_LEVEL_NONE, /* Write no debugging info. */ @@ -54,7 +55,10 @@ extern enum debug_info_level debug_info_level; /* Nonzero means use GNU-only extensions in the generated symbolic debugging information. */ -extern int use_gnu_debug_info_extensions; +extern bool use_gnu_debug_info_extensions; + +/* Nonzero means emit debugging information only for symbols which are used. */ +extern int flag_debug_only_used_symbols; /* Nonzero means do optimizations. -opt. */ @@ -69,10 +73,6 @@ extern int optimize_size; extern int quiet_flag; -/* Print times taken by the various passes. -ftime-report. */ - -extern int time_report; - /* Print memory still in use at end of compilation (which may have little to do with peak memory consumption). -fmem-report. */ @@ -80,65 +80,62 @@ extern int mem_report; /* Don't print warning messages. -w. */ -extern int inhibit_warnings; +extern bool inhibit_warnings; /* Don't suppress warnings from system headers. -Wsystem-headers. */ -extern int warn_system_headers; +extern bool warn_system_headers; -/* Do print extra warnings (such as for uninitialized variables). -W. */ +/* Do print extra warnings (such as for uninitialized variables). + -W/-Wextra. */ -extern int extra_warnings; +extern bool extra_warnings; + +/* If -Werror. */ + +extern bool warnings_are_errors; /* Nonzero to warn about unused variables, functions et.al. Use set_Wunused() to update the -Wunused-* flags that correspond to the -Wunused option. */ -extern void set_Wunused PARAMS ((int setting)); +extern void set_Wunused (int setting); -extern int warn_unused_function; -extern int warn_unused_label; -extern int warn_unused_parameter; -extern int warn_unused_variable; -extern int warn_unused_value; +extern bool warn_unused_function; +extern bool warn_unused_label; +extern bool warn_unused_parameter; +extern bool warn_unused_variable; +extern bool warn_unused_value; /* Nonzero to warn about code which is never reached. */ -extern int warn_notreached; +extern bool warn_notreached; /* Nonzero means warn if inline function is too large. */ -extern int warn_inline; +extern bool warn_inline; /* Nonzero to warn about variables used before they are initialized. */ extern int warn_uninitialized; -/* Zero if unknown pragmas are ignored - One if the compiler should warn about an unknown pragma not in - a system include file. - Greater than one if the compiler should warn for all unknown - pragmas. */ - -extern int warn_unknown_pragmas; - /* Nonzero means warn about all declarations which shadow others. */ -extern int warn_shadow; +extern bool warn_shadow; /* Warn if a switch on an enum, that does not have a default case, fails to have a case for every enum value. */ -extern int warn_switch; +extern bool warn_switch; /* Warn if a switch does not have a default case. */ -extern int warn_switch_default; +extern bool warn_switch_default; /* Warn if a switch on an enum fails to have a case for every enum value (regardless of the presence or otherwise of a default case). */ -extern int warn_switch_enum; +extern bool warn_switch_enum; /* Nonzero means warn about function definitions that default the return type or that use a null return and have a return-type other than void. */ @@ -147,47 +144,47 @@ extern int warn_return_type; /* Warn about functions which might be candidates for attribute noreturn. */ -extern int warn_missing_noreturn; +extern bool warn_missing_noreturn; /* Nonzero means warn about pointer casts that increase the required alignment of the target type (and might therefore lead to a crash due to a misaligned access). */ -extern int warn_cast_align; +extern bool warn_cast_align; /* Nonzero means warn about any objects definitions whose size is larger than N bytes. Also want about function definitions whose returned values are larger than N bytes. The value N is in `larger_than_size'. */ -extern int warn_larger_than; +extern bool warn_larger_than; extern HOST_WIDE_INT larger_than_size; /* Warn if a function returns an aggregate, since there are often incompatible calling conventions for doing this. */ -extern int warn_aggregate_return; +extern bool warn_aggregate_return; /* Warn if packed attribute on struct is unnecessary and inefficient. */ -extern int warn_packed; +extern bool warn_packed; /* Warn when gcc pads a structure to an alignment boundary. */ -extern int warn_padded; +extern bool warn_padded; /* Warn when an optimization pass is disabled. */ -extern int warn_disabled_optimization; +extern bool warn_disabled_optimization; /* Nonzero means warn about uses of __attribute__((deprecated)) declarations. */ -extern int warn_deprecated_decl; +extern bool warn_deprecated_decl; /* Nonzero means warn about constructs which might not be strict aliasing safe. */ -extern int warn_strict_aliasing; +extern bool warn_strict_aliasing; /* Nonzero if generating code to do profiling. */ @@ -197,6 +194,10 @@ extern int profile_flag; extern int profile_arc_flag; +/* Nonzero if value profile should be measured. */ + +extern int flag_profile_values; + /* Nonzero if generating info for gcov to calculate line test coverage. */ extern int flag_test_coverage; @@ -281,12 +282,12 @@ extern int flag_strength_reduce; UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are unrolled. */ -extern int flag_unroll_loops; +extern int flag_old_unroll_loops; /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled. This is generally not a win. */ -extern int flag_unroll_all_loops; +extern int flag_old_unroll_all_loops; /* Nonzero forces all invariant computations in loops to be moved outside the loop. */ @@ -336,18 +337,6 @@ extern int flag_omit_frame_pointer; extern int flag_no_peephole; -/* Nonzero means all references through pointers are volatile. */ - -extern int flag_volatile; - -/* Nonzero means treat all global and extern variables as volatile. */ - -extern int flag_volatile_global; - -/* Nonzero means treat all static variables as volatile. */ - -extern int flag_volatile_static; - /* Nonzero allows GCC to optimize sibling and tail recursive calls. */ extern int flag_optimize_sibling_calls; @@ -374,6 +363,11 @@ extern int flag_finite_math_only; extern int flag_trapping_math; +/* Nonzero means disable transformations that assume default floating + point rounding behavior. */ + +extern int flag_rounding_math; + /* 0 means straightforward implementation of complex divide acceptable. 1 means wide ranges of inputs must work for complex divide. 2 means C99-like requirements for complex divide (not yet implemented). */ @@ -427,6 +421,8 @@ extern int flag_shared_data; extern int flag_schedule_insns; extern int flag_schedule_insns_after_reload; +extern int flag_sched2_use_superblocks; +extern int flag_sched2_use_traces; /* The following flags have effect only for scheduling before register allocation: @@ -443,6 +439,20 @@ extern int flag_schedule_speculative; extern int flag_schedule_speculative_load; extern int flag_schedule_speculative_load_dangerous; +/* The following flags have an effect during scheduling after register + allocation: + + sched_stalled_insns means that insns can be moved prematurely from the queue + of stalled insns into the ready list. + + sched_stalled_insns_dep controls how many recently scheduled cycles will + be examined for a dependency on a stalled insn that is candidate for + premature removal from the queue of stalled insns into the ready list (has + an effect only if the flag 'sched_stalled_insns' is set). */ + +extern int flag_sched_stalled_insns; +extern int flag_sched_stalled_insns_dep; + /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple by a cheaper branch, on a count register. */ extern int flag_branch_on_count_reg; @@ -472,16 +482,26 @@ extern int flag_pedantic_errors; extern int flag_pic; +/* Nonzero if we are compiling position independent code for executable. + 1 vs 2 for a target-dependent "small" or "large" mode. */ + +extern int flag_pie; + +/* Nonzero if we are compiling code for a shared library, zero for + executable. */ + +extern int flag_shlib; + /* Nonzero means generate extra code for exception handling and enable exception handling. */ extern int flag_exceptions; -/* Nonzero means generate frame unwind info table when supported */ +/* Nonzero means generate frame unwind info table when supported. */ extern int flag_unwind_tables; -/* Nonzero means generate frame unwind info table exact at each insn boundary */ +/* Nonzero means generate frame unwind info table exact at each insn boundary. */ extern int flag_asynchronous_unwind_tables; @@ -525,9 +545,9 @@ extern int flag_debug_asm; extern int flag_dump_rtl_in_asm; -/* -fgnu-linker specifies use of the GNU linker for initializations. - -fno-gnu-linker says that collect will be used. */ -extern int flag_gnu_linker; +/* Greater than zero if user symbols are prepended by a leading underscore + in generated assembly code. */ +extern int flag_leading_underscore; /* Tag all structures with __attribute__(packed) */ extern int flag_pack_struct; @@ -560,7 +580,7 @@ extern int flag_instrument_function_entry_exit; /* Perform a peephole pass before sched2. */ extern int flag_peephole2; -/* Try to guess branch probablities. */ +/* Try to guess branch probabilities. */ extern int flag_guess_branch_prob; /* -fcheck-bounds causes gcc to generate array bounds checks. @@ -591,9 +611,15 @@ extern int frame_pointer_needed; for PLUS / SUB / MULT. */ extern int flag_trapv; +/* Nonzero if the signed arithmetic overflow should wrap around. */ +extern int flag_wrapv; + +/* Nonzero if subexpressions must be evaluated from left-to-right. */ +extern int flag_evaluation_order; + /* Value of the -G xx switch, and whether it was passed or not. */ -extern int g_switch_value; -extern int g_switch_set; +extern unsigned HOST_WIDE_INT g_switch_value; +extern bool g_switch_set; /* Values of the -falign-* flags: how much to align labels in code. 0 means `use default', 1 means `don't align'. @@ -633,6 +659,10 @@ extern enum graph_dump_types graph_dump_format; extern int flag_no_ident; +/* Nonzero means perform global CSE. */ + +extern int flag_gcse; + /* Nonzero if we want to perform enhanced load motion during gcse. */ extern int flag_gcse_lm; @@ -641,11 +671,33 @@ extern int flag_gcse_lm; extern int flag_gcse_sm; +/* Nonzero if we want to perform redundant load-after-store elimination + in gcse. */ + +extern int flag_gcse_las; + +/* Nonzero if value histograms should be used to optimize code. */ +extern int flag_value_profile_transformations; + +/* Perform branch target register optimization before prologue / epilogue + threading. */ + +extern int flag_branch_target_load_optimize; + +/* Perform branch target register optimization after prologue / epilogue + threading and jump2. */ + +extern int flag_branch_target_load_optimize2; + /* Nonzero means we should do dwarf2 duplicate elimination. */ extern int flag_eliminate_dwarf2_dups; +/* Nonzero means we should do unused type elimination. */ + +extern int flag_eliminate_unused_debug_types; + /* Nonzero means to collect statistics which might be expensive and to print them when we are done. */ extern int flag_detailed_statistics; @@ -659,11 +711,40 @@ extern int flag_zero_initialized_in_bss; /* Nonzero means disable transformations observable by signaling NaNs. */ extern int flag_signaling_nans; +extern int flag_unit_at_a_time; + +extern int flag_web; + +/* Nonzero means that we defer emitting functions until they are actually + used. */ +extern int flag_remove_unreachable_functions; + /* A string that's used when a random name is required. NULL means to make it really random. */ extern const char *flag_random_seed; +/* The version of the C++ ABI in use. The following values are + allowed: + + 0: The version of the ABI believed most conformant with the + C++ ABI specification. This ABI may change as bugs are + discovered and fixed. Therefore, 0 will not necessarily + indicate the same ABI in different versions of G++. + + 1: The version of the ABI first used in G++ 3.2. + + Additional positive integers will be assigned as new versions of + the ABI become the default version of the ABI. */ + +extern int flag_abi_version; + +/* Returns TRUE if generated code should match ABI version N or + greater is in use. */ + +#define abi_version_at_least(N) \ + (flag_abi_version == 0 || flag_abi_version >= (N)) + /* True if the given mode has a NaN representation and the treatment of NaN operands is important. Certain optimizations, such as folding x * 0 into x, are not correct for NaN operands, and are normally @@ -681,13 +762,13 @@ extern const char *flag_random_seed; (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only) /* Like HONOR_NANS, but true if the given mode distinguishes between - postive and negative zero, and the sign of zero is important. */ + positive and negative zero, and the sign of zero is important. */ #define HONOR_SIGNED_ZEROS(MODE) \ (MODE_HAS_SIGNED_ZEROS (MODE) && !flag_unsafe_math_optimizations) /* Like HONOR_NANS, but true if given mode supports sign-dependent rounding, and the rounding mode is important. */ #define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \ - (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && !flag_unsafe_math_optimizations) + (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math) #endif /* ! GCC_FLAGS_H */ diff --git a/contrib/gcc/ginclude/stdarg.h b/contrib/gcc/ginclude/stdarg.h index e451c31c53f2..f178505e892e 100644 --- a/contrib/gcc/ginclude/stdarg.h +++ b/contrib/gcc/ginclude/stdarg.h @@ -1,19 +1,19 @@ /* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. -GNU CC is distributed in the hope that it will be useful, +GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ diff --git a/contrib/gcc/ginclude/stddef.h b/contrib/gcc/ginclude/stddef.h index 2cd15899af10..1bb3e90bc9b1 100644 --- a/contrib/gcc/ginclude/stddef.h +++ b/contrib/gcc/ginclude/stddef.h @@ -1,19 +1,19 @@ /* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. -GNU CC is distributed in the hope that it will be useful, +GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -409,10 +409,17 @@ typedef __WINT_TYPE__ wint_t; #ifdef _STDDEF_H -/* Offset of member MEMBER in a struct of type TYPE. */ - +/* Offset of member MEMBER in a struct of type TYPE. */ +#ifndef __cplusplus #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - +#else +/* The cast to "char &" below avoids problems with user-defined + "operator &", which can appear in a POD type. */ +#define offsetof(TYPE, MEMBER) \ + (__offsetof__ (reinterpret_cast \ + (&reinterpret_cast \ + (static_cast (0)->MEMBER)))) +#endif /* C++ */ #endif /* _STDDEF_H was defined this time */ #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ diff --git a/contrib/gcc/libgcc2.c b/contrib/gcc/libgcc2.c index dea803def0d7..8d77a7ee8903 100644 --- a/contrib/gcc/libgcc2.c +++ b/contrib/gcc/libgcc2.c @@ -1,7 +1,7 @@ /* More subroutines needed by GCC output code on some machines. */ /* Compile this one with gcc. */ /* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GCC. @@ -29,18 +29,30 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is + supposedly valid even though this is a "target" file. */ +#include "auto-host.h" + /* It is incorrect to include config.h here, because this file is being compiled for the target, and hence definitions concerning only the host do not apply. */ - #include "tconfig.h" #include "tsystem.h" +#include "coretypes.h" +#include "tm.h" /* Don't use `fancy_abort' here even if config.h says to use it. */ #ifdef abort #undef abort #endif +#ifdef HAVE_GAS_HIDDEN +#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) +#else +#define ATTRIBUTE_HIDDEN +#endif + #include "libgcc2.h" #ifdef DECLARE_LIBRARY_RENAMES @@ -51,13 +63,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA DWtype __negdi2 (DWtype u) { - DWunion w; - DWunion uu; - - uu.ll = u; - - w.s.low = -uu.s.low; - w.s.high = -uu.s.high - ((UWtype) w.s.low > 0); + const DWunion uu = {.ll = u}; + const DWunion w = { {.low = -uu.s.low, + .high = -uu.s.high - ((UWtype) -uu.s.low > 0) } }; return w.ll; } @@ -67,9 +75,7 @@ __negdi2 (DWtype u) Wtype __addvsi3 (Wtype a, Wtype b) { - Wtype w; - - w = a + b; + const Wtype w = a + b; if (b >= 0 ? w < a : w > a) abort (); @@ -82,9 +88,7 @@ __addvsi3 (Wtype a, Wtype b) DWtype __addvdi3 (DWtype a, DWtype b) { - DWtype w; - - w = a + b; + const DWtype w = a + b; if (b >= 0 ? w < a : w > a) abort (); @@ -97,18 +101,12 @@ __addvdi3 (DWtype a, DWtype b) Wtype __subvsi3 (Wtype a, Wtype b) { -#ifdef L_addvsi3 - return __addvsi3 (a, (-b)); -#else - DWtype w; - - w = a - b; + const DWtype w = a - b; if (b >= 0 ? w > a : w < a) abort (); return w; -#endif } #endif @@ -116,30 +114,25 @@ __subvsi3 (Wtype a, Wtype b) DWtype __subvdi3 (DWtype a, DWtype b) { -#ifdef L_addvdi3 - return (a, (-b)); -#else - DWtype w; - - w = a - b; + const DWtype w = a - b; if (b >= 0 ? w > a : w < a) abort (); return w; -#endif } #endif #ifdef L_mulvsi3 +#define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) Wtype __mulvsi3 (Wtype a, Wtype b) { - DWtype w; + const DWtype w = (DWtype) a * (DWtype) b; - w = a * b; - - if (((a >= 0) == (b >= 0)) ? w < 0 : w > 0) + if (((a >= 0) == (b >= 0)) + ? (UDWtype) w > (UDWtype) (((DWtype) 1 << (WORD_SIZE - 1)) - 1) + : (UDWtype) w < (UDWtype) ((DWtype) -1 << (WORD_SIZE - 1))) abort (); return w; @@ -150,9 +143,7 @@ __mulvsi3 (Wtype a, Wtype b) Wtype __negvsi2 (Wtype a) { - Wtype w; - - w = -a; + const Wtype w = -a; if (a >= 0 ? w > 0 : w < 0) abort (); @@ -165,9 +156,7 @@ __negvsi2 (Wtype a) DWtype __negvdi2 (DWtype a) { - DWtype w; - - w = -a; + const DWtype w = -a; if (a >= 0 ? w > 0 : w < 0) abort (); @@ -203,8 +192,8 @@ __absvdi2 (DWtype a) DWtype w = a; if (a < 0) -#ifdef L_negvsi2 - w = __negvsi2 (a); +#ifdef L_negvdi2 + w = __negvdi2 (a); #else w = -a; @@ -217,37 +206,144 @@ __absvdi2 (DWtype a) #endif #ifdef L_mulvdi3 +#define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) DWtype __mulvdi3 (DWtype u, DWtype v) { - DWtype w; + /* The unchecked multiplication needs 3 Wtype x Wtype multiplications, + but the checked multiplication needs only two. */ + const DWunion uu = {.ll = u}; + const DWunion vv = {.ll = v}; - w = u * v; + if (__builtin_expect (uu.s.high == uu.s.low >> (WORD_SIZE - 1), 1)) + { + /* u fits in a single Wtype. */ + if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1)) + { + /* v fits in a single Wtype as well. */ + /* A single multiplication. No overflow risk. */ + return (DWtype) uu.s.low * (DWtype) vv.s.low; + } + else + { + /* Two multiplications. */ + DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; + DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.high}; - if (((u >= 0) == (v >= 0)) ? w < 0 : w > 0) - abort (); + if (vv.s.high < 0) + w1.s.high -= uu.s.low; + if (uu.s.low < 0) + w1.ll -= vv.ll; + w1.ll += (UWtype) w0.s.high; + if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1)) + { + w0.s.high = w1.s.low; + return w0.ll; + } + } + } + else + { + if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1)) + { + /* v fits into a single Wtype. */ + /* Two multiplications. */ + DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; + DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.high + * (UDWtype) (UWtype) vv.s.low}; - return w; + if (uu.s.high < 0) + w1.s.high -= vv.s.low; + if (vv.s.low < 0) + w1.ll -= uu.ll; + w1.ll += (UWtype) w0.s.high; + if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1)) + { + w0.s.high = w1.s.low; + return w0.ll; + } + } + else + { + /* A few sign checks and a single multiplication. */ + if (uu.s.high >= 0) + { + if (vv.s.high >= 0) + { + if (uu.s.high == 0 && vv.s.high == 0) + { + const DWtype w = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low; + if (__builtin_expect (w >= 0, 1)) + return w; + } + } + else + { + if (uu.s.high == 0 && vv.s.high == (Wtype) -1) + { + DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; + + ww.s.high -= uu.s.low; + if (__builtin_expect (ww.s.high < 0, 1)) + return ww.ll; + } + } + } + else + { + if (vv.s.high >= 0) + { + if (uu.s.high == (Wtype) -1 && vv.s.high == 0) + { + DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; + + ww.s.high -= vv.s.low; + if (__builtin_expect (ww.s.high < 0, 1)) + return ww.ll; + } + } + else + { + if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1) + { + DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; + + ww.s.high -= uu.s.low; + ww.s.high -= vv.s.low; + if (__builtin_expect (ww.s.high >= 0, 1)) + return ww.ll; + } + } + } + } + } + + /* Overflow. */ + abort (); } #endif -/* Unless shift functions are defined whith full ANSI prototypes, +/* Unless shift functions are defined with full ANSI prototypes, parameter b will be promoted to int if word_type is smaller than an int. */ #ifdef L_lshrdi3 DWtype __lshrdi3 (DWtype u, word_type b) { - DWunion w; - word_type bm; - DWunion uu; - if (b == 0) return u; - uu.ll = u; + const DWunion uu = {.ll = u}; + const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + DWunion w; - bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; if (bm <= 0) { w.s.high = 0; @@ -255,7 +351,7 @@ __lshrdi3 (DWtype u, word_type b) } else { - UWtype carries = (UWtype) uu.s.high << bm; + const UWtype carries = (UWtype) uu.s.high << bm; w.s.high = (UWtype) uu.s.high >> b; w.s.low = ((UWtype) uu.s.low >> b) | carries; @@ -269,16 +365,13 @@ __lshrdi3 (DWtype u, word_type b) DWtype __ashldi3 (DWtype u, word_type b) { - DWunion w; - word_type bm; - DWunion uu; - if (b == 0) return u; - uu.ll = u; + const DWunion uu = {.ll = u}; + const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + DWunion w; - bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; if (bm <= 0) { w.s.low = 0; @@ -286,7 +379,7 @@ __ashldi3 (DWtype u, word_type b) } else { - UWtype carries = (UWtype) uu.s.low >> bm; + const UWtype carries = (UWtype) uu.s.low >> bm; w.s.low = (UWtype) uu.s.low << b; w.s.high = ((UWtype) uu.s.high << b) | carries; @@ -300,16 +393,13 @@ __ashldi3 (DWtype u, word_type b) DWtype __ashrdi3 (DWtype u, word_type b) { - DWunion w; - word_type bm; - DWunion uu; - if (b == 0) return u; - uu.ll = u; + const DWunion uu = {.ll = u}; + const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + DWunion w; - bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; if (bm <= 0) { /* w.s.high = 1..1 or 0..0 */ @@ -318,7 +408,7 @@ __ashrdi3 (DWtype u, word_type b) } else { - UWtype carries = (UWtype) uu.s.high << bm; + const UWtype carries = (UWtype) uu.s.high << bm; w.s.high = uu.s.high >> b; w.s.low = ((UWtype) uu.s.low >> b) | carries; @@ -328,14 +418,31 @@ __ashrdi3 (DWtype u, word_type b) } #endif -#ifdef L_ffsdi2 -DWtype -__ffsdi2 (DWtype u) +#ifdef L_ffssi2 +#undef int +extern int __ffsSI2 (UWtype u); +int +__ffsSI2 (UWtype u) { - DWunion uu; + UWtype count; + + if (u == 0) + return 0; + + count_trailing_zeros (count, u); + return count + 1; +} +#endif + +#ifdef L_ffsdi2 +#undef int +extern int __ffsDI2 (DWtype u); +int +__ffsDI2 (DWtype u) +{ + const DWunion uu = {.ll = u}; UWtype word, count, add; - uu.ll = u; if (uu.s.low != 0) word = uu.s.low, add = 0; else if (uu.s.high != 0) @@ -352,13 +459,10 @@ __ffsdi2 (DWtype u) DWtype __muldi3 (DWtype u, DWtype v) { - DWunion w; - DWunion uu, vv; + const DWunion uu = {.ll = u}; + const DWunion vv = {.ll = v}; + DWunion w = {.ll = __umulsidi3 (uu.s.low, vv.s.low)}; - uu.ll = u, - vv.ll = v; - - w.ll = __umulsidi3 (uu.s.low, vv.s.low); w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high + (UWtype) uu.s.high * (UWtype) vv.s.low); @@ -506,6 +610,170 @@ const UQItype __clz_tab[] = 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, }; #endif + +#ifdef L_clzsi2 +#undef int +extern int __clzSI2 (UWtype x); +int +__clzSI2 (UWtype x) +{ + Wtype ret; + + count_leading_zeros (ret, x); + + return ret; +} +#endif + +#ifdef L_clzdi2 +#undef int +extern int __clzDI2 (UDWtype x); +int +__clzDI2 (UDWtype x) +{ + const DWunion uu = {.ll = x}; + UWtype word; + Wtype ret, add; + + if (uu.s.high) + word = uu.s.high, add = 0; + else + word = uu.s.low, add = W_TYPE_SIZE; + + count_leading_zeros (ret, word); + return ret + add; +} +#endif + +#ifdef L_ctzsi2 +#undef int +extern int __ctzSI2 (UWtype x); +int +__ctzSI2 (UWtype x) +{ + Wtype ret; + + count_trailing_zeros (ret, x); + + return ret; +} +#endif + +#ifdef L_ctzdi2 +#undef int +extern int __ctzDI2 (UDWtype x); +int +__ctzDI2 (UDWtype x) +{ + const DWunion uu = {.ll = x}; + UWtype word; + Wtype ret, add; + + if (uu.s.low) + word = uu.s.low, add = 0; + else + word = uu.s.high, add = W_TYPE_SIZE; + + count_trailing_zeros (ret, word); + return ret + add; +} +#endif + +#if (defined (L_popcountsi2) || defined (L_popcountdi2) \ + || defined (L_popcount_tab)) +extern const UQItype __popcount_tab[] ATTRIBUTE_HIDDEN; +#endif + +#ifdef L_popcount_tab +const UQItype __popcount_tab[] = +{ + 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5, + 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, + 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, + 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, + 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, + 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, + 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, + 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8, +}; +#endif + +#ifdef L_popcountsi2 +#undef int +extern int __popcountSI2 (UWtype x); +int +__popcountSI2 (UWtype x) +{ + UWtype i, ret = 0; + + for (i = 0; i < W_TYPE_SIZE; i += 8) + ret += __popcount_tab[(x >> i) & 0xff]; + + return ret; +} +#endif + +#ifdef L_popcountdi2 +#undef int +extern int __popcountDI2 (UDWtype x); +int +__popcountDI2 (UDWtype x) +{ + UWtype i, ret = 0; + + for (i = 0; i < 2*W_TYPE_SIZE; i += 8) + ret += __popcount_tab[(x >> i) & 0xff]; + + return ret; +} +#endif + +#ifdef L_paritysi2 +#undef int +extern int __paritySI2 (UWtype x); +int +__paritySI2 (UWtype x) +{ +#if W_TYPE_SIZE > 64 +# error "fill out the table" +#endif +#if W_TYPE_SIZE > 32 + x ^= x >> 32; +#endif +#if W_TYPE_SIZE > 16 + x ^= x >> 16; +#endif + x ^= x >> 8; + x ^= x >> 4; + x &= 0xf; + return (0x6996 >> x) & 1; +} +#endif + +#ifdef L_paritydi2 +#undef int +extern int __parityDI2 (UDWtype x); +int +__parityDI2 (UDWtype x) +{ + const DWunion uu = {.ll = x}; + UWtype nx = uu.s.low ^ uu.s.high; + +#if W_TYPE_SIZE > 64 +# error "fill out the table" +#endif +#if W_TYPE_SIZE > 32 + nx ^= nx >> 32; +#endif +#if W_TYPE_SIZE > 16 + nx ^= nx >> 16; +#endif + nx ^= nx >> 8; + nx ^= nx >> 4; + nx &= 0xf; + return (0x6996 >> nx) & 1; +} +#endif #ifdef L_udivmoddi4 @@ -516,16 +784,13 @@ static inline __attribute__ ((__always_inline__)) UDWtype __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) { - DWunion ww; - DWunion nn, dd; + const DWunion nn = {.ll = n}; + const DWunion dd = {.ll = d}; DWunion rr; UWtype d0, d1, n0, n1, n2; UWtype q0, q1; UWtype b, bm; - nn.ll = n; - dd.ll = d; - d0 = dd.s.low; d1 = dd.s.high; n0 = nn.s.low; @@ -725,8 +990,7 @@ __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) } } - ww.s.low = q0; - ww.s.high = q1; + const DWunion ww = {{.low = q0, .high = q1}}; return ww.ll; } #endif @@ -736,12 +1000,10 @@ DWtype __divdi3 (DWtype u, DWtype v) { word_type c = 0; - DWunion uu, vv; + DWunion uu = {.ll = u}; + DWunion vv = {.ll = v}; DWtype w; - uu.ll = u; - vv.ll = v; - if (uu.s.high < 0) c = ~c, uu.ll = -uu.ll; @@ -762,12 +1024,10 @@ DWtype __moddi3 (DWtype u, DWtype v) { word_type c = 0; - DWunion uu, vv; + DWunion uu = {.ll = u}; + DWunion vv = {.ll = v}; DWtype w; - uu.ll = u; - vv.ll = v; - if (uu.s.high < 0) c = ~c, uu.ll = -uu.ll; @@ -806,9 +1066,8 @@ __udivdi3 (UDWtype n, UDWtype d) word_type __cmpdi2 (DWtype a, DWtype b) { - DWunion au, bu; - - au.ll = a, bu.ll = b; + const DWunion au = {.ll = a}; + const DWunion bu = {.ll = b}; if (au.s.high < bu.s.high) return 0; @@ -826,9 +1085,8 @@ __cmpdi2 (DWtype a, DWtype b) word_type __ucmpdi2 (DWtype a, DWtype b) { - DWunion au, bu; - - au.ll = a, bu.ll = b; + const DWunion au = {.ll = a}; + const DWunion bu = {.ll = b}; if ((UWtype) au.s.high < (UWtype) bu.s.high) return 0; @@ -849,17 +1107,14 @@ __ucmpdi2 (DWtype a, DWtype b) DWtype __fixunstfDI (TFtype a) { - TFtype b; - UDWtype v; - if (a < 0) return 0; /* Compute high word of result, as a flonum. */ - b = (a / HIGH_WORD_COEFF); + const TFtype b = (a / HIGH_WORD_COEFF); /* Convert that to fixed (but not to DWtype!), and shift it into the high word. */ - v = (UWtype) b; + UDWtype v = (UWtype) b; v <<= WORD_SIZE; /* Remove high part from the TFtype, leaving the low part as flonum. */ a -= (TFtype)v; @@ -891,17 +1146,14 @@ __fixtfdi (TFtype a) DWtype __fixunsxfDI (XFtype a) { - XFtype b; - UDWtype v; - if (a < 0) return 0; /* Compute high word of result, as a flonum. */ - b = (a / HIGH_WORD_COEFF); + const XFtype b = (a / HIGH_WORD_COEFF); /* Convert that to fixed (but not to DWtype!), and shift it into the high word. */ - v = (UWtype) b; + UDWtype v = (UWtype) b; v <<= WORD_SIZE; /* Remove high part from the XFtype, leaving the low part as flonum. */ a -= (XFtype)v; @@ -933,28 +1185,18 @@ __fixxfdi (XFtype a) DWtype __fixunsdfDI (DFtype a) { - DFtype b; - UDWtype v; + /* Get high part of result. The division here will just moves the radix + point and will not cause any rounding. Then the conversion to integral + type chops result as desired. */ + const UWtype hi = a / HIGH_WORD_COEFF; - if (a < 0) - return 0; + /* Get low part of result. Convert `hi' to floating type and scale it back, + then subtract this from the number being converted. This leaves the low + part. Convert that to integral type. */ + const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF); - /* Compute high word of result, as a flonum. */ - b = (a / HIGH_WORD_COEFF); - /* Convert that to fixed (but not to DWtype!), - and shift it into the high word. */ - v = (UWtype) b; - v <<= WORD_SIZE; - /* Remove high part from the DFtype, leaving the low part as flonum. */ - a -= (DFtype)v; - /* Convert that to fixed (but not to DWtype!) and add it in. - Sometimes A comes out negative. This is significant, since - A has more bits than a long int does. */ - if (a < 0) - v -= (UWtype) (- a); - else - v += (UWtype) a; - return v; + /* Assemble result from the two parts. */ + return ((UDWtype) hi << WORD_SIZE) | lo; } #endif @@ -978,29 +1220,20 @@ __fixunssfDI (SFtype original_a) /* Convert the SFtype to a DFtype, because that is surely not going to lose any bits. Some day someone else can write a faster version that avoids converting to DFtype, and verify it really works right. */ - DFtype a = original_a; - DFtype b; - UDWtype v; + const DFtype a = original_a; - if (a < 0) - return 0; + /* Get high part of result. The division here will just moves the radix + point and will not cause any rounding. Then the conversion to integral + type chops result as desired. */ + const UWtype hi = a / HIGH_WORD_COEFF; - /* Compute high word of result, as a flonum. */ - b = (a / HIGH_WORD_COEFF); - /* Convert that to fixed (but not to DWtype!), - and shift it into the high word. */ - v = (UWtype) b; - v <<= WORD_SIZE; - /* Remove high part from the DFtype, leaving the low part as flonum. */ - a -= (DFtype) v; - /* Convert that to fixed (but not to DWtype!) and add it in. - Sometimes A comes out negative. This is significant, since - A has more bits than a long int does. */ - if (a < 0) - v -= (UWtype) (- a); - else - v += (UWtype) a; - return v; + /* Get low part of result. Convert `hi' to floating type and scale it back, + then subtract this from the number being converted. This leaves the low + part. Convert that to integral type. */ + const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF); + + /* Assemble result from the two parts. */ + return ((UDWtype) hi << WORD_SIZE) | lo; } #endif @@ -1022,9 +1255,7 @@ __fixsfdi (SFtype a) XFtype __floatdixf (DWtype u) { - XFtype d; - - d = (Wtype) (u >> WORD_SIZE); + XFtype d = (Wtype) (u >> WORD_SIZE); d *= HIGH_HALFWORD_COEFF; d *= HIGH_HALFWORD_COEFF; d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); @@ -1041,9 +1272,7 @@ __floatdixf (DWtype u) TFtype __floatditf (DWtype u) { - TFtype d; - - d = (Wtype) (u >> WORD_SIZE); + TFtype d = (Wtype) (u >> WORD_SIZE); d *= HIGH_HALFWORD_COEFF; d *= HIGH_HALFWORD_COEFF; d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); @@ -1060,9 +1289,7 @@ __floatditf (DWtype u) DFtype __floatdidf (DWtype u) { - DFtype d; - - d = (Wtype) (u >> WORD_SIZE); + DFtype d = (Wtype) (u >> WORD_SIZE); d *= HIGH_HALFWORD_COEFF; d *= HIGH_HALFWORD_COEFF; d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); @@ -1083,11 +1310,6 @@ __floatdidf (DWtype u) SFtype __floatdisf (DWtype u) { - /* Do the calculation in DFmode - so that we don't lose any of the precision of the high word - while multiplying it. */ - DFtype f; - /* Protect against double-rounding error. Represent any low-order bits, that might be truncated in DFmode, by a bit that won't be lost. The bit can go in anywhere below the @@ -1108,7 +1330,10 @@ __floatdisf (DWtype u) } } } - f = (Wtype) (u >> WORD_SIZE); + /* Do the calculation in DFmode + so that we don't lose any of the precision of the high word + while multiplying it. */ + DFtype f = (Wtype) (u >> WORD_SIZE); f *= HIGH_HALFWORD_COEFF; f *= HIGH_HALFWORD_COEFF; f += (UWtype) (u & (HIGH_WORD_COEFF - 1)); @@ -1217,7 +1442,7 @@ __gcc_bcmp (const unsigned char *s1, const unsigned char *s2, size_t size) { while (size > 0) { - unsigned char c1 = *s1++, c2 = *s2++; + const unsigned char c1 = *s1++, c2 = *s2++; if (c1 != c2) return c1 - c2; size--; @@ -1249,453 +1474,34 @@ __eprintf (const char *string, const char *expression, #endif #endif -#ifdef L_bb - -struct bb_function_info { - long checksum; - int arc_count; - const char *name; -}; - -/* Structure emitted by --profile-arcs */ -struct bb -{ - long zero_word; - const char *filename; - gcov_type *counts; - long ncounts; - struct bb *next; - - /* Older GCC's did not emit these fields. */ - long sizeof_bb; - struct bb_function_info *function_infos; -}; - -#ifndef inhibit_libc - -/* Arc profile dumper. Requires atexit and stdio. */ - -#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */ -#include - -#include "gcov-io.h" -#include -#ifdef TARGET_HAS_F_SETLKW -#include -#include -#endif - -/* Chain of per-object file bb structures. */ -static struct bb *bb_head; - -/* Dump the coverage counts. We merge with existing counts when - possible, to avoid growing the .da files ad infinitum. */ - -void -__bb_exit_func (void) -{ - struct bb *ptr; - int i; - gcov_type program_sum = 0; - gcov_type program_max = 0; - long program_arcs = 0; - gcov_type merged_sum = 0; - gcov_type merged_max = 0; - long merged_arcs = 0; - -#if defined (TARGET_HAS_F_SETLKW) - struct flock s_flock; - - s_flock.l_type = F_WRLCK; - s_flock.l_whence = SEEK_SET; - s_flock.l_start = 0; - s_flock.l_len = 0; /* Until EOF. */ - s_flock.l_pid = getpid (); -#endif - - /* Non-merged stats for this program. */ - for (ptr = bb_head; ptr; ptr = ptr->next) - { - for (i = 0; i < ptr->ncounts; i++) - { - program_sum += ptr->counts[i]; - - if (ptr->counts[i] > program_max) - program_max = ptr->counts[i]; - } - program_arcs += ptr->ncounts; - } - - for (ptr = bb_head; ptr; ptr = ptr->next) - { - FILE *da_file; - gcov_type object_max = 0; - gcov_type object_sum = 0; - long object_functions = 0; - int merging = 0; - int error = 0; - struct bb_function_info *fn_info; - gcov_type *count_ptr; - - /* Open for modification */ - da_file = fopen (ptr->filename, "r+b"); - - if (da_file) - merging = 1; - else - { - /* Try for appending */ - da_file = fopen (ptr->filename, "ab"); - /* Some old systems might not allow the 'b' mode modifier. - Therefore, try to open without it. This can lead to a - race condition so that when you delete and re-create the - file, the file might be opened in text mode, but then, - you shouldn't delete the file in the first place. */ - if (!da_file) - da_file = fopen (ptr->filename, "a"); - } - - if (!da_file) - { - fprintf (stderr, "arc profiling: Can't open output file %s.\n", - ptr->filename); - ptr->filename = 0; - continue; - } - -#if defined (TARGET_HAS_F_SETLKW) - /* After a fork, another process might try to read and/or write - the same file simultanously. So if we can, lock the file to - avoid race conditions. */ - while (fcntl (fileno (da_file), F_SETLKW, &s_flock) - && errno == EINTR) - continue; -#endif - for (fn_info = ptr->function_infos; fn_info->arc_count != -1; fn_info++) - object_functions++; - - if (merging) - { - /* Merge data from file. */ - long tmp_long; - gcov_type tmp_gcov; - - if (/* magic */ - (__read_long (&tmp_long, da_file, 4) || tmp_long != -123l) - /* functions in object file. */ - || (__read_long (&tmp_long, da_file, 4) - || tmp_long != object_functions) - /* extension block, skipped */ - || (__read_long (&tmp_long, da_file, 4) - || fseek (da_file, tmp_long, SEEK_CUR))) - { - read_error:; - fprintf (stderr, "arc profiling: Error merging output file %s.\n", - ptr->filename); - clearerr (da_file); - } - else - { - /* Merge execution counts for each function. */ - count_ptr = ptr->counts; - - for (fn_info = ptr->function_infos; fn_info->arc_count != -1; - fn_info++) - { - if (/* function name delim */ - (__read_long (&tmp_long, da_file, 4) - || tmp_long != -1) - /* function name length */ - || (__read_long (&tmp_long, da_file, 4) - || tmp_long != (long) strlen (fn_info->name)) - /* skip string */ - || fseek (da_file, ((tmp_long + 1) + 3) & ~3, SEEK_CUR) - /* function name delim */ - || (__read_long (&tmp_long, da_file, 4) - || tmp_long != -1)) - goto read_error; - - if (/* function checksum */ - (__read_long (&tmp_long, da_file, 4) - || tmp_long != fn_info->checksum) - /* arc count */ - || (__read_long (&tmp_long, da_file, 4) - || tmp_long != fn_info->arc_count)) - goto read_error; - - for (i = fn_info->arc_count; i > 0; i--, count_ptr++) - if (__read_gcov_type (&tmp_gcov, da_file, 8)) - goto read_error; - else - *count_ptr += tmp_gcov; - } - } - fseek (da_file, 0, SEEK_SET); - } - - /* Calculate the per-object statistics. */ - for (i = 0; i < ptr->ncounts; i++) - { - object_sum += ptr->counts[i]; - - if (ptr->counts[i] > object_max) - object_max = ptr->counts[i]; - } - merged_sum += object_sum; - if (merged_max < object_max) - merged_max = object_max; - merged_arcs += ptr->ncounts; - - /* Write out the data. */ - if (/* magic */ - __write_long (-123, da_file, 4) - /* number of functions in object file. */ - || __write_long (object_functions, da_file, 4) - /* length of extra data in bytes. */ - || __write_long ((4 + 8 + 8) + (4 + 8 + 8), da_file, 4) - - /* whole program statistics. If merging write per-object - now, rewrite later */ - /* number of instrumented arcs. */ - || __write_long (merging ? ptr->ncounts : program_arcs, da_file, 4) - /* sum of counters. */ - || __write_gcov_type (merging ? object_sum : program_sum, da_file, 8) - /* maximal counter. */ - || __write_gcov_type (merging ? object_max : program_max, da_file, 8) - - /* per-object statistics. */ - /* number of counters. */ - || __write_long (ptr->ncounts, da_file, 4) - /* sum of counters. */ - || __write_gcov_type (object_sum, da_file, 8) - /* maximal counter. */ - || __write_gcov_type (object_max, da_file, 8)) - { - write_error:; - fprintf (stderr, "arc profiling: Error writing output file %s.\n", - ptr->filename); - error = 1; - } - else - { - /* Write execution counts for each function. */ - count_ptr = ptr->counts; - - for (fn_info = ptr->function_infos; fn_info->arc_count != -1; - fn_info++) - { - if (__write_gcov_string (fn_info->name, - strlen (fn_info->name), da_file, -1) - || __write_long (fn_info->checksum, da_file, 4) - || __write_long (fn_info->arc_count, da_file, 4)) - goto write_error; - - for (i = fn_info->arc_count; i > 0; i--, count_ptr++) - if (__write_gcov_type (*count_ptr, da_file, 8)) - goto write_error; /* RIP Edsger Dijkstra */ - } - } - - if (fclose (da_file)) - { - fprintf (stderr, "arc profiling: Error closing output file %s.\n", - ptr->filename); - error = 1; - } - if (error || !merging) - ptr->filename = 0; - } - - /* Upate whole program statistics. */ - for (ptr = bb_head; ptr; ptr = ptr->next) - if (ptr->filename) - { - FILE *da_file; - - da_file = fopen (ptr->filename, "r+b"); - if (!da_file) - { - fprintf (stderr, "arc profiling: Cannot reopen %s.\n", - ptr->filename); - continue; - } - -#if defined (TARGET_HAS_F_SETLKW) - while (fcntl (fileno (da_file), F_SETLKW, &s_flock) - && errno == EINTR) - continue; -#endif - - if (fseek (da_file, 4 * 3, SEEK_SET) - /* number of instrumented arcs. */ - || __write_long (merged_arcs, da_file, 4) - /* sum of counters. */ - || __write_gcov_type (merged_sum, da_file, 8) - /* maximal counter. */ - || __write_gcov_type (merged_max, da_file, 8)) - fprintf (stderr, "arc profiling: Error updating program header %s.\n", - ptr->filename); - if (fclose (da_file)) - fprintf (stderr, "arc profiling: Error reclosing %s\n", - ptr->filename); - } -} - -/* Add a new object file onto the bb chain. Invoked automatically - when running an object file's global ctors. */ - -void -__bb_init_func (struct bb *blocks) -{ - if (blocks->zero_word) - return; - - /* Initialize destructor and per-thread data. */ - if (!bb_head) - atexit (__bb_exit_func); - - /* Set up linked list. */ - blocks->zero_word = 1; - blocks->next = bb_head; - bb_head = blocks; -} - -/* Called before fork or exec - write out profile information gathered so - far and reset it to zero. This avoids duplication or loss of the - profile information gathered so far. */ - -void -__bb_fork_func (void) -{ - struct bb *ptr; - - __bb_exit_func (); - for (ptr = bb_head; ptr != (struct bb *) 0; ptr = ptr->next) - { - long i; - for (i = ptr->ncounts - 1; i >= 0; i--) - ptr->counts[i] = 0; - } -} - -#endif /* not inhibit_libc */ -#endif /* L_bb */ #ifdef L_clear_cache /* Clear part of an instruction cache. */ -#define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH) - void __clear_cache (char *beg __attribute__((__unused__)), char *end __attribute__((__unused__))) { #ifdef CLEAR_INSN_CACHE CLEAR_INSN_CACHE (beg, end); -#else -#ifdef INSN_CACHE_SIZE - static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH]; - static int initialized; - int offset; - void *start_addr - void *end_addr; - typedef (*function_ptr) (void); - -#if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16 - /* It's cheaper to clear the whole cache. - Put in a series of jump instructions so that calling the beginning - of the cache will clear the whole thing. */ - - if (! initialized) - { - int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) - & -INSN_CACHE_LINE_WIDTH); - int end_ptr = ptr + INSN_CACHE_SIZE; - - while (ptr < end_ptr) - { - *(INSTRUCTION_TYPE *)ptr - = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH; - ptr += INSN_CACHE_LINE_WIDTH; - } - *(INSTRUCTION_TYPE *) (ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION; - - initialized = 1; - } - - /* Call the beginning of the sequence. */ - (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1) - & -INSN_CACHE_LINE_WIDTH)) - ()); - -#else /* Cache is large. */ - - if (! initialized) - { - int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) - & -INSN_CACHE_LINE_WIDTH); - - while (ptr < (int) array + sizeof array) - { - *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION; - ptr += INSN_CACHE_LINE_WIDTH; - } - - initialized = 1; - } - - /* Find the location in array that occupies the same cache line as BEG. */ - - offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1); - start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1) - & -INSN_CACHE_PLANE_SIZE) - + offset); - - /* Compute the cache alignment of the place to stop clearing. */ -#if 0 /* This is not needed for gcc's purposes. */ - /* If the block to clear is bigger than a cache plane, - we clear the entire cache, and OFFSET is already correct. */ - if (end < beg + INSN_CACHE_PLANE_SIZE) -#endif - offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1) - & -INSN_CACHE_LINE_WIDTH) - & (INSN_CACHE_PLANE_SIZE - 1)); - -#if INSN_CACHE_DEPTH > 1 - end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset; - if (end_addr <= start_addr) - end_addr += INSN_CACHE_PLANE_SIZE; - - for (plane = 0; plane < INSN_CACHE_DEPTH; plane++) - { - int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE; - int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE; - - while (addr != stop) - { - /* Call the return instruction at ADDR. */ - ((function_ptr) addr) (); - - addr += INSN_CACHE_LINE_WIDTH; - } - } -#else /* just one plane */ - do - { - /* Call the return instruction at START_ADDR. */ - ((function_ptr) start_addr) (); - - start_addr += INSN_CACHE_LINE_WIDTH; - } - while ((start_addr % INSN_CACHE_SIZE) != offset); -#endif /* just one plane */ -#endif /* Cache is large */ -#endif /* Cache exists */ #endif /* CLEAR_INSN_CACHE */ } #endif /* L_clear_cache */ +#ifdef L_enable_execute_stack +/* Attempt to turn on execute permission for the stack. */ + +#ifdef ENABLE_EXECUTE_STACK + ENABLE_EXECUTE_STACK +#else +void +__enable_execute_stack (void *addr __attribute__((__unused__))) +{} +#endif /* ENABLE_EXECUTE_STACK */ + +#endif /* L_enable_execute_stack */ + #ifdef L_trampoline /* Jump to a trampoline, loading the static chain address. */ @@ -1745,51 +1551,6 @@ mprotect (char *addr, int len, int prot) #ifdef TRANSFER_FROM_TRAMPOLINE TRANSFER_FROM_TRAMPOLINE #endif - -#ifdef __sysV68__ - -#include -#include - -/* Motorola forgot to put memctl.o in the libp version of libc881.a, - so define it here, because we need it in __clear_insn_cache below */ -/* On older versions of this OS, no memctl or MCT_TEXT are defined; - hence we enable this stuff only if MCT_TEXT is #define'd. */ - -#ifdef MCT_TEXT -asm("\n\ - global memctl\n\ -memctl:\n\ - movq &75,%d0\n\ - trap &0\n\ - bcc.b noerror\n\ - jmp cerror%\n\ -noerror:\n\ - movq &0,%d0\n\ - rts"); -#endif - -/* Clear instruction cache so we can call trampolines on stack. - This is called from FINALIZE_TRAMPOLINE in mot3300.h. */ - -void -__clear_insn_cache (void) -{ -#ifdef MCT_TEXT - int save_errno; - - /* Preserve errno, because users would be surprised to have - errno changing without explicitly calling any system-call. */ - save_errno = errno; - - /* Keep it simple : memctl (MCT_TEXT) always fully clears the insn cache. - No need to use an address derived from _start or %sp, as 0 works also. */ - memctl(0, 4096, MCT_TEXT); - errno = save_errno; -#endif -} - -#endif /* __sysV68__ */ #endif /* L_trampoline */ #ifndef __CYGWIN__ @@ -1874,8 +1635,9 @@ __do_global_ctors (void) For systems which support a .init section we use the .init section to run __do_global_ctors, so we need not do anything here. */ +extern void SYMBOL__MAIN (void); void -SYMBOL__MAIN () +SYMBOL__MAIN (void) { /* Support recursive calls to `main': run initializers just once. */ static int initialized; @@ -1917,79 +1679,4 @@ func_ptr __DTOR_LIST__[2]; #endif #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */ #endif /* L_ctors */ - -#ifdef L_exit -#include "gbl-ctors.h" - -#ifdef NEED_ATEXIT - -#ifndef ON_EXIT - -# include - -static func_ptr *atexit_chain = 0; -static long atexit_chain_length = 0; -static volatile long last_atexit_chain_slot = -1; - -int -atexit (func_ptr func) -{ - if (++last_atexit_chain_slot == atexit_chain_length) - { - atexit_chain_length += 32; - if (atexit_chain) - atexit_chain = (func_ptr *) realloc (atexit_chain, atexit_chain_length - * sizeof (func_ptr)); - else - atexit_chain = (func_ptr *) malloc (atexit_chain_length - * sizeof (func_ptr)); - if (! atexit_chain) - { - atexit_chain_length = 0; - last_atexit_chain_slot = -1; - errno = ENOMEM; - return (-1); - } - } - atexit_chain[last_atexit_chain_slot] = func; - return (0); -} - -extern void _cleanup (void); -extern void _exit (int) __attribute__ ((__noreturn__)); - -void -exit (int status) -{ - if (atexit_chain) - { - for ( ; last_atexit_chain_slot-- >= 0; ) - { - (*atexit_chain[last_atexit_chain_slot + 1]) (); - atexit_chain[last_atexit_chain_slot + 1] = 0; - } - free (atexit_chain); - atexit_chain = 0; - } -#ifdef EXIT_BODY - EXIT_BODY; -#else - _cleanup (); -#endif - _exit (status); -} - -#else /* ON_EXIT */ - -/* Simple; we just need a wrapper for ON_EXIT. */ -int -atexit (func_ptr func) -{ - return ON_EXIT (func); -} - -#endif /* ON_EXIT */ -#endif /* NEED_ATEXIT */ - -#endif /* L_exit */ diff --git a/contrib/gcc/print-tree.c b/contrib/gcc/print-tree.c index 05ca52b3c56b..2965d6ee5749 100644 --- a/contrib/gcc/print-tree.c +++ b/contrib/gcc/print-tree.c @@ -1,6 +1,6 @@ -/* Prints out tree in human readable form - GNU C-compiler +/* Prints out tree in human readable form - GCC Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -22,6 +22,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "tree.h" #include "real.h" #include "ggc.h" @@ -45,23 +47,19 @@ static struct bucket **table; down to a depth of six. */ void -debug_tree (node) - tree node; +debug_tree (tree node) { - table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *)); + table = xcalloc (HASH_SIZE, sizeof (struct bucket *)); print_node (stderr, "", node, 0); + free (table); table = 0; - fprintf (stderr, "\n"); + putc ('\n', stderr); } /* Print a node in brief fashion, with just the code, address and name. */ void -print_node_brief (file, prefix, node, indent) - FILE *file; - const char *prefix; - tree node; - int indent; +print_node_brief (FILE *file, const char *prefix, tree node, int indent) { char class; @@ -74,8 +72,8 @@ print_node_brief (file, prefix, node, indent) name if any. */ if (indent > 0) fprintf (file, " "); - fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]); - fprintf (file, HOST_PTR_PRINTF, (char *) node); + fprintf (file, "%s <%s " HOST_PTR_PRINTF, + prefix, tree_code_name[(int) TREE_CODE (node)], (char *) node); if (class == 'd') { @@ -108,11 +106,8 @@ print_node_brief (file, prefix, node, indent) fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node)); else if (TREE_INT_CST_HIGH (node) == -1 && TREE_INT_CST_LOW (node) != 0) - { - fprintf (file, "-"); - fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, - -TREE_INT_CST_LOW (node)); - } + fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED, + -TREE_INT_CST_LOW (node)); else fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node)); @@ -141,9 +136,7 @@ print_node_brief (file, prefix, node, indent) } void -indent_to (file, column) - FILE *file; - int column; +indent_to (FILE *file, int column) { int i; @@ -158,11 +151,7 @@ indent_to (file, column) starting in column INDENT. */ void -print_node (file, prefix, node, indent) - FILE *file; - const char *prefix; - tree node; - int indent; +print_node (FILE *file, const char *prefix, tree node, int indent) { int hash; struct bucket *b; @@ -193,7 +182,7 @@ print_node (file, prefix, node, indent) return; } - /* It is unsafe to look at any other filds of an ERROR_MARK node. */ + /* It is unsafe to look at any other fields of an ERROR_MARK node. */ if (TREE_CODE (node) == ERROR_MARK) { print_node_brief (file, prefix, node, indent); @@ -211,7 +200,7 @@ print_node (file, prefix, node, indent) } /* Add this node to the table. */ - b = (struct bucket *) xmalloc (sizeof (struct bucket)); + b = xmalloc (sizeof (struct bucket)); b->node = node; b->next = table[hash]; table[hash] = b; @@ -220,8 +209,8 @@ print_node (file, prefix, node, indent) indent_to (file, indent); /* Print the slot this node is in, and its code, and address. */ - fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]); - fprintf (file, HOST_PTR_PRINTF, (char *) node); + fprintf (file, "%s <%s " HOST_PTR_PRINTF, + prefix, tree_code_name[(int) TREE_CODE (node)], (void *) node); /* Print the name, if any. */ if (class == 'd') @@ -273,7 +262,7 @@ print_node (file, prefix, node, indent) if (TREE_USED (node)) fputs (" used", file); if (TREE_NOTHROW (node)) - fputs (" nothrow", file); + fputs (TYPE_P (node) ? " align-ok" : " nothrow", file); if (TREE_PUBLIC (node)) fputs (" public", file); if (TREE_PRIVATE (node)) @@ -328,14 +317,10 @@ print_node (file, prefix, node, indent) if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node)) fputs (" suppress-debug", file); - if (TREE_CODE (node) == FUNCTION_DECL && DID_INLINE_FUNC (node)) - fputs (" autoinline", file); - else if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node)) - fputs (" inline", file); + if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node)) + fputs (DECL_DECLARED_INLINE_P (node) ? " inline" : " autoinline", file); if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node)) fputs (" built-in", file); - if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node)) - fputs (" built-in-nonansi", file); if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node)) fputs (" no-static-chain", file); @@ -399,11 +384,8 @@ print_node (file, prefix, node, indent) fprintf (file, " align %d", DECL_ALIGN (node)); if (TREE_CODE (node) == FIELD_DECL) - { - fprintf (file, " offset_align "); - fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, - DECL_OFFSET_ALIGN (node)); - } + fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, + DECL_OFFSET_ALIGN (node)); } else if (DECL_BUILT_IN (node)) { @@ -416,11 +398,8 @@ print_node (file, prefix, node, indent) } if (DECL_POINTER_ALIAS_SET_KNOWN_P (node)) - { - fprintf (file, " alias set "); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - DECL_POINTER_ALIAS_SET (node)); - } + fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC, + DECL_POINTER_ALIAS_SET (node)); if (TREE_CODE (node) == FIELD_DECL) { @@ -464,8 +443,8 @@ print_node (file, prefix, node, indent) && DECL_SAVED_INSNS (node) != 0) { indent_to (file, indent + 4); - fprintf (file, "saved-insns "); - fprintf (file, HOST_PTR_PRINTF, (char *) DECL_SAVED_INSNS (node)); + fprintf (file, "saved-insns " HOST_PTR_PRINTF, + (void *) DECL_SAVED_INSNS (node)); } /* Print the decl chain only if decl is at second level. */ @@ -502,9 +481,6 @@ print_node (file, prefix, node, indent) else if (TREE_CODE (node) == ARRAY_TYPE && TYPE_NONALIASED_COMPONENT (node)) fputs (" nonaliased-component", file); - else if (TREE_CODE (node) == FUNCTION_TYPE - && TYPE_AMBIENT_BOUNDEDNESS (node)) - fputs (" ambient-boundedness", file); if (TYPE_PACKED (node)) fputs (" packed", file); @@ -537,10 +513,9 @@ print_node (file, prefix, node, indent) if (TYPE_USER_ALIGN (node)) fprintf (file, " user"); - fprintf (file, " align %d", TYPE_ALIGN (node)); - fprintf (file, " symtab %d", TYPE_SYMTAB_ADDRESS (node)); - fprintf (file, " alias set "); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, TYPE_ALIAS_SET (node)); + fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC, + TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node), + TYPE_ALIAS_SET (node)); print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); @@ -622,7 +597,7 @@ print_node (file, prefix, node, indent) indent_to (file, indent + 4); fprintf (file, "rtl %d ", i); if (TREE_OPERAND (node, i)) - print_rtl (file, (struct rtx_def *) TREE_OPERAND (node, i)); + print_rtl (file, (rtx) TREE_OPERAND (node, i)); else fprintf (file, "(nil)"); fprintf (file, "\n"); @@ -661,11 +636,8 @@ print_node (file, prefix, node, indent) TREE_INT_CST_LOW (node)); else if (TREE_INT_CST_HIGH (node) == -1 && TREE_INT_CST_LOW (node) != 0) - { - fprintf (file, "-"); - fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, - -TREE_INT_CST_LOW (node)); - } + fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED, + -TREE_INT_CST_LOW (node)); else fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node)); diff --git a/contrib/gcc/recog.c b/contrib/gcc/recog.c index bd42a5b5363a..2224c5ac8f43 100644 --- a/contrib/gcc/recog.c +++ b/contrib/gcc/recog.c @@ -1,6 +1,6 @@ /* Subroutines used by or related to instruction recognition. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -22,6 +22,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tm_p.h" #include "insn-config.h" @@ -54,10 +56,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #endif -static void validate_replace_rtx_1 PARAMS ((rtx *, rtx, rtx, rtx)); -static rtx *find_single_use_1 PARAMS ((rtx, rtx *)); -static void validate_replace_src_1 PARAMS ((rtx *, void *)); -static rtx split_insn PARAMS ((rtx)); +static void validate_replace_rtx_1 (rtx *, rtx, rtx, rtx); +static rtx *find_single_use_1 (rtx, rtx *); +static void validate_replace_src_1 (rtx *, void *); +static rtx split_insn (rtx); /* Nonzero means allow operands to be volatile. This should be 0 if you are generating rtl, such as if you are calling @@ -86,18 +88,21 @@ int which_alternative; int reload_completed; +/* Nonzero after thread_prologue_and_epilogue_insns has run. */ +int epilogue_completed; + /* Initialize data used by the function `recog'. This must be called once in the compilation of a function before any insn recognition may be done in the function. */ void -init_recog_no_volatile () +init_recog_no_volatile (void) { volatile_ok = 0; } void -init_recog () +init_recog (void) { volatile_ok = 1; } @@ -112,8 +117,7 @@ init_recog () through this one. (The only exception is in combine.c.) */ int -recog_memoized_1 (insn) - rtx insn; +recog_memoized_1 (rtx insn) { if (INSN_CODE (insn) < 0) INSN_CODE (insn) = recog (PATTERN (insn), insn, 0); @@ -124,8 +128,7 @@ recog_memoized_1 (insn) and that the operands mentioned in it are legitimate. */ int -check_asm_operands (x) - rtx x; +check_asm_operands (rtx x) { int noperands; rtx *operands; @@ -147,8 +150,8 @@ check_asm_operands (x) if (noperands == 0) return 1; - operands = (rtx *) alloca (noperands * sizeof (rtx)); - constraints = (const char **) alloca (noperands * sizeof (char *)); + operands = alloca (noperands * sizeof (rtx)); + constraints = alloca (noperands * sizeof (char *)); decode_asm_operands (x, operands, NULL, constraints, NULL); @@ -201,11 +204,7 @@ static int num_changes = 0; Otherwise, perform the change and return 1. */ int -validate_change (object, loc, new, in_group) - rtx object; - rtx *loc; - rtx new; - int in_group; +validate_change (rtx object, rtx *loc, rtx new, int in_group) { rtx old = *loc; @@ -227,9 +226,7 @@ validate_change (object, loc, new, in_group) else changes_allocated *= 2; - changes = - (change_t*) xrealloc (changes, - sizeof (change_t) * changes_allocated); + changes = xrealloc (changes, sizeof (change_t) * changes_allocated); } changes[num_changes].object = object; @@ -259,8 +256,7 @@ validate_change (object, loc, new, in_group) were valid; i.e. whether INSN can still be recognized. */ int -insn_invalid_p (insn) - rtx insn; +insn_invalid_p (rtx insn) { rtx pat = PATTERN (insn); int num_clobbers = 0; @@ -310,7 +306,7 @@ insn_invalid_p (insn) /* Return number of changes made and not validated yet. */ int -num_changes_pending () +num_changes_pending (void) { return num_changes; } @@ -319,7 +315,7 @@ num_changes_pending () Return 1 if all changes are valid, zero otherwise. */ int -apply_change_group () +apply_change_group (void) { int i; rtx last_validated = NULL_RTX; @@ -337,7 +333,7 @@ apply_change_group () { rtx object = changes[i].object; - /* if there is no object to test or if it is the same as the one we + /* If there is no object to test or if it is the same as the one we already tested, ignore it. */ if (object == 0 || object == last_validated) continue; @@ -420,7 +416,7 @@ apply_change_group () /* Return the number of changes so far in the current group. */ int -num_validated_changes () +num_validated_changes (void) { return num_changes; } @@ -428,8 +424,7 @@ num_validated_changes () /* Retract the changes numbered NUM and up. */ void -cancel_changes (num) - int num; +cancel_changes (int num) { int i; @@ -448,9 +443,7 @@ cancel_changes (num) validate_change passing OBJECT. */ static void -validate_replace_rtx_1 (loc, from, to, object) - rtx *loc; - rtx from, to, object; +validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx object) { int i, j; const char *fmt; @@ -483,16 +476,38 @@ validate_replace_rtx_1 (loc, from, to, object) return; } - /* Call ourself recursively to perform the replacements. */ + /* Call ourself recursively to perform the replacements. + We must not replace inside already replaced expression, otherwise we + get infinite recursion for replacements like (reg X)->(subreg (reg X)) + done by regmove, so we must special case shared ASM_OPERANDS. */ - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + if (GET_CODE (x) == PARALLEL) { - if (fmt[i] == 'e') - validate_replace_rtx_1 (&XEXP (x, i), from, to, object); - else if (fmt[i] == 'E') - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - validate_replace_rtx_1 (&XVECEXP (x, i, j), from, to, object); + for (j = XVECLEN (x, 0) - 1; j >= 0; j--) + { + if (j && GET_CODE (XVECEXP (x, 0, j)) == SET + && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == ASM_OPERANDS) + { + /* Verify that operands are really shared. */ + if (ASM_OPERANDS_INPUT_VEC (SET_SRC (XVECEXP (x, 0, 0))) != + ASM_OPERANDS_INPUT_VEC (SET_SRC (XVECEXP (x, 0, j)))) + abort (); + validate_replace_rtx_1 (&SET_DEST (XVECEXP (x, 0, j)), + from, to, object); + } + else + validate_replace_rtx_1 (&XVECEXP (x, 0, j), from, to, object); + } } + else + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + validate_replace_rtx_1 (&XEXP (x, i), from, to, object); + else if (fmt[i] == 'E') + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + validate_replace_rtx_1 (&XVECEXP (x, i, j), from, to, object); + } /* If we didn't substitute, there is nothing more to do. */ if (num_changes == prev_changes) @@ -631,8 +646,7 @@ validate_replace_rtx_1 (loc, from, to, object) if INSN is still valid. */ int -validate_replace_rtx_subexp (from, to, insn, loc) - rtx from, to, insn, *loc; +validate_replace_rtx_subexp (rtx from, rtx to, rtx insn, rtx *loc) { validate_replace_rtx_1 (loc, from, to, insn); return apply_change_group (); @@ -642,8 +656,7 @@ validate_replace_rtx_subexp (from, to, insn, loc) changes have been made, validate by seeing if INSN is still valid. */ int -validate_replace_rtx (from, to, insn) - rtx from, to, insn; +validate_replace_rtx (rtx from, rtx to, rtx insn) { validate_replace_rtx_1 (&PATTERN (insn), from, to, insn); return apply_change_group (); @@ -652,8 +665,7 @@ validate_replace_rtx (from, to, insn) /* Try replacing every occurrence of FROM in INSN with TO. */ void -validate_replace_rtx_group (from, to, insn) - rtx from, to, insn; +validate_replace_rtx_group (rtx from, rtx to, rtx insn) { validate_replace_rtx_1 (&PATTERN (insn), from, to, insn); } @@ -667,9 +679,7 @@ struct validate_replace_src_data }; static void -validate_replace_src_1 (x, data) - rtx *x; - void *data; +validate_replace_src_1 (rtx *x, void *data) { struct validate_replace_src_data *d = (struct validate_replace_src_data *) data; @@ -681,8 +691,7 @@ validate_replace_src_1 (x, data) SET_DESTs. */ void -validate_replace_src_group (from, to, insn) - rtx from, to, insn; +validate_replace_src_group (rtx from, rtx to, rtx insn) { struct validate_replace_src_data d; @@ -692,11 +701,10 @@ validate_replace_src_group (from, to, insn) note_uses (&PATTERN (insn), validate_replace_src_1, &d); } -/* Same as validate_repalace_src_group, but validate by seeing if +/* Same as validate_replace_src_group, but validate by seeing if INSN is still valid. */ int -validate_replace_src (from, to, insn) - rtx from, to, insn; +validate_replace_src (rtx from, rtx to, rtx insn) { validate_replace_src_group (from, to, insn); return apply_change_group (); @@ -708,8 +716,7 @@ validate_replace_src (from, to, insn) EQ and NE tests do not count. */ int -next_insn_tests_no_inequality (insn) - rtx insn; +next_insn_tests_no_inequality (rtx insn) { rtx next = next_cc0_user (insn); @@ -722,34 +729,6 @@ next_insn_tests_no_inequality (insn) || GET_CODE (next) == CALL_INSN) && ! inequality_comparisons_p (PATTERN (next))); } - -#if 0 /* This is useless since the insn that sets the cc's - must be followed immediately by the use of them. */ -/* Return 1 if the CC value set up by INSN is not used. */ - -int -next_insns_test_no_inequality (insn) - rtx insn; -{ - rtx next = NEXT_INSN (insn); - - for (; next != 0; next = NEXT_INSN (next)) - { - if (GET_CODE (next) == CODE_LABEL - || GET_CODE (next) == BARRIER) - return 1; - if (GET_CODE (next) == NOTE) - continue; - if (inequality_comparisons_p (PATTERN (next))) - return 0; - if (sets_cc0_p (PATTERN (next)) == 1) - return 1; - if (! reg_mentioned_p (cc0_rtx, PATTERN (next))) - return 1; - } - return 1; -} -#endif #endif /* This is used by find_single_use to locate an rtx that contains exactly one @@ -758,9 +737,7 @@ next_insns_test_no_inequality (insn) DEST that are being used to totally replace it are not counted. */ static rtx * -find_single_use_1 (dest, loc) - rtx dest; - rtx *loc; +find_single_use_1 (rtx dest, rtx *loc) { rtx x = *loc; enum rtx_code code = GET_CODE (x); @@ -871,10 +848,7 @@ find_single_use_1 (dest, loc) and last insn referencing DEST. */ rtx * -find_single_use (dest, insn, ploc) - rtx dest; - rtx insn; - rtx *ploc; +find_single_use (rtx dest, rtx insn, rtx *ploc) { rtx next; rtx *result; @@ -937,9 +911,7 @@ find_single_use (dest, insn, ploc) class NO_REGS, see the comment for `register_operand'. */ int -general_operand (op, mode) - rtx op; - enum machine_mode mode; +general_operand (rtx op, enum machine_mode mode) { enum rtx_code code = GET_CODE (op); @@ -994,7 +966,7 @@ general_operand (op, mode) return 0; /* FLOAT_MODE subregs can't be paradoxical. Combine will occasionally - create such rtl, and we must reject it. */ + create such rtl, and we must reject it. */ if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT && GET_MODE_SIZE (GET_MODE (op)) > GET_MODE_SIZE (GET_MODE (sub))) return 0; @@ -1041,9 +1013,7 @@ general_operand (op, mode) expressions in the machine description. */ int -address_operand (op, mode) - rtx op; - enum machine_mode mode; +address_operand (rtx op, enum machine_mode mode) { return memory_address_p (mode, op); } @@ -1063,9 +1033,7 @@ address_operand (op, mode) it is most consistent to keep this function from accepting them. */ int -register_operand (op, mode) - rtx op; - enum machine_mode mode; +register_operand (rtx op, enum machine_mode mode) { if (GET_MODE (op) != mode && mode != VOIDmode) return 0; @@ -1116,9 +1084,7 @@ register_operand (op, mode) /* Return 1 for a register in Pmode; ignore the tested mode. */ int -pmode_register_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +pmode_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return register_operand (op, Pmode); } @@ -1127,9 +1093,7 @@ pmode_register_operand (op, mode) or a hard register. */ int -scratch_operand (op, mode) - rtx op; - enum machine_mode mode; +scratch_operand (rtx op, enum machine_mode mode) { if (GET_MODE (op) != mode && mode != VOIDmode) return 0; @@ -1145,9 +1109,7 @@ scratch_operand (op, mode) expressions in the machine description. */ int -immediate_operand (op, mode) - rtx op; - enum machine_mode mode; +immediate_operand (rtx op, enum machine_mode mode) { /* Don't accept CONST_INT or anything similar if the caller wants something floating. */ @@ -1179,9 +1141,7 @@ immediate_operand (op, mode) /* Returns 1 if OP is an operand that is a CONST_INT. */ int -const_int_operand (op, mode) - rtx op; - enum machine_mode mode; +const_int_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) != CONST_INT) return 0; @@ -1197,9 +1157,7 @@ const_int_operand (op, mode) floating-point number. */ int -const_double_operand (op, mode) - rtx op; - enum machine_mode mode; +const_double_operand (rtx op, enum machine_mode mode) { /* Don't accept CONST_INT or anything similar if the caller wants something floating. */ @@ -1216,9 +1174,7 @@ const_double_operand (op, mode) /* Return 1 if OP is a general operand that is not an immediate operand. */ int -nonimmediate_operand (op, mode) - rtx op; - enum machine_mode mode; +nonimmediate_operand (rtx op, enum machine_mode mode) { return (general_operand (op, mode) && ! CONSTANT_P (op)); } @@ -1226,9 +1182,7 @@ nonimmediate_operand (op, mode) /* Return 1 if OP is a register reference or immediate value of mode MODE. */ int -nonmemory_operand (op, mode) - rtx op; - enum machine_mode mode; +nonmemory_operand (rtx op, enum machine_mode mode) { if (CONSTANT_P (op)) { @@ -1282,9 +1236,7 @@ nonmemory_operand (op, mode) expressions in the machine description. */ int -push_operand (op, mode) - rtx op; - enum machine_mode mode; +push_operand (rtx op, enum machine_mode mode) { unsigned int rounded_size = GET_MODE_SIZE (mode); @@ -1314,7 +1266,7 @@ push_operand (op, mode) #ifdef STACK_GROWS_DOWNWARD || INTVAL (XEXP (XEXP (op, 1), 1)) != - (int) rounded_size #else - || INTVAL (XEXP (XEXP (op, 1), 1)) != rounded_size + || INTVAL (XEXP (XEXP (op, 1), 1)) != (int) rounded_size #endif ) return 0; @@ -1330,9 +1282,7 @@ push_operand (op, mode) expressions in the machine description. */ int -pop_operand (op, mode) - rtx op; - enum machine_mode mode; +pop_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) != MEM) return 0; @@ -1351,9 +1301,7 @@ pop_operand (op, mode) /* Return 1 if ADDR is a valid memory address for mode MODE. */ int -memory_address_p (mode, addr) - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx addr; +memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr) { if (GET_CODE (addr) == ADDRESSOF) return 1; @@ -1372,9 +1320,7 @@ memory_address_p (mode, addr) expressions in the machine description. */ int -memory_operand (op, mode) - rtx op; - enum machine_mode mode; +memory_operand (rtx op, enum machine_mode mode) { rtx inner; @@ -1397,9 +1343,7 @@ memory_operand (op, mode) that is, a memory reference whose address is a general_operand. */ int -indirect_operand (op, mode) - rtx op; - enum machine_mode mode; +indirect_operand (rtx op, enum machine_mode mode) { /* Before reload, a SUBREG isn't in memory (see memory_operand, above). */ if (! reload_completed @@ -1432,9 +1376,7 @@ indirect_operand (op, mode) MATCH_OPERATOR to recognize all the branch insns. */ int -comparison_operator (op, mode) - rtx op; - enum machine_mode mode; +comparison_operator (rtx op, enum machine_mode mode) { return ((mode == VOIDmode || GET_MODE (op) == mode) && GET_RTX_CLASS (GET_CODE (op)) == '<'); @@ -1445,8 +1387,7 @@ comparison_operator (op, mode) Otherwise return -1. */ int -asm_noperands (body) - rtx body; +asm_noperands (rtx body) { switch (GET_CODE (body)) { @@ -1530,12 +1471,8 @@ asm_noperands (body) we don't store that info. */ const char * -decode_asm_operands (body, operands, operand_locs, constraints, modes) - rtx body; - rtx *operands; - rtx **operand_locs; - const char **constraints; - enum machine_mode *modes; +decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs, + const char **constraints, enum machine_mode *modes) { int i; int noperands; @@ -1667,9 +1604,7 @@ decode_asm_operands (body, operands, operand_locs, constraints, modes) Return > 0 if ok, = 0 if bad, < 0 if inconclusive. */ int -asm_operand_ok (op, constraint) - rtx op; - const char *constraint; +asm_operand_ok (rtx op, const char *constraint) { int result = 0; @@ -1679,18 +1614,21 @@ asm_operand_ok (op, constraint) while (*constraint) { - char c = *constraint++; + char c = *constraint; + int len; switch (c) { + case ',': + constraint++; + continue; case '=': case '+': case '*': case '%': - case '?': case '!': case '#': case '&': - case ',': + case '?': break; case '0': case '1': case '2': case '3': case '4': @@ -1699,25 +1637,27 @@ asm_operand_ok (op, constraint) proper matching constraint, but we can't actually fail the check if they didn't. Indicate that results are inconclusive. */ - while (ISDIGIT (*constraint)) + do constraint++; - result = -1; - break; + while (ISDIGIT (*constraint)); + if (! result) + result = -1; + continue; case 'p': if (address_operand (op, VOIDmode)) - return 1; + result = 1; break; case 'm': case 'V': /* non-offsettable */ if (memory_operand (op, VOIDmode)) - return 1; + result = 1; break; case 'o': /* offsettable */ if (offsettable_nonstrict_memref_p (op)) - return 1; + result = 1; break; case '<': @@ -1732,7 +1672,7 @@ asm_operand_ok (op, constraint) && (1 || GET_CODE (XEXP (op, 0)) == PRE_DEC || GET_CODE (XEXP (op, 0)) == POST_DEC)) - return 1; + result = 1; break; case '>': @@ -1740,7 +1680,7 @@ asm_operand_ok (op, constraint) && (1 || GET_CODE (XEXP (op, 0)) == PRE_INC || GET_CODE (XEXP (op, 0)) == POST_INC)) - return 1; + result = 1; break; case 'E': @@ -1748,18 +1688,18 @@ asm_operand_ok (op, constraint) if (GET_CODE (op) == CONST_DOUBLE || (GET_CODE (op) == CONST_VECTOR && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT)) - return 1; + result = 1; break; case 'G': if (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_OK_FOR_LETTER_P (op, 'G')) - return 1; + && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, 'G', constraint)) + result = 1; break; case 'H': if (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_OK_FOR_LETTER_P (op, 'H')) - return 1; + && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, 'H', constraint)) + result = 1; break; case 's': @@ -1767,7 +1707,7 @@ asm_operand_ok (op, constraint) || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) break; - /* FALLTHRU */ + /* Fall through. */ case 'i': if (CONSTANT_P (op) @@ -1775,94 +1715,97 @@ asm_operand_ok (op, constraint) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op)) #endif ) - return 1; + result = 1; break; case 'n': if (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)) - return 1; + result = 1; break; case 'I': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'I', constraint)) + result = 1; break; case 'J': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'J')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'J', constraint)) + result = 1; break; case 'K': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'K', constraint)) + result = 1; break; case 'L': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'L')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'L', constraint)) + result = 1; break; case 'M': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'M')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'M', constraint)) + result = 1; break; case 'N': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'N')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'N', constraint)) + result = 1; break; case 'O': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'O', constraint)) + result = 1; break; case 'P': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), 'P')) - return 1; + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'P', constraint)) + result = 1; break; case 'X': - return 1; + result = 1; + break; case 'g': if (general_operand (op, VOIDmode)) - return 1; + result = 1; break; default: /* For all other letters, we first check for a register class, otherwise it is an EXTRA_CONSTRAINT. */ - if (REG_CLASS_FROM_LETTER (c) != NO_REGS) + if (REG_CLASS_FROM_CONSTRAINT (c, constraint) != NO_REGS) { case 'r': if (GET_MODE (op) == BLKmode) break; if (register_operand (op, VOIDmode)) - return 1; - } -#ifdef EXTRA_CONSTRAINT - if (EXTRA_CONSTRAINT (op, c)) - return 1; - if (EXTRA_MEMORY_CONSTRAINT (c)) - { - /* Every memory operand can be reloaded to fit. */ - if (memory_operand (op, VOIDmode)) - return 1; - } - if (EXTRA_ADDRESS_CONSTRAINT (c)) - { - /* Every address operand can be reloaded to fit. */ - if (address_operand (op, VOIDmode)) - return 1; + result = 1; } +#ifdef EXTRA_CONSTRAINT_STR + else if (EXTRA_CONSTRAINT_STR (op, c, constraint)) + result = 1; + else if (EXTRA_MEMORY_CONSTRAINT (c, constraint) + /* Every memory operand can be reloaded to fit. */ + && memory_operand (op, VOIDmode)) + result = 1; + else if (EXTRA_ADDRESS_CONSTRAINT (c, constraint) + /* Every address operand can be reloaded to fit. */ + && address_operand (op, VOIDmode)) + result = 1; #endif break; } + len = CONSTRAINT_LEN (c, constraint); + do + constraint++; + while (--len && *constraint); + if (len) + return 0; } return result; @@ -1873,8 +1816,7 @@ asm_operand_ok (op, constraint) Otherwise, return a null pointer. */ rtx * -find_constant_term_loc (p) - rtx *p; +find_constant_term_loc (rtx *p) { rtx *tem; enum rtx_code code = GET_CODE (*p); @@ -1927,8 +1869,7 @@ find_constant_term_loc (p) don't use it before reload. */ int -offsettable_memref_p (op) - rtx op; +offsettable_memref_p (rtx op) { return ((GET_CODE (op) == MEM) && offsettable_address_p (1, GET_MODE (op), XEXP (op, 0))); @@ -1938,8 +1879,7 @@ offsettable_memref_p (op) consider pseudo-regs valid as index or base regs. */ int -offsettable_nonstrict_memref_p (op) - rtx op; +offsettable_nonstrict_memref_p (rtx op) { return ((GET_CODE (op) == MEM) && offsettable_address_p (0, GET_MODE (op), XEXP (op, 0))); @@ -1956,16 +1896,13 @@ offsettable_nonstrict_memref_p (op) for the sake of use in reload.c. */ int -offsettable_address_p (strictp, mode, y) - int strictp; - enum machine_mode mode; - rtx y; +offsettable_address_p (int strictp, enum machine_mode mode, rtx y) { enum rtx_code ycode = GET_CODE (y); rtx z; rtx y1 = y; rtx *y2; - int (*addressp) PARAMS ((enum machine_mode, rtx)) = + int (*addressp) (enum machine_mode, rtx) = (strictp ? strict_memory_address_p : memory_address_p); unsigned int mode_sz = GET_MODE_SIZE (mode); @@ -2031,8 +1968,7 @@ offsettable_address_p (strictp, mode, y) because the amount of the increment depends on the mode. */ int -mode_dependent_address_p (addr) - rtx addr ATTRIBUTE_UNUSED; /* Maybe used in GO_IF_MODE_DEPENDENT_ADDRESS. */ +mode_dependent_address_p (rtx addr ATTRIBUTE_UNUSED /* Maybe used in GO_IF_MODE_DEPENDENT_ADDRESS. */) { GO_IF_MODE_DEPENDENT_ADDRESS (addr, win); return 0; @@ -2040,59 +1976,32 @@ mode_dependent_address_p (addr) win: ATTRIBUTE_UNUSED_LABEL return 1; } - -/* Return 1 if OP is a general operand - other than a memory ref with a mode dependent address. */ - -int -mode_independent_operand (op, mode) - enum machine_mode mode; - rtx op; -{ - rtx addr; - - if (! general_operand (op, mode)) - return 0; - - if (GET_CODE (op) != MEM) - return 1; - - addr = XEXP (op, 0); - GO_IF_MODE_DEPENDENT_ADDRESS (addr, lose); - return 1; - /* Label `lose' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS. */ - lose: ATTRIBUTE_UNUSED_LABEL - return 0; -} /* Like extract_insn, but save insn extracted and don't extract again, when called again for the same insn expecting that recog_data still contain the valid information. This is used primary by gen_attr infrastructure that often does extract insn again and again. */ void -extract_insn_cached (insn) - rtx insn; +extract_insn_cached (rtx insn) { if (recog_data.insn == insn && INSN_CODE (insn) >= 0) return; extract_insn (insn); recog_data.insn = insn; } -/* Do cached extract_insn, constrain_operand and complain about failures. +/* Do cached extract_insn, constrain_operands and complain about failures. Used by insn_attrtab. */ void -extract_constrain_insn_cached (insn) - rtx insn; +extract_constrain_insn_cached (rtx insn) { extract_insn_cached (insn); if (which_alternative == -1 && !constrain_operands (reload_completed)) fatal_insn_not_found (insn); } -/* Do cached constrain_operand and complain about failures. */ +/* Do cached constrain_operands and complain about failures. */ int -constrain_operands_cached (strict) - int strict; +constrain_operands_cached (int strict) { if (which_alternative == -1) return constrain_operands (strict); @@ -2103,8 +2012,7 @@ constrain_operands_cached (strict) /* Analyze INSN and fill in recog_data. */ void -extract_insn (insn) - rtx insn; +extract_insn (rtx insn) { int i; int icode; @@ -2203,11 +2111,14 @@ extract_insn (insn) information from the constraint strings into a more usable form. The collected data is stored in recog_op_alt. */ void -preprocess_constraints () +preprocess_constraints (void) { int i; - memset (recog_op_alt, 0, sizeof recog_op_alt); + for (i = 0; i < recog_data.n_operands; i++) + memset (recog_op_alt[i], 0, (recog_data.n_alternatives + * sizeof (struct operand_alternative))); + for (i = 0; i < recog_data.n_operands; i++) { int j; @@ -2231,13 +2142,16 @@ preprocess_constraints () for (;;) { - char c = *p++; + char c = *p; if (c == '#') do - c = *p++; + c = *++p; while (c != ',' && c != '\0'); if (c == ',' || c == '\0') - break; + { + p++; + break; + } switch (c) { @@ -2263,11 +2177,11 @@ preprocess_constraints () case '5': case '6': case '7': case '8': case '9': { char *end; - op_alt[j].matches = strtoul (p - 1, &end, 10); + op_alt[j].matches = strtoul (p, &end, 10); recog_op_alt[op_alt[j].matches][j].matched = i; p = end; } - break; + continue; case 'm': op_alt[j].memory_ok = 1; @@ -2299,22 +2213,28 @@ preprocess_constraints () break; default: - if (EXTRA_MEMORY_CONSTRAINT (c)) + if (EXTRA_MEMORY_CONSTRAINT (c, p)) { op_alt[j].memory_ok = 1; break; } - if (EXTRA_ADDRESS_CONSTRAINT (c)) + if (EXTRA_ADDRESS_CONSTRAINT (c, p)) { op_alt[j].is_address = 1; - op_alt[j].class = reg_class_subunion[(int) op_alt[j].class] - [(int) MODE_BASE_REG_CLASS (VOIDmode)]; + op_alt[j].class + = (reg_class_subunion + [(int) op_alt[j].class] + [(int) MODE_BASE_REG_CLASS (VOIDmode)]); break; } - op_alt[j].class = reg_class_subunion[(int) op_alt[j].class][(int) REG_CLASS_FROM_LETTER ((unsigned char) c)]; + op_alt[j].class + = (reg_class_subunion + [(int) op_alt[j].class] + [(int) REG_CLASS_FROM_CONSTRAINT ((unsigned char) c, p)]); break; } + p += CONSTRAINT_LEN (c, p); } } } @@ -2329,7 +2249,7 @@ preprocess_constraints () alternative of constraints was matched: 0 for the first alternative, 1 for the next, etc. - In addition, when two operands are match + In addition, when two operands are required to match and it happens that the output operand is (reg) while the input operand is --(reg) or ++(reg) (a pre-inc or pre-dec), make the output operand look like the input. @@ -2353,8 +2273,7 @@ struct funny_match }; int -constrain_operands (strict) - int strict; +constrain_operands (int strict) { const char *constraints[MAX_RECOG_OPERANDS]; int matching_operands[MAX_RECOG_OPERANDS]; @@ -2388,6 +2307,7 @@ constrain_operands (strict) int offset = 0; int win = 0; int val; + int len; earlyclobber[opno] = 0; @@ -2412,9 +2332,16 @@ constrain_operands (strict) if (*p == 0 || *p == ',') win = 1; - while (*p && (c = *p++) != ',') - switch (c) + do + switch (c = *p, len = CONSTRAINT_LEN (c, p), c) { + case '\0': + len = 0; + break; + case ',': + c = '\0'; + break; + case '?': case '!': case '*': case '%': case '=': case '+': break; @@ -2422,8 +2349,10 @@ constrain_operands (strict) case '#': /* Ignore rest of this alternative as far as constraint checking is concerned. */ - while (*p && *p != ',') + do p++; + while (*p && *p != ','); + len = 0; break; case '&': @@ -2445,7 +2374,7 @@ constrain_operands (strict) char *end; int match; - match = strtoul (p - 1, &end, 10); + match = strtoul (p, &end, 10); p = end; if (strict < 0) @@ -2480,6 +2409,7 @@ constrain_operands (strict) funny_match[funny_match_index++].other = match; } } + len = 0; break; case 'p': @@ -2515,12 +2445,25 @@ constrain_operands (strict) break; case 'm': - if (GET_CODE (op) == MEM - /* Before reload, accept what reload can turn into mem. */ - || (strict < 0 && CONSTANT_P (op)) - /* During reload, accept a pseudo */ - || (reload_in_progress && GET_CODE (op) == REG - && REGNO (op) >= FIRST_PSEUDO_REGISTER)) + /* Memory operands must be valid, to the extent + required by STRICT. */ + if (GET_CODE (op) == MEM) + { + if (strict > 0 + && !strict_memory_address_p (GET_MODE (op), + XEXP (op, 0))) + break; + if (strict == 0 + && !memory_address_p (GET_MODE (op), XEXP (op, 0))) + break; + win = 1; + } + /* Before reload, accept what reload can turn into mem. */ + else if (strict < 0 && CONSTANT_P (op)) + win = 1; + /* During reload, accept a pseudo */ + else if (reload_in_progress && GET_CODE (op) == REG + && REGNO (op) >= FIRST_PSEUDO_REGISTER) win = 1; break; @@ -2549,7 +2492,7 @@ constrain_operands (strict) case 'G': case 'H': if (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_OK_FOR_LETTER_P (op, c)) + && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, p)) win = 1; break; @@ -2579,7 +2522,7 @@ constrain_operands (strict) case 'O': case 'P': if (GET_CODE (op) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (op), c)) + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, p)) win = 1; break; @@ -2610,7 +2553,8 @@ constrain_operands (strict) { enum reg_class class; - class = (c == 'r' ? GENERAL_REGS : REG_CLASS_FROM_LETTER (c)); + class = (c == 'r' + ? GENERAL_REGS : REG_CLASS_FROM_CONSTRAINT (c, p)); if (class != NO_REGS) { if (strict < 0 @@ -2622,35 +2566,29 @@ constrain_operands (strict) && reg_fits_class_p (op, class, offset, mode))) win = 1; } -#ifdef EXTRA_CONSTRAINT - else if (EXTRA_CONSTRAINT (op, c)) +#ifdef EXTRA_CONSTRAINT_STR + else if (EXTRA_CONSTRAINT_STR (op, c, p)) win = 1; - if (EXTRA_MEMORY_CONSTRAINT (c)) - { - /* Every memory operand can be reloaded to fit. */ - if (strict < 0 && GET_CODE (op) == MEM) - win = 1; - - /* Before reload, accept what reload can turn into mem. */ - if (strict < 0 && CONSTANT_P (op)) - win = 1; - - /* During reload, accept a pseudo */ - if (reload_in_progress && GET_CODE (op) == REG - && REGNO (op) >= FIRST_PSEUDO_REGISTER) - win = 1; - } - if (EXTRA_ADDRESS_CONSTRAINT (c)) - { - /* Every address operand can be reloaded to fit. */ - if (strict < 0) - win = 1; - } + else if (EXTRA_MEMORY_CONSTRAINT (c, p) + /* Every memory operand can be reloaded to fit. */ + && ((strict < 0 && GET_CODE (op) == MEM) + /* Before reload, accept what reload can turn + into mem. */ + || (strict < 0 && CONSTANT_P (op)) + /* During reload, accept a pseudo */ + || (reload_in_progress && GET_CODE (op) == REG + && REGNO (op) >= FIRST_PSEUDO_REGISTER))) + win = 1; + else if (EXTRA_ADDRESS_CONSTRAINT (c, p) + /* Every address operand can be reloaded to fit. */ + && strict < 0) + win = 1; #endif break; } } + while (p += len, c); constraints[opno] = p; /* If this operand did not win somehow, @@ -2718,11 +2656,8 @@ constrain_operands (strict) If REG occupies multiple hard regs, all of them must be in CLASS. */ int -reg_fits_class_p (operand, class, offset, mode) - rtx operand; - enum reg_class class; - int offset; - enum machine_mode mode; +reg_fits_class_p (rtx operand, enum reg_class class, int offset, + enum machine_mode mode) { int regno = REGNO (operand); if (regno < FIRST_PSEUDO_REGISTER @@ -2742,67 +2677,46 @@ reg_fits_class_p (operand, class, offset, mode) return 0; } -/* Split single instruction. Helper function for split_all_insns. - Return last insn in the sequence if successful, or NULL if unsuccessful. */ +/* Split single instruction. Helper function for split_all_insns and + split_all_insns_noflow. Return last insn in the sequence if successful, + or NULL if unsuccessful. */ + static rtx -split_insn (insn) - rtx insn; +split_insn (rtx insn) { - rtx set; - if (!INSN_P (insn)) - ; - /* Don't split no-op move insns. These should silently - disappear later in final. Splitting such insns would - break the code that handles REG_NO_CONFLICT blocks. */ + /* Split insns here to get max fine-grain parallelism. */ + rtx first = PREV_INSN (insn); + rtx last = try_split (PATTERN (insn), insn, 1); - else if ((set = single_set (insn)) != NULL && set_noop_p (set)) - { - /* Nops get in the way while scheduling, so delete them - now if register allocation has already been done. It - is too risky to try to do this before register - allocation, and there are unlikely to be very many - nops then anyways. */ - if (reload_completed) - delete_insn_and_edges (insn); - } - else - { - /* Split insns here to get max fine-grain parallelism. */ - rtx first = PREV_INSN (insn); - rtx last = try_split (PATTERN (insn), insn, 1); + if (last == insn) + return NULL_RTX; - if (last != insn) + /* try_split returns the NOTE that INSN became. */ + PUT_CODE (insn, NOTE); + NOTE_SOURCE_FILE (insn) = 0; + NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; + + /* ??? Coddle to md files that generate subregs in post-reload + splitters instead of computing the proper hard register. */ + if (reload_completed && first != last) + { + first = NEXT_INSN (first); + for (;;) { - /* try_split returns the NOTE that INSN became. */ - PUT_CODE (insn, NOTE); - NOTE_SOURCE_FILE (insn) = 0; - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; - - /* ??? Coddle to md files that generate subregs in post- - reload splitters instead of computing the proper - hard register. */ - if (reload_completed && first != last) - { - first = NEXT_INSN (first); - while (1) - { - if (INSN_P (first)) - cleanup_subreg_operands (first); - if (first == last) - break; - first = NEXT_INSN (first); - } - } - return last; + if (INSN_P (first)) + cleanup_subreg_operands (first); + if (first == last) + break; + first = NEXT_INSN (first); } } - return NULL_RTX; + return last; } + /* Split all insns in the function. If UPD_LIFE, update life info after. */ void -split_all_insns (upd_life) - int upd_life; +split_all_insns (int upd_life) { sbitmap blocks; bool changed; @@ -2817,26 +2731,54 @@ split_all_insns (upd_life) rtx insn, next; bool finish = false; - for (insn = bb->head; !finish ; insn = next) + for (insn = BB_HEAD (bb); !finish ; insn = next) { - rtx last; - /* Can't use `next_real_insn' because that might go across CODE_LABELS and short-out basic blocks. */ next = NEXT_INSN (insn); - finish = (insn == bb->end); - last = split_insn (insn); - if (last) + finish = (insn == BB_END (bb)); + if (INSN_P (insn)) { - /* The split sequence may include barrier, but the - BB boundary we are interested in will be set to previous - one. */ + rtx set = single_set (insn); - while (GET_CODE (last) == BARRIER) - last = PREV_INSN (last); - SET_BIT (blocks, bb->index); - changed = true; - insn = last; + /* Don't split no-op move insns. These should silently + disappear later in final. Splitting such insns would + break the code that handles REG_NO_CONFLICT blocks. */ + if (set && set_noop_p (set)) + { + /* Nops get in the way while scheduling, so delete them + now if register allocation has already been done. It + is too risky to try to do this before register + allocation, and there are unlikely to be very many + nops then anyways. */ + if (reload_completed) + { + /* If the no-op set has a REG_UNUSED note, we need + to update liveness information. */ + if (find_reg_note (insn, REG_UNUSED, NULL_RTX)) + { + SET_BIT (blocks, bb->index); + changed = true; + } + /* ??? Is life info affected by deleting edges? */ + delete_insn_and_edges (insn); + } + } + else + { + rtx last = split_insn (insn); + if (last) + { + /* The split sequence may include barrier, but the + BB boundary we are interested in will be set to + previous one. */ + + while (GET_CODE (last) == BARRIER) + last = PREV_INSN (last); + SET_BIT (blocks, bb->index); + changed = true; + } + } } } } @@ -2863,19 +2805,38 @@ split_all_insns (upd_life) } /* Same as split_all_insns, but do not expect CFG to be available. - Used by machine depedent reorg passes. */ + Used by machine dependent reorg passes. */ void -split_all_insns_noflow () +split_all_insns_noflow (void) { rtx next, insn; for (insn = get_insns (); insn; insn = next) { next = NEXT_INSN (insn); - split_insn (insn); + if (INSN_P (insn)) + { + /* Don't split no-op move insns. These should silently + disappear later in final. Splitting such insns would + break the code that handles REG_NO_CONFLICT blocks. */ + rtx set = single_set (insn); + if (set && set_noop_p (set)) + { + /* Nops get in the way while scheduling, so delete them + now if register allocation has already been done. It + is too risky to try to do this before register + allocation, and there are unlikely to be very many + nops then anyways. + + ??? Should we use delete_insn when the CFG isn't valid? */ + if (reload_completed) + delete_insn_and_edges (insn); + } + else + split_insn (insn); + } } - return; } #ifdef HAVE_peephole2 @@ -2898,8 +2859,7 @@ static int peep2_current; in a multi-insn pattern. */ rtx -peep2_next_insn (n) - int n; +peep2_next_insn (int n) { if (n >= MAX_INSNS_PER_PEEP2 + 1) abort (); @@ -2917,9 +2877,7 @@ peep2_next_insn (n) after `current'. */ int -peep2_regno_dead_p (ofs, regno) - int ofs; - int regno; +peep2_regno_dead_p (int ofs, int regno) { if (ofs >= MAX_INSNS_PER_PEEP2 + 1) abort (); @@ -2937,9 +2895,7 @@ peep2_regno_dead_p (ofs, regno) /* Similarly for a REG. */ int -peep2_reg_dead_p (ofs, reg) - int ofs; - rtx reg; +peep2_reg_dead_p (int ofs, rtx reg) { int regno, n; @@ -2973,11 +2929,8 @@ peep2_reg_dead_p (ofs, reg) returned. */ rtx -peep2_find_free_register (from, to, class_str, mode, reg_set) - int from, to; - const char *class_str; - enum machine_mode mode; - HARD_REG_SET *reg_set; +peep2_find_free_register (int from, int to, const char *class_str, + enum machine_mode mode, HARD_REG_SET *reg_set) { static int search_ofs; enum reg_class class; @@ -3011,7 +2964,7 @@ peep2_find_free_register (from, to, class_str, mode, reg_set) } class = (class_str[0] == 'r' ? GENERAL_REGS - : REG_CLASS_FROM_LETTER (class_str[0])); + : REG_CLASS_FROM_CONSTRAINT (class_str[0], class_str)); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { @@ -3075,8 +3028,7 @@ peep2_find_free_register (from, to, class_str, mode, reg_set) /* Perform the peephole2 optimization pass. */ void -peephole2_optimize (dump_file) - FILE *dump_file ATTRIBUTE_UNUSED; +peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) { regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2]; rtx insn, prev; @@ -3125,7 +3077,7 @@ peephole2_optimize (dump_file) pbi = init_propagate_block_info (bb, live, NULL, NULL, PROP_DEATH_NOTES); #endif - for (insn = bb->end; ; insn = prev) + for (insn = BB_END (bb); ; insn = prev) { prev = PREV_INSN (insn); if (INSN_P (insn)) @@ -3214,8 +3166,8 @@ peephole2_optimize (dump_file) REG_EH_REGION, NULL_RTX); /* Replace the old sequence with the new. */ - try = emit_insn_after_scope (try, peep2_insn_data[i].insn, - INSN_SCOPE (peep2_insn_data[i].insn)); + try = emit_insn_after_setloc (try, peep2_insn_data[i].insn, + INSN_LOCATOR (peep2_insn_data[i].insn)); before_try = PREV_INSN (insn); delete_insn_chain (insn, peep2_insn_data[i].insn); @@ -3241,7 +3193,7 @@ peephole2_optimize (dump_file) XEXP (note, 0), REG_NOTES (x)); - if (x != bb->end && eh_edge) + if (x != BB_END (bb) && eh_edge) { edge nfte, nehe; int flags; @@ -3325,7 +3277,7 @@ peephole2_optimize (dump_file) } } - if (insn == bb->head) + if (insn == BB_HEAD (bb)) break; } @@ -3366,8 +3318,7 @@ peephole2_optimize (dump_file) SETs inside. */ int -store_data_bypass_p (out_insn, in_insn) - rtx out_insn, in_insn; +store_data_bypass_p (rtx out_insn, rtx in_insn) { rtx out_set, in_set; @@ -3417,8 +3368,7 @@ store_data_bypass_p (out_insn, in_insn) of insn categorization may be any JUMP or CALL insn. */ int -if_test_bypass_p (out_insn, in_insn) - rtx out_insn, in_insn; +if_test_bypass_p (rtx out_insn, rtx in_insn) { rtx out_set, in_set; diff --git a/contrib/gcc/reload.c b/contrib/gcc/reload.c index b151af738538..0dfac2ccdf83 100644 --- a/contrib/gcc/reload.c +++ b/contrib/gcc/reload.c @@ -1,6 +1,6 @@ /* Search an insn for pseudo regs that must be in hard regs and are not. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -88,6 +88,8 @@ a register with any other reload. */ #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tm_p.h" #include "insn-config.h" @@ -102,10 +104,7 @@ a register with any other reload. */ #include "output.h" #include "function.h" #include "toplev.h" - -#ifndef REGISTER_MOVE_COST -#define REGISTER_MOVE_COST(m, x, y) 2 -#endif +#include "params.h" #ifndef REGNO_MODE_OK_FOR_BASE_P #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO) @@ -174,6 +173,7 @@ struct decomposition static rtx secondary_memlocs[NUM_MACHINE_MODES]; static rtx secondary_memlocs_elim[NUM_MACHINE_MODES][MAX_RECOG_OPERANDS]; +static int secondary_memlocs_elim_used = 0; #endif /* The instruction we are doing reloads for; @@ -236,43 +236,41 @@ static int output_reloadnum; : (type))) #ifdef HAVE_SECONDARY_RELOADS -static int push_secondary_reload PARAMS ((int, rtx, int, int, enum reg_class, - enum machine_mode, enum reload_type, - enum insn_code *)); +static int push_secondary_reload (int, rtx, int, int, enum reg_class, + enum machine_mode, enum reload_type, + enum insn_code *); #endif -static enum reg_class find_valid_class PARAMS ((enum machine_mode, int, - unsigned int)); -static int reload_inner_reg_of_subreg PARAMS ((rtx, enum machine_mode, int)); -static void push_replacement PARAMS ((rtx *, int, enum machine_mode)); -static void dup_replacements PARAMS ((rtx *, rtx *)); -static void combine_reloads PARAMS ((void)); -static int find_reusable_reload PARAMS ((rtx *, rtx, enum reg_class, - enum reload_type, int, int)); -static rtx find_dummy_reload PARAMS ((rtx, rtx, rtx *, rtx *, - enum machine_mode, enum machine_mode, - enum reg_class, int, int)); -static int hard_reg_set_here_p PARAMS ((unsigned int, unsigned int, rtx)); -static struct decomposition decompose PARAMS ((rtx)); -static int immune_p PARAMS ((rtx, rtx, struct decomposition)); -static int alternative_allows_memconst PARAMS ((const char *, int)); -static rtx find_reloads_toplev PARAMS ((rtx, int, enum reload_type, int, - int, rtx, int *)); -static rtx make_memloc PARAMS ((rtx, int)); -static int maybe_memory_address_p PARAMS ((enum machine_mode, rtx, rtx *)); -static int find_reloads_address PARAMS ((enum machine_mode, rtx *, rtx, rtx *, - int, enum reload_type, int, rtx)); -static rtx subst_reg_equivs PARAMS ((rtx, rtx)); -static rtx subst_indexed_address PARAMS ((rtx)); -static void update_auto_inc_notes PARAMS ((rtx, int, int)); -static int find_reloads_address_1 PARAMS ((enum machine_mode, rtx, int, rtx *, - int, enum reload_type,int, rtx)); -static void find_reloads_address_part PARAMS ((rtx, rtx *, enum reg_class, - enum machine_mode, int, - enum reload_type, int)); -static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, - enum reload_type, int, rtx)); -static void copy_replacements_1 PARAMS ((rtx *, rtx *, int)); -static int find_inc_amount PARAMS ((rtx, rtx)); +static enum reg_class find_valid_class (enum machine_mode, int, unsigned int); +static int reload_inner_reg_of_subreg (rtx, enum machine_mode, int); +static void push_replacement (rtx *, int, enum machine_mode); +static void dup_replacements (rtx *, rtx *); +static void combine_reloads (void); +static int find_reusable_reload (rtx *, rtx, enum reg_class, + enum reload_type, int, int); +static rtx find_dummy_reload (rtx, rtx, rtx *, rtx *, enum machine_mode, + enum machine_mode, enum reg_class, int, int); +static int hard_reg_set_here_p (unsigned int, unsigned int, rtx); +static struct decomposition decompose (rtx); +static int immune_p (rtx, rtx, struct decomposition); +static int alternative_allows_memconst (const char *, int); +static rtx find_reloads_toplev (rtx, int, enum reload_type, int, int, rtx, + int *); +static rtx make_memloc (rtx, int); +static int maybe_memory_address_p (enum machine_mode, rtx, rtx *); +static int find_reloads_address (enum machine_mode, rtx *, rtx, rtx *, + int, enum reload_type, int, rtx); +static rtx subst_reg_equivs (rtx, rtx); +static rtx subst_indexed_address (rtx); +static void update_auto_inc_notes (rtx, int, int); +static int find_reloads_address_1 (enum machine_mode, rtx, int, rtx *, + int, enum reload_type,int, rtx); +static void find_reloads_address_part (rtx, rtx *, enum reg_class, + enum machine_mode, int, + enum reload_type, int); +static rtx find_reloads_subreg_address (rtx, int, int, enum reload_type, + int, rtx); +static void copy_replacements_1 (rtx *, rtx *, int); +static int find_inc_amount (rtx, rtx); #ifdef HAVE_SECONDARY_RELOADS @@ -286,16 +284,10 @@ static int find_inc_amount PARAMS ((rtx, rtx)); need a secondary reload. */ static int -push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode, - type, picode) - int in_p; - rtx x; - int opnum; - int optional; - enum reg_class reload_class; - enum machine_mode reload_mode; - enum reload_type type; - enum insn_code *picode; +push_secondary_reload (int in_p, rtx x, int opnum, int optional, + enum reg_class reload_class, + enum machine_mode reload_mode, enum reload_type type, + enum insn_code *picode) { enum reg_class class = NO_REGS; enum machine_mode mode = reload_mode; @@ -380,11 +372,13 @@ push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode, insn_class = ALL_REGS; else { - char insn_letter - = insn_data[(int) icode].operand[!in_p].constraint[in_p]; + const char *insn_constraint + = &insn_data[(int) icode].operand[!in_p].constraint[in_p]; + char insn_letter = *insn_constraint; insn_class = (insn_letter == 'r' ? GENERAL_REGS - : REG_CLASS_FROM_LETTER ((unsigned char) insn_letter)); + : REG_CLASS_FROM_CONSTRAINT ((unsigned char) insn_letter, + insn_constraint)); if (insn_class == NO_REGS) abort (); @@ -402,11 +396,14 @@ push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode, mode = insn_data[(int) icode].operand[2].mode; else { - char t_letter = insn_data[(int) icode].operand[2].constraint[2]; + const char *t_constraint + = &insn_data[(int) icode].operand[2].constraint[2]; + char t_letter = *t_constraint; class = insn_class; t_mode = insn_data[(int) icode].operand[2].mode; t_class = (t_letter == 'r' ? GENERAL_REGS - : REG_CLASS_FROM_LETTER ((unsigned char) t_letter)); + : REG_CLASS_FROM_CONSTRAINT ((unsigned char) t_letter, + t_constraint)); t_icode = icode; icode = CODE_FOR_nothing; } @@ -585,11 +582,8 @@ push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode, call find_reloads_address on the location being returned. */ rtx -get_secondary_mem (x, mode, opnum, type) - rtx x ATTRIBUTE_UNUSED; - enum machine_mode mode; - int opnum; - enum reload_type type; +get_secondary_mem (rtx x ATTRIBUTE_UNUSED, enum machine_mode mode, + int opnum, enum reload_type type) { rtx loc; int mem_valid; @@ -651,15 +645,17 @@ get_secondary_mem (x, mode, opnum, type) } secondary_memlocs_elim[(int) mode][opnum] = loc; + if (secondary_memlocs_elim_used <= (int)mode) + secondary_memlocs_elim_used = (int)mode + 1; return loc; } /* Clear any secondary memory locations we've made. */ void -clear_secondary_mem () +clear_secondary_mem (void) { - memset ((char *) secondary_memlocs, 0, sizeof secondary_memlocs); + memset (secondary_memlocs, 0, sizeof secondary_memlocs); } #endif /* SECONDARY_MEMORY_NEEDED */ @@ -668,16 +664,14 @@ clear_secondary_mem () Abort if no such class exists. */ static enum reg_class -find_valid_class (m1, n, dest_regno) - enum machine_mode m1 ATTRIBUTE_UNUSED; - int n; - unsigned int dest_regno; +find_valid_class (enum machine_mode m1 ATTRIBUTE_UNUSED, int n, + unsigned int dest_regno ATTRIBUTE_UNUSED) { int best_cost = -1; int class; int regno; enum reg_class best_class = NO_REGS; - enum reg_class dest_class = REGNO_REG_CLASS (dest_regno); + enum reg_class dest_class ATTRIBUTE_UNUSED = REGNO_REG_CLASS (dest_regno); unsigned int best_size = 0; int cost; @@ -719,11 +713,8 @@ find_valid_class (m1, n, dest_regno) DONT_SHARE is nonzero if we can't share any input-only reload for IN. */ static int -find_reusable_reload (p_in, out, class, type, opnum, dont_share) - rtx *p_in, out; - enum reg_class class; - enum reload_type type; - int opnum, dont_share; +find_reusable_reload (rtx *p_in, rtx out, enum reg_class class, + enum reload_type type, int opnum, int dont_share) { rtx in = *p_in; int i; @@ -796,10 +787,7 @@ find_reusable_reload (p_in, out, class, type, opnum, dont_share) SUBREG_REG expression. */ static int -reload_inner_reg_of_subreg (x, mode, output) - rtx x; - enum machine_mode mode; - int output; +reload_inner_reg_of_subreg (rtx x, enum machine_mode mode, int output) { rtx inner; @@ -819,13 +807,6 @@ reload_inner_reg_of_subreg (x, mode, output) || REGNO (inner) >= FIRST_PSEUDO_REGISTER) return 0; - if (!subreg_offset_representable_p - (REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), - GET_MODE (x))) - return 1; - /* If INNER is not ok for MODE, then INNER will need reloading. */ if (! HARD_REGNO_MODE_OK (subreg_regno (x), mode)) return 1; @@ -840,6 +821,56 @@ reload_inner_reg_of_subreg (x, mode, output) != (int) HARD_REGNO_NREGS (REGNO (inner), GET_MODE (inner)))); } +/* Return nonzero if IN can be reloaded into REGNO with mode MODE without + requiring an extra reload register. The caller has already found that + IN contains some reference to REGNO, so check that we can produce the + new value in a single step. E.g. if we have + (set (reg r13) (plus (reg r13) (const int 1))), and there is an + instruction that adds one to a register, this should succeed. + However, if we have something like + (set (reg r13) (plus (reg r13) (const int 999))), and the constant 999 + needs to be loaded into a register first, we need a separate reload + register. + Such PLUS reloads are generated by find_reload_address_part. + The out-of-range PLUS expressions are usually introduced in the instruction + patterns by register elimination and substituting pseudos without a home + by their function-invariant equivalences. */ +static int +can_reload_into (rtx in, int regno, enum machine_mode mode) +{ + rtx dst, test_insn; + int r = 0; + struct recog_data save_recog_data; + + /* For matching constraints, we often get notional input reloads where + we want to use the original register as the reload register. I.e. + technically this is a non-optional input-output reload, but IN is + already a valid register, and has been chosen as the reload register. + Speed this up, since it trivially works. */ + if (GET_CODE (in) == REG) + return 1; + + /* To test MEMs properly, we'd have to take into account all the reloads + that are already scheduled, which can become quite complicated. + And since we've already handled address reloads for this MEM, it + should always succeed anyway. */ + if (GET_CODE (in) == MEM) + return 1; + + /* If we can make a simple SET insn that does the job, everything should + be fine. */ + dst = gen_rtx_REG (mode, regno); + test_insn = make_insn_raw (gen_rtx_SET (VOIDmode, dst, in)); + save_recog_data = recog_data; + if (recog_memoized (test_insn) >= 0) + { + extract_insn (test_insn); + r = constrain_operands (1); + } + recog_data = save_recog_data; + return r; +} + /* Record one reload that needs to be performed. IN is an rtx saying where the data are to be found before this instruction. OUT says where they must be stored after the instruction. @@ -874,16 +905,10 @@ reload_inner_reg_of_subreg (x, mode, output) distinguish them. */ int -push_reload (in, out, inloc, outloc, class, - inmode, outmode, strict_low, optional, opnum, type) - rtx in, out; - rtx *inloc, *outloc; - enum reg_class class; - enum machine_mode inmode, outmode; - int strict_low; - int optional; - int opnum; - enum reload_type type; +push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc, + enum reg_class class, enum machine_mode inmode, + enum machine_mode outmode, int strict_low, int optional, + int opnum, enum reload_type type) { int i; int dont_share = 0; @@ -1124,7 +1149,7 @@ push_reload (in, out, inloc, outloc, class, || (GET_CODE (SUBREG_REG (out)) == REG && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER && REG_CANNOT_CHANGE_MODE_P (REGNO (SUBREG_REG (out)), - GET_MODE (SUBREG_REG (out)), + GET_MODE (SUBREG_REG (out)), outmode)) #endif )) @@ -1532,7 +1557,11 @@ push_reload (in, out, inloc, outloc, class, regno + offs)) break; - if (offs == nregs) + if (offs == nregs + && (! (refers_to_regno_for_reload_p + (regno, (regno + HARD_REGNO_NREGS (regno, inmode)), + in, (rtx *)0)) + || can_reload_into (in, regno, inmode))) { rld[i].reg_rtx = gen_rtx_REG (rel_mode, regno); break; @@ -1553,10 +1582,7 @@ push_reload (in, out, inloc, outloc, class, This is used in insn patterns that use match_dup. */ static void -push_replacement (loc, reloadnum, mode) - rtx *loc; - int reloadnum; - enum machine_mode mode; +push_replacement (rtx *loc, int reloadnum, enum machine_mode mode) { if (replace_reloads) { @@ -1573,9 +1599,7 @@ push_replacement (loc, reloadnum, mode) This is used in insn patterns that use match_dup. */ static void -dup_replacements (dup_loc, orig_loc) - rtx *dup_loc; - rtx *orig_loc; +dup_replacements (rtx *dup_loc, rtx *orig_loc) { int i, n = n_replacements; @@ -1591,8 +1615,7 @@ dup_replacements (dup_loc, orig_loc) reload TO. */ void -transfer_replacements (to, from) - int to, from; +transfer_replacements (int to, int from) { int i; @@ -1606,8 +1629,7 @@ transfer_replacements (to, from) cancel the reloads that were supposed to load them. Return nonzero if we canceled any reloads. */ int -remove_address_replacements (in_rtx) - rtx in_rtx; +remove_address_replacements (rtx in_rtx) { int i, j; char reload_flags[MAX_RELOADS]; @@ -1653,7 +1675,7 @@ remove_address_replacements (in_rtx) class and does not appear in the value being output-reloaded. */ static void -combine_reloads () +combine_reloads (void) { int i; int output_reload = -1; @@ -1850,14 +1872,9 @@ combine_reloads () is safe from the earlyclobber). */ static rtx -find_dummy_reload (real_in, real_out, inloc, outloc, - inmode, outmode, class, for_real, earlyclobber) - rtx real_in, real_out; - rtx *inloc, *outloc; - enum machine_mode inmode, outmode; - enum reg_class class; - int for_real; - int earlyclobber; +find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc, + enum machine_mode inmode, enum machine_mode outmode, + enum reg_class class, int for_real, int earlyclobber) { rtx in = real_in; rtx out = real_out; @@ -2008,8 +2025,7 @@ find_dummy_reload (real_in, real_out, inloc, outloc, /* Return 1 if X is an operand of an insn that is being earlyclobbered. */ int -earlyclobber_operand_p (x) - rtx x; +earlyclobber_operand_p (rtx x) { int i; @@ -2026,9 +2042,7 @@ earlyclobber_operand_p (x) X should be the body of an instruction. */ static int -hard_reg_set_here_p (beg_regno, end_regno, x) - unsigned int beg_regno, end_regno; - rtx x; +hard_reg_set_here_p (unsigned int beg_regno, unsigned int end_regno, rtx x) { if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER) { @@ -2063,9 +2077,7 @@ hard_reg_set_here_p (beg_regno, end_regno, x) hard reg. */ int -strict_memory_address_p (mode, addr) - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx addr; +strict_memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr) { GO_IF_LEGITIMATE_ADDRESS (mode, addr, win); return 0; @@ -2090,8 +2102,7 @@ strict_memory_address_p (mode, addr) because that is natural in (SET output (... input ...)). */ int -operands_match_p (x, y) - rtx x, y; +operands_match_p (rtx x, rtx y) { int i; RTX_CODE code = GET_CODE (x); @@ -2137,10 +2148,10 @@ operands_match_p (x, y) (reg:SI 1) will be considered the same register. */ if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD && i < FIRST_PSEUDO_REGISTER) - i += (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD) - 1; + i += HARD_REGNO_NREGS (i, GET_MODE (x)) - 1; if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (y)) > UNITS_PER_WORD && j < FIRST_PSEUDO_REGISTER) - j += (GET_MODE_SIZE (GET_MODE (y)) / UNITS_PER_WORD) - 1; + j += HARD_REGNO_NREGS (j, GET_MODE (y)) - 1; return i == j; } @@ -2242,8 +2253,7 @@ operands_match_p (x, y) so we set the SAFE field. */ static struct decomposition -decompose (x) - rtx x; +decompose (rtx x) { struct decomposition val; int all_const = 0; @@ -2381,9 +2391,7 @@ decompose (x) Y is also described by YDATA, which should be decompose (Y). */ static int -immune_p (x, y, ydata) - rtx x, y; - struct decomposition ydata; +immune_p (rtx x, rtx y, struct decomposition ydata) { struct decomposition xdata; @@ -2426,8 +2434,7 @@ immune_p (x, y, ydata) /* Similar, but calls decompose. */ int -safe_from_earlyclobber (op, clobber) - rtx op, clobber; +safe_from_earlyclobber (rtx op, rtx clobber) { struct decomposition early_data; @@ -2458,11 +2465,8 @@ safe_from_earlyclobber (op, clobber) commutative operands, reg_equiv_address substitution, or whatever. */ int -find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) - rtx insn; - int replace, ind_levels; - int live_known; - short *reload_reg_p; +find_reloads (rtx insn, int replace, int ind_levels, int live_known, + short *reload_reg_p) { int insn_code_number; int i, j; @@ -2539,7 +2543,12 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) /* The eliminated forms of any secondary memory locations are per-insn, so clear them out here. */ - memset ((char *) secondary_memlocs_elim, 0, sizeof secondary_memlocs_elim); + if (secondary_memlocs_elim_used) + { + memset (secondary_memlocs_elim, 0, + sizeof (secondary_memlocs_elim[0]) * secondary_memlocs_elim_used); + secondary_memlocs_elim_used = 0; + } #endif /* Dispose quickly of (set (reg..) (reg..)) if both have hard regs and it @@ -2591,8 +2600,9 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) /* Scan this operand's constraint to see if it is an output operand, an in-out operand, is commutative, or should match another. */ - while ((c = *p++)) + while ((c = *p)) { + p += CONSTRAINT_LEN (c, p); if (c == '=') modified[i] = RELOAD_WRITE; else if (c == '+') @@ -2603,7 +2613,17 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) if (i == noperands - 1) abort (); - commutative = i; + /* We currently only support one commutative pair of + operands. Some existing asm code currently uses more + than one pair. Previously, that would usually work, + but sometimes it would crash the compiler. We + continue supporting that case as well as we can by + silently ignoring all but the first pair. In the + future we may handle it correctly. */ + if (commutative < 0) + commutative = i; + else if (!this_insn_is_asm) + abort (); } else if (ISDIGIT (c)) { @@ -2669,7 +2689,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) /* Ignore things like match_operator operands. */ ; else if (constraints[i][0] == 'p' - || EXTRA_ADDRESS_CONSTRAINT (constraints[i][0])) + || EXTRA_ADDRESS_CONSTRAINT (constraints[i][0], constraints[i])) { address_operand_reloaded[i] = find_reloads_address (recog_data.operand_mode[i], (rtx*) 0, @@ -2839,6 +2859,8 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) for (i = 0; i < noperands; i++) { char *p = constraints[i]; + char *end; + int len; int win = 0; int did_match = 0; /* 0 => this operand can be reloaded somehow for this alternative. */ @@ -2846,6 +2868,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) /* 0 => this operand can be reloaded if the alternative allows regs. */ int winreg = 0; int c; + int m; rtx operand = recog_data.operand[i]; int offset = 0; /* Nonzero means this is a MEM that must be reloaded into a reg @@ -2910,11 +2933,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) This is doubly true if WORD_REGISTER_OPERATIONS. In this case eliminate_regs has left non-paradoxical - subregs for push_reloads to see. Make sure it does + subregs for push_reload to see. Make sure it does by forcing the reload. ??? When is it right at this stage to have a subreg - of a mem that is _not_ to be handled specialy? IMO + of a mem that is _not_ to be handled specially? IMO those should have been reduced to just a mem. */ || ((GET_CODE (operand) == MEM || (GET_CODE (operand)== REG @@ -2924,7 +2947,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) < BIGGEST_ALIGNMENT) && (GET_MODE_SIZE (operand_mode[i]) > GET_MODE_SIZE (GET_MODE (operand)))) - || (GET_CODE (operand) == MEM && BYTES_BIG_ENDIAN) + || BYTES_BIG_ENDIAN #ifdef LOAD_EXTEND_OP || (GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD && (GET_MODE_SIZE (GET_MODE (operand)) @@ -2960,16 +2983,22 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) or set WINREG if this operand could fit after reloads provided the constraint allows some registers. */ - while (*p && (c = *p++) != ',') - switch (c) + do + switch ((c = *p, len = CONSTRAINT_LEN (c, p)), c) { + case '\0': + len = 0; + break; + case ',': + c = '\0'; + break; + case '=': case '+': case '*': break; case '%': - /* The last operand should not be marked commutative. */ - if (i != noperands - 1) - commutative = i; + /* We only support one commutative marker, the first + one. We already set commutative above. */ break; case '?': @@ -2983,15 +3012,19 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) case '#': /* Ignore rest of this alternative as far as reloading is concerned. */ - while (*p && *p != ',') + do p++; + while (*p && *p != ','); + len = 0; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - c = strtoul (p - 1, &p, 10); + m = strtoul (p, &end, 10); + p = end; + len = 0; - this_alternative_matches[i] = c; + this_alternative_matches[i] = m; /* We are supposed to match a previous operand. If we do, we win if that one did. If we do not, count both of the operands as losers. @@ -2999,7 +3032,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) only a single reload insn will be needed to make the two operands win. As a result, this alternative may be rejected when it is actually desirable.) */ - if ((swapped && (c != commutative || i != commutative + 1)) + if ((swapped && (m != commutative || i != commutative + 1)) /* If we are matching as if two operands were swapped, also pretend that operands_match had been computed with swapped. @@ -3007,22 +3040,22 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) don't exchange them, because operands_match is valid only on one side of its diagonal. */ ? (operands_match - [(c == commutative || c == commutative + 1) - ? 2 * commutative + 1 - c : c] + [(m == commutative || m == commutative + 1) + ? 2 * commutative + 1 - m : m] [(i == commutative || i == commutative + 1) ? 2 * commutative + 1 - i : i]) - : operands_match[c][i]) + : operands_match[m][i]) { /* If we are matching a non-offsettable address where an offsettable address was expected, then we must reject this combination, because we can't reload it. */ - if (this_alternative_offmemok[c] - && GET_CODE (recog_data.operand[c]) == MEM - && this_alternative[c] == (int) NO_REGS - && ! this_alternative_win[c]) + if (this_alternative_offmemok[m] + && GET_CODE (recog_data.operand[m]) == MEM + && this_alternative[m] == (int) NO_REGS + && ! this_alternative_win[m]) bad = 1; - did_match = this_alternative_win[c]; + did_match = this_alternative_win[m]; } else { @@ -3030,21 +3063,21 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) rtx value; /* Retroactively mark the operand we had to match as a loser, if it wasn't already. */ - if (this_alternative_win[c]) + if (this_alternative_win[m]) losers++; - this_alternative_win[c] = 0; - if (this_alternative[c] == (int) NO_REGS) + this_alternative_win[m] = 0; + if (this_alternative[m] == (int) NO_REGS) bad = 1; /* But count the pair only once in the total badness of this alternative, if the pair can be a dummy reload. */ value = find_dummy_reload (recog_data.operand[i], - recog_data.operand[c], + recog_data.operand[m], recog_data.operand_loc[i], - recog_data.operand_loc[c], - operand_mode[i], operand_mode[c], - this_alternative[c], -1, - this_alternative_earlyclobber[c]); + recog_data.operand_loc[m], + operand_mode[i], operand_mode[m], + this_alternative[m], -1, + this_alternative_earlyclobber[m]); if (value != 0) losers--; @@ -3052,7 +3085,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) /* This can be fixed with reloads if the operand we are supposed to match can be fixed with reloads. */ badop = 0; - this_alternative[i] = this_alternative[c]; + this_alternative[i] = this_alternative[m]; /* If we have to reload this operand and some previous operand also had to match the same thing as this @@ -3171,7 +3204,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) case 'G': case 'H': if (GET_CODE (operand) == CONST_DOUBLE - && CONST_DOUBLE_OK_FOR_LETTER_P (operand, c)) + && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (operand, c, p)) win = 1; break; @@ -3205,7 +3238,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) case 'O': case 'P': if (GET_CODE (operand) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (operand), c)) + && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operand), c, p)) win = 1; break; @@ -3238,28 +3271,29 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) goto reg; default: - if (REG_CLASS_FROM_LETTER (c) == NO_REGS) + if (REG_CLASS_FROM_CONSTRAINT (c, p) == NO_REGS) { -#ifdef EXTRA_CONSTRAINT - if (EXTRA_MEMORY_CONSTRAINT (c)) +#ifdef EXTRA_CONSTRAINT_STR + if (EXTRA_MEMORY_CONSTRAINT (c, p)) { if (force_reload) break; - if (EXTRA_CONSTRAINT (operand, c)) + if (EXTRA_CONSTRAINT_STR (operand, c, p)) win = 1; /* If the address was already reloaded, we win as well. */ - if (GET_CODE (operand) == MEM && address_reloaded[i]) + else if (GET_CODE (operand) == MEM + && address_reloaded[i]) win = 1; /* Likewise if the address will be reloaded because reg_equiv_address is nonzero. For reg_equiv_mem we have to check. */ - if (GET_CODE (operand) == REG - && REGNO (operand) >= FIRST_PSEUDO_REGISTER - && reg_renumber[REGNO (operand)] < 0 - && ((reg_equiv_mem[REGNO (operand)] != 0 - && EXTRA_CONSTRAINT (reg_equiv_mem[REGNO (operand)], c)) - || (reg_equiv_address[REGNO (operand)] != 0))) + else if (GET_CODE (operand) == REG + && REGNO (operand) >= FIRST_PSEUDO_REGISTER + && reg_renumber[REGNO (operand)] < 0 + && ((reg_equiv_mem[REGNO (operand)] != 0 + && EXTRA_CONSTRAINT_STR (reg_equiv_mem[REGNO (operand)], c, p)) + || (reg_equiv_address[REGNO (operand)] != 0))) win = 1; /* If we didn't already win, we can reload @@ -3272,9 +3306,9 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) offmemok = 1; break; } - if (EXTRA_ADDRESS_CONSTRAINT (c)) + if (EXTRA_ADDRESS_CONSTRAINT (c, p)) { - if (EXTRA_CONSTRAINT (operand, c)) + if (EXTRA_CONSTRAINT_STR (operand, c, p)) win = 1; /* If we didn't already win, we can reload @@ -3284,14 +3318,16 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) break; } - if (EXTRA_CONSTRAINT (operand, c)) + if (EXTRA_CONSTRAINT_STR (operand, c, p)) win = 1; #endif break; } this_alternative[i] - = (int) reg_class_subunion[this_alternative[i]][(int) REG_CLASS_FROM_LETTER (c)]; + = (int) (reg_class_subunion + [this_alternative[i]] + [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]); reg: if (GET_MODE (operand) == BLKmode) break; @@ -3302,6 +3338,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) win = 1; break; } + while ((p += len), c); constraints[i] = p; @@ -3375,6 +3412,12 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) && ! const_to_mem) bad = 1; +#ifdef DISPARAGE_RELOAD_CLASS + reject + += DISPARAGE_RELOAD_CLASS (operand, + (enum reg_class) this_alternative[i]); +#endif + /* We prefer to reload pseudos over reloading other things, since such reloads may be able to be eliminated later. If we are reloading a SCRATCH, we won't be generating any @@ -4319,16 +4362,26 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) for (i = 0; i < n_reloads; i++) if (rld[i].when_needed == RELOAD_FOR_INPUT && GET_CODE (PATTERN (insn)) == SET - && GET_CODE (SET_DEST (PATTERN (insn))) == REG - && SET_SRC (PATTERN (insn)) == rld[i].in) + && GET_CODE (SET_DEST (PATTERN (insn))) == REG + && SET_SRC (PATTERN (insn)) == rld[i].in) { - rtx dest = SET_DEST (PATTERN (insn)); + rtx dest = SET_DEST (PATTERN (insn)); unsigned int regno = REGNO (dest); - if (regno < FIRST_PSEUDO_REGISTER - && TEST_HARD_REG_BIT (reg_class_contents[rld[i].class], regno) - && HARD_REGNO_MODE_OK (regno, rld[i].mode)) - rld[i].reg_rtx = dest; + if (regno < FIRST_PSEUDO_REGISTER + && TEST_HARD_REG_BIT (reg_class_contents[rld[i].class], regno) + && HARD_REGNO_MODE_OK (regno, rld[i].mode)) + { + int nr = HARD_REGNO_NREGS (regno, rld[i].mode); + int ok = 1, nri; + + for (nri = 1; nri < nr; nri ++) + if (! TEST_HARD_REG_BIT (reg_class_contents[rld[i].class], regno + nri)) + ok = 0; + + if (ok) + rld[i].reg_rtx = dest; + } } return retval; @@ -4338,9 +4391,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) accepts a memory operand with constant address. */ static int -alternative_allows_memconst (constraint, altnum) - const char *constraint; - int altnum; +alternative_allows_memconst (const char *constraint, int altnum) { int c; /* Skip alternatives before the one requested. */ @@ -4351,8 +4402,9 @@ alternative_allows_memconst (constraint, altnum) } /* Scan the requested alternative for 'm' or 'o'. If one of them is present, this alternative accepts memory constants. */ - while ((c = *constraint++) && c != ',' && c != '#') - if (c == 'm' || c == 'o' || EXTRA_MEMORY_CONSTRAINT (c)) + for (; (c = *constraint) && c != ',' && c != '#'; + constraint += CONSTRAINT_LEN (c, constraint)) + if (c == 'm' || c == 'o' || EXTRA_MEMORY_CONSTRAINT (c, constraint)) return 1; return 0; } @@ -4380,15 +4432,9 @@ alternative_allows_memconst (constraint, altnum) result of find_reloads_address. */ static rtx -find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest, insn, - address_reloaded) - rtx x; - int opnum; - enum reload_type type; - int ind_levels; - int is_set_dest; - rtx insn; - int *address_reloaded; +find_reloads_toplev (rtx x, int opnum, enum reload_type type, + int ind_levels, int is_set_dest, rtx insn, + int *address_reloaded) { RTX_CODE code = GET_CODE (x); @@ -4532,9 +4578,7 @@ find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest, insn, This mem ref is not shared with anything. */ static rtx -make_memloc (ad, regno) - rtx ad; - int regno; +make_memloc (rtx ad, int regno) { /* We must rerun eliminate_regs, in case the elimination offsets have changed. */ @@ -4557,14 +4601,11 @@ make_memloc (ad, regno) } /* Returns true if AD could be turned into a valid memory reference - to mode MODE by reloading the part pointed to by PART into a + to mode MODE by reloading the part pointed to by PART into a register. */ static int -maybe_memory_address_p (mode, ad, part) - enum machine_mode mode; - rtx ad; - rtx *part; +maybe_memory_address_p (enum machine_mode mode, rtx ad, rtx *part) { int retv; rtx tem = *part; @@ -4602,15 +4643,9 @@ maybe_memory_address_p (mode, ad, part) to a hard register, and frame pointer elimination. */ static int -find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn) - enum machine_mode mode; - rtx *memrefloc; - rtx ad; - rtx *loc; - int opnum; - enum reload_type type; - int ind_levels; - rtx insn; +find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad, + rtx *loc, int opnum, enum reload_type type, + int ind_levels, rtx insn) { int regno; int removed_and = 0; @@ -4858,7 +4893,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn) of it. Handle all base registers here, not just fp/ap/sp, because on some - targets (namely Sparc) we can also get invalid addresses from preventive + targets (namely SPARC) we can also get invalid addresses from preventive subreg big-endian corrections made by find_reloads_toplev. If we decide to do something, it must be that `double_reg_address_ok' @@ -4873,7 +4908,15 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn) && GET_CODE (XEXP (ad, 0)) == PLUS && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER - && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode) + && (REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode) + || XEXP (XEXP (ad, 0), 0) == frame_pointer_rtx +#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM + || XEXP (XEXP (ad, 0), 0) == hard_frame_pointer_rtx +#endif +#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM + || XEXP (XEXP (ad, 0), 0) == arg_pointer_rtx +#endif + || XEXP (XEXP (ad, 0), 0) == stack_pointer_rtx) && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 1))) { *loc = ad = gen_rtx_PLUS (GET_MODE (ad), @@ -4893,7 +4936,15 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn) && GET_CODE (XEXP (ad, 0)) == PLUS && GET_CODE (XEXP (XEXP (ad, 0), 1)) == REG && REGNO (XEXP (XEXP (ad, 0), 1)) < FIRST_PSEUDO_REGISTER - && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode) + && (REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode) + || XEXP (XEXP (ad, 0), 1) == frame_pointer_rtx +#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM + || XEXP (XEXP (ad, 0), 1) == hard_frame_pointer_rtx +#endif +#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM + || XEXP (XEXP (ad, 0), 1) == arg_pointer_rtx +#endif + || XEXP (XEXP (ad, 0), 1) == stack_pointer_rtx) && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 0))) { *loc = ad = gen_rtx_PLUS (GET_MODE (ad), @@ -4963,9 +5014,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn) front of it for pseudos that we have to replace with stack slots. */ static rtx -subst_reg_equivs (ad, insn) - rtx ad; - rtx insn; +subst_reg_equivs (rtx ad, rtx insn) { RTX_CODE code = GET_CODE (ad); int i; @@ -5036,8 +5085,7 @@ subst_reg_equivs (ad, insn) This routine assumes both inputs are already in canonical form. */ rtx -form_sum (x, y) - rtx x, y; +form_sum (rtx x, rtx y) { rtx tem; enum machine_mode mode = GET_MODE (x); @@ -5091,8 +5139,7 @@ form_sum (x, y) In all other cases, return ADDR. */ static rtx -subst_indexed_address (addr) - rtx addr; +subst_indexed_address (rtx addr) { rtx op0 = 0, op1 = 0, op2 = 0; rtx tem; @@ -5149,17 +5196,15 @@ subst_indexed_address (addr) RELOADNUM is the reload number. */ static void -update_auto_inc_notes (insn, regno, reloadnum) - rtx insn ATTRIBUTE_UNUSED; - int regno ATTRIBUTE_UNUSED; - int reloadnum ATTRIBUTE_UNUSED; +update_auto_inc_notes (rtx insn ATTRIBUTE_UNUSED, int regno ATTRIBUTE_UNUSED, + int reloadnum ATTRIBUTE_UNUSED) { #ifdef AUTO_INC_DEC rtx link; for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) if (REG_NOTE_KIND (link) == REG_INC - && REGNO (XEXP (link, 0)) == regno) + && (int) REGNO (XEXP (link, 0)) == regno) push_replacement (&XEXP (link, 0), reloadnum, VOIDmode); #endif } @@ -5189,15 +5234,9 @@ update_auto_inc_notes (insn, regno, reloadnum) could have addressing modes that this does not handle right. */ static int -find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn) - enum machine_mode mode; - rtx x; - int context; - rtx *loc; - int opnum; - enum reload_type type; - int ind_levels; - rtx insn; +find_reloads_address_1 (enum machine_mode mode, rtx x, int context, + rtx *loc, int opnum, enum reload_type type, + int ind_levels, rtx insn) { RTX_CODE code = GET_CODE (x); @@ -5240,7 +5279,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn) GET_MODE (orig_op1)))); } /* Plus in the index register may be created only as a result of - register remateralization for expresion like &localvar*4. Reload it. + register remateralization for expression like &localvar*4. Reload it. It may be possible to combine the displacement on the outer level, but it is probably not worthwhile to do so. */ if (context) @@ -5366,7 +5405,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn) /* Handle a register that is equivalent to a memory location which cannot be addressed directly. */ - if (reg_equiv_memory_loc[regno] != 0 + if (reg_equiv_memory_loc[regno] != 0 && (reg_equiv_address[regno] != 0 || num_not_at_initial_offset)) { @@ -5664,7 +5703,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn) needless copies if SUBREG_REG is multi-word. */ if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER) { - int regno = subreg_regno (x); + int regno ATTRIBUTE_UNUSED = subreg_regno (x); if (! (context ? REGNO_OK_FOR_INDEX_P (regno) : REGNO_MODE_OK_FOR_BASE_P (regno, mode))) @@ -5730,14 +5769,9 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn) supports. */ static void -find_reloads_address_part (x, loc, class, mode, opnum, type, ind_levels) - rtx x; - rtx *loc; - enum reg_class class; - enum machine_mode mode; - int opnum; - enum reload_type type; - int ind_levels; +find_reloads_address_part (rtx x, rtx *loc, enum reg_class class, + enum machine_mode mode, int opnum, + enum reload_type type, int ind_levels) { if (CONSTANT_P (x) && (! LEGITIMATE_CONSTANT_P (x) @@ -5790,14 +5824,8 @@ find_reloads_address_part (x, loc, class, mode, opnum, type, ind_levels) stack slots. */ static rtx -find_reloads_subreg_address (x, force_replace, opnum, type, - ind_levels, insn) - rtx x; - int force_replace; - int opnum; - enum reload_type type; - int ind_levels; - rtx insn; +find_reloads_subreg_address (rtx x, int force_replace, int opnum, + enum reload_type type, int ind_levels, rtx insn) { int regno = REGNO (SUBREG_REG (x)); @@ -5819,9 +5847,16 @@ find_reloads_subreg_address (x, force_replace, opnum, type, if (force_replace || ! rtx_equal_p (tem, reg_equiv_mem[regno])) { - int offset = SUBREG_BYTE (x); unsigned outer_size = GET_MODE_SIZE (GET_MODE (x)); unsigned inner_size = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))); + int offset; + + /* For big-endian paradoxical subregs, SUBREG_BYTE does not + hold the correct (negative) byte offset. */ + if (BYTES_BIG_ENDIAN && outer_size > inner_size) + offset = inner_size - outer_size; + else + offset = SUBREG_BYTE (x); XEXP (tem, 0) = plus_constant (XEXP (tem, 0), offset); PUT_MODE (tem, GET_MODE (x)); @@ -5876,8 +5911,7 @@ find_reloads_subreg_address (x, force_replace, opnum, type, Return the rtx that X translates into; usually X, but modified. */ void -subst_reloads (insn) - rtx insn; +subst_reloads (rtx insn) { int i; @@ -5927,7 +5961,7 @@ subst_reloads (insn) do the wrong thing if RELOADREG is multi-word. RELOADREG will always be a REG here. */ if (GET_MODE (reloadreg) != r->mode && r->mode != VOIDmode) - reloadreg = gen_rtx_REG (r->mode, REGNO (reloadreg)); + reloadreg = reload_adjust_reg_for_mode (reloadreg, r->mode); /* If we are putting this into a SUBREG and RELOADREG is a SUBREG, we would be making nested SUBREGs, so we have to fix @@ -5967,8 +6001,7 @@ subst_reloads (insn) copies to locations in Y, a copy of X. */ void -copy_replacements (x, y) - rtx x, y; +copy_replacements (rtx x, rtx y) { /* We can't support X being a SUBREG because we might then need to know its location if something inside it was replaced. */ @@ -5979,10 +6012,7 @@ copy_replacements (x, y) } static void -copy_replacements_1 (px, py, orig_replacements) - rtx *px; - rtx *py; - int orig_replacements; +copy_replacements_1 (rtx *px, rtx *py, int orig_replacements) { int i, j; rtx x, y; @@ -6029,9 +6059,7 @@ copy_replacements_1 (px, py, orig_replacements) /* Change any replacements being done to *X to be done to *Y. */ void -move_replacements (x, y) - rtx *x; - rtx *y; +move_replacements (rtx *x, rtx *y) { int i; @@ -6049,8 +6077,7 @@ move_replacements (x, y) Otherwise, return *LOC. */ rtx -find_replacement (loc) - rtx *loc; +find_replacement (rtx *loc) { struct replacement *r; @@ -6120,10 +6147,8 @@ find_replacement (loc) look at equivalences for pseudos that didn't get hard registers. */ int -refers_to_regno_for_reload_p (regno, endregno, x, loc) - unsigned int regno, endregno; - rtx x; - rtx *loc; +refers_to_regno_for_reload_p (unsigned int regno, unsigned int endregno, + rtx x, rtx *loc) { int i; unsigned int r; @@ -6246,8 +6271,7 @@ refers_to_regno_for_reload_p (regno, endregno, x, loc) that we look at equivalences for pseudos that didn't get hard registers. */ int -reg_overlap_mentioned_for_reload_p (x, in) - rtx x, in; +reg_overlap_mentioned_for_reload_p (rtx x, rtx in) { int regno, endregno; @@ -6290,8 +6314,22 @@ reg_overlap_mentioned_for_reload_p (x, in) || GET_CODE (x) == CC0) return reg_mentioned_p (x, in); else if (GET_CODE (x) == PLUS) - return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in) - || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in)); + { + /* We actually want to know if X is mentioned somewhere inside IN. + We must not say that (plus (sp) (const_int 124)) is in + (plus (sp) (const_int 64)), since that can lead to incorrect reload + allocation when spuriously changing a RELOAD_FOR_OUTPUT_ADDRESS + into a RELOAD_OTHER on behalf of another RELOAD_OTHER. */ + while (GET_CODE (in) == MEM) + in = XEXP (in, 0); + if (GET_CODE (in) == REG) + return 0; + else if (GET_CODE (in) == PLUS) + return (reg_overlap_mentioned_for_reload_p (x, XEXP (in, 0)) + || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 1))); + else return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in) + || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in)); + } else abort (); @@ -6305,8 +6343,7 @@ reg_overlap_mentioned_for_reload_p (x, in) registers. */ int -refers_to_mem_for_reload_p (x) - rtx x; +refers_to_mem_for_reload_p (rtx x) { const char *fmt; int i; @@ -6356,14 +6393,8 @@ refers_to_mem_for_reload_p (x) as if it were a constant except that sp is required to be unchanging. */ rtx -find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) - rtx goal; - rtx insn; - enum reg_class class; - int other; - short *reload_reg_p; - int goalreg; - enum machine_mode mode; +find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other, + short *reload_reg_p, int goalreg, enum machine_mode mode) { rtx p = insn; rtx goaltry, valtry, value, where; @@ -6376,6 +6407,7 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) int need_stable_sp = 0; int nregs; int valuenregs; + int num = 0; if (goal == 0) regno = goalreg; @@ -6416,6 +6448,7 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) else return 0; + num = 0; /* Scan insns back from INSN, looking for one that copies a value into or out of GOAL. Stop and give up if we reach a label. */ @@ -6423,7 +6456,9 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) while (1) { p = PREV_INSN (p); - if (p == 0 || GET_CODE (p) == CODE_LABEL) + num++; + if (p == 0 || GET_CODE (p) == CODE_LABEL + || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS)) return 0; if (GET_CODE (p) == INSN @@ -6811,8 +6846,7 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) The value is always positive. */ static int -find_inc_amount (x, inced) - rtx x, inced; +find_inc_amount (rtx x, rtx inced) { enum rtx_code code = GET_CODE (x); const char *fmt; @@ -6867,11 +6901,8 @@ find_inc_amount (x, inced) If SETS is nonzero, also consider SETs. */ int -regno_clobbered_p (regno, insn, mode, sets) - unsigned int regno; - rtx insn; - enum machine_mode mode; - int sets; +regno_clobbered_p (unsigned int regno, rtx insn, enum machine_mode mode, + int sets) { unsigned int nregs = HARD_REGNO_NREGS (regno, mode); unsigned int endregno = regno + nregs; @@ -6907,6 +6938,24 @@ regno_clobbered_p (regno, insn, mode, sets) return 0; } +/* Find the low part, with mode MODE, of a hard regno RELOADREG. */ +rtx +reload_adjust_reg_for_mode (rtx reloadreg, enum machine_mode mode) +{ + int regno; + + if (GET_MODE (reloadreg) == mode) + return reloadreg; + + regno = REGNO (reloadreg); + + if (WORDS_BIG_ENDIAN) + regno += HARD_REGNO_NREGS (regno, GET_MODE (reloadreg)) + - HARD_REGNO_NREGS (regno, mode); + + return gen_rtx_REG (mode, regno); +} + static const char *const reload_when_needed_name[] = { "RELOAD_FOR_INPUT", @@ -6927,8 +6976,7 @@ static const char * const reg_class_names[] = REG_CLASS_NAMES; /* These functions are used to print the variables set by 'find_reloads' */ void -debug_reload_to_stream (f) - FILE *f; +debug_reload_to_stream (FILE *f) { int r; const char *prefix; @@ -7023,7 +7071,7 @@ debug_reload_to_stream (f) } void -debug_reload () +debug_reload (void) { debug_reload_to_stream (stderr); }