This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH to read-rtl.c


Zack Weinberg <zack@codesourcery.com> writes:

| > Zack Weinberg <zack@codesourcery.com> writes:
| > | 
| > | I'm not enthused about your solution to this problem. 
| > 
| > I can understand.  It is not something that I really liked, but from
| > the possibilities it seems to be the least unpleasant.
| 
| In that case, I'd prefer just bare casts (as mentioned in the earlier message).

Done.
Thanks,

-- Gaby
2005-06-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>
  
	* rtl.h (to_rtx_code): Remove.
	* machmode.h (to_machine_mode): Likewise.
	* read-rtl.c (apply_mode_macro): Replace to_machine_mode with
	explicit cast.
	(apply_mode_maps): Likewise.
	(read_rtx_1): Likewise.
	(apply_code_macro): Replace to to_rtx_code with explicit cast.
	(check_code_macro): Likewise.
	(read_rtx_1): Likewise.
  
Index: machmode.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/machmode.h,v
retrieving revision 1.40
diff -p -r1.40 machmode.h
*** machmode.h	9 Jun 2005 17:41:36 -0000	1.40
--- machmode.h	11 Jun 2005 19:55:48 -0000
*************** Software Foundation, 59 Temple Place - S
*** 25,34 ****
  /* Make an enum class that gives all the machine modes.  */
  #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.  */
  
  extern const char * const mode_name[NUM_MACHINE_MODES];
--- 25,30 ----
Index: read-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/read-rtl.c,v
retrieving revision 1.41
diff -p -r1.41 read-rtl.c
*** read-rtl.c	9 Jun 2005 17:41:36 -0000	1.41
--- read-rtl.c	11 Jun 2005 19:55:49 -0000
*************** uses_mode_macro_p (rtx x, int mode)
*** 243,249 ****
  static void
  apply_mode_macro (rtx x, int mode)
  {
!   PUT_MODE (x, to_machine_mode (mode));
  }
  
  /* Implementations of the macro_group callbacks for codes.  */
--- 243,249 ----
  static void
  apply_mode_macro (rtx x, int mode)
  {
!   PUT_MODE (x, (enum machine_mode) mode);
  }
  
  /* Implementations of the macro_group callbacks for codes.  */
*************** uses_code_macro_p (rtx x, int code)
*** 269,275 ****
  static void
  apply_code_macro (rtx x, int code)
  {
!   PUT_CODE (x, to_rtx_code (code));
  }
  
  /* Map a code or mode attribute string P to the underlying string for
--- 269,275 ----
  static void
  apply_code_macro (rtx x, int code)
  {
!   PUT_CODE (x, (enum rtx_code) code);
  }
  
  /* Map a code or mode attribute string P to the underlying string for
*************** apply_mode_maps (rtx x, struct map_value
*** 363,369 ****
  
  	  v = map_attr_string (pm->string, macro, value);
  	  if (v)
! 	    PUT_MODE (x, to_machine_mode (find_mode (v->string, infile)));
  	  else
  	    *unknown = pm->string;
  	  return;
--- 363,369 ----
  
  	  v = map_attr_string (pm->string, macro, value);
  	  if (v)
! 	    PUT_MODE (x, (enum machine_mode) find_mode (v->string, infile));
  	  else
  	    *unknown = pm->string;
  	  return;
*************** check_code_macro (struct mapping *macro,
*** 1311,1317 ****
    struct map_value *v;
    enum rtx_code bellwether;
  
!   bellwether = to_rtx_code (macro->values->number);
    for (v = macro->values->next; v != 0; v = v->next)
      if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0)
        fatal_with_file_and_line (infile, "code macro `%s' combines "
--- 1311,1317 ----
    struct map_value *v;
    enum rtx_code bellwether;
  
!   bellwether = (enum rtx_code) macro->values->number;
    for (v = macro->values->next; v != 0; v = v->next)
      if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0)
        fatal_with_file_and_line (infile, "code macro `%s' combines "
*************** read_rtx_1 (FILE *infile, struct map_val
*** 1449,1455 ****
        check_code_macro (read_mapping (&codes, codes.macros, infile), infile);
        goto again;
      }
!   real_code = to_rtx_code (find_macro (&codes, tmp_char, infile));
    bellwether_code = BELLWETHER_CODE (real_code);
  
    /* If we end up with an insn expression then we free this space below.  */
--- 1449,1455 ----
        check_code_macro (read_mapping (&codes, codes.macros, infile), infile);
        goto again;
      }
!   real_code = (enum rtx_code) find_macro (&codes, tmp_char, infile);
    bellwether_code = BELLWETHER_CODE (real_code);
  
    /* If we end up with an insn expression then we free this space below.  */
*************** read_rtx_1 (FILE *infile, struct map_val
*** 1470,1476 ****
  	mode = find_macro (&modes, tmp_char, infile);
        else
  	mode = mode_attr_index (mode_maps, tmp_char);
!       PUT_MODE (return_rtx, to_machine_mode (mode));
        if (GET_MODE (return_rtx) != mode)
  	fatal_with_file_and_line (infile, "mode too large");
      }
--- 1470,1476 ----
  	mode = find_macro (&modes, tmp_char, infile);
        else
  	mode = mode_attr_index (mode_maps, tmp_char);
!       PUT_MODE (return_rtx, (enum machine_mode) mode);
        if (GET_MODE (return_rtx) != mode)
  	fatal_with_file_and_line (infile, "mode too large");
      }
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.552
diff -p -r1.552 rtl.h
*** rtl.h	9 Jun 2005 17:41:37 -0000	1.552
--- rtl.h	11 Jun 2005 19:55:50 -0000
*************** enum rtx_code  {
*** 51,58 ****
  #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
  				/* The cast here, saves many elsewhere.  */
  
- #define to_rtx_code(CODE)    ((enum rtx_code) (CODE))
- 
  /* Register Transfer Language EXPRESSIONS CODE CLASSES */
  
  enum rtx_class  {
--- 51,56 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]