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]

[PATCH] Add prototype for ssa_fast_dce, add dump output for ssa-ccp


ssa-ccp was missing a prototype for ssa_fast_dce.
And it never said what it was doing when it removed edges/set
registers constant, in the dump file.

(It's also missing a prototype in ssa.h, but i'll send that in a sec).

2001-07-09  Daniel Berlin  <dan@cgsoftware.com>

	* ssa-ccp.c: Add prototype for ssa_fast_dce.
	(optimize_unexecutable_edges): Add note about removal
	of edge, and removal of phi alternative,  to dump file. 
	(ssa_ccp_substitute_constants): Add note about register now being
	constant, and which uses were replaced in what insns, to dump file.

Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa-ccp.c,v
retrieving revision 1.1
diff -c -3 -p -w -B -b -r1.1 ssa-ccp.c
*** ssa-ccp.c	2001/07/09 19:47:27	1.1
--- ssa-ccp.c	2001/07/09 22:33:14
*************** static void follow_def_use_chains      P
*** 133,139 ****
  static void optimize_unexecutable_edges PARAMS ((struct edge_list *, sbitmap));
  static void ssa_ccp_substitute_constants PARAMS ((void));
  static void ssa_ccp_df_delete_unreachable_insns PARAMS ((void));
! 
  /* Return the first PHI node in a basic block.  This routine knows
     what INSNs can start a basic block and what can validly follow
     them up to the first PHI node.
--- 133,139 ----
  static void optimize_unexecutable_edges PARAMS ((struct edge_list *, sbitmap));
  static void ssa_ccp_substitute_constants PARAMS ((void));
  static void ssa_ccp_df_delete_unreachable_insns PARAMS ((void));
! static void ssa_fast_dce PARAMS ((struct df *));
  /* Return the first PHI node in a basic block.  This routine knows
     what INSNs can start a basic block and what can validly follow
     them up to the first PHI node.
*************** optimize_unexecutable_edges (edges, exec
*** 756,765 ****
  	      while (PHI_NODE_P (insn))
  		{
  		  remove_phi_alternative (PATTERN (insn), edge->src);
  		  insn = NEXT_INSN (insn);
  		}
  	    }
! 
  	  /* Since the edge was not executable, remove it from the CFG.  */
  	  remove_edge (edge);
  	}
--- 756,770 ----
  	      while (PHI_NODE_P (insn))
  		{
  		  remove_phi_alternative (PATTERN (insn), edge->src);
+ 		  if (rtl_dump_file)
+ 		    fprintf (rtl_dump_file, "Removing alternative for bb %d of phi %d\n", 
+ 			     edge->src->index, SSA_NAME (PATTERN (insn)));
  		  insn = NEXT_INSN (insn);
  		}
  	    }
! 	  if (rtl_dump_file)
! 	    fprintf (rtl_dump_file, "Removing edge from %d to %d because it is not executable\n",
! 		     edge->src->index, edge->dest->index);
  	  /* Since the edge was not executable, remove it from the CFG.  */
  	  remove_edge (edge);
  	}
*************** ssa_ccp_substitute_constants ()
*** 859,864 ****
--- 864,872 ----
  	     are consecutive at the start of the basic block.  */
  	  if (! PHI_NODE_P (def))
  	    {
+ 	      if (rtl_dump_file)
+ 		fprintf (rtl_dump_file, "Register %d is now set to a constant\n", SSA_NAME (PATTERN (def)));
+ 	      
  	      SET_SRC (set) = values[i].const_value;
  	      INSN_CODE (def) = -1;
  	      df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), def);
*************** ssa_ccp_substitute_constants ()
*** 882,894 ****
  		  && (GET_CODE (useinsn) == INSN
  		      || GET_CODE (useinsn) == JUMP_INSN))
  		{
! 		  validate_replace_src (regno_reg_rtx [i],
  					values[i].const_value,
! 					useinsn);
  		  INSN_CODE (useinsn) = -1;
  		  df_insn_modify (df_analyzer,
  				  BLOCK_FOR_INSN (useinsn),
  				  useinsn);
  		}
  
  	    }
--- 890,910 ----
  		  && (GET_CODE (useinsn) == INSN
  		      || GET_CODE (useinsn) == JUMP_INSN))
  		{
! 		  
! 		  if (validate_replace_src (regno_reg_rtx [i],
  					    values[i].const_value,
! 					    useinsn))
! 		    {
! 		      if (rtl_dump_file)
! 			fprintf(rtl_dump_file, 
! 				"Use of register %d in insn %d replace with constant value\n",
! 				i, INSN_UID (useinsn));
  		      INSN_CODE (useinsn) = -1;
  		      df_insn_modify (df_analyzer,
  				      BLOCK_FOR_INSN (useinsn),
  				      useinsn);
+ 		    }
+ 		  
  		}
  
  	    }

-- 
"Curiosity killed the cat, but for a while I was a suspect.
"-Steven Wright


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