re PR other/44034 (target hooks are hard to maintain)

gcc:
	PR other/44034
	* target.def, doc/tm.texi.in, genhooks.c: New files.
	* target.h: Instead of defining individual hook members,
	define DEFHOOKPOD / DEFHOOK / DEFHOOK_UNDOC / HOOKSTRUCT and
	include target.def.
	* target-def.h: Instead of defining individual hook initializers,
	include target-hooks-def.h.
	* df-scan.c, haifa-sched.c, sel-sched.c: Rename targetm members:
	targetm.live_on_entry -> targetm.extra_live_on_entry
	targetm.sched.md_finish ->targetm.sched.finish
	targetm.sched.md_init -> targetm.sched.init
	targetm.sched.md_init_global -> targetm.sched.init_global
	targetm.asm_out.unwind_label -> targetm.asm_out.emit_unwind_label
	targetm.asm_out.except_table_label ->
	  targetm.asm_out.emit_except_table_label
	targetm.asm_out.visibility -> targetm.asm_out.assemble_visibility
	targetm.target_help -> targetm.help
	targetm.vectorize.builtin_support_vector_misalignment ->
	  targetm.vectorize.support_vector_misalignment
	targetm.file_start_app_off -> targetm.asm_file_start_app_off
	targetm.file_start_file_directive ->
	 targetm.asm_file_start_file_directive
	* dwarf2out.c, opts.c, tree-vect-data-refs.c, except.c: Likewise.
	* varasm.c, config/alpha/alpha.c, config/cris/cris.c: Likewise.
	* gcc/config/spu/spu.c, config/ia64/ia64.c: Rename target macros:
	TARGET_VECTOR_ALIGNMENT_REACHABLE ->
	  TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
	TARGET_SUPPORT_VECTOR_MISALIGNMENT ->
	  TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
	TARGET_UNWIND_EMIT -> TARGET_ASM_UNWIND_EMIT
	* config/rs6000/rs6000.c, config/arm/arm.c: Likewise.
	* Makefile.in (TARGET_H): Depend on target.def.
	(TARGET_DEF_H): Depend on target-hooks-def.h.
	(target-hooks-def.h, tm.texi, s-target-hooks-def-h): New rules.
	(s-tm-texi, build/genhooks.o, build/genhooks): Likewise.
	* doc/tm.texi: Regenerate.
gcc/c-family:
	* c-common.c: Rename targetm member:
	targetm.enum_va_list -> targetm.enum_va_list_p
gcc/po:
	* EXCLUDES: Add genhooks.c.
Index: gcc/doc/tm.texi

From-SVN: r161547
This commit is contained in:
Joern Rennecke 2010-06-29 18:22:00 +00:00 committed by Joern Rennecke
parent c75c86636f
commit 38f8b050ed
26 changed files with 14037 additions and 2291 deletions

View File

@ -1,3 +1,42 @@
2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
PR other/44034
* target.def, doc/tm.texi.in, genhooks.c: New files.
* target.h: Instead of defining individual hook members,
define DEFHOOKPOD / DEFHOOK / DEFHOOK_UNDOC / HOOKSTRUCT and
include target.def.
* target-def.h: Instead of defining individual hook initializers,
include target-hooks-def.h.
* df-scan.c, haifa-sched.c, sel-sched.c: Rename targetm members:
targetm.live_on_entry -> targetm.extra_live_on_entry
targetm.sched.md_finish ->targetm.sched.finish
targetm.sched.md_init -> targetm.sched.init
targetm.sched.md_init_global -> targetm.sched.init_global
targetm.asm_out.unwind_label -> targetm.asm_out.emit_unwind_label
targetm.asm_out.except_table_label ->
targetm.asm_out.emit_except_table_label
targetm.asm_out.visibility -> targetm.asm_out.assemble_visibility
targetm.target_help -> targetm.help
targetm.vectorize.builtin_support_vector_misalignment ->
targetm.vectorize.support_vector_misalignment
targetm.file_start_app_off -> targetm.asm_file_start_app_off
targetm.file_start_file_directive ->
targetm.asm_file_start_file_directive
* dwarf2out.c, opts.c, tree-vect-data-refs.c, except.c: Likewise.
* varasm.c, config/alpha/alpha.c, config/cris/cris.c: Likewise.
* gcc/config/spu/spu.c, config/ia64/ia64.c: Rename target macros:
TARGET_VECTOR_ALIGNMENT_REACHABLE ->
TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
TARGET_SUPPORT_VECTOR_MISALIGNMENT ->
TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
TARGET_UNWIND_EMIT -> TARGET_ASM_UNWIND_EMIT
* config/rs6000/rs6000.c, config/arm/arm.c: Likewise.
* Makefile.in (TARGET_H): Depend on target.def.
(TARGET_DEF_H): Depend on target-hooks-def.h.
(target-hooks-def.h, tm.texi, s-target-hooks-def-h): New rules.
(s-tm-texi, build/genhooks.o, build/genhooks): Likewise.
* doc/tm.texi: Regenerate.
2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
PR bootstrap/44713

View File

@ -861,12 +861,12 @@ endif
VEC_H = vec.h statistics.h
EXCEPT_H = except.h $(HASHTAB_H) vecprim.h vecir.h
TOPLEV_H = toplev.h $(INPUT_H) bversion.h $(DIAGNOSTIC_CORE_H)
TARGET_H = $(TM_H) target.h insn-modes.h
TARGET_H = $(TM_H) target.h target.def insn-modes.h
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 $(HOOKS_H) targhooks.h
TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.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
FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
@ -3674,6 +3674,36 @@ s-constrs-h: $(MD_DEPS) build/genpreds$(build_exeext)
$(SHELL) $(srcdir)/../move-if-change tmp-constrs.h tm-constrs.h
$(STAMP) s-constrs-h
target-hooks-def.h: s-target-hooks-def-h; @true
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
$(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
target-hooks-def.h
$(STAMP) s-target-hooks-def-h
# check if someone mistakenly only changed tm.texi.
s-tm-texi: $(srcdir)/doc/tm.texi
s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
$(RUN_GEN) build/genhooks$(build_exeext) \
$(srcdir)/doc/tm.texi.in > tmp-tm.texi
$(SHELL) $(srcdir)/../move-if-change tmp-tm.texi tm.texi
@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)/doc/target.def; then \
echo >&2 ; \
echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
false; \
else \
echo >&2 ; \
echo Verify that you have permission to grant a GFDL license for all >&2 ; \
echo new text in tm.texi, then copy it to $(srcdir)/doc/tm.texi. >&2 ; \
false; \
fi
GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/vecprim.h $(srcdir)/vecir.h \
$(host_xm_file_list) \
@ -3852,6 +3882,7 @@ build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
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
# Compile the programs that generate insn-* from the machine description.
# They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@ -3881,6 +3912,7 @@ build/genautomata$(build_exeext) : BUILD_LIBS += -lm
# These programs are not linked with the MD reader.
build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o
build/genhooks$(build_exeext) : $(BUILD_ERRORS)
# Generated source files for gengtype.
gengtype-lex.c : gengtype-lex.l

View File

@ -1,3 +1,9 @@
2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
PR other/44034
* c-common.c: Rename targetm member:
targetm.enum_va_list -> targetm.enum_va_list_p
2010-06-28 Anatoly Sokolov <aesok@post.ru>
* c-common.c (shorten_compare): Adjust call to force_fit_type_double.

View File

@ -4906,13 +4906,13 @@ c_common_nodes_and_builtins (void)
(build_decl (UNKNOWN_LOCATION,
TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));
if (targetm.enum_va_list)
if (targetm.enum_va_list_p)
{
int l;
const char *pname;
tree ptype;
for (l = 0; targetm.enum_va_list (l, &pname, &ptype); ++l)
for (l = 0; targetm.enum_va_list_p (l, &pname, &ptype); ++l)
{
lang_hooks.decls.pushdecl
(build_decl (UNKNOWN_LOCATION,

View File

@ -9742,7 +9742,7 @@ alpha_file_start (void)
/* 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);
targetm.asm_file_start_file_directive = (write_symbols == DBX_DEBUG);
#endif
default_file_start ();

View File

@ -434,8 +434,8 @@ static const struct attribute_spec arm_attribute_table[] =
#define TARGET_MUST_PASS_IN_STACK arm_must_pass_in_stack
#ifdef TARGET_UNWIND_INFO
#undef TARGET_UNWIND_EMIT
#define TARGET_UNWIND_EMIT arm_unwind_emit
#undef TARGET_ASM_UNWIND_EMIT
#define TARGET_ASM_UNWIND_EMIT arm_unwind_emit
/* EABI unwinding tables use a different format for the typeinfo tables. */
#undef TARGET_ASM_TTYPE

View File

@ -2571,8 +2571,8 @@ cris_file_start (void)
{
/* These expressions can vary at run time, so we cannot put
them into TARGET_INITIALIZER. */
targetm.file_start_app_off = !(TARGET_PDEBUG || flag_print_asm_name);
targetm.file_start_file_directive = TARGET_ELF;
targetm.asm_file_start_app_off = !(TARGET_PDEBUG || flag_print_asm_name);
targetm.asm_file_start_file_directive = TARGET_ELF;
default_file_start ();
}

View File

@ -510,8 +510,8 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg
#undef TARGET_UNWIND_EMIT
#define TARGET_UNWIND_EMIT process_for_unwind_directive
#undef TARGET_ASM_UNWIND_EMIT
#define TARGET_ASM_UNWIND_EMIT process_for_unwind_directive
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P ia64_scalar_mode_supported_p

View File

@ -1462,11 +1462,11 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM rs6000_builtin_vec_perm
#undef TARGET_SUPPORT_VECTOR_MISALIGNMENT
#define TARGET_SUPPORT_VECTOR_MISALIGNMENT \
#undef TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
#define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT \
rs6000_builtin_support_vector_misalignment
#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
#undef TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS rs6000_init_builtins

View File

@ -432,8 +432,8 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST spu_builtin_vectorization_cost
#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
#undef TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM spu_builtin_vec_perm

View File

@ -3922,7 +3922,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
bitmap_set_bit (entry_block_defs, REGNO (INCOMING_RETURN_ADDR_RTX));
#endif
targetm.live_on_entry (entry_block_defs);
targetm.extra_live_on_entry (entry_block_defs);
}

View File

@ -4425,8 +4425,7 @@ specially by the compiler and was not mentioned in the C code being
compiled.
@end defmac
@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode
@var{mode}, const_rtx @var{fun})
@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode @var{mode}, const_rtx @var{fun})
Define this hook if the back-end needs to know the name of the libcall
function in order to determine where the result should be returned.
@ -5744,7 +5743,7 @@ return type of the vectorized function shall be of vector type
@var{vec_type_out} and the argument types should be @var{vec_type_in}.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed})
@deftypefn {Target Hook} bool TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed})
This hook should return true if the target supports misaligned vector
store/load of a specific factor denoted in the @var{misalignment}
parameter. The vector store/load should be of machine mode @var{mode} and
@ -8693,7 +8692,7 @@ to be broken up according to function.
The default is that no label is emitted.
@end deftypefn
@deftypefn {Target Hook} void TARGET_UNWIND_EMIT (FILE *@var{stream}, rtx @var{insn})
@deftypefn {Target Hook} void TARGET_ASM_UNWIND_EMIT (FILE *@var{stream}, rtx @var{insn})
This target hook emits assembly directives required to unwind the
given instruction. This is only used when TARGET_UNWIND_INFO is set.
@end deftypefn
@ -8757,7 +8756,7 @@ default.
@defmac TARGET_UNWIND_INFO
Define this macro if your target has ABI specified unwind tables. Usually
these will be output by @code{TARGET_UNWIND_EMIT}.
these will be output by @code{TARGET_ASM_UNWIND_EMIT}.
@end defmac
@deftypevr {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT
@ -9628,9 +9627,7 @@ to perform initial processing of the @samp{dllimport} and
@end deftypefn
@deftypefn {Target Hook} bool TARGET_VALID_DLLIMPORT_ATTRIBUTE_P (const_tree @var{decl})
@var{decl} is a variable or function with @code{__attribute__((dllimport))}
specified. Use this hook if the target needs to add extra validation
checks to @code{handle_dll_attribute}.
@var{decl} is a variable or function with @code{__attribute__((dllimport))} specified. Use this hook if the target needs to add extra validation checks to @code{handle_dll_attribute}.
@end deftypefn
@defmac TARGET_DECLSPEC
@ -9902,7 +9899,7 @@ This hook should return @code{true} if the element size should be stored in
array cookies. The default is to return @code{false}.
@end deftypefn
@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree @var{type}, int @var{import_export})
@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree @var{type}, int @var{import_export})
If defined by a backend this hook allows the decision made to export
class @var{type} to be overruled. Upon entry @var{import_export}
will contain 1 if the class is going to be exported, @minus{}1 if it is going
@ -9928,12 +9925,7 @@ method. The default is to return @code{true}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY (tree @var{decl})
@var{decl} is a virtual table, virtual table table, typeinfo object,
or other similar implicit class data object that will be emitted with
external linkage in this translation unit. No ELF visibility has been
explicitly specified. If the target needs to specify a visibility
other than that of the containing class, use this hook to set
@code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.
@var{decl} is a virtual table, virtual table table, typeinfo object, or other similar implicit class data object that will be emitted with external linkage in this translation unit. No ELF visibility has been explicitly specified. If the target needs to specify a visibility other than that of the containing class, use this hook to set @code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT (void)
@ -9965,9 +9957,7 @@ unloaded. The default is to return false.
@end deftypefn
@deftypefn {Target Hook} void TARGET_CXX_ADJUST_CLASS_AT_DEFINITION (tree @var{type})
@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been
defined. Use this hook to make adjustments to the class (eg, tweak
visibility or perform any other required target modifications).
@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been defined. Use this hook to make adjustments to the class (eg, tweak visibility or perform any other required target modifications).
@end deftypefn
@node Named Address Spaces

11171
gcc/doc/tm.texi.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3463,8 +3463,8 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
char l1[20], l2[20];
dw_cfi_ref cfi;
targetm.asm_out.unwind_label (asm_out_file, fde->decl, for_eh,
/* empty */ 0);
targetm.asm_out.emit_unwind_label (asm_out_file, fde->decl, for_eh,
/* empty */ 0);
targetm.asm_out.internal_label (asm_out_file, FDE_LABEL,
for_eh + j);
ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + j);
@ -3680,7 +3680,8 @@ output_call_frame_info (int for_eh)
else if (fde_needed_for_eh_p (&fde_table[i]))
any_eh_needed = true;
else if (TARGET_USES_WEAK_UNWIND_INFO)
targetm.asm_out.unwind_label (asm_out_file, fde_table[i].decl, 1, 1);
targetm.asm_out.emit_unwind_label (asm_out_file, fde_table[i].decl,
1, 1);
if (!any_eh_needed)
return;

View File

@ -2930,7 +2930,7 @@ output_one_function_exception_table (const char * ARG_UNUSED (fnname),
#endif
/* If the target wants a label to begin the table, emit it here. */
targetm.asm_out.except_table_label (asm_out_file);
targetm.asm_out.emit_except_table_label (asm_out_file);
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data)
|| (targetm.arm_eabi_unwinder

343
gcc/genhooks.c Normal file
View File

@ -0,0 +1,343 @@
/* 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.
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 "bconfig.h"
#include "system.h"
#include <string.h>
#include "hashtab.h"
#include "errors.h"
struct hook_desc { const char *doc, *type, *name, *param, *init; };
static struct hook_desc hook_array[] = {
#define HOOK_VECTOR_1(NAME, FRAGMENT) \
{ 0, 0, #NAME, 0, 0 },
#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) \
{ DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT },
#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) \
{ DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT) \
{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
#include "target.def"
#undef DEFHOOK
};
/* For each @Fcode in the the first paragraph of the documentation string DOC,
print an @findex directive. HOOK_NAME is the name of the hook this bit of
documentation pertains to. */
static void
emit_findices (const char *doc, const char *hook_name)
{
const char *end = strstr (doc, "\n\n");
const char *fcode;
while ((fcode = strstr (doc, "@Fcode{")) && (!end || fcode < end))
{
fcode += strlen ("@Fcode{");
doc = strchr (fcode, '}');
if (!doc)
fatal ("Malformed @Fcode for hook %s\n", hook_name);
printf ("@findex %.*s\n", doc - fcode, fcode);
doc = fcode;
}
}
/* Return an upper-case copy of IN. */
static char *
upstrdup (const char *in)
{
char *p, *ret = xstrdup (in);
for (p = ret; *p; p++)
*p = TOUPPER (*p);
return ret;
}
/* Struct for 'start hooks' which start a sequence of consecutive hooks
that are defined in target.def and to be documented in tm.texi. */
struct s_hook
{
char *name;
int pos;
};
static hashval_t
s_hook_hash (const void *p)
{
const struct s_hook *s_hook = (const struct s_hook *)p;
return htab_hash_string (s_hook->name);
}
static int
s_hook_eq_p (const void *p1, const void *p2)
{
return (strcmp (((const struct s_hook *) p1)->name,
((const struct s_hook *) p2)->name) == 0);
}
/* Read the documentation file with name IN_FNAME, perform substitutions
to incorporate informtion from hook_array, and emit the result on stdout.
Hooks defined with DEFHOOK / DEFHOOKPOD are emitted at the place of a
matching @hook in the input file; if there is no matching @hook, the
hook is emitted after the hook that precedes it in target.def .
Usually, the emitted hook documentation starts with the hook
signature, followed by the string from the doc field.
The documentation is bracketed in @deftypefn / @deftypevr and a matching
@end.
While emitting the doc field, @Fcode is translated to @code, and an
@findex entry is added to the affected paragraph.
If the doc field starts with '*', the leading '*' is stripped, and the doc
field is otherwise emitted unaltered; no function signature/
@deftypefn/deftypevr/@end is emitted.
In particular, a doc field of "*" means not to emit any ocumentation for
this target.def / hook_array entry at all (there might be documentation
for this hook in the file named IN_FNAME, though).
A doc field of 0 is used to append the hook signature after the previous
hook's signture, so that one description can be used for a group of hooks.
When the doc field is "", @deftypefn/@deftypevr and the hook signature
is emitted, but not the matching @end. This allows all the free-form
documentation to be placed in IN_FNAME, to work around GPL/GFDL
licensing incompatibility issues. */
static void
emit_documentation (const char *in_fname)
{
int i, j;
char buf[1000];
htab_t start_hooks = htab_create (99, s_hook_hash, s_hook_eq_p, (htab_del) 0);
FILE *f;
bool found_start = false;
/* Enter all the start hooks in start_hooks. */
f = fopen (in_fname, "r");
if (!f)
{
perror ("");
fatal ("Couldn't open input file");
}
while (fscanf (f, "%*[^@]"), buf[0] = '\0',
fscanf (f, "@%5[^ \n]", buf) != EOF)
{
void **p;
struct s_hook *shp;
if (strcmp (buf, "hook") != 0)
continue;
buf[0] = '\0';
fscanf (f, "%999s", buf);
shp = XNEW (struct s_hook);
shp->name = upstrdup (buf);
shp->pos = -1;
p = htab_find_slot (start_hooks, shp, INSERT);
if (*p != HTAB_EMPTY_ENTRY)
fatal ("Duplicate placement for hook %s\n", shp->name);
*(struct s_hook **) p = shp;
}
fclose (f);
/* For each hook in hook_array, if it is a start hook, store its position. */
for (i = 0; i < (int) (sizeof hook_array / sizeof hook_array[0]); i++)
{
struct s_hook sh, *shp;
void *p;
if (!hook_array[i].doc || strcmp (hook_array[i].doc, "*") == 0)
continue;
sh.name = upstrdup (hook_array[i].name);
p = htab_find (start_hooks, &sh);
if (p)
{
shp = (struct s_hook *) p;
if (shp->pos >= 0)
fatal ("Duplicate hook %s\n", sh.name);
shp->pos = i;
found_start = true;
}
else if (!found_start)
fatal ("No place specified to document hook %s\n", sh.name);
free (sh.name);
}
/* Copy input file to stdout, substituting @hook directives with the
corresponding hook documentation sequences. */
f = fopen (in_fname, "r");
if (!f)
{
perror ("");
fatal ("Couldn't open input file");
}
for (;;)
{
struct s_hook sh, *shp;
int c = getc (f);
char *name;
if (c == EOF)
break;
if (c != '@')
{
putchar (c);
continue;
}
buf[0] = '\0';
fscanf (f, "%5[^ \n]", buf);
if (strcmp (buf, "hook") != 0)
{
printf ("@%s", buf);
continue;
}
fscanf (f, "%999s", buf);
sh.name = name = upstrdup (buf);
shp = (struct s_hook *) htab_find (start_hooks, &sh);
if (!shp || shp->pos < 0)
fatal ("No documentation for hook %s\n", sh.name);
i = shp->pos;
do
{
const char *q, *e;
const char *deftype;
const char *doc, *fcode, *p_end;
/* A leading '*' means to output the documentation string without
further processing. */
if (*hook_array[i].doc == '*')
printf ("%s", hook_array[i].doc + 1);
else
{
if (i != shp->pos)
printf ("\n\n");
emit_findices (hook_array[i].doc, name);
/* 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);
if (strchr (hook_array[i].type, ' '))
printf ("{%s}", hook_array[i].type);
else
printf ("%s", hook_array[i].type);
printf (" %s", name);
if (hook_array[i].param)
{
/* Print the parameter list, with the parameter names
enclosed in @var{}. */
printf (" ");
for (q = hook_array[i].param; (e = strpbrk (q, " *,)"));
q = e + 1)
/* Type names like 'int' are followed by a space, sometimes
also by '*'. 'void' should appear only in "(void)". */
if (*e == ' ' || *e == '*' || *q == '(')
printf ("%.*s", e - q + 1, q);
else
printf ("@var{%.*s}%c", e - q, q, *e);
}
/* POD-valued hooks sometimes come in groups with common
documentation.*/
for (j = i + 1;
j < (int) (sizeof hook_array / sizeof hook_array[0])
&& hook_array[j].doc == 0 && hook_array[j].type; j++)
{
char *namex = upstrdup (hook_array[j].name);
printf ("\n@%sx {Target Hook} {%s} %s",
deftype, hook_array[j].type, namex);
}
if (hook_array[i].doc[0])
{
printf ("\n");
/* Print each documentation paragraph in turn. */
for (doc = hook_array[i].doc; *doc; doc = p_end)
{
/* Find paragraph end. */
p_end = strstr (doc, "\n\n");
p_end = (p_end ? p_end + 2 : doc + strlen (doc));
/* Print paragraph, emitting @Fcode as @code. */
for (; (fcode = strstr (doc, "@Fcode{")) && fcode < p_end;
doc = fcode + 2)
printf ("%.*s@", fcode - doc, doc);
printf ("%.*s", p_end - doc, doc);
/* Emit function indices for next paragraph. */
emit_findices (p_end, name);
}
printf ("\n@end %s", deftype);
}
}
if (++i >= (int) (sizeof hook_array / sizeof hook_array[0])
|| !hook_array[i].doc)
break;
free (name);
sh.name = name = upstrdup (hook_array[i].name);
}
while (!htab_find (start_hooks, &sh));
free (name);
}
}
/* Emit #defines to stdout (this will be redirected to generate
target-hook-def.h) which set target hooks initializer macros
to their default values. */
static void
emit_init_macros (void)
{
int i;
const int MAX_NEST = 2;
int print_nest, nest = 0;
for (print_nest = 0; print_nest <= MAX_NEST; print_nest++)
{
for (i = 0; i < (int) (sizeof hook_array / sizeof hook_array[0]); i++)
{
char *name = upstrdup (hook_array[i].name);
if (!hook_array[i].type)
{
if (*name)
{
if (nest && nest == print_nest)
printf (" %s, \\\n", name);
nest++;
if (nest > MAX_NEST)
fatal ("Unexpected nesting of %s\n", name);
if (nest == print_nest)
printf ("\n#define %s \\\n { \\\n", name);
}
else
{
if (nest == print_nest)
printf (" }\n");
nest--;
}
continue;
}
if (0 == print_nest)
{
/* Output default definitions of target hooks. */
printf ("#ifndef %s\n#define %s %s\n#endif\n",
name, name, hook_array[i].init);
}
if (nest == print_nest)
printf (" %s, \\\n", name);
}
}
}
int
main (int argc, char **argv)
{
if (argc >= 2)
emit_documentation (argv[1]);
else
emit_init_macros ();
return 0;
}

View File

@ -1798,7 +1798,7 @@ schedule_insn (rtx insn)
forward dependencies for INSN anymore. Nevertheless they are used in
heuristics in rank_for_schedule (), early_queue_to_ready () and in
some targets (e.g. rs6000). Thus the earliest place where we *can*
remove dependencies is after targetm.sched.md_finish () call in
remove dependencies is after targetm.sched.finish () call in
schedule_block (). But, on the other side, the safest place to remove
dependencies is when we are finishing scheduling entire region. As we
don't generate [many] dependencies during scheduling itself, we won't
@ -2808,8 +2808,8 @@ schedule_block (basic_block *target_bb)
/* It is used for first cycle multipass scheduling. */
temp_state = alloca (dfa_state_size);
if (targetm.sched.md_init)
targetm.sched.md_init (sched_dump, sched_verbose, ready.veclen);
if (targetm.sched.init)
targetm.sched.init (sched_dump, sched_verbose, ready.veclen);
/* We start inserting insns after PREV_HEAD. */
last_scheduled_insn = prev_head;
@ -3283,9 +3283,9 @@ schedule_block (basic_block *target_bb)
fix_inter_tick (NEXT_INSN (prev_head), last_scheduled_insn);
}
if (targetm.sched.md_finish)
if (targetm.sched.finish)
{
targetm.sched.md_finish (sched_dump, sched_verbose);
targetm.sched.finish (sched_dump, sched_verbose);
/* Target might have added some instructions to the scheduled block
in its md_finish () hook. These new insns don't have any data
initialized and to identify them we extend h_i_d so that they'll
@ -3444,9 +3444,8 @@ sched_init (void)
regstat_compute_calls_crossed ();
if (targetm.sched.md_init_global)
targetm.sched.md_init_global (sched_dump, sched_verbose,
get_max_uid () + 1);
if (targetm.sched.init_global)
targetm.sched.init_global (sched_dump, sched_verbose, get_max_uid () + 1);
if (sched_pressure_p)
{
@ -3571,8 +3570,8 @@ sched_finish (void)
}
free (curr_state);
if (targetm.sched.md_finish_global)
targetm.sched.md_finish_global (sched_dump, sched_verbose);
if (targetm.sched.finish_global)
targetm.sched.finish_global (sched_dump, sched_verbose);
end_alias_analysis ();

View File

@ -1473,8 +1473,8 @@ common_handle_option (size_t scode, const char *arg, int value,
exit_after_options = true;
/* Allow the target a chance to give the user some additional information. */
if (targetm.target_help)
targetm.target_help ();
if (targetm.help)
targetm.help ();
break;
case OPT_fhelp_:

View File

@ -1,3 +1,8 @@
2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
PR other/44034
* EXCLUDES: Add genhooks.c.
2010-05-01 Joseph Myers <joseph@codesourcery.com>
* sv.po: Update.

View File

@ -74,6 +74,7 @@ genextract.c
genflags.c
gengenrtl.c
gengtype.c
genhooks.c
genmodes.c
genopinit.c
genoutput.c

View File

@ -6863,11 +6863,11 @@ sel_region_init (int rgn)
/* Set hooks so that no newly generated insn will go out unnoticed. */
sel_register_cfg_hooks ();
/* !!! We call target.sched.md_init () for the whole region, but we invoke
targetm.sched.md_finish () for every ebb. */
if (targetm.sched.md_init)
/* !!! We call target.sched.init () for the whole region, but we invoke
targetm.sched.finish () for every ebb. */
if (targetm.sched.init)
/* None of the arguments are actually used in any target. */
targetm.sched.md_init (sched_dump, sched_verbose, -1);
targetm.sched.init (sched_dump, sched_verbose, -1);
first_emitted_uid = get_max_uid () + 1;
preheader_removed = false;
@ -6949,11 +6949,11 @@ reset_sched_cycles_in_current_ebb (void)
int haifa_clock = 0;
insn_t insn;
if (targetm.sched.md_init)
if (targetm.sched.init)
{
/* None of the arguments are actually used in any target.
NB: We should have md_reset () hook for cases like this. */
targetm.sched.md_init (sched_dump, sched_verbose, -1);
targetm.sched.init (sched_dump, sched_verbose, -1);
}
state_reset (curr_state);
@ -7131,14 +7131,14 @@ sel_region_target_finish (bool reset_sched_cycles_p)
if (reset_sched_cycles_p)
reset_sched_cycles_in_current_ebb ();
if (targetm.sched.md_init)
targetm.sched.md_init (sched_dump, sched_verbose, -1);
if (targetm.sched.init)
targetm.sched.init (sched_dump, sched_verbose, -1);
put_TImodes ();
if (targetm.sched.md_finish)
if (targetm.sched.finish)
{
targetm.sched.md_finish (sched_dump, sched_verbose);
targetm.sched.finish (sched_dump, sched_verbose);
/* Extend luids so that insns generated by the target will
get zero luid. */

File diff suppressed because it is too large Load Diff

2370
gcc/target.def Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3677,8 +3677,8 @@ vect_supportable_dr_alignment (struct data_reference *dr)
}
if (targetm.vectorize.
builtin_support_vector_misalignment (mode, type,
DR_MISALIGNMENT (dr), is_packed))
support_vector_misalignment (mode, type,
DR_MISALIGNMENT (dr), is_packed))
/* Can't software pipeline the loads, but can at least do them. */
return dr_unaligned_supported;
}
@ -3696,8 +3696,8 @@ vect_supportable_dr_alignment (struct data_reference *dr)
}
if (targetm.vectorize.
builtin_support_vector_misalignment (mode, type,
DR_MISALIGNMENT (dr), is_packed))
support_vector_misalignment (mode, type,
DR_MISALIGNMENT (dr), is_packed))
return dr_unaligned_supported;
}

View File

@ -5979,7 +5979,7 @@ maybe_assemble_visibility (tree decl)
if (vis != VISIBILITY_DEFAULT)
{
targetm.asm_out.visibility (decl, vis);
targetm.asm_out.assemble_visibility (decl, vis);
return 1;
}
else
@ -6905,11 +6905,11 @@ default_asm_declare_constant_name (FILE *file, const char *name,
void
default_file_start (void)
{
if (targetm.file_start_app_off
if (targetm.asm_file_start_app_off
&& !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm))
fputs (ASM_APP_OFF, asm_out_file);
if (targetm.file_start_file_directive)
if (targetm.asm_file_start_file_directive)
output_file_directive (asm_out_file, main_input_filename);
}