View | Details | Return to bug 10060 | Differences between
and this patch

Collapse All | Expand All

(-)emit-rtl.c (-11 / +50 lines)
Lines 196-201 static reg_attrs *get_reg_attrs (tree, i Link Here
196
static tree component_ref_for_mem_expr (tree);
196
static tree component_ref_for_mem_expr (tree);
197
static rtx gen_const_vector_0 (enum machine_mode);
197
static rtx gen_const_vector_0 (enum machine_mode);
198
static rtx gen_complex_constant_part (enum machine_mode, rtx, int);
198
static rtx gen_complex_constant_part (enum machine_mode, rtx, int);
199
static void copy_rtx_if_shared_1 (rtx *orig);
199
200
200
/* Probability of the conditional branch currently proceeded by try_split.
201
/* Probability of the conditional branch currently proceeded by try_split.
201
   Set to -1 otherwise.  */
202
   Set to -1 otherwise.  */
Lines 2643-2656 copy_most_rtx (rtx orig, rtx may_share) Link Here
2643
rtx
2644
rtx
2644
copy_rtx_if_shared (rtx orig)
2645
copy_rtx_if_shared (rtx orig)
2645
{
2646
{
2646
  rtx x = orig;
2647
  copy_rtx_if_shared_1 (&orig);
2648
  return orig;
2649
}
2650
2651
static void
2652
copy_rtx_if_shared_1 (rtx *orig1)
2653
{
2654
  rtx x;
2647
  int i;
2655
  int i;
2648
  enum rtx_code code;
2656
  enum rtx_code code;
2649
  const char *format_ptr;
2657
  const char *format_ptr;
2650
  int copied = 0;
2658
  int copied = 0;
2659
  int length;
2660
2661
  /* Repeat is used to turn tail-recursion into iteration.  */
2662
repeat:
2663
  x = *orig1;
2651
2664
2652
  if (x == 0)
2665
  if (x == 0)
2653
    return 0;
2666
    return;
2654
2667
2655
  code = GET_CODE (x);
2668
  code = GET_CODE (x);
2656
2669
Lines 2669-2675 copy_rtx_if_shared (rtx orig) Link Here
2669
    case CC0:
2682
    case CC0:
2670
    case SCRATCH:
2683
    case SCRATCH:
2671
      /* SCRATCH must be shared because they represent distinct values.  */
2684
      /* SCRATCH must be shared because they represent distinct values.  */
2672
      return x;
2685
      return;
2673
2686
2674
    case CONST:
2687
    case CONST:
2675
      /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
2688
      /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
Lines 2677-2683 copy_rtx_if_shared (rtx orig) Link Here
2677
      if (GET_CODE (XEXP (x, 0)) == PLUS
2690
      if (GET_CODE (XEXP (x, 0)) == PLUS
2678
	  && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
2691
	  && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
2679
	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
2692
	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
2680
	return x;
2693
	return;
2681
      break;
2694
      break;
2682
2695
2683
    case INSN:
2696
    case INSN:
Lines 2686-2692 copy_rtx_if_shared (rtx orig) Link Here
2686
    case NOTE:
2699
    case NOTE:
2687
    case BARRIER:
2700
    case BARRIER:
2688
      /* The chain of insns is not being copied.  */
2701
      /* The chain of insns is not being copied.  */
2689
      return x;
2702
      return;
2690
2703
2691
    case MEM:
2704
    case MEM:
2692
      /* A MEM is allowed to be shared if its address is constant.
2705
      /* A MEM is allowed to be shared if its address is constant.
Lines 2698-2704 copy_rtx_if_shared (rtx orig) Link Here
2698
	 because it looks safe and profitable in one context, but
2711
	 because it looks safe and profitable in one context, but
2699
	 in some other context it creates unrecognizable RTL.  */
2712
	 in some other context it creates unrecognizable RTL.  */
2700
      if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
2713
      if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
2701
	return x;
2714
	return;
2702
2715
2703
      break;
2716
      break;
2704
2717
Lines 2728-2740 copy_rtx_if_shared (rtx orig) Link Here
2728
     must be copied if X was copied.  */
2741
     must be copied if X was copied.  */
2729
2742
2730
  format_ptr = GET_RTX_FORMAT (code);
2743
  format_ptr = GET_RTX_FORMAT (code);
2744
  length = GET_RTX_LENGTH (code);
2745
  
2746
  /* Optimize common case of "ee". */
2747
  if (length == 2 && format_ptr[0] == 'e' && format_ptr[1] == 'e')
2748
    {
2749
      *orig1 = x;
2750
      copy_rtx_if_shared_1 (& XEXP (x, 0));
2751
      
2752
      orig1 = & XEXP (x, 1);
2753
      goto repeat;
2754
    }
2731
2755
2732
  for (i = 0; i < GET_RTX_LENGTH (code); i++)
2756
  for (i = 0; i < length; i++)
2733
    {
2757
    {
2734
      switch (*format_ptr++)
2758
      switch (*format_ptr++)
2735
	{
2759
	{
2736
	case 'e':
2760
	case 'e':
2737
	  XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i));
2761
	  copy_rtx_if_shared_1 (& XEXP (x, i));
2738
	  break;
2762
	  break;
2739
2763
2740
	case 'E':
2764
	case 'E':
Lines 2742-2757 copy_rtx_if_shared (rtx orig) Link Here
2742
	    {
2766
	    {
2743
	      int j;
2767
	      int j;
2744
	      int len = XVECLEN (x, i);
2768
	      int len = XVECLEN (x, i);
2745
2769
              
2770
              /* Copy the vector iff I copied the rtx and the length is nonzero. */
2746
	      if (copied && len > 0)
2771
	      if (copied && len > 0)
2747
		XVEC (x, i) = gen_rtvec_v (len, XVEC (x, i)->elem);
2772
		XVEC (x, i) = gen_rtvec_v (len, XVEC (x, i)->elem);
2773
              
2774
              /* Call recsusively on all inside the vector. */
2748
	      for (j = 0; j < len; j++)
2775
	      for (j = 0; j < len; j++)
2749
		XVECEXP (x, i, j) = copy_rtx_if_shared (XVECEXP (x, i, j));
2776
                copy_rtx_if_shared_1 (& XVECEXP (x, i, j));
2750
	    }
2777
	    }
2751
	  break;
2778
	  break;
2752
	}
2779
	}
2753
    }
2780
    }
2754
  return x;
2781
  *orig1 = x;
2782
  return;
2755
}
2783
}
2756
2784
2757
/* Clear all the USED bits in X to allow copy_rtx_if_shared to be used
2785
/* Clear all the USED bits in X to allow copy_rtx_if_shared to be used
Lines 2764-2769 reset_used_flags (rtx x) Link Here
2764
  enum rtx_code code;
2792
  enum rtx_code code;
2765
  const char *format_ptr;
2793
  const char *format_ptr;
2766
2794
2795
  /* Repeat is used to turn tail-recursion into iteration.  */
2796
repeat:
2767
  if (x == 0)
2797
  if (x == 0)
2768
    return;
2798
    return;
2769
2799
Lines 2801-2806 reset_used_flags (rtx x) Link Here
2801
  RTX_FLAG (x, used) = 0;
2831
  RTX_FLAG (x, used) = 0;
2802
2832
2803
  format_ptr = GET_RTX_FORMAT (code);
2833
  format_ptr = GET_RTX_FORMAT (code);
2834
  
2835
  /* Optimize common case of "ee". */
2836
  if (GET_RTX_LENGTH (code) == 2 && format_ptr[0] == 'e' && format_ptr[1] == 'e')
2837
    {
2838
      reset_used_flags (XEXP (x, 0));
2839
      x = XEXP (x, 1);
2840
      goto repeat;
2841
    }
2842
  
2804
  for (i = 0; i < GET_RTX_LENGTH (code); i++)
2843
  for (i = 0; i < GET_RTX_LENGTH (code); i++)
2805
    {
2844
    {
2806
      switch (*format_ptr++)
2845
      switch (*format_ptr++)

Return to bug 10060