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: gcc/builtins.c: rtl object comparisons replaced by predicates


I'm currently working in code cleanliness, as proposed in the GCC's Open Projects section. My goal for now is to fix the old rtl object comparisons (through GET_CODE) by applying the correspondent predicates, as well to add new ones when appropriate.
Below, a patch for builtins.c


2009-01-28 Marcelo A. B. Slomp <mslomp@linuxmail.org>

* gcc/builtins.c: rtl object comparisons replaced by predicates


Index: gcc/builtins.c =================================================================== --- gcc/builtins.c (revision 143743) +++ gcc/builtins.c (working copy) @@ -1156,7 +1156,7 @@ get_memory_rtx (tree exp, tree len) gcc_assert (TREE_CODE (inner) == COMPONENT_REF);

 	  if (MEM_OFFSET (mem)
-	      && GET_CODE (MEM_OFFSET (mem)) == CONST_INT)
+	      && CONST_INT_P (MEM_OFFSET (mem)))
 	    offset = INTVAL (MEM_OFFSET (mem));

 	  if (offset >= 0 && len && host_integerp (len, 0))
@@ -1519,7 +1519,7 @@ expand_builtin_apply (rtx function, rtx

   dest = virtual_outgoing_args_rtx;
 #ifndef STACK_GROWS_DOWNWARD
-  if (GET_CODE (argsize) == CONST_INT)
+  if (CONST_INT_P (argsize))
     dest = plus_constant (dest, -INTVAL (argsize));
   else
     dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize));
@@ -3388,7 +3388,7 @@ expand_builtin_memcpy (tree exp, rtx tar
 	 by pieces, we can avoid loading the string from memory
 	 and only stored the computed constants.  */
       if (src_str
-	  && GET_CODE (len_rtx) == CONST_INT
+	  && CONST_INT_P (len_rtx)
 	  && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
 	  && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
 				  CONST_CAST (char *, src_str),
@@ -3506,7 +3506,7 @@ expand_builtin_mempcpy_args (tree dest,
 	 by pieces, we can avoid loading the string from memory
 	 and only stored the computed constants.  */
       if (src_str
-	  && GET_CODE (len_rtx) == CONST_INT
+	  && CONST_INT_P (len_rtx)
 	  && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
 	  && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
 				  CONST_CAST (char *, src_str),
@@ -3523,7 +3523,7 @@ expand_builtin_mempcpy_args (tree dest,
 	  return dest_mem;
 	}

-      if (GET_CODE (len_rtx) == CONST_INT
+      if (CONST_INT_P (len_rtx)
 	  && can_move_by_pieces (INTVAL (len_rtx),
 				 MIN (dest_align, src_align)))
 	{
@@ -3771,7 +3771,7 @@ expand_builtin_stpcpy (tree exp, rtx tar
 	{
 	  rtx len_rtx = expand_normal (len);

-	  if (GET_CODE (len_rtx) == CONST_INT)
+	  if (CONST_INT_P (len_rtx))
 	    {
 	      ret = expand_builtin_strcpy_args (get_callee_fndecl (exp),
 						dst, src, target, mode);
@@ -4179,7 +4179,7 @@ expand_builtin_memcmp (tree exp, rtx tar
     arg3_rtx = expand_normal (len);

     /* Set MEM_SIZE as appropriate.  */
-    if (GET_CODE (arg3_rtx) == CONST_INT)
+    if (CONST_INT_P (arg3_rtx))
       {
 	set_mem_size (arg1_rtx, arg3_rtx);
 	set_mem_size (arg2_rtx, arg3_rtx);


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