diff options
author | Joern Rennecke <joern.rennecke@embecosm.com> | 2012-11-05 15:18:10 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2012-11-05 15:18:10 +0000 |
commit | d327457f172ab91732d0789bf925c7510f5e1015 (patch) | |
tree | 8e0a8f071bd365a15434d0e94b091fe7d57014a7 /gcc/genattr.c | |
parent | 1539ccbf52c4a95c63fc3fb3efe9bf78f85f6158 (diff) | |
download | gcc-d327457f172ab91732d0789bf925c7510f5e1015.zip gcc-d327457f172ab91732d0789bf925c7510f5e1015.tar.gz gcc-d327457f172ab91732d0789bf925c7510f5e1015.tar.bz2 |
md.texi (Defining Attributes): Document that we are defining HAVE_ATTR_name macors as 1 for defined attributes...
* doc/md.texi (Defining Attributes): Document that we are defining
HAVE_ATTR_name macors as 1 for defined attributes, and as 0
for undefined special attributes.
* final.c (asm_insn_count, align_fuzz): Always define.
(insn_current_reference_address): Likewise.
(init_insn_lengths): Use if (HAVE_ATTR_length) instead of
#ifdef HAVE_ATTR_length.
(get_attr_length_1, shorten_branches, final): Likewise.
(final_scan_insn, output_asm_name): Likewise.
* genattr.c (gen_attr): Define HAVE_ATTR_name macros for
defined attributes as 1.
Remove ancient get_attr_alternative compatibility code.
For special purpose attributes not provided, define HAVE_ATTR_name
as 0.
In case no length attribute is given, provide stub definitions
for insn_*_length* functions, and also include insn-addr.h.
In case no enabled attribute is given, provide stub definition.
* genattrtab.c (write_length_unit_log): Always write a definition.
* hooks.c (hook_int_rtx_1, hook_int_rtx_unreachable): New functions.
* hooks.h (hook_int_rtx_1, hook_int_rtx_unreachable): Declare.
* lra-int.h (struct lra_insn_recog_data): Make member
alternative_enabled_p unconditional.
* lra.c (free_insn_recog_data): Use if (HAVE_ATTR_length) instead of
#ifdef HAVE_ATTR_length.
(lra_set_insn_recog_data): Likewise. Make initialization of
alternative_enabled_p unconditional.
(lra_update_insn_recog_data): Use #if instead of #ifdef for
HAVE_ATTR_enabled.
* recog.c [!HAVE_ATTR_enabled] (get_attr_enabled): Don't define.
(extract_insn): Check HAVE_ATTR_enabled.
(gate_handle_split_before_regstack): Use #if instead of
#if defined for HAVE_ATTR_length.
From-SVN: r193168
Diffstat (limited to 'gcc/genattr.c')
-rw-r--r-- | gcc/genattr.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/genattr.c b/gcc/genattr.c index 33030b1..bb5cf96 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -44,7 +44,7 @@ gen_attr (rtx attr) if (is_const) VEC_safe_push (rtx, heap, const_attrs, attr); - printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0)); + printf ("#define HAVE_ATTR_%s 1\n", XSTR (attr, 0)); /* If numeric attribute, don't need to write an enum. */ if (GET_CODE (attr) == DEFINE_ENUM_ATTR) @@ -159,12 +159,6 @@ main (int argc, char **argv) puts ("#include \"insn-attr-common.h\"\n"); - /* For compatibility, define the attribute `alternative', which is just - a reference to the variable `which_alternative'. */ - - puts ("#define HAVE_ATTR_alternative"); - puts ("#define get_attr_alternative(insn) which_alternative"); - /* Read the machine description. */ while (1) @@ -342,6 +336,29 @@ main (int argc, char **argv) printf ("typedef void *state_t;\n\n"); } + /* Special-purpose atributes should be tested with if, not #ifdef. */ + const char * const special_attrs[] = { "length", "enabled", 0 }; + for (const char * const *p = special_attrs; *p; p++) + { + printf ("#ifndef HAVE_ATTR_%s\n" + "#define HAVE_ATTR_%s 0\n" + "#endif\n", *p, *p); + } + /* We make an exception here to provide stub definitions for + insn_*_length* / get_attr_enabled functions. */ + puts ("#if !HAVE_ATTR_length\n" + "extern int hook_int_rtx_unreachable (rtx);\n" + "#define insn_default_length hook_int_rtx_unreachable\n" + "#define insn_min_length hook_int_rtx_unreachable\n" + "#define insn_variable_length_p hook_int_rtx_unreachable\n" + "#define insn_current_length hook_int_rtx_unreachable\n" + "#include \"insn-addr.h\"\n" + "#endif\n" + "#if !HAVE_ATTR_enabled\n" + "extern int hook_int_rtx_1 (rtx);\n" + "#define get_attr_enabled hook_int_rtx_1\n" + "#endif\n"); + /* Output flag masks for use by reorg. Flags are used to hold branch direction for use by eligible_for_... */ |