Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
View | Details | Raw Unified | Return to bug 270638
Collapse All | Expand All

(-)gcc-4.4.0-orig/gcc/fwprop.c (-3 / +84 lines)
Lines 852-857 forward_propagate_subreg (df_ref use, rt Link Here
852
    return false;
852
    return false;
853
}
853
}
854
854
855
/* Try to replace USE with SRC (defined in DEF_INSN) in __asm.  */
856
857
static bool
858
forward_propagate_asm (df_ref use, rtx def_insn, rtx def_set, rtx reg)
859
{
860
  rtx use_insn = DF_REF_INSN (use), src, use_pat, asm_operands, new_rtx, *loc;
861
  int speed_p, i;
862
  df_ref *use_vec;
863
864
  gcc_assert ((DF_REF_FLAGS (use) & DF_REF_IN_NOTE) == 0);
865
866
  src = SET_SRC (def_set);
867
  use_pat = PATTERN (use_insn);
868
869
  /* In __asm don't replace if src might need more registers than
870
     reg, as that could increase register pressure on the __asm.  */
871
  use_vec = DF_INSN_USES (def_insn);
872
  if (use_vec[0] && use_vec[1])
873
    return false;
874
875
  speed_p = optimize_bb_for_speed_p (BLOCK_FOR_INSN (use_insn));
876
  asm_operands = NULL_RTX;
877
  switch (GET_CODE (use_pat))
878
    {
879
    case ASM_OPERANDS:
880
      asm_operands = use_pat;
881
      break;
882
    case SET:
883
      if (MEM_P (SET_DEST (use_pat)))
884
	{
885
	  loc = &SET_DEST (use_pat);
886
	  new_rtx = propagate_rtx (*loc, GET_MODE (*loc), reg, src, speed_p);
887
	  if (new_rtx)
888
	    validate_unshare_change (use_insn, loc, new_rtx, true);
889
	}
890
      asm_operands = SET_SRC (use_pat);
891
      break;
892
    case PARALLEL:
893
      for (i = 0; i < XVECLEN (use_pat, 0); i++)
894
	if (GET_CODE (XVECEXP (use_pat, 0, i)) == SET)
895
	  {
896
	    if (MEM_P (SET_DEST (XVECEXP (use_pat, 0, i))))
897
	      {
898
		loc = &SET_DEST (XVECEXP (use_pat, 0, i));
899
		new_rtx = propagate_rtx (*loc, GET_MODE (*loc), reg,
900
					 src, speed_p);
901
		if (new_rtx)
902
		  validate_unshare_change (use_insn, loc, new_rtx, true);
903
	      }
904
	    asm_operands = SET_SRC (XVECEXP (use_pat, 0, i));
905
	  }
906
	else if (GET_CODE (XVECEXP (use_pat, 0, i)) == ASM_OPERANDS)
907
	  asm_operands = XVECEXP (use_pat, 0, i);
908
      break;
909
    default:
910
      gcc_unreachable ();
911
    }
912
913
  gcc_assert (asm_operands && GET_CODE (asm_operands) == ASM_OPERANDS);
914
  for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (asm_operands); i++)
915
    {
916
      loc = &ASM_OPERANDS_INPUT (asm_operands, i);
917
      new_rtx = propagate_rtx (*loc, GET_MODE (*loc), reg, src, speed_p);
918
      if (new_rtx)
919
	validate_unshare_change (use_insn, loc, new_rtx, true);
920
    }
921
922
  if (num_changes_pending () == 0 || !apply_change_group ())
923
    return false;
924
925
  num_changes++;
926
  return true;
927
}
928
855
/* Try to replace USE with SRC (defined in DEF_INSN) and simplify the
929
/* Try to replace USE with SRC (defined in DEF_INSN) and simplify the
856
   result.  */
930
   result.  */
857
931
Lines 863-874 forward_propagate_and_simplify (df_ref u Link Here
863
  rtx src, reg, new_rtx, *loc;
937
  rtx src, reg, new_rtx, *loc;
864
  bool set_reg_equal;
938
  bool set_reg_equal;
865
  enum machine_mode mode;
939
  enum machine_mode mode;
940
  int asm_use = -1;
866
941
867
  if (!use_set)
942
  if (INSN_CODE (use_insn) < 0)
943
    asm_use = asm_noperands (PATTERN (use_insn));
944
945
  if (!use_set && asm_use < 0)
868
    return false;
946
    return false;
869
947
870
  /* Do not propagate into PC, CC0, etc.  */
948
  /* Do not propagate into PC, CC0, etc.  */
871
  if (GET_MODE (SET_DEST (use_set)) == VOIDmode)
949
  if (use_set && GET_MODE (SET_DEST (use_set)) == VOIDmode)
872
    return false;
950
    return false;
873
951
874
  /* If def and use are subreg, check if they match.  */
952
  /* If def and use are subreg, check if they match.  */
Lines 900-906 forward_propagate_and_simplify (df_ref u Link Here
900
  if (MEM_P (src) && MEM_READONLY_P (src))
978
  if (MEM_P (src) && MEM_READONLY_P (src))
901
    {
979
    {
902
      rtx x = avoid_constant_pool_reference (src);
980
      rtx x = avoid_constant_pool_reference (src);
903
      if (x != src)
981
      if (x != src && use_set)
904
	{
982
	{
905
          rtx note = find_reg_note (use_insn, REG_EQUAL, NULL_RTX);
983
          rtx note = find_reg_note (use_insn, REG_EQUAL, NULL_RTX);
906
	  rtx old_rtx = note ? XEXP (note, 0) : SET_SRC (use_set);
984
	  rtx old_rtx = note ? XEXP (note, 0) : SET_SRC (use_set);
Lines 911-916 forward_propagate_and_simplify (df_ref u Link Here
911
      return false;
989
      return false;
912
    }
990
    }
913
991
992
  if (asm_use >= 0)
993
    return forward_propagate_asm (use, def_insn, def_set, reg);
994
914
  /* Else try simplifying.  */
995
  /* Else try simplifying.  */
915
996
916
  if (DF_REF_TYPE (use) == DF_REF_REG_MEM_STORE)
997
  if (DF_REF_TYPE (use) == DF_REF_REG_MEM_STORE)

Return to bug 270638