aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2012-11-05 15:18:10 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2012-11-05 15:18:10 +0000
commitd327457f172ab91732d0789bf925c7510f5e1015 (patch)
tree8e0a8f071bd365a15434d0e94b091fe7d57014a7 /gcc/final.c
parent1539ccbf52c4a95c63fc3fb3efe9bf78f85f6158 (diff)
downloadgcc-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/final.c')
-rw-r--r--gcc/final.c73
1 files changed, 28 insertions, 45 deletions
diff --git a/gcc/final.c b/gcc/final.c
index f414dd0..81a679d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -204,9 +204,7 @@ rtx current_insn_predicate;
/* True if printing into -fdump-final-insns= dump. */
bool final_insns_dump_p;
-#ifdef HAVE_ATTR_length
static int asm_insn_count (rtx);
-#endif
static void profile_function (FILE *);
static void profile_after_prologue (FILE *);
static bool notice_source_line (rtx, bool *);
@@ -224,9 +222,7 @@ static int alter_cond (rtx);
#ifndef ADDR_VEC_ALIGN
static int final_addr_vec_align (rtx);
#endif
-#ifdef HAVE_ATTR_length
static int align_fuzz (rtx, rtx, int, unsigned);
-#endif
/* Initialize data in final at the beginning of a compilation. */
@@ -362,9 +358,8 @@ init_insn_lengths (void)
insn_lengths = 0;
insn_lengths_max_uid = 0;
}
-#ifdef HAVE_ATTR_length
- INSN_ADDRESSES_FREE ();
-#endif
+ if (HAVE_ATTR_length)
+ INSN_ADDRESSES_FREE ();
if (uid_align)
{
free (uid_align);
@@ -376,14 +371,15 @@ init_insn_lengths (void)
get its actual length. Otherwise, use FALLBACK_FN to calculate the
length. */
static inline int
-get_attr_length_1 (rtx insn ATTRIBUTE_UNUSED,
- int (*fallback_fn) (rtx) ATTRIBUTE_UNUSED)
+get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx))
{
-#ifdef HAVE_ATTR_length
rtx body;
int i;
int length = 0;
+ if (!HAVE_ATTR_length)
+ return 0;
+
if (insn_lengths_max_uid > INSN_UID (insn))
return insn_lengths[INSN_UID (insn)];
else
@@ -432,11 +428,6 @@ get_attr_length_1 (rtx insn ATTRIBUTE_UNUSED,
ADJUST_INSN_LENGTH (insn, length);
#endif
return length;
-#else /* not HAVE_ATTR_length */
- return 0;
-#define insn_default_length 0
-#define insn_min_length 0
-#endif /* not HAVE_ATTR_length */
}
/* Obtain the current length of an insn. If branch shortening has been done,
@@ -583,7 +574,6 @@ label_to_max_skip (rtx label)
return 0;
}
-#ifdef HAVE_ATTR_length
/* The differences in addresses
between a branch and its target might grow or shrink depending on
the alignment the start insn of the range (the branch for a forward
@@ -686,7 +676,6 @@ insn_current_reference_address (rtx branch)
+ align_fuzz (dest, seq, length_unit_log, ~0));
}
}
-#endif /* HAVE_ATTR_length */
/* Compute branch alignments based on frequency information in the
CFG. */
@@ -851,14 +840,13 @@ struct rtl_opt_pass pass_compute_alignments =
slots. */
void
-shorten_branches (rtx first ATTRIBUTE_UNUSED)
+shorten_branches (rtx first)
{
rtx insn;
int max_uid;
int i;
int max_log;
int max_skip;
-#ifdef HAVE_ATTR_length
#define MAX_CODE_ALIGN 16
rtx seq;
int something_changed = 1;
@@ -867,8 +855,6 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
int uid;
rtx align_tab[MAX_CODE_ALIGN];
-#endif
-
/* Compute maximum UID and allocate label_align / uid_shuid. */
max_uid = get_max_uid ();
@@ -975,7 +961,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
}
}
}
-#ifdef HAVE_ATTR_length
+ if (!HAVE_ATTR_length)
+ return;
/* Allocate the rest of the arrays. */
insn_lengths = XNEWVEC (int, max_uid);
@@ -1421,11 +1408,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
}
free (varying_length);
-
-#endif /* HAVE_ATTR_length */
}
-#ifdef HAVE_ATTR_length
/* Given the body of an INSN known to be generated by an ASM statement, return
the number of machine instructions likely to be generated for this insn.
This is used to compute its length. */
@@ -1442,7 +1426,6 @@ asm_insn_count (rtx body)
return asm_str_count (templ);
}
-#endif
/* Return the number of machine instructions likely to be generated for the
inline-asm template. */
@@ -1903,17 +1886,18 @@ final (rtx first, FILE *file, int optimize_p)
/* Output the insns. */
for (insn = first; insn;)
{
-#ifdef HAVE_ATTR_length
- if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
+ if (HAVE_ATTR_length)
{
- /* This can be triggered by bugs elsewhere in the compiler if
- new insns are created after init_insn_lengths is called. */
- gcc_assert (NOTE_P (insn));
- insn_current_address = -1;
+ if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
+ {
+ /* This can be triggered by bugs elsewhere in the compiler if
+ new insns are created after init_insn_lengths is called. */
+ gcc_assert (NOTE_P (insn));
+ insn_current_address = -1;
+ }
+ else
+ insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
}
- else
- insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
-#endif /* HAVE_ATTR_length */
dump_basic_block_info (file, insn, start_to_bb, end_to_bb,
bb_map_size, &bb_seqn);
@@ -2854,12 +2838,10 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
if (new_rtx == insn && PATTERN (new_rtx) == body)
fatal_insn ("could not split insn", insn);
-#ifdef HAVE_ATTR_length
- /* This instruction should have been split in shorten_branches,
- to ensure that we would have valid length info for the
- splitees. */
- gcc_unreachable ();
-#endif
+ /* If we have a length attribute, this instruction should have
+ been split in shorten_branches, to ensure that we would have
+ valid length info for the splitees. */
+ gcc_assert (!HAVE_ATTR_length);
return new_rtx;
}
@@ -3293,10 +3275,11 @@ output_asm_name (void)
insn_data[num].name);
if (insn_data[num].n_alternatives > 1)
fprintf (asm_out_file, "/%d", which_alternative + 1);
-#ifdef HAVE_ATTR_length
- fprintf (asm_out_file, "\t[length = %d]",
- get_attr_length (debug_insn));
-#endif
+
+ if (HAVE_ATTR_length)
+ fprintf (asm_out_file, "\t[length = %d]",
+ get_attr_length (debug_insn));
+
/* Clear this so only the first assembler insn
of any rtl insn will get the special comment for -dp. */
debug_insn = 0;