Commit 8562f05c by Gabriel Dos Reis Committed by Gabriel Dos Reis

machmode.h (to_machine_mode): New.

        * machmode.h (to_machine_mode): New.
        * rtl.h (to_rtx_code): Likewise.
        * read-rtl.c (apply_mode_macro): Convert mode to machine_mode.
        (print_c_condition): Convert return value of htab_find().
        (apply_code_macro): Add explicit cast when convertin to enums.
        (apply_mode_maps): Likewise.
        (check_code_macro): Likewise.
        (read_rtx_1): Likewise.

From-SVN: r100804
parent c8d3810f
2005-06-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
* machmode.h (to_machine_mode): New.
* rtl.h (to_rtx_code): Likewise.
* read-rtl.c (apply_mode_macro): Convert mode to machine_mode.
(print_c_condition): Convert return value of htab_find().
(apply_code_macro): Add explicit cast when convertin to enums.
(apply_mode_maps): Likewise.
(check_code_macro): Likewise.
(read_rtx_1): Likewise.
2005-06-09 Richard Henderson <rth@redhat.com> 2005-06-09 Richard Henderson <rth@redhat.com>
* config/ia64/ia64.c (update_set_flags): Just return for IF_THEN_ELSE. * config/ia64/ia64.c (update_set_flags): Just return for IF_THEN_ELSE.
......
...@@ -25,6 +25,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -25,6 +25,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Make an enum class that gives all the machine modes. */ /* Make an enum class that gives all the machine modes. */
#include "insn-modes.h" #include "insn-modes.h"
/* Given MODE as integer value, get the corresponding enum machine_mode
enumeration value. */
#define to_machine_mode(MODE) ((enum machine_mode) (MODE))
/* Get the name of mode MODE as a string. */ /* Get the name of mode MODE as a string. */
extern const char * const mode_name[NUM_MACHINE_MODES]; extern const char * const mode_name[NUM_MACHINE_MODES];
......
...@@ -243,7 +243,7 @@ uses_mode_macro_p (rtx x, int mode) ...@@ -243,7 +243,7 @@ uses_mode_macro_p (rtx x, int mode)
static void static void
apply_mode_macro (rtx x, int mode) apply_mode_macro (rtx x, int mode)
{ {
PUT_MODE (x, mode); PUT_MODE (x, to_machine_mode (mode));
} }
/* Implementations of the macro_group callbacks for codes. */ /* Implementations of the macro_group callbacks for codes. */
...@@ -269,7 +269,7 @@ uses_code_macro_p (rtx x, int code) ...@@ -269,7 +269,7 @@ uses_code_macro_p (rtx x, int code)
static void static void
apply_code_macro (rtx x, int code) apply_code_macro (rtx x, int code)
{ {
PUT_CODE (x, code); PUT_CODE (x, to_rtx_code (code));
} }
/* Map a code or mode attribute string P to the underlying string for /* Map a code or mode attribute string P to the underlying string for
...@@ -363,7 +363,7 @@ apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *macro, ...@@ -363,7 +363,7 @@ apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *macro,
v = map_attr_string (pm->string, macro, value); v = map_attr_string (pm->string, macro, value);
if (v) if (v)
PUT_MODE (x, find_mode (v->string, infile)); PUT_MODE (x, to_machine_mode (find_mode (v->string, infile)));
else else
*unknown = pm->string; *unknown = pm->string;
return; return;
...@@ -798,7 +798,7 @@ join_c_conditions (const char *cond1, const char *cond2) ...@@ -798,7 +798,7 @@ join_c_conditions (const char *cond1, const char *cond2)
void void
print_c_condition (const char *cond) print_c_condition (const char *cond)
{ {
const void **halves = htab_find (joined_conditions, &cond); const char **halves = (const char **) htab_find (joined_conditions, &cond);
if (halves != 0) if (halves != 0)
{ {
printf ("("); printf ("(");
...@@ -1311,7 +1311,7 @@ check_code_macro (struct mapping *macro, FILE *infile) ...@@ -1311,7 +1311,7 @@ check_code_macro (struct mapping *macro, FILE *infile)
struct map_value *v; struct map_value *v;
enum rtx_code bellwether; enum rtx_code bellwether;
bellwether = macro->values->number; bellwether = to_rtx_code (macro->values->number);
for (v = macro->values->next; v != 0; v = v->next) for (v = macro->values->next; v != 0; v = v->next)
if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0) if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0)
fatal_with_file_and_line (infile, "code macro `%s' combines " fatal_with_file_and_line (infile, "code macro `%s' combines "
...@@ -1449,7 +1449,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps) ...@@ -1449,7 +1449,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
check_code_macro (read_mapping (&codes, codes.macros, infile), infile); check_code_macro (read_mapping (&codes, codes.macros, infile), infile);
goto again; goto again;
} }
real_code = find_macro (&codes, tmp_char, infile); real_code = to_rtx_code (find_macro (&codes, tmp_char, infile));
bellwether_code = BELLWETHER_CODE (real_code); bellwether_code = BELLWETHER_CODE (real_code);
/* If we end up with an insn expression then we free this space below. */ /* If we end up with an insn expression then we free this space below. */
...@@ -1470,7 +1470,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps) ...@@ -1470,7 +1470,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
mode = find_macro (&modes, tmp_char, infile); mode = find_macro (&modes, tmp_char, infile);
else else
mode = mode_attr_index (mode_maps, tmp_char); mode = mode_attr_index (mode_maps, tmp_char);
PUT_MODE (return_rtx, mode); PUT_MODE (return_rtx, to_machine_mode (mode));
if (GET_MODE (return_rtx) != mode) if (GET_MODE (return_rtx) != mode)
fatal_with_file_and_line (infile, "mode too large"); fatal_with_file_and_line (infile, "mode too large");
} }
......
...@@ -51,6 +51,8 @@ enum rtx_code { ...@@ -51,6 +51,8 @@ enum rtx_code {
#define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE) #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
/* The cast here, saves many elsewhere. */ /* The cast here, saves many elsewhere. */
#define to_rtx_code(CODE) ((enum rtx_code) (CODE))
/* Register Transfer Language EXPRESSIONS CODE CLASSES */ /* Register Transfer Language EXPRESSIONS CODE CLASSES */
enum rtx_class { enum rtx_class {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment