gensupport.h (get_num_insn_codes): Declare.
gcc/ * gensupport.h (get_num_insn_codes): Declare. * gensupport.c (get_num_insn_codes): New function. * genattrtab.c (optimize_attrs): Rename max_insn_code to num_insn_codes. (main): Likewise. Use get_num_insn_codes. * gencodes.c (main): Remove "last" and use get_num_insn_codes. From-SVN: r226633
This commit is contained in:
parent
dcc74ead1e
commit
ba0ee63dfe
|
@ -1,3 +1,12 @@
|
||||||
|
2015-08-05 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
|
* gensupport.h (get_num_insn_codes): Declare.
|
||||||
|
* gensupport.c (get_num_insn_codes): New function.
|
||||||
|
* genattrtab.c (optimize_attrs): Rename max_insn_code to
|
||||||
|
num_insn_codes.
|
||||||
|
(main): Likewise. Use get_num_insn_codes.
|
||||||
|
* gencodes.c (main): Remove "last" and use get_num_insn_codes.
|
||||||
|
|
||||||
2015-08-05 Richard Sandiford <richard.sandiford@arm.com>
|
2015-08-05 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
PR middle-end/66311
|
PR middle-end/66311
|
||||||
|
|
|
@ -2952,11 +2952,11 @@ get_attr_order (struct attr_desc ***ret)
|
||||||
|
|
||||||
/* Optimize the attribute lists by seeing if we can determine conditional
|
/* Optimize the attribute lists by seeing if we can determine conditional
|
||||||
values from the known values of other attributes. This will save subroutine
|
values from the known values of other attributes. This will save subroutine
|
||||||
calls during the compilation. MAX_INSN_CODE is the number of unique
|
calls during the compilation. NUM_INSN_CODES is the number of unique
|
||||||
instruction codes. */
|
instruction codes. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
optimize_attrs (int max_insn_code)
|
optimize_attrs (int num_insn_codes)
|
||||||
{
|
{
|
||||||
struct attr_desc *attr;
|
struct attr_desc *attr;
|
||||||
struct attr_value *av;
|
struct attr_value *av;
|
||||||
|
@ -2975,7 +2975,7 @@ optimize_attrs (int max_insn_code)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Make 2 extra elements, for "code" values -2 and -1. */
|
/* Make 2 extra elements, for "code" values -2 and -1. */
|
||||||
insn_code_values = XCNEWVEC (struct attr_value_list *, max_insn_code + 2);
|
insn_code_values = XCNEWVEC (struct attr_value_list *, num_insn_codes + 2);
|
||||||
|
|
||||||
/* Offset the table address so we can index by -2 or -1. */
|
/* Offset the table address so we can index by -2 or -1. */
|
||||||
insn_code_values += 2;
|
insn_code_values += 2;
|
||||||
|
@ -3003,7 +3003,7 @@ optimize_attrs (int max_insn_code)
|
||||||
gcc_assert (iv == ivbuf + num_insn_ents);
|
gcc_assert (iv == ivbuf + num_insn_ents);
|
||||||
|
|
||||||
/* Process one insn code at a time. */
|
/* Process one insn code at a time. */
|
||||||
for (i = -2; i < max_insn_code; i++)
|
for (i = -2; i < num_insn_codes; i++)
|
||||||
{
|
{
|
||||||
/* Clear the ATTR_CURR_SIMPLIFIED_P flag everywhere relevant.
|
/* Clear the ATTR_CURR_SIMPLIFIED_P flag everywhere relevant.
|
||||||
We use it to mean "already simplified for this insn". */
|
We use it to mean "already simplified for this insn". */
|
||||||
|
@ -5161,7 +5161,6 @@ main (int argc, char **argv)
|
||||||
struct attr_desc *attr;
|
struct attr_desc *attr;
|
||||||
struct insn_def *id;
|
struct insn_def *id;
|
||||||
int i;
|
int i;
|
||||||
int max_insn_code = 0;
|
|
||||||
|
|
||||||
progname = "genattrtab";
|
progname = "genattrtab";
|
||||||
|
|
||||||
|
@ -5224,14 +5223,11 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (GET_CODE (info.def) != DEFINE_ASM_ATTRIBUTES)
|
if (GET_CODE (info.def) != DEFINE_ASM_ATTRIBUTES)
|
||||||
insn_index_number++;
|
insn_index_number++;
|
||||||
max_insn_code = info.index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_error)
|
if (have_error)
|
||||||
return FATAL_EXIT_CODE;
|
return FATAL_EXIT_CODE;
|
||||||
|
|
||||||
max_insn_code++;
|
|
||||||
|
|
||||||
/* If we didn't have a DEFINE_ASM_ATTRIBUTES, make a null one. */
|
/* If we didn't have a DEFINE_ASM_ATTRIBUTES, make a null one. */
|
||||||
if (! got_define_asm_attributes)
|
if (! got_define_asm_attributes)
|
||||||
{
|
{
|
||||||
|
@ -5248,14 +5244,15 @@ main (int argc, char **argv)
|
||||||
expand_delays ();
|
expand_delays ();
|
||||||
|
|
||||||
/* Make `insn_alternatives'. */
|
/* Make `insn_alternatives'. */
|
||||||
insn_alternatives = oballocvec (uint64_t, max_insn_code);
|
int num_insn_codes = get_num_insn_codes ();
|
||||||
|
insn_alternatives = oballocvec (uint64_t, num_insn_codes);
|
||||||
for (id = defs; id; id = id->next)
|
for (id = defs; id; id = id->next)
|
||||||
if (id->insn_code >= 0)
|
if (id->insn_code >= 0)
|
||||||
insn_alternatives[id->insn_code]
|
insn_alternatives[id->insn_code]
|
||||||
= (((uint64_t) 1) << id->num_alternatives) - 1;
|
= (((uint64_t) 1) << id->num_alternatives) - 1;
|
||||||
|
|
||||||
/* Make `insn_n_alternatives'. */
|
/* Make `insn_n_alternatives'. */
|
||||||
insn_n_alternatives = oballocvec (int, max_insn_code);
|
insn_n_alternatives = oballocvec (int, num_insn_codes);
|
||||||
for (id = defs; id; id = id->next)
|
for (id = defs; id; id = id->next)
|
||||||
if (id->insn_code >= 0)
|
if (id->insn_code >= 0)
|
||||||
insn_n_alternatives[id->insn_code] = id->num_alternatives;
|
insn_n_alternatives[id->insn_code] = id->num_alternatives;
|
||||||
|
@ -5284,7 +5281,7 @@ main (int argc, char **argv)
|
||||||
make_length_attrs ();
|
make_length_attrs ();
|
||||||
|
|
||||||
/* Perform any possible optimizations to speed up compilation. */
|
/* Perform any possible optimizations to speed up compilation. */
|
||||||
optimize_attrs (max_insn_code);
|
optimize_attrs (num_insn_codes);
|
||||||
|
|
||||||
/* Now write out all the `gen_attr_...' routines. Do these before the
|
/* Now write out all the `gen_attr_...' routines. Do these before the
|
||||||
special routines so that they get defined before they are used. */
|
special routines so that they get defined before they are used. */
|
||||||
|
|
|
@ -49,8 +49,6 @@ gen_insn (md_rtx_info *info)
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int last = 1;
|
|
||||||
|
|
||||||
progname = "gencodes";
|
progname = "gencodes";
|
||||||
|
|
||||||
/* We need to see all the possibilities. Elided insns may have
|
/* We need to see all the possibilities. Elided insns may have
|
||||||
|
@ -79,7 +77,6 @@ enum insn_code {\n\
|
||||||
case DEFINE_INSN:
|
case DEFINE_INSN:
|
||||||
case DEFINE_EXPAND:
|
case DEFINE_EXPAND:
|
||||||
gen_insn (&info);
|
gen_insn (&info);
|
||||||
last = info.index + 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -89,7 +86,7 @@ enum insn_code {\n\
|
||||||
printf (" LAST_INSN_CODE = %d\n\
|
printf (" LAST_INSN_CODE = %d\n\
|
||||||
};\n\
|
};\n\
|
||||||
\n\
|
\n\
|
||||||
#endif /* GCC_INSN_CODES_H */\n", last);
|
#endif /* GCC_INSN_CODES_H */\n", get_num_insn_codes () - 1);
|
||||||
|
|
||||||
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
|
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
|
||||||
return FATAL_EXIT_CODE;
|
return FATAL_EXIT_CODE;
|
||||||
|
|
|
@ -2602,6 +2602,14 @@ read_md_rtx (md_rtx_info *info)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the number of possible INSN_CODEs. Only meaningful once the
|
||||||
|
whole file has been processed. */
|
||||||
|
unsigned int
|
||||||
|
get_num_insn_codes ()
|
||||||
|
{
|
||||||
|
return sequence_num;
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper functions for insn elision. */
|
/* Helper functions for insn elision. */
|
||||||
|
|
||||||
/* Compute a hash function of a c_test structure, which is keyed
|
/* Compute a hash function of a c_test structure, which is keyed
|
||||||
|
|
|
@ -43,6 +43,7 @@ extern rtx add_implicit_parallel (rtvec);
|
||||||
extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
|
extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
|
||||||
extern bool init_rtx_reader_args (int, char **);
|
extern bool init_rtx_reader_args (int, char **);
|
||||||
extern bool read_md_rtx (md_rtx_info *);
|
extern bool read_md_rtx (md_rtx_info *);
|
||||||
|
extern unsigned int get_num_insn_codes ();
|
||||||
|
|
||||||
/* Set this to 0 to disable automatic elision of insn patterns which
|
/* Set this to 0 to disable automatic elision of insn patterns which
|
||||||
can never be used in this configuration. See genconditions.c.
|
can never be used in this configuration. See genconditions.c.
|
||||||
|
|
Loading…
Reference in New Issue