reserv_sets_hash_value (reservs)
reserv_sets_t reservs;
{
- unsigned int hash_value;
- int reservs_num;
+ set_el_t hash_value;
+ unsigned result;
+ int reservs_num, i;
set_el_t *reserv_ptr;
hash_value = 0;
reservs_num = els_in_reservs;
reserv_ptr = reservs;
+ i = 0;
while (reservs_num != 0)
{
reservs_num--;
- hash_value = ((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT)
- | (hash_value << CHAR_BIT)) + *reserv_ptr;
+ hash_value += ((*reserv_ptr >> i)
+ | (*reserv_ptr << (sizeof (set_el_t) * CHAR_BIT - i)));
+ i++;
+ if (i == sizeof (set_el_t) * CHAR_BIT)
+ i = 0;
reserv_ptr++;
}
- return hash_value;
+ if (sizeof (set_el_t) <= sizeof (unsigned))
+ return hash_value;
+ result = 0;
+ for (i = sizeof (set_el_t); i > 0; i -= sizeof (unsigned) - 1)
+ {
+ result += (unsigned) hash_value;
+ hash_value >>= (sizeof (unsigned) - 1) * CHAR_BIT;
+ }
+ return result;
}
/* Comparison of given reservation sets. */
fprintf (f, NOTHING_NAME);
if (repetition_num <= 0)
abort ();
- if (reserved_units_num != 0 && repetition_num != 1)
- {
- if (reserved_units_num > 1)
- fprintf (f, ")");
- fprintf (f, "*%d", repetition_num);
- }
+ if (reserved_units_num > 1)
+ fprintf (f, ")");
+ if (repetition_num != 1)
+ fprintf (f, "*%d", repetition_num);
}
/* The function outputs string representation of units reservation in
/* The function makes transformations
...,A|B|...,C,... -> (...,A,C,...)|(...,B,C,...)|...
- ...+(A|B|...)+C+... -> (...+A+C+...)|(...+B+C+...)|... */
+ ...+(A|B|...)+C+... -> (...+A+C+...)|(...+B+C+...)|...
+ ...+(A,B,...)+C+... -> (...+A+C+...),B,...
+ ...+(A,B,...)+(C,D,...) -> (A+C),(B+D),... */
static regexp_t
transform_3 (regexp)
regexp_t regexp;
}
else if (regexp->mode == rm_allof)
{
- regexp_t oneof;
- int oneof_index;
+ regexp_t oneof, seq;
+ int oneof_index, max_seq_length, allof_length;
regexp_t result;
- regexp_t allof;
+ regexp_t allof, allof_op;
int i, j;
for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
regexp_transformed_p = 1;
regexp = result;
}
+ max_seq_length = 0;
+ for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
+ if (regexp->regexp.allof.regexps [i]->mode == rm_sequence)
+ {
+ seq = regexp->regexp.allof.regexps [i];
+ if (max_seq_length < seq->regexp.sequence.regexps_num)
+ max_seq_length = seq->regexp.sequence.regexps_num;
+ }
+ else if (regexp->regexp.allof.regexps [i]->mode != rm_unit)
+ {
+ max_seq_length = 0;
+ break;
+ }
+ if (max_seq_length != 0)
+ {
+ if (max_seq_length == 1 || regexp->regexp.allof.regexps_num <= 1)
+ abort ();
+ result = create_node (sizeof (struct regexp)
+ + sizeof (regexp_t) * (max_seq_length - 1));
+ result->mode = rm_sequence;
+ result->pos = regexp->pos;
+ result->regexp.sequence.regexps_num = max_seq_length;
+ for (i = 0; i < max_seq_length; i++)
+ {
+ allof_length = 0;
+ for (j = 0; j < regexp->regexp.allof.regexps_num; j++)
+ if (regexp->regexp.allof.regexps [j]->mode == rm_sequence
+ && (i < (regexp->regexp.allof.regexps [j]
+ ->regexp.sequence.regexps_num)))
+ {
+ allof_op = (regexp->regexp.allof.regexps [j]
+ ->regexp.sequence.regexps [i]);
+ allof_length++;
+ }
+ else if (i == 0
+ && regexp->regexp.allof.regexps [j]->mode == rm_unit)
+ {
+ allof_op = regexp->regexp.allof.regexps [j];
+ allof_length++;
+ }
+ if (allof_length == 1)
+ result->regexp.sequence.regexps [i] = allof_op;
+ else
+ {
+ allof = create_node (sizeof (struct regexp)
+ + sizeof (regexp_t)
+ * (allof_length - 1));
+ allof->mode = rm_allof;
+ allof->pos = regexp->pos;
+ allof->regexp.allof.regexps_num = allof_length;
+ result->regexp.sequence.regexps [i] = allof;
+ allof_length = 0;
+ for (j = 0; j < regexp->regexp.allof.regexps_num; j++)
+ if (regexp->regexp.allof.regexps [j]->mode == rm_sequence
+ && (i < (regexp->regexp.allof.regexps [j]
+ ->regexp.sequence.regexps_num)))
+ {
+ allof_op = (regexp->regexp.allof.regexps [j]
+ ->regexp.sequence.regexps [i]);
+ allof->regexp.allof.regexps [allof_length] = allof_op;
+
+ allof_length++;
+ }
+ else if (i == 0
+ && (regexp->regexp.allof.regexps [j]->mode
+ == rm_unit))
+ {
+ allof_op = regexp->regexp.allof.regexps [j];
+ allof->regexp.allof.regexps [allof_length] = allof_op;
+ allof_length++;
+ }
+ }
+ }
+ regexp_transformed_p = 1;
+ regexp = result;
+ }
}
return regexp;
}
if (unit->mode == rm_unit)
process_unit_to_form_the_same_automaton_unit_lists
(unit, regexp, j);
- else if (allof->mode != rm_nothing)
+ else if (unit->mode != rm_nothing)
abort ();
}
else if (allof->mode == rm_unit)
fprintf (output_file, "static int %s PARAMS ((int, struct %s *));\n",
INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, CHIP_NAME);
fprintf (output_file,
- "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s;\n",
+ "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s ATTRIBUTE_UNUSED;\n",
INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME,
CHIP_PARAMETER_NAME);
- fprintf (output_file, "{\n int %s;\n int %s;\n",
+ fprintf (output_file, "{\n int %s ATTRIBUTE_UNUSED;\n int %s;\n",
TEMPORARY_VARIABLE_NAME, RESULT_VARIABLE_NAME);
fprintf (output_file, "\n switch (%s)\n {\n", INTERNAL_INSN_CODE_NAME);
output_insn_code_cases (output_automata_list_min_issue_delay_code);
fprintf (output_file, "static int %s PARAMS ((int, struct %s *));\n",
INTERNAL_TRANSITION_FUNC_NAME, CHIP_NAME);
fprintf (output_file,
- "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s;\n",
+ "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s ATTRIBUTE_UNUSED;\n",
INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME,
CHIP_NAME, CHIP_PARAMETER_NAME);
- fprintf (output_file, "{\n int %s;\n", TEMPORARY_VARIABLE_NAME);
+ fprintf (output_file, "{\n int %s ATTRIBUTE_UNUSED;\n", TEMPORARY_VARIABLE_NAME);
fprintf (output_file, "\n switch (%s)\n {\n", INTERNAL_INSN_CODE_NAME);
output_insn_code_cases (output_automata_list_transition_code);
fprintf (output_file, "\n default:\n return -1;\n }\n");