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,

somehow I remembered this a few months old patch
(http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00947.html).
Here is the diff against current sources, also updated by
Richard's comment.  Bootstrapped & regtested 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.
	(struct rtx_def): Use integrated for MEM_SCALAR_P and frame_related
	for MEM_POINTER.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.383
diff -c -3 -p -r1.383 emit-rtl.c
*** emit-rtl.c	6 Mar 2004 01:21:26 -0000	1.383
--- emit-rtl.c	20 Mar 2004 13:45:17 -0000
*************** set_mem_attributes_minus_bitpos (rtx ref
*** 1512,1517 ****
--- 1512,1518 ----
      |= ((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.121
diff -c -3 -p -r1.121 explow.c
*** explow.c	14 Mar 2004 22:26:04 -0000	1.121
--- explow.c	20 Mar 2004 13:45:17 -0000
*************** force_not_mem (rtx x)
*** 770,775 ****
--- 770,779 ----
      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.465
diff -c -3 -p -r1.465 rtl.h
*** rtl.h	9 Mar 2004 17:06:21 -0000	1.465
--- rtl.h	20 Mar 2004 13:45:17 -0000
*************** struct rtx_def GTY((chain_next ("RTX_NEX
*** 243,256 ****
    /* 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
       restoring registers in the prologue and epilogue.
!      1 in a MEM if the MEM refers to a scalar, rather than a member of
!      an aggregate.
!      1 in a REG if the register is a pointer.
       1 in a SYMBOL_REF if it addresses something in the per-function
       constant string pool.  */
    unsigned frame_related : 1;
--- 243,256 ----
    /* 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 refers to a scalar, rather than a member of
!      an aggregate.  */
    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
       restoring registers in the prologue and epilogue.
!      1 in a REG or MEM if it is a pointer.
       1 in a SYMBOL_REF if it addresses something in the per-function
       constant string pool.  */
    unsigned frame_related : 1;
*************** enum label_kind
*** 1136,1141 ****
--- 1136,1145 ----
  #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)->frame_related)
+ 
  /* 1 if the given register REG corresponds to a hard register.  */
  #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
  
*************** do {									\
*** 1251,1257 ****
  /* 1 if RTX is a mem that refers to a scalar.  If zero, RTX may or may
     not refer to a scalar.  */
  #define MEM_SCALAR_P(RTX)						\
!   (RTL_FLAG_CHECK1("MEM_SCALAR_P", (RTX), MEM)->frame_related)
  
  /* 1 if RTX is a mem that cannot trap.  */
  #define MEM_NOTRAP_P(RTX) \
--- 1255,1261 ----
  /* 1 if RTX is a mem that refers to a scalar.  If zero, RTX may or may
     not refer to a scalar.  */
  #define MEM_SCALAR_P(RTX)						\
!   (RTL_FLAG_CHECK1("MEM_SCALAR_P", (RTX), MEM)->integrated)
  
  /* 1 if RTX is a mem that cannot trap.  */
  #define MEM_NOTRAP_P(RTX) \


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