Move copy_most_rtx to emit-rtl.c

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Fri Mar 8 04:33:00 GMT 2002


This is in preparation for a bugfix that will require it to call a
function not included in the gen* programs.

Applied to trunk and branch.

Fri Mar  8 06:48:45 2002  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* rtl.c (copy_most_rtx): Move from here ...
	* emit-rtl.c (copy_most_rtx): ... to here.

*** rtl.c	2002/02/19 02:53:10	1.108
--- rtl.c	2002/03/08 11:49:28
*************** copy_rtx (orig)
*** 444,547 ****
  }
  
- /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
-    placed in the result directly, rather than being copied.  */
- 
- rtx
- copy_most_rtx (orig, may_share)
-      rtx orig;
-      rtx may_share;
- {
-   rtx copy;
-   int i, j;
-   RTX_CODE code;
-   const char *format_ptr;
- 
-   if (orig == may_share)
-     return orig;
- 
-   code = GET_CODE (orig);
- 
-   switch (code)
-     {
-     case REG:
-     case QUEUED:
-     case CONST_INT:
-     case CONST_DOUBLE:
-     case CONST_VECTOR:
-     case SYMBOL_REF:
-     case CODE_LABEL:
-     case PC:
-     case CC0:
-       return orig;
-     default:
-       break;
-     }
- 
-   copy = rtx_alloc (code);
-   PUT_MODE (copy, GET_MODE (orig));
-   copy->in_struct = orig->in_struct;
-   copy->volatil = orig->volatil;
-   copy->unchanging = orig->unchanging;
-   copy->integrated = orig->integrated;
-   copy->frame_related = orig->frame_related;
- 
-   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
- 
-   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
-     {
-       switch (*format_ptr++)
- 	{
- 	case 'e':
- 	  XEXP (copy, i) = XEXP (orig, i);
- 	  if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
- 	    XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
- 	  break;
- 
- 	case 'u':
- 	  XEXP (copy, i) = XEXP (orig, i);
- 	  break;
- 
- 	case 'E':
- 	case 'V':
- 	  XVEC (copy, i) = XVEC (orig, i);
- 	  if (XVEC (orig, i) != NULL)
- 	    {
- 	      XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- 	      for (j = 0; j < XVECLEN (copy, i); j++)
- 		XVECEXP (copy, i, j)
- 		  = copy_most_rtx (XVECEXP (orig, i, j), may_share);
- 	    }
- 	  break;
- 
- 	case 'w':
- 	  XWINT (copy, i) = XWINT (orig, i);
- 	  break;
- 
- 	case 'n':
- 	case 'i':
- 	  XINT (copy, i) = XINT (orig, i);
- 	  break;
- 
- 	case 't':
- 	  XTREE (copy, i) = XTREE (orig, i);
- 	  break;
- 
- 	case 's':
- 	case 'S':
- 	  XSTR (copy, i) = XSTR (orig, i);
- 	  break;
- 
- 	case '0':
- 	  /* Copy this through the wide int field; that's safest.  */
- 	  X0WINT (copy, i) = X0WINT (orig, i);
- 	  break;
- 
- 	default:
- 	  abort ();
- 	}
-     }
-   return copy;
- }
- 
  /* Create a new copy of an rtx.  Only copy just one level.  */
  
--- 444,447 ----
*** emit-rtl.c	2002/03/02 11:38:49	1.249.2.2
--- emit-rtl.c	2002/03/08 11:49:31
*************** reset_used_decls (blk)
*** 2384,2387 ****
--- 2384,2487 ----
  }
  
+ /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
+    placed in the result directly, rather than being copied.  */
+ 
+ rtx
+ copy_most_rtx (orig, may_share)
+      rtx orig;
+      rtx may_share;
+ {
+   rtx copy;
+   int i, j;
+   RTX_CODE code;
+   const char *format_ptr;
+ 
+   if (orig == may_share)
+     return orig;
+ 
+   code = GET_CODE (orig);
+ 
+   switch (code)
+     {
+     case REG:
+     case QUEUED:
+     case CONST_INT:
+     case CONST_DOUBLE:
+     case CONST_VECTOR:
+     case SYMBOL_REF:
+     case CODE_LABEL:
+     case PC:
+     case CC0:
+       return orig;
+     default:
+       break;
+     }
+ 
+   copy = rtx_alloc (code);
+   PUT_MODE (copy, GET_MODE (orig));
+   copy->in_struct = orig->in_struct;
+   copy->volatil = orig->volatil;
+   copy->unchanging = orig->unchanging;
+   copy->integrated = orig->integrated;
+   copy->frame_related = orig->frame_related;
+ 
+   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
+ 
+   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
+     {
+       switch (*format_ptr++)
+ 	{
+ 	case 'e':
+ 	  XEXP (copy, i) = XEXP (orig, i);
+ 	  if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
+ 	    XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
+ 	  break;
+ 
+ 	case 'u':
+ 	  XEXP (copy, i) = XEXP (orig, i);
+ 	  break;
+ 
+ 	case 'E':
+ 	case 'V':
+ 	  XVEC (copy, i) = XVEC (orig, i);
+ 	  if (XVEC (orig, i) != NULL)
+ 	    {
+ 	      XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
+ 	      for (j = 0; j < XVECLEN (copy, i); j++)
+ 		XVECEXP (copy, i, j)
+ 		  = copy_most_rtx (XVECEXP (orig, i, j), may_share);
+ 	    }
+ 	  break;
+ 
+ 	case 'w':
+ 	  XWINT (copy, i) = XWINT (orig, i);
+ 	  break;
+ 
+ 	case 'n':
+ 	case 'i':
+ 	  XINT (copy, i) = XINT (orig, i);
+ 	  break;
+ 
+ 	case 't':
+ 	  XTREE (copy, i) = XTREE (orig, i);
+ 	  break;
+ 
+ 	case 's':
+ 	case 'S':
+ 	  XSTR (copy, i) = XSTR (orig, i);
+ 	  break;
+ 
+ 	case '0':
+ 	  /* Copy this through the wide int field; that's safest.  */
+ 	  X0WINT (copy, i) = X0WINT (orig, i);
+ 	  break;
+ 
+ 	default:
+ 	  abort ();
+ 	}
+     }
+   return copy;
+ }
+ 
  /* Mark ORIG as in use, and return a copy of it if it was already in use.
     Recursively does the same for subexpressions.  */



More information about the Gcc-patches mailing list