This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Separate C-family hooks better from general hooks


On Wed, Apr 6, 2011 at 3:27 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> This patch separates the C-family hooks targetcm out of target.def
> into a separate c-family/c-target.def, with associated c-target.h and
> c-target-def.h.
>
> This is logically cleaner, in that declarations and definitions
> applicable only to C-family front ends (of targetcm and the associated
> initializers) should not be visible in code using target.h or
> target-def.h that is not part of those front ends. ?The hooks are also
> logically different from ordinary target hooks, needing to be defined
> in a different place, and the patch arranges for them to be marked
> accordingly as "C Target Hook" in the internals manual. ?The
> TARGET_HAS_TARGETCM target macro is removed and poisoned; in its
> place, config.gcc determines whether a target has its own definition
> of targetcm, and if not, a file config/default-c.c with such a
> definition is linked in to the C-family compilers.
>
> The main motivation, however, is to set up the infrastructure for
> separate hook structures in separate files that will be needed for
> common hooks (shared between driver and cc1) and driver hooks as
> described in <http://gcc.gnu.org/ml/gcc/2010-10/msg00294.html>. ?Thus,
> I would propose that such hooks go in common/common-target.def and
> driver/driver-target.def, with associated names used in documenting
> the hooks. ?(The name also serves as a key to tell genhooks which set
> of default definitions to output when generating a header.) ?If a
> target has any non-default common hooks (initially, maybe options
> hooks) then config.gcc would set an appropriate variable indicating
> what file in common/config/ to compile that defines the hooks
> structure; otherwise common/config/default.c would be compiled.
>
> Where the hook setting depends on both architecture and OS in a way
> meaning the macro associated with the hook effectively needs to be
> defined in a header rather than a target .c file (for example,
> consider converting NO_DOLLAR_IN_LABEL to a hook - it's used in
> collect2, which counts as driver for this purpose, middle-end and
> front ends), appropriate headers in common/config/ (or driver/config/
> when specs are converted to a hooks scheme) would be used, listed in
> common_tm_file or similar and used to generate tm-common.h or similar,
> which would be included in common/config/default.c and other files
> defining the hooks.
>
> The desired state would be that common/ files do not include headers
> from outside common/, and do not reference types, functions etc. not
> relevant to common code, and that driver/ files only reference common/
> and driver/ (so neither should reference tm.h, although the practical
> initial state may involve tm.h references in both places for a while -
> after all, opts.c should be common in this model, and still uses
> several target macros, and even coretypes.h ought to be split so types
> such as "tree" and "rtx" don't appear in common code). ?That is the
> reason behind the "Do not include tm.h or tm_p.h here" comment in
> default-c.c - there is nothing logically wrong with default-c.c
> depending on things specific to the core compilers (front ends can
> depend on the core compilers) in the way there is with the driver or
> common code having such declarations visible, but the desired future
> model avoids making macros used only to define hooks visible
> throughout the compiler.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu, and
> tested building cc1 and xgcc for cross to i686-darwin. ?OK to commit
> (the non-c-family parts)?

Ok.

Thanks,
Richard.

> 2011-04-05 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?* doc/tm.texi.in: Document C target hooks as separate from general
> ? ? ? ?target hooks.
> ? ? ? ?* doc/tm.texi: Regenerate.
> ? ? ? ?* genhooks.c (struct hook_desc): Add docname field.
> ? ? ? ?(HOOK_VECTOR_1, DEFHOOKPOD, DEFHOOK, DEFHOOK_UNDOC). ?Initialize
> ? ? ? ?docname field.
> ? ? ? ?(hook_array): Include c-target.def.
> ? ? ? ?(emit_documentation): Use docname field in output.
> ? ? ? ?(emit_init_macros): Take docname argument. ?Only emit definitions
> ? ? ? ?for hooks matching docname.
> ? ? ? ?(main): Expect additional arguments in all cases. ?Pass argument
> ? ? ? ?to emit_init_macros.
> ? ? ? ?* target.def: Move initial macro definitions and comments to
> ? ? ? ?target-hooks-macros.h.
> ? ? ? ?(gcc_targetcm): Move to c-family/c-target.def.
> ? ? ? ?* target.h (targetcm): Move declaration to c-family/c-target.h.
> ? ? ? ?* targhooks.c (default_handle_c_option): Move to
> ? ? ? ?c-family/c-opts.c.
> ? ? ? ?* targhooks.h (default_handle_c_option): Move declaration to
> ? ? ? ?c-family/c-common.h.
> ? ? ? ?* target-hooks-macros.h: New file.
> ? ? ? ?* config.gcc (target_has_targetcm): Define and use to add to
> ? ? ? ?c_target_objs and cxx_target_objs.
> ? ? ? ?* config/default-c.c: New file.
> ? ? ? ?* config/darwin-c.c: Include c-target.h and c-target-def.h instead
> ? ? ? ?of target.h and target-def.h.
> ? ? ? ?(TARGET_HANDLE_C_OPTION, targetcm): Define later in file.
> ? ? ? ?(darwin_objc_construct_string, darwin_cfstring_ref_p,
> ? ? ? ?darwin_check_cfstring_format_arg): Make static.
> ? ? ? ?(TARGET_OBJC_CONSTRUCT_STRING_OBJECT,
> ? ? ? ?TARGET_STRING_OBJECT_REF_TYPE_P,
> ? ? ? ?TARGET_CHECK_STRING_OBJECT_FORMAT_ARG): Define here.
> ? ? ? ?* config/darwin-protos.h (darwin_objc_construct_string,
> ? ? ? ?darwin_cfstring_ref_p, darwin_check_cfstring_format_arg): Don't
> ? ? ? ?declare.
> ? ? ? ?* config/darwin.h (TARGET_OBJC_CONSTRUCT_STRING_OBJECT,
> ? ? ? ?TARGET_STRING_OBJECT_REF_TYPE_P,
> ? ? ? ?TARGET_CHECK_STRING_OBJECT_FORMAT_ARG, TARGET_HAS_TARGETCM):
> ? ? ? ?Remove.
> ? ? ? ?* config/t-darwin (darwin-c.o): Update dependencies.
> ? ? ? ?* system.h (TARGET_HAS_TARGETCM): Poison.
> ? ? ? ?* Makefile.in (TARGET_H): Update.
> ? ? ? ?(TARGET_DEF, C_TARGET_DEF, C_TARGET_H, C_TARGET_DEF_H): Define.
> ? ? ? ?(c-family/c-format.o, c-family/c-opts.o): Update dependencies.
> ? ? ? ?(default-c.o): New target.
> ? ? ? ?(s-target-hooks-def-h): Pass "Target Hook" string to genhooks.
> ? ? ? ?(c-family/c-target-hooks-def.h, s-c-target-hooks-def-h): New
> ? ? ? ?targets.
> ? ? ? ?(s-tm-texi): Pass -d option to genhooks. ?Also test timestamp on
> ? ? ? ?c-target.def.
> ? ? ? ?(build/genhooks.o): Update dependencies.
>
> c-family:
> 2011-04-05 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?* c-target-def.h: New file.
> ? ? ? ?* c-target.def: New file.
> ? ? ? ?* c-target.h: New file.
> ? ? ? ?* c-common.c (targetcm): Don't define here.
> ? ? ? ?* c-common.h (default_handle_c_option): Declare.
> ? ? ? ?* c-format.c: Include c-target.h instead of target.h.
> ? ? ? ?* c-opts.c: Include c-target.h instead of target.h. ?Explicitly
> ? ? ? ?include tm.h.
> ? ? ? ?(default_handle_c_option): Move from targhooks.c.
>
> objc:
> 2011-04-05 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?* objc-act.c: Include c-target.h instead of target.h.
> ? ? ? ?* Make-lang.in (objc/objc-act.o): Update dependencies.
>
> Index: gcc/doc/tm.texi
> ===================================================================
> --- gcc/doc/tm.texi ? ? (revision 171986)
> +++ gcc/doc/tm.texi ? ? (working copy)
> @@ -91,6 +91,14 @@ form part of the @code{targetm} structur
> ?from being defined in the @file{.h} file to being part of the
> ?@code{targetm} structure.
>
> +Similarly, there is a @code{targetcm} variable for hooks that are
> +specific to front ends for C-family languages, documented as ``C
> +Target Hook''. ?This is declared in @file{c-family/c-target.h}, the
> +the initializer @code{TARGETCM_INITIALIZER} in
> +@file{c-family/c-target-def.h}. ?If targets initialize @code{targetcm}
> +themselves, they should set @code{target_has_targetcm=yes} in
> +@file{config.gcc}; otherwise a default definition is used.
> +
> ?@node Driver
> ?@section Controlling the Compilation Driver, @file{gcc}
> ?@cindex driver
> @@ -678,7 +686,7 @@ option was passed (@code{UNKNOWN_LOCATIO
> ?via attributes).
> ?@end deftypefn
>
> -@deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
> +@deftypefn {C Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
> ?This target hook is called whenever the user specifies one of the
> ?target-specific C language family options described by the @file{.opt}
> ?definition files(@pxref{Options}). ?It has the opportunity to do some
> @@ -692,15 +700,15 @@ only available in the C (and related lan
> ?should use @code{TARGET_HANDLE_C_OPTION} instead.
> ?@end deftypefn
>
> -@deftypefn {Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree @var{string})
> +@deftypefn {C Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree @var{string})
> ?Targets may provide a string object type that can be used within and between C, C++ and their respective Objective-C dialects. A string object might, for example, embed encoding and length information. These objects are considered opaque to the compiler and handled as references. An ideal implementation makes the composition of the string object match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep), allowing efficient interworking between C-only and Objective-C code. If a target implements string objects then this hook should return a reference to such an object constructed from the normal `C' string representation provided in @var{string}. At present, the hook is used by Objective-C only, to obtain a common-format string object when the target provides one.
> ?@end deftypefn
>
> -@deftypefn {Target Hook} bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree @var{stringref})
> +@deftypefn {C Target Hook} bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree @var{stringref})
> ?If a target implements string objects then this hook should return @code{true} if @var{stringref} is a valid reference to such an object.
> ?@end deftypefn
>
> -@deftypefn {Target Hook} void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree @var{format_arg}, tree @var{args_list})
> +@deftypefn {C Target Hook} void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree @var{format_arg}, tree @var{args_list})
> ?If a target implements string objects then this hook should should ?provide a facility to check the function arguments in @var{args_list} ?against the format specifiers in @var{format_arg} where the type of ?@var{format_arg} is one recognized as a valid string reference type.
> ?@end deftypefn
>
> Index: gcc/doc/tm.texi.in
> ===================================================================
> --- gcc/doc/tm.texi.in ?(revision 171986)
> +++ gcc/doc/tm.texi.in ?(working copy)
> @@ -91,6 +91,14 @@ form part of the @code{targetm} structur
> ?from being defined in the @file{.h} file to being part of the
> ?@code{targetm} structure.
>
> +Similarly, there is a @code{targetcm} variable for hooks that are
> +specific to front ends for C-family languages, documented as ``C
> +Target Hook''. ?This is declared in @file{c-family/c-target.h}, the
> +the initializer @code{TARGETCM_INITIALIZER} in
> +@file{c-family/c-target-def.h}. ?If targets initialize @code{targetcm}
> +themselves, they should set @code{target_has_targetcm=yes} in
> +@file{config.gcc}; otherwise a default definition is used.
> +
> ?@node Driver
> ?@section Controlling the Compilation Driver, @file{gcc}
> ?@cindex driver
> Index: gcc/targhooks.c
> ===================================================================
> --- gcc/targhooks.c ? ? (revision 171986)
> +++ gcc/targhooks.c ? ? (working copy)
> @@ -930,14 +930,6 @@ default_secondary_reload (bool in_p ATTR
> ? return rclass;
> ?}
>
> -bool
> -default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
> - ? ? ? ? ? ? ? ? ? ? ? ?const char *arg ATTRIBUTE_UNUSED,
> - ? ? ? ? ? ? ? ? ? ? ? ?int value ATTRIBUTE_UNUSED)
> -{
> - ?return false;
> -}
> -
> ?/* By default, if flag_pic is true, then neither local nor global relocs
> ? ?should be placed in readonly memory. ?*/
>
> Index: gcc/targhooks.h
> ===================================================================
> --- gcc/targhooks.h ? ? (revision 171986)
> +++ gcc/targhooks.h ? ? (working copy)
> @@ -129,7 +129,6 @@ extern reg_class_t default_secondary_rel
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? secondary_reload_info *);
> ?extern void default_target_option_override (void);
> ?extern void hook_void_bitmap (bitmap);
> -extern bool default_handle_c_option (size_t, const char *, int);
> ?extern int default_reloc_rw_mask (void);
> ?extern tree default_mangle_decl_assembler_name (tree, tree);
> ?extern tree default_emutls_var_fields (tree, tree *);
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c ? ? ? (revision 171986)
> +++ gcc/c-family/c-opts.c ? ? ? (working copy)
> @@ -36,7 +36,12 @@ along with GCC; see the file COPYING3.
> ?#include "opts.h"
> ?#include "options.h"
> ?#include "mkdeps.h"
> -#include "target.h" ? ? ? ? ? ?/* For gcc_targetcm. ?*/
> +#include "c-target.h"
> +#include "tm.h" ? ? ? ? ? ? ? ? ? ? ? ?/* For BYTES_BIG_ENDIAN,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DOLLARS_IN_IDENTIFIERS,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?STDC_0_IN_SYSTEM_HEADERS,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TARGET_OPTF. ?*/
> ?#include "tm_p.h" ? ? ? ? ? ? ?/* For C_COMMON_OVERRIDE_OPTIONS. ?*/
>
> ?#ifndef DOLLARS_IN_IDENTIFIERS
> @@ -809,6 +814,16 @@ c_common_handle_option (size_t scode, co
> ? return result;
> ?}
>
> +/* Default implementation of TARGET_HANDLE_C_OPTION. ?*/
> +
> +bool
> +default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
> + ? ? ? ? ? ? ? ? ? ? ? ?const char *arg ATTRIBUTE_UNUSED,
> + ? ? ? ? ? ? ? ? ? ? ? ?int value ATTRIBUTE_UNUSED)
> +{
> + ?return false;
> +}
> +
> ?/* Post-switch processing. ?*/
> ?bool
> ?c_common_post_options (const char **pfilename)
> Index: gcc/c-family/c-target-def.h
> ===================================================================
> --- gcc/c-family/c-target-def.h (revision 0)
> +++ gcc/c-family/c-target-def.h (revision 0)
> @@ -0,0 +1,22 @@
> +/* Default initializers for C-family target hooks.
> + ? Copyright (C) 2011
> + ? Free Software Foundation, Inc.
> +
> + ? This program 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 3, or (at your option) any
> + ? later version.
> +
> + ? This program 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 this program; see the file COPYING3. ?If not see
> + ? <http://www.gnu.org/licenses/>. ?*/
> +
> +#include "c-family/c-target-hooks-def.h"
> +#include "tree.h"
> +#include "c-family/c-common.h"
> +#include "hooks.h"
> Index: gcc/c-family/c-format.c
> ===================================================================
> --- gcc/c-family/c-format.c ? ? (revision 171986)
> +++ gcc/c-family/c-format.c ? ? (working copy)
> @@ -1,6 +1,6 @@
> ?/* Check calls to formatted I/O functions (-Wformat).
> ? ?Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
> - ? 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
> + ? 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
> ? ?Free Software Foundation, Inc.
>
> ?This file is part of GCC.
> @@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.
> ?#include "langhooks.h"
> ?#include "c-format.h"
> ?#include "alloc-pool.h"
> -#include "target.h"
> +#include "c-target.h"
>
> ?/* Set format warning options according to a -Wformat=n option. ?*/
>
> Index: gcc/c-family/c-common.c
> ===================================================================
> --- gcc/c-family/c-common.c ? ? (revision 171986)
> +++ gcc/c-family/c-common.c ? ? (working copy)
> @@ -9252,10 +9252,6 @@ warn_for_unused_label (tree label)
> ? ? }
> ?}
>
> -#ifndef TARGET_HAS_TARGETCM
> -struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
> -#endif
> -
> ?/* Warn for division by zero according to the value of DIVISOR. ?LOC
> ? ?is the location of the division operator. ?*/
>
> Index: gcc/c-family/c-target.h
> ===================================================================
> --- gcc/c-family/c-target.h ? ? (revision 0)
> +++ gcc/c-family/c-target.h ? ? (revision 0)
> @@ -0,0 +1,37 @@
> +/* Data structure definitions for target-specific C-family behavior.
> + ? Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
> + ? 2011
> + ? Free Software Foundation, Inc.
> +
> + ? This program 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 3, or (at your option) any
> + ? later version.
> +
> + ? This program 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 this program; see the file COPYING3. ?If not see
> + ? <http://www.gnu.org/licenses/>.
> +
> + ? In other words, you are welcome to use, share and improve this program.
> + ? You are forbidden to forbid anyone else to use, share and improve
> + ? what you give them. ? Help stamp out software-hoarding! ?*/
> +
> +#ifndef GCC_C_TARGET_H
> +#define GCC_C_TARGET_H
> +
> +#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
> +#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
> +#define DEFHOOK_UNDOC DEFHOOK
> +#define HOOKSTRUCT(FRAGMENT) FRAGMENT
> +
> +#include "c-target.def"
> +
> +/* Each target can provide their own. ?*/
> +extern struct gcc_targetcm targetcm;
> +
> +#endif /* GCC_C_TARGET_H */
> Index: gcc/c-family/c-common.h
> ===================================================================
> --- gcc/c-family/c-common.h ? ? (revision 171986)
> +++ gcc/c-family/c-common.h ? ? (working copy)
> @@ -700,6 +700,7 @@ extern tree handle_format_arg_attribute
> ?extern bool attribute_takes_identifier_p (const_tree);
> ?extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const struct cl_option_handlers *);
> +extern bool default_handle_c_option (size_t, const char *, int);
> ?extern tree c_common_type_for_mode (enum machine_mode, int);
> ?extern tree c_common_type_for_size (unsigned int, int);
> ?extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
> Index: gcc/c-family/c-target.def
> ===================================================================
> --- gcc/c-family/c-target.def ? (revision 0)
> +++ gcc/c-family/c-target.def ? (revision 0)
> @@ -0,0 +1,79 @@
> +/* Target hook definitions for C-family front ends.
> + ? Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
> + ? 2011
> + ? Free Software Foundation, Inc.
> +
> + ? This program 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 3, or (at your option) any
> + ? later version.
> +
> + ? This program 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 this program; see the file COPYING3. ?If not see
> + ? <http://www.gnu.org/licenses/>. ?*/
> +
> +/* See target-hooks-macros.h for details of macros that should be
> + ? provided by the including file, and how to use them here. ?*/
> +#include "target-hooks-macros.h"
> +
> +#undef HOOK_TYPE
> +#define HOOK_TYPE "C Target Hook"
> +
> +HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
> +
> +#undef HOOK_PREFIX
> +#define HOOK_PREFIX "TARGET_"
> +
> +/* Handle target switch CODE (an OPT_* value). ?ARG is the argument
> + ? passed to the switch; it is NULL if no argument was. ?VALUE is the
> + ? value of ARG if CODE specifies a UInteger option, otherwise it is
> + ? 1 if the positive form of the switch was used and 0 if the negative
> + ? form was. ?Return true if the switch was valid. ?*/
> +DEFHOOK
> +(handle_c_option,
> + "",
> + bool, (size_t code, const char *arg, int value),
> + default_handle_c_option)
> +
> +/* Targets may provide a string object type that can be used within
> + ? and between C, C++, and Objective-C dialects. ?*/
> +
> +DEFHOOK
> +(objc_construct_string_object,
> + "Targets may provide a string object type that can be used within\
> + and between C, C++ and their respective Objective-C dialects.\
> + A string object might, for example, embed encoding and length information.\
> + These objects are considered opaque to the compiler and handled as references.\
> + An ideal implementation makes the composition of the string object\
> + match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\
> + allowing efficient interworking between C-only and Objective-C code.\
> + If a target implements string objects then this hook should return a\
> + reference to such an object constructed from the normal `C' string\
> + representation provided in @var{string}.\
> + At present, the hook is used by Objective-C only, to obtain a\
> + common-format string object when the target provides one.",
> + tree, (tree string),
> + NULL)
> +
> +DEFHOOK
> +(string_object_ref_type_p,
> + "If a target implements string objects then this hook should return\
> + @code{true} if @var{stringref} is a valid reference to such an object.",
> + bool, (const_tree stringref),
> + hook_bool_const_tree_false)
> +
> +DEFHOOK
> +(check_string_object_format_arg,
> + "If a target implements string objects then this hook should should\
> + ?provide a facility to check the function arguments in @var{args_list}\
> + ?against the format specifiers in @var{format_arg} where the type of\
> + ?@var{format_arg} is one recognized as a valid string reference type.",
> + void, (tree format_arg, tree args_list),
> + NULL)
> +
> +HOOK_VECTOR_END (C90_EMPTY_HACK)
> Index: gcc/target.def
> ===================================================================
> --- gcc/target.def ? ? ?(revision 171986)
> +++ gcc/target.def ? ? ?(working copy)
> @@ -21,68 +21,15 @@
> ? ?You are forbidden to forbid anyone else to use, share and improve
> ? ?what you give them. ? Help stamp out software-hoarding! ?*/
>
> -/* The following macros should be provided by the including file:
> +/* See target-hooks-macros.h for details of macros that should be
> + ? provided by the including file, and how to use them here. ?*/
> +#include "target-hooks-macros.h"
>
> - ? DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
> - ? DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. ?*/
> -
> -/* Defaults for optional macros:
> - ? DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
> - ? with the previous 'hook'. ?*/
> -#ifndef DEFHOOKPODX
> -#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
> -#endif
> -
> -/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
> - ? members into a struct gcc_target, which in turn contains several
> - ? sub-structs. ?*/
> -#ifndef HOOKSTRUCT
> -#define HOOKSTRUCT(FRAGMENT)
> -#endif
> -/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
> - ? HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
> - ? ? ? ? ? ? ? ? ? ?name for nested use. ?*/
> -#ifndef HOOK_VECTOR_1
> -#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
> -#endif
> -#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
> -#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
> +#undef HOOK_TYPE
> +#define HOOK_TYPE "Target Hook"
>
> ?HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
>
> -/* FIXME: For pre-existing hooks, we can't place the documentation in the
> - ? documentation field here till we get permission from the FSF to include
> - ? it in GPLed software - the target hook documentation is so far only
> - ? available under the GFDL. ?*/
> -
> -/* A hook should generally be documented by a string in the DOC parameter,
> - ? which should contain texinfo markup. ?If the documentation is only available
> - ? under the GPL, but not under the GFDL, put it in a comment above the hook
> - ? definition. ?If the function declaration is available both under GPL and
> - ? GFDL, but the documentation is only available under the GFDL, put the
> - ? documentaton in tm.texi.in, heading with @hook <hookname> and closing
> - ? the paragraph with @end deftypefn / deftypevr as appropriate, and marking
> - ? the next autogenerated hook with @hook <hookname>.
> - ? In both these cases, leave the DOC string empty, i.e. "".
> - ? Sometimes, for some historic reason the function declaration
> - ? has to be documented differently
> - ? than what it is. ?In that case, use DEFHOOK_UNDOC to supress auto-generation
> - ? of documentation. ?DEFHOOK_UNDOC takes a DOC string which it ignores, so
> - ? you can put GPLed documentation string there if you have hopes that you
> - ? can clear the declaration & documentation for GFDL distribution later,
> - ? in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
> - ? to turn on the autogeneration of the documentation.
> -
> - ? A documentation string of "*" means not to emit any documentation at all,
> - ? and is mainly used internally for DEFHOOK_UNDOC. ?It should generally not
> - ? be used otherwise, but it has its use for exceptional cases where automatic
> - ? documentation is not wanted, and the real documentation is elsewere, like
> - ? for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
> - ? purposes; they refer to structs, the components of which are documented as
> - ? separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
> - ? A DOC string of 0 is for internal use of DEFHOOKPODX and special table
> - ? entries only. ?*/
> -
> ?/* Functions that output assembler for the target. ?*/
> ?#define HOOK_PREFIX "TARGET_ASM_"
> ?HOOK_VECTOR (TARGET_ASM_OUT, asm_out)
> @@ -2715,58 +2662,5 @@ DEFHOOKPOD
>
> ?/* Leave the boolean fields at the end. ?*/
>
> -/* Empty macro arguments are undefined in C90, so use an empty macro. ?*/
> -#define C90_EMPTY_HACK
> ?/* Close the 'struct gcc_target' definition. ?*/
> ?HOOK_VECTOR_END (C90_EMPTY_HACK)
> -
> -HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
> -
> -/* Handle target switch CODE (an OPT_* value). ?ARG is the argument
> - ? passed to the switch; it is NULL if no argument was. ?VALUE is the
> - ? value of ARG if CODE specifies a UInteger option, otherwise it is
> - ? 1 if the positive form of the switch was used and 0 if the negative
> - ? form was. ?Return true if the switch was valid. ?*/
> -DEFHOOK
> -(handle_c_option,
> - "",
> - bool, (size_t code, const char *arg, int value),
> - default_handle_c_option)
> -
> -/* Targets may provide a string object type that can be used within
> - ? and between C, C++, and Objective-C dialects. ?*/
> -
> -DEFHOOK
> -(objc_construct_string_object,
> - "Targets may provide a string object type that can be used within\
> - and between C, C++ and their respective Objective-C dialects.\
> - A string object might, for example, embed encoding and length information.\
> - These objects are considered opaque to the compiler and handled as references.\
> - An ideal implementation makes the composition of the string object\
> - match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\
> - allowing efficient interworking between C-only and Objective-C code.\
> - If a target implements string objects then this hook should return a\
> - reference to such an object constructed from the normal `C' string\
> - representation provided in @var{string}.\
> - At present, the hook is used by Objective-C only, to obtain a\
> - common-format string object when the target provides one.",
> - tree, (tree string),
> - NULL)
> -
> -DEFHOOK
> -(string_object_ref_type_p,
> - "If a target implements string objects then this hook should return\
> - @code{true} if @var{stringref} is a valid reference to such an object.",
> - bool, (const_tree stringref),
> - hook_bool_const_tree_false)
> -
> -DEFHOOK
> -(check_string_object_format_arg,
> - "If a target implements string objects then this hook should should\
> - ?provide a facility to check the function arguments in @var{args_list}\
> - ?against the format specifiers in @var{format_arg} where the type of\
> - ?@var{format_arg} is one recognized as a valid string reference type.",
> - void, (tree format_arg, tree args_list),
> - NULL)
> -
> -HOOK_VECTOR_END (C90_EMPTY_HACK)
> Index: gcc/target.h
> ===================================================================
> --- gcc/target.h ? ? ? ?(revision 171986)
> +++ gcc/target.h ? ? ? ?(working copy)
> @@ -176,7 +176,4 @@ struct default_options
>
> ?extern struct gcc_target targetm;
>
> -/* Each target can provide their own. ?*/
> -extern struct gcc_targetcm targetcm;
> -
> ?#endif /* GCC_TARGET_H */
> Index: gcc/objc/Make-lang.in
> ===================================================================
> --- gcc/objc/Make-lang.in ? ? ? (revision 171986)
> +++ gcc/objc/Make-lang.in ? ? ? (working copy)
> @@ -98,7 +98,8 @@ objc/objc-next-runtime-abi-02.o: objc/ob
> ?objc/objc-act.o : objc/objc-act.c $(START_HDRS) $(GGC_H) \
> ? ?$(DIAGNOSTIC_CORE_H) toplev.h $(FLAGS_H) input.h $(FUNCTION_H) output.h debug.h \
> ? ?$(LANGHOOKS_DEF_H) $(HASHTAB_H) $(C_PRAGMA_H) gt-objc-objc-act.h $(OBSTACK_H) \
> - ? $(GIMPLE_H) objc/objc-runtime-shared-support.h objc/objc-runtime-hooks.h
> + ? $(GIMPLE_H) objc/objc-runtime-shared-support.h objc/objc-runtime-hooks.h \
> + ? $(C_TARGET_H)
>
> ?objc.srcextra:
>
> Index: gcc/objc/objc-act.c
> ===================================================================
> --- gcc/objc/objc-act.c (revision 171986)
> +++ gcc/objc/objc-act.c (working copy)
> @@ -46,7 +46,7 @@ along with GCC; see the file COPYING3.
> ?#include "toplev.h"
> ?#include "ggc.h"
> ?#include "debug.h"
> -#include "target.h"
> +#include "c-family/c-target.h"
> ?#include "diagnostic-core.h"
> ?#include "intl.h"
> ?#include "cgraph.h"
> Index: gcc/target-hooks-macros.h
> ===================================================================
> --- gcc/target-hooks-macros.h ? (revision 0)
> +++ gcc/target-hooks-macros.h ? (revision 0)
> @@ -0,0 +1,82 @@
> +/* Common macros for target hook definitions.
> + ? Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
> + ? 2011
> + ? Free Software Foundation, Inc.
> +
> + ? This program 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 3, or (at your option) any
> + ? later version.
> +
> + ? This program 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 this program; see the file COPYING3. ?If not see
> + ? <http://www.gnu.org/licenses/>. ?*/
> +
> +/* The following macros should be provided by the including file:
> +
> + ? DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
> + ? DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. ?*/
> +
> +/* Defaults for optional macros:
> + ? DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
> + ? with the previous 'hook'. ?*/
> +#ifndef DEFHOOKPODX
> +#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
> +#endif
> +
> +/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
> + ? members into a struct gcc_target, which in turn contains several
> + ? sub-structs. ?*/
> +#ifndef HOOKSTRUCT
> +#define HOOKSTRUCT(FRAGMENT)
> +#endif
> +/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
> + ? HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
> + ? ? ? ? ? ? ? ? ? ?name for nested use. ?*/
> +#ifndef HOOK_VECTOR_1
> +#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
> +#endif
> +#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
> +#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
> +
> +/* FIXME: For pre-existing hooks, we can't place the documentation in the
> + ? documentation field here till we get permission from the FSF to include
> + ? it in GPLed software - the target hook documentation is so far only
> + ? available under the GFDL. ?*/
> +
> +/* A hook should generally be documented by a string in the DOC parameter,
> + ? which should contain texinfo markup. ?If the documentation is only available
> + ? under the GPL, but not under the GFDL, put it in a comment above the hook
> + ? definition. ?If the function declaration is available both under GPL and
> + ? GFDL, but the documentation is only available under the GFDL, put the
> + ? documentaton in tm.texi.in, heading with @hook <hookname> and closing
> + ? the paragraph with @end deftypefn / deftypevr as appropriate, and marking
> + ? the next autogenerated hook with @hook <hookname>.
> + ? In both these cases, leave the DOC string empty, i.e. "".
> + ? Sometimes, for some historic reason the function declaration
> + ? has to be documented differently
> + ? than what it is. ?In that case, use DEFHOOK_UNDOC to supress auto-generation
> + ? of documentation. ?DEFHOOK_UNDOC takes a DOC string which it ignores, so
> + ? you can put GPLed documentation string there if you have hopes that you
> + ? can clear the declaration & documentation for GFDL distribution later,
> + ? in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
> + ? to turn on the autogeneration of the documentation.
> +
> + ? ?A documentation string of "*" means not to emit any documentation at all,
> + ? and is mainly used internally for DEFHOOK_UNDOC. ?It should generally not
> + ? be used otherwise, but it has its use for exceptional cases where automatic
> + ? documentation is not wanted, and the real documentation is elsewere, like
> + ? for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
> + ? purposes; they refer to structs, the components of which are documented as
> + ? separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
> + ? A DOC string of 0 is for internal use of DEFHOOKPODX and special table
> + ? entries only. ?*/
> +
> +/* Empty macro arguments are undefined in C90, so use an empty macro
> + ? to close top-level hook structures. ?*/
> +#define C90_EMPTY_HACK
> Index: gcc/genhooks.c
> ===================================================================
> --- gcc/genhooks.c ? ? ?(revision 171986)
> +++ gcc/genhooks.c ? ? ?(working copy)
> @@ -1,6 +1,6 @@
> ?/* Process target.def to create initialization macros definition in
> ? ?target-hooks-def.h and documentation in target-hooks.texi.
> - ? Copyright (C) 2009, 2010 Free Software Foundation, Inc.
> + ? Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
>
> ?This file is part of GCC.
>
> @@ -22,17 +22,18 @@ along with GCC; see the file COPYING3.
> ?#include "hashtab.h"
> ?#include "errors.h"
>
> -struct hook_desc { const char *doc, *type, *name, *param, *init; };
> +struct hook_desc { const char *doc, *type, *name, *param, *init, *docname; };
> ?static struct hook_desc hook_array[] = {
> -#define HOOK_VECTOR_1(NAME, FRAGMENT) \
> - ?{ 0, 0, #NAME, 0, 0 },
> +#define HOOK_VECTOR_1(NAME, FRAGMENT) ?\
> + ?{ 0, 0, #NAME, 0, 0, HOOK_TYPE },
> ?#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) \
> - ?{ DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT },
> + ?{ DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT, HOOK_TYPE },
> ?#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) \
> - ?{ DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
> + ?{ DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
> ?#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT) \
> - ?{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
> + ?{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
> ?#include "target.def"
> +#include "c-family/c-target.def"
> ?#undef DEFHOOK
> ?};
>
> @@ -221,7 +222,7 @@ emit_documentation (const char *in_fname
> ? ? ? ? ? ? ?/* Print header. ?Function-valued hooks have a parameter list,
> ? ? ? ? ? ? ? ? unlike POD-valued ones. ?*/
> ? ? ? ? ? ? ?deftype = hook_array[i].param ? "deftypefn" : "deftypevr";
> - ? ? ? ? ? ? printf ("@%s {Target Hook} ", deftype);
> + ? ? ? ? ? ? printf ("@%s {%s} ", deftype, hook_array[i].docname);
> ? ? ? ? ? ? ?if (strchr (hook_array[i].type, ' '))
> ? ? ? ? ? ? ? ?printf ("{%s}", hook_array[i].type);
> ? ? ? ? ? ? ?else
> @@ -249,8 +250,9 @@ emit_documentation (const char *in_fname
> ? ? ? ? ? ? ? ?{
> ? ? ? ? ? ? ? ? ?char *namex = upstrdup (hook_array[j].name);
>
> - ? ? ? ? ? ? ? ? printf ("\n@%sx {Target Hook} {%s} %s",
> - ? ? ? ? ? ? ? ? ? ? ? ? deftype, hook_array[j].type, namex);
> + ? ? ? ? ? ? ? ? printf ("\n@%sx {%s} {%s} %s",
> + ? ? ? ? ? ? ? ? ? ? ? ? deftype, hook_array[j].docname,
> + ? ? ? ? ? ? ? ? ? ? ? ? hook_array[j].type, namex);
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ?if (hook_array[i].doc[0])
> ? ? ? ? ? ? ? ?{
> @@ -285,9 +287,10 @@ emit_documentation (const char *in_fname
>
> ?/* Emit #defines to stdout (this will be redirected to generate
> ? ?target-hook-def.h) which set target hooks initializer macros
> - ? to their default values. ?*/
> + ? to their default values. ?These should only be emitted for hooks
> + ? whose type is given by DOCNAME. ?*/
> ?static void
> -emit_init_macros (void)
> +emit_init_macros (const char *docname)
> ?{
> ? int i;
> ? const int MAX_NEST = 2;
> @@ -299,6 +302,9 @@ emit_init_macros (void)
> ? ? ? ?{
> ? ? ? ? ?char *name = upstrdup (hook_array[i].name);
>
> + ? ? ? ? if (strcmp (hook_array[i].docname, docname) != 0)
> + ? ? ? ? ? continue;
> +
> ? ? ? ? ?if (!hook_array[i].type)
> ? ? ? ? ? ?{
> ? ? ? ? ? ? ?if (*name)
> @@ -334,9 +340,9 @@ emit_init_macros (void)
> ?int
> ?main (int argc, char **argv)
> ?{
> - ?if (argc >= 2)
> - ? ?emit_documentation (argv[1]);
> + ?if (argc >= 3)
> + ? ?emit_documentation (argv[2]);
> ? else
> - ? ?emit_init_macros ();
> + ? ?emit_init_macros (argv[1]);
> ? return 0;
> ?}
> Index: gcc/system.h
> ===================================================================
> --- gcc/system.h ? ? ? ?(revision 171986)
> +++ gcc/system.h ? ? ? ?(working copy)
> @@ -830,7 +830,7 @@ extern void fancy_abort (const char *, i
> ? ? ? ?FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST ?\
> ? ? ? ?USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE ? ? ? \
> ? ? ? ?FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION ? ? ? ? ? ? \
> - ? ? ? MACHINE_TYPE
> + ? ? ? MACHINE_TYPE TARGET_HAS_TARGETCM
>
> ?/* Hooks that are no longer used. ?*/
> ?#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE ?\
> Index: gcc/config.gcc
> ===================================================================
> --- gcc/config.gcc ? ? ?(revision 171986)
> +++ gcc/config.gcc ? ? ?(working copy)
> @@ -183,6 +183,9 @@
> ?#
> ?# ?gnu_ld ? ? ? ? ? ? ?Set to yes or no depending on whether the target
> ?# ? ? ? ? ? ? ? ? ? ? ?system normally uses GNU ld.
> +#
> +# ?target_has_targetcm Set to yes or no depending on whether the target
> +# ? ? ? ? ? ? ? ? ? ? ?has its own definition of targetcm.
>
> ?out_file=
> ?tmake_file=
> @@ -200,6 +203,7 @@ extra_options=
> ?c_target_objs=
> ?cxx_target_objs=
> ?fortran_target_objs=
> +target_has_targetcm=no
> ?tm_defines=
> ?xm_defines=
> ?# Set this to force installation and use of collect2.
> @@ -478,6 +482,7 @@ case ${target} in
> ? c_target_objs="${c_target_objs} darwin-c.o"
> ? cxx_target_objs="${cxx_target_objs} darwin-c.o"
> ? fortran_target_objs="darwin-f.o"
> + ?target_has_targetcm=yes
> ? extra_objs="darwin.o"
> ? extra_gcc_objs="darwin-driver.o"
> ? default_use_cxa_atexit=yes
> @@ -2661,6 +2666,11 @@ powerpc*-*-* | rs6000-*-*)
> ? ? ? ?tm_file="${tm_file} rs6000/option-defaults.h"
> ?esac
>
> +if [ "$target_has_targetcm" = "no" ]; then
> + ?c_target_objs="$c_target_objs default-c.o"
> + ?cxx_target_objs="$cxx_target_objs default-c.o"
> +fi
> +
> ?# Support for --with-cpu and related options (and a few unrelated options,
> ?# too).
> ?case ${with_cpu} in
> Index: gcc/Makefile.in
> ===================================================================
> --- gcc/Makefile.in ? ? (revision 171986)
> +++ gcc/Makefile.in ? ? (working copy)
> @@ -873,12 +873,17 @@ endif
> ?# Shorthand variables for dependency lists.
> ?VEC_H = vec.h statistics.h
> ?EXCEPT_H = except.h $(HASHTAB_H) vecprim.h vecir.h
> -TARGET_H = $(TM_H) target.h target.def insn-modes.h
> +TARGET_DEF = target.def target-hooks-macros.h
> +C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h
> +TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h
> +C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
> ?MACHMODE_H = machmode.h mode-classes.def insn-modes.h
> ?HOOKS_H = hooks.h $(MACHMODE_H)
> ?HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
> ?LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
> ?TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
> +C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \
> + ?$(TREE_H) $(C_COMMON_H) $(HOOKS_H)
> ?RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
> ? $(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h \
> ? $(HASHTAB_H)
> @@ -2110,7 +2115,7 @@ c-family/c-dump.o : c-family/c-dump.c $(
>
> ?c-family/c-format.o : c-family/c-format.c c-family/c-format.h \
> ? ? ? ?$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
> - ? ? ? $(C_COMMON_H) $(FLAGS_H) intl.h \
> + ? ? ? $(C_COMMON_H) $(FLAGS_H) intl.h $(C_TARGET_H) \
> ? ? ? ?$(DIAGNOSTIC_CORE_H) alloc-pool.h c-family/c-objc.h
>
> ?c-family/c-gimplify.o : c-family/c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
> @@ -2129,7 +2134,7 @@ c-family/c-omp.o : c-family/c-omp.c $(CO
>
> ?c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> ? ? ? ? $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
> - ? ? ? ?$(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) ? \
> + ? ? ? ?$(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) $(C_TARGET_H) \
> ? ? ? ? $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
> ? ? ? ?$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
> ? ? ? ? ? ? ? ?$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
> @@ -2168,6 +2173,10 @@ c-family/c-ada-spec.o : c-family/c-ada-s
> ?c-family/stub-objc.o : c-family/stub-objc.c $(CONFIG_H) $(SYSTEM_H) \
> ? ? ? ?coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-objc.h
>
> +default-c.o: config/default-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> + ?$(C_TARGET_H) $(C_TARGET_DEF_H)
> + ? ? ? $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
> + ? ? ? ? $< $(OUTPUT_OPTION)
>
> ?# Files used by all variants of C and some other languages.
>
> @@ -3658,11 +3667,21 @@ target-hooks-def.h: s-target-hooks-def-h
> ?$(srcdir)/doc/tm.texi: s-tm-texi; @true
>
> ?s-target-hooks-def-h: build/genhooks$(build_exeext)
> - ? ? ? $(RUN_GEN) build/genhooks$(build_exeext) > tmp-target-hooks-def.h
> + ? ? ? $(RUN_GEN) build/genhooks$(build_exeext) "Target Hook" \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?> tmp-target-hooks-def.h
> ? ? ? ?$(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? target-hooks-def.h
> ? ? ? ?$(STAMP) s-target-hooks-def-h
>
> +c-family/c-target-hooks-def.h: s-c-target-hooks-def-h; @true
> +
> +s-c-target-hooks-def-h: build/genhooks$(build_exeext)
> + ? ? ? $(RUN_GEN) build/genhooks$(build_exeext) "C Target Hook" \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?> tmp-c-target-hooks-def.h
> + ? ? ? $(SHELL) $(srcdir)/../move-if-change tmp-c-target-hooks-def.h \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?c-family/c-target-hooks-def.h
> + ? ? ? $(STAMP) s-c-target-hooks-def-h
> +
> ?# check if someone mistakenly only changed tm.texi.
> ?# We use a different pathname here to avoid a circular dependency.
> ?s-tm-texi: $(srcdir)/doc/../doc/tm.texi
> @@ -3672,7 +3691,7 @@ s-tm-texi: $(srcdir)/doc/../doc/tm.texi
> ?# \r is not portable to Solaris tr, therefore we have a special
> ?# case for ASCII. ?We use \r for other encodings like EBCDIC.
> ?s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
> - ? ? ? $(RUN_GEN) build/genhooks$(build_exeext) \
> + ? ? ? $(RUN_GEN) build/genhooks$(build_exeext) -d \
> ? ? ? ? ? ? ? ? ? ? ? ?$(srcdir)/doc/tm.texi.in > tmp-tm.texi
> ? ? ? ?case `echo X|tr X '\101'` in \
> ? ? ? ? ?A) tr -d '\015' < tmp-tm.texi > tmp2-tm.texi ;; \
> @@ -3683,7 +3702,9 @@ s-tm-texi: build/genhooks$(build_exeext)
> ? ? ? ?@if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
> ? ? ? ? ?$(STAMP) $@; \
> ? ? ? ?elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
> - ? ? ? ? && test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def; then \
> + ? ? ? ? && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \
> + ? ? ? ? ? || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \
> + ? ? ? ? ); then \
> ? ? ? ? ?echo >&2 ; \
> ? ? ? ? ?echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
> ? ? ? ? ?false; \
> @@ -3896,7 +3917,8 @@ build/genpreds.o : genpreds.c $(RTL_BASE
> ? coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h $(OBSTACK_H)
> ?build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) ? \
> ? coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
> -build/genhooks.o : genhooks.c target.def $(BCONFIG_H) $(SYSTEM_H) errors.h
> +build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) ? ? ? ? ? ?\
> + ?$(BCONFIG_H) $(SYSTEM_H) errors.h
>
> ?# Compile the programs that generate insn-* from the machine description.
> ?# They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
> Index: gcc/config/t-darwin
> ===================================================================
> --- gcc/config/t-darwin (revision 171986)
> +++ gcc/config/t-darwin (working copy)
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
> +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
> ?# Free Software Foundation, Inc.
> ?#
> ?# This file is part of GCC.
> @@ -29,7 +29,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CO
>
> ?darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> ? $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(TM_P_H) \
> - ?incpath.h flags.h $(C_COMMON_H)
> + ?incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H)
> ? ? ? ?$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> ? ? ? ? ? ? ? ?$(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
>
> Index: gcc/config/darwin-c.c
> ===================================================================
> --- gcc/config/darwin-c.c ? ? ? (revision 171986)
> +++ gcc/config/darwin-c.c ? ? ? (working copy)
> @@ -1,5 +1,5 @@
> ?/* Darwin support needed only by C/C++ frontends.
> - ? Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2010
> + ? Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2010, 2011
> ? ?Free Software Foundation, Inc.
> ? ?Contributed by Apple Computer Inc.
>
> @@ -34,8 +34,8 @@ along with GCC; see the file COPYING3.
> ?#include "tm_p.h"
> ?#include "cppdefault.h"
> ?#include "prefix.h"
> -#include "target.h"
> -#include "target-def.h"
> +#include "c-family/c-target.h"
> +#include "c-family/c-target-def.h"
>
> ?/* Pragmas. ?*/
>
> @@ -660,13 +660,8 @@ handle_c_option (size_t code,
> ? return true;
> ?}
>
> -#undef TARGET_HANDLE_C_OPTION
> -#define TARGET_HANDLE_C_OPTION handle_c_option
> -
> -struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
> -
> ?/* Allow ObjC* access to CFStrings. ?*/
> -tree
> +static tree
> ?darwin_objc_construct_string (tree str)
> ?{
> ? if (!darwin_constant_cfstrings)
> @@ -685,7 +680,7 @@ darwin_objc_construct_string (tree str)
> ?/* The string ref type is created as CFStringRef by <CFBase.h> therefore, we
> ? ?must match for it explicitly, since it's outside the gcc code. ?*/
>
> -bool
> +static bool
> ?darwin_cfstring_ref_p (const_tree strp)
> ?{
> ? tree tn;
> @@ -701,7 +696,7 @@ darwin_cfstring_ref_p (const_tree strp)
> ?}
>
> ?/* At present the behavior of this is undefined and it does nothing. ?*/
> -void
> +static void
> ?darwin_check_cfstring_format_arg (tree ARG_UNUSED (format_arg),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?tree ARG_UNUSED (args_list))
> ?{
> @@ -715,3 +710,17 @@ EXPORTED_CONST format_kind_info darwin_a
> ? ? NULL, NULL
> ? }
> ?};
> +
> +#undef TARGET_HANDLE_C_OPTION
> +#define TARGET_HANDLE_C_OPTION handle_c_option
> +
> +#undef TARGET_OBJC_CONSTRUCT_STRING_OBJECT
> +#define TARGET_OBJC_CONSTRUCT_STRING_OBJECT darwin_objc_construct_string
> +
> +#undef TARGET_STRING_OBJECT_REF_TYPE_P
> +#define TARGET_STRING_OBJECT_REF_TYPE_P darwin_cfstring_ref_p
> +
> +#undef TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
> +#define TARGET_CHECK_STRING_OBJECT_FORMAT_ARG darwin_check_cfstring_format_arg
> +
> +struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
> Index: gcc/config/default-c.c
> ===================================================================
> --- gcc/config/default-c.c ? ? ?(revision 0)
> +++ gcc/config/default-c.c ? ? ?(revision 0)
> @@ -0,0 +1,34 @@
> +/* Default C-family target hooks initializer.
> + ? Copyright (C) 2011
> + ? Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +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 3, or (at your option) any later
> +version.
> +
> +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 GCC; see the file COPYING3. ?If not see
> +<http://www.gnu.org/licenses/>. ?*/
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "c-family/c-target.h"
> +#include "c-family/c-target-def.h"
> +
> +/* Do not include tm.h or tm_p.h here; if it is useful for a target to
> + ? define some macros for the initializer in a header without defining
> + ? targetcm itself (for example, because of interactions with some
> + ? hooks depending on the target OS and others on the target
> + ? architecture), create a separate tm_c.h for only the relevant
> + ? definitions. ?*/
> +
> +struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
> Index: gcc/config/darwin-protos.h
> ===================================================================
> --- gcc/config/darwin-protos.h ?(revision 171986)
> +++ gcc/config/darwin-protos.h ?(working copy)
> @@ -1,5 +1,5 @@
> ?/* Prototypes.
> - ? Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
> + ? Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010, 2011
> ? ?Free Software Foundation, Inc.
>
> ?This file is part of GCC.
> @@ -112,10 +112,7 @@ extern void darwin_cpp_builtins (struct
>
> ?extern tree darwin_init_cfstring_builtins (unsigned);
> ?extern tree darwin_fold_builtin (tree, int, tree *, bool);
> -extern tree darwin_objc_construct_string (tree);
> ?extern bool darwin_cfstring_p (tree);
> -extern bool darwin_cfstring_ref_p (const_tree);
> -extern void darwin_check_cfstring_format_arg (tree, tree);
> ?extern tree darwin_build_constant_cfstring (tree);
> ?extern void darwin_enter_string_into_cfstring_table (tree);
>
> Index: gcc/config/darwin.h
> ===================================================================
> --- gcc/config/darwin.h (revision 171986)
> +++ gcc/config/darwin.h (working copy)
> @@ -965,20 +965,9 @@ __enable_execute_stack (void *addr)
> ?/* We have target-specific builtins. ?*/
> ?#define TARGET_FOLD_BUILTIN darwin_fold_builtin
>
> -#define TARGET_OBJC_CONSTRUCT_STRING_OBJECT \
> - ?darwin_objc_construct_string
> -
> -#define TARGET_STRING_OBJECT_REF_TYPE_P \
> - ?darwin_cfstring_ref_p
> -
> ?#define TARGET_N_FORMAT_TYPES 1
> ?#define TARGET_FORMAT_TYPES darwin_additional_format_types
>
> -#define TARGET_CHECK_STRING_OBJECT_FORMAT_ARG \
> - ?darwin_check_cfstring_format_arg
> -
> -#define TARGET_HAS_TARGETCM 1
> -
> ?#ifndef USED_FOR_TARGET
> ?extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **);
> ?#define GCC_DRIVER_HOST_INITIALIZATION \
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]