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]

[patch] Record REG_POINTER in more cases


Hello,

REG_POINTER is not set if the pointer is taken from a MEM location.
This patch makes the flag to be added.  I don't know whether there
are some other consequences, but it increases coverage of PRED_POINTER
heuristics.  Bootstrapped on i686.

Zdenek

	* emit-rtl.c (set_mem_attributes_minus_bitpos): Set MEM_POINTER
	flag.
	* explow.c (force_not_mem): Set REG_POINTER flag according to
	MEM_POINTER one.
	* rtl.h (MEM_POINTER): New macro.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.350
diff -c -3 -p -r1.350 emit-rtl.c
*** emit-rtl.c	11 Sep 2003 21:40:41 -0000	1.350
--- emit-rtl.c	12 Oct 2003 19:42:12 -0000
*************** set_mem_attributes_minus_bitpos (rtx ref
*** 1843,1848 ****
--- 1843,1849 ----
      |= ((lang_hooks.honor_readonly
  	 && (TYPE_READONLY (type) || TREE_READONLY (t)))
  	|| (! TYPE_P (t) && TREE_CONSTANT (t)));
+   MEM_POINTER (ref) = POINTER_TYPE_P (type);
  
    /* If we are making an object of this type, or if this is a DECL, we know
       that it is a scalar if the type is not an aggregate.  */
Index: explow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/explow.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 explow.c
*** explow.c	18 Sep 2003 20:43:04 -0000	1.117
--- explow.c	12 Oct 2003 19:42:12 -0000
*************** force_not_mem (rtx x)
*** 736,741 ****
--- 736,745 ----
      return x;
  
    temp = gen_reg_rtx (GET_MODE (x));
+ 
+   if (MEM_POINTER (x))
+     REG_POINTER (temp) = 1;
+ 
    emit_move_insn (temp, x);
    return temp;
  }
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.436
diff -c -3 -p -r1.436 rtl.h
*** rtl.h	11 Oct 2003 22:57:46 -0000	1.436
--- rtl.h	12 Oct 2003 19:42:12 -0000
*************** struct rtx_def GTY((chain_next ("RTX_NEX
*** 200,206 ****
    /* Nonzero if this rtx came from procedure integration.
       1 in a REG or PARALLEL means this rtx refers to the return value
       of the current function.
!      1 in a SYMBOL_REF if the symbol is weak.  */
    unsigned integrated : 1;
    /* 1 in an INSN or a SET if this rtx is related to the call frame,
       either changing how we compute the frame address or saving and
--- 200,207 ----
    /* Nonzero if this rtx came from procedure integration.
       1 in a REG or PARALLEL means this rtx refers to the return value
       of the current function.
!      1 in a SYMBOL_REF if the symbol is weak.
!      1 in a MEM if the MEM is a pointer.  */
    unsigned integrated : 1;
    /* 1 in an INSN or a SET if this rtx is related to the call frame,
       either changing how we compute the frame address or saving and
*************** enum label_kind
*** 1003,1008 ****
--- 1004,1013 ----
  /* 1 if RTX is a reg that holds a pointer value.  */
  #define REG_POINTER(RTX)						\
    (RTL_FLAG_CHECK1("REG_POINTER", (RTX), REG)->frame_related)
+ 
+ /* 1 if RTX is a mem that holds a pointer value.  */
+ #define MEM_POINTER(RTX)						\
+   (RTL_FLAG_CHECK1("MEM_POINTER", (RTX), MEM)->integrated)
  
  /* 1 if the given register REG corresponds to a hard register.  */
  #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))


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