[PATCH][varmap] Add bitmap operand to rtl SET insns

Richard Guenther rguenther@suse.de
Mon Nov 12 16:16:00 GMT 2007


This adds a (transparent) bitmap argument to all rtx SET insns to be
able to track variable decls in addition to the single one in
REG_EXPR or MEM_EXPR at the point of a definition.

We play some tricks to get around changing all gen_rtx_SET calls.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
var-mappings-branch.

Richard.


2007-11-12  Michael Matz  <matz@suse.de>
	Richard Guenther  <rguenther@suse.de>

	* rtl.def (SET): Add bitmap operand.
	* rtl.h (gen_rtx_SET): Re-define to always create SET
	with NULL bitmap.
	(gen_rtx_SET_with_vars): New.
	* genrecog.c (find_operand): Handle 'b'.
	(find_matching_operand): Likewise.
	(validate_pattern): Likewise.
	(add_to_sequence): Likewise.
	* genemit.c (gen_exp): Handle 'b' like '0'.
	* genattrtab.c (attr_rtx_1): Likewise.
	* jump.c (rtx_renumbered_equal_p): Likewise.
	* read-rtl.c (read_rtx_1): Likewise.
	* emit-rtl.c (copy_insn_1): Likewise.
	* rtl.c (copy_rtx): Likewise.
	(rtx_equal_p): Ignore bitmaps.
	* cse.c (exp_equiv_p): Likewise.

Index: gcc/genrecog.c
===================================================================
*** gcc/genrecog.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/genrecog.c	2007-11-09 15:58:12.000000000 +0100
*************** find_operand (rtx pattern, int n, rtx st
*** 566,572 ****
  	      return r;
  	  break;
  
! 	case 'i': case 'w': case '0': case 's':
  	  break;
  
  	default:
--- 566,572 ----
  	      return r;
  	  break;
  
! 	case 'i': case 'w': case '0': case 's': case 'b':
  	  break;
  
  	default:
*************** find_matching_operand (rtx pattern, int 
*** 617,623 ****
  	      return r;
  	  break;
  
! 	case 'i': case 'w': case '0': case 's':
  	  break;
  
  	default:
--- 617,623 ----
  	      return r;
  	  break;
  
! 	case 'i': case 'w': case '0': case 's': case 'b':
  	  break;
  
  	default:
*************** validate_pattern (rtx pattern, rtx insn,
*** 870,876 ****
  	    validate_pattern (XVECEXP (pattern, i, j), insn, NULL_RTX, 0);
  	  break;
  
! 	case 'i': case 'w': case '0': case 's':
  	  break;
  
  	default:
--- 870,876 ----
  	    validate_pattern (XVECEXP (pattern, i, j), insn, NULL_RTX, 0);
  	  break;
  
! 	case 'i': case 'w': case '0': case 's': case 'b':
  	  break;
  
  	default:
*************** add_to_sequence (rtx pattern, struct dec
*** 1149,1154 ****
--- 1149,1155 ----
  	  /* Handled above.  */
  	  break;
  	case '0':
+ 	case 'b':
  	  break;
  
  	default:
Index: gcc/genemit.c
===================================================================
*** gcc/genemit.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/genemit.c	2007-11-09 16:01:29.000000000 +0100
*************** gen_exp (rtx x, enum rtx_code subroutine
*** 274,280 ****
    len = GET_RTX_LENGTH (code);
    for (i = 0; i < len; i++)
      {
!       if (fmt[i] == '0')
  	break;
        printf (",\n\t");
        switch (fmt[i])
--- 274,280 ----
    len = GET_RTX_LENGTH (code);
    for (i = 0; i < len; i++)
      {
!       if (fmt[i] == '0' || fmt[i] == 'b')
  	break;
        printf (",\n\t");
        switch (fmt[i])
Index: gcc/rtl.def
===================================================================
*** gcc/rtl.def.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/rtl.def	2007-11-09 15:58:12.000000000 +0100
*************** DEF_RTL_EXPR(PREFETCH, "prefetch", "eee"
*** 275,281 ****
     ALL assignment must use SET.
     Instructions that do multiple assignments must use multiple SET,
     under PARALLEL.  */
! DEF_RTL_EXPR(SET, "set", "ee", RTX_EXTRA)
  
  /* Indicate something is used in a way that we don't want to explain.
     For example, subroutine calls will use the register
--- 275,281 ----
     ALL assignment must use SET.
     Instructions that do multiple assignments must use multiple SET,
     under PARALLEL.  */
! DEF_RTL_EXPR(SET, "set", "eeb", RTX_EXTRA)
  
  /* Indicate something is used in a way that we don't want to explain.
     For example, subroutine calls will use the register
Index: gcc/jump.c
===================================================================
*** gcc/jump.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/jump.c	2007-11-09 15:58:12.000000000 +0100
*************** rtx_renumbered_equal_p (const_rtx x, con
*** 1670,1675 ****
--- 1670,1676 ----
  	    return 0;
  	  /* Fall through.  */
  	case '0':
+ 	case 'b':
  	  break;
  
  	case 'E':
Index: gcc/genattrtab.c
===================================================================
*** gcc/genattrtab.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/genattrtab.c	2007-11-09 15:58:12.000000000 +0100
*************** attr_rtx_1 (enum rtx_code code, va_list 
*** 495,500 ****
--- 495,501 ----
  	  switch (*fmt++)
  	    {
  	    case '0':		/* Unused field.  */
+ 	    case 'b':
  	      break;
  
  	    case 'i':		/* An integer?  */
Index: gcc/read-rtl.c
===================================================================
*** gcc/read-rtl.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/read-rtl.c	2007-11-09 15:58:12.000000000 +0100
*************** read_rtx_1 (FILE *infile, struct map_val
*** 1554,1559 ****
--- 1554,1560 ----
  	/* 0 means a field for internal use only.
  	   Don't expect it to be present in the input.  */
        case '0':
+       case 'b':
  	break;
  
        case 'e':
Index: gcc/emit-rtl.c
===================================================================
*** gcc/emit-rtl.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/emit-rtl.c	2007-11-09 15:58:12.000000000 +0100
*************** copy_insn_1 (rtx orig)
*** 4986,4991 ****
--- 4986,4992 ----
        case 'S':
        case 'u':
        case '0':
+       case 'b':
  	/* These are left unchanged.  */
  	break;
  
Index: gcc/rtl.c
===================================================================
*** gcc/rtl.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/rtl.c	2007-11-09 15:58:12.000000000 +0100
*************** copy_rtx (rtx orig)
*** 307,312 ****
--- 307,313 ----
        case 'u':
        case 'B':
        case '0':
+       case 'b':
  	/* These are left unchanged.  */
  	break;
  
*************** rtx_equal_p (const_rtx x, const_rtx y)
*** 434,439 ****
--- 435,444 ----
  	case 't':
  	  break;
  
+ 	case 'b':
+ 	  /* In SETs we have debug variable bitmaps.  Ignore them.  */
+ 	  break;
+ 
  	  /* It is believed that rtx's at this level will never
  	     contain anything but integers and other rtx's,
  	     except for within LABEL_REFs and SYMBOL_REFs.  */
Index: gcc/cse.c
===================================================================
*** gcc/cse.c.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/cse.c	2007-11-09 15:58:12.000000000 +0100
*************** exp_equiv_p (const_rtx x, const_rtx y, i
*** 2558,2563 ****
--- 2558,2564 ----
  
  	case '0':
  	case 't':
+ 	case 'b':
  	  break;
  
  	default:
Index: gcc/rtl.h
===================================================================
*** gcc/rtl.h.orig	2007-11-09 15:53:03.000000000 +0100
--- gcc/rtl.h	2007-11-09 15:58:12.000000000 +0100
*************** extern GTY(()) rtx return_address_pointe
*** 1900,1905 ****
--- 1900,1910 ----
  #define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
    gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
  #endif
+ #undef gen_rtx_SET
+ #define gen_rtx_SET(MODE, ARG0, ARG1) \
+   gen_rtx_fmt_eeb (SET, (MODE), (ARG0), (ARG1), 0)
+ #define gen_rtx_SET_with_vars(MODE, ARG0, ARG1, ARG2) \
+   gen_rtx_fmt_eeb (SET, (MODE), (ARG0), (ARG1), (ARG2))
  #endif
  
  /* There are some RTL codes that require special attention; the



More information about the Gcc-patches mailing list