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]

Remove unreachable expand code from expr.c


Hi,

These codes are gimplified so they should never reach expand_expr.
Bootstrapped (with a plug for the IMA problem) and tested on x86-64.
OK?

Gr.
Steven

2004-05-19  Steven Bosscher  <stevenb@suse.de>

	* expr.c (expand_expr_real_1): Abort for LABEL_BLOCK_EXPR,
	EXIT_BLOCK_EXPR, CONJ_EXPR, TARGET_EXPR, and INIT_EXPR.
	Remove code to expand them.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.647
diff -c -3 -p -r1.647 expr.c
*** expr.c	19 May 2004 06:26:21 -0000	1.647
--- expr.c	19 May 2004 06:46:11 -0000
*************** expand_expr_real_1 (tree exp, rtx target
*** 6818,6838 ****
         see them here.  */
      case LOOP_EXPR:
      case EXIT_EXPR:
!       abort ();
! 
      case LABELED_BLOCK_EXPR:
-       if (LABELED_BLOCK_BODY (exp))
- 	expand_expr_stmt_value (LABELED_BLOCK_BODY (exp), 0, 1);
-       /* Should perhaps use expand_label, but this is simpler and safer.  */
-       do_pending_stack_adjust ();
-       emit_label (label_rtx (LABELED_BLOCK_LABEL (exp)));
-       return const0_rtx;
- 
      case EXIT_BLOCK_EXPR:
!       if (EXIT_BLOCK_RETURN (exp))
! 	sorry ("returned value in block_exit_expr");
!       expand_goto (LABELED_BLOCK_LABEL (EXIT_BLOCK_LABELED_BLOCK (exp)));
!       return const0_rtx;
  
      case BIND_EXPR:
        {
--- 6818,6829 ----
         see them here.  */
      case LOOP_EXPR:
      case EXIT_EXPR:
!     case CONJ_EXPR:
      case LABELED_BLOCK_EXPR:
      case EXIT_BLOCK_EXPR:
!     case TARGET_EXPR:
!     case INIT_EXPR:
!       abort ();
  
      case BIND_EXPR:
        {
*************** expand_expr_real_1 (tree exp, rtx target
*** 8768,8877 ****
  	return temp;
        }
  
-     case TARGET_EXPR:
-       {
- 	/* Something needs to be initialized, but we didn't know
- 	   where that thing was when building the tree.  For example,
- 	   it could be the return value of a function, or a parameter
- 	   to a function which lays down in the stack, or a temporary
- 	   variable which must be passed by reference.
- 
- 	   We guarantee that the expression will either be constructed
- 	   or copied into our original target.  */
- 
- 	tree slot = TREE_OPERAND (exp, 0);
- 	tree cleanups = NULL_TREE;
- 	tree exp1;
- 
- 	if (TREE_CODE (slot) != VAR_DECL)
- 	  abort ();
- 
- 	if (! ignore)
- 	  target = original_target;
- 
- 	/* Set this here so that if we get a target that refers to a
- 	   register variable that's already been used, put_reg_into_stack
- 	   knows that it should fix up those uses.  */
- 	TREE_USED (slot) = 1;
- 
- 	if (target == 0)
- 	  {
- 	    if (DECL_RTL_SET_P (slot))
- 	      {
- 		target = DECL_RTL (slot);
- 		/* If we have already expanded the slot, so don't do
- 		   it again.  (mrs)  */
- 		if (TREE_OPERAND (exp, 1) == NULL_TREE)
- 		  return target;
- 	      }
- 	    else
- 	      {
- 		target = assign_temp (type, 2, 0, 1);
- 		SET_DECL_RTL (slot, target);
- 		if (TREE_ADDRESSABLE (slot))
- 		  put_var_into_stack (slot, /*rescan=*/false);
- 
- 		/* Since SLOT is not known to the called function
- 		   to belong to its stack frame, we must build an explicit
- 		   cleanup.  This case occurs when we must build up a reference
- 		   to pass the reference as an argument.  In this case,
- 		   it is very likely that such a reference need not be
- 		   built here.  */
- 
- 		if (TREE_OPERAND (exp, 2) == 0)
- 		  TREE_OPERAND (exp, 2)
- 		    = lang_hooks.maybe_build_cleanup (slot);
- 		cleanups = TREE_OPERAND (exp, 2);
- 	      }
- 	  }
- 	else
- 	  {
- 	    /* This case does occur, when expanding a parameter which
- 	       needs to be constructed on the stack.  The target
- 	       is the actual stack address that we want to initialize.
- 	       The function we call will perform the cleanup in this case.  */
- 
- 	    /* If we have already assigned it space, use that space,
- 	       not target that we were passed in, as our target
- 	       parameter is only a hint.  */
- 	    if (DECL_RTL_SET_P (slot))
- 	      {
- 		target = DECL_RTL (slot);
- 		/* If we have already expanded the slot, so don't do
-                    it again.  (mrs)  */
- 		if (TREE_OPERAND (exp, 1) == NULL_TREE)
- 		  return target;
- 	      }
- 	    else
- 	      {
- 		SET_DECL_RTL (slot, target);
- 		/* If we must have an addressable slot, then make sure that
- 		   the RTL that we just stored in slot is OK.  */
- 		if (TREE_ADDRESSABLE (slot))
- 		  put_var_into_stack (slot, /*rescan=*/true);
- 	      }
- 	  }
- 
- 	exp1 = TREE_OPERAND (exp, 3) = TREE_OPERAND (exp, 1);
- 	/* Mark it as expanded.  */
- 	TREE_OPERAND (exp, 1) = NULL_TREE;
- 
- 	store_expr (exp1, target, modifier == EXPAND_STACK_PARM ? 2 : 0);
- 
- 	expand_decl_cleanup_eh (NULL_TREE, cleanups, CLEANUP_EH_ONLY (exp));
- 
- 	return target;
-       }
- 
-     case INIT_EXPR:
-       {
- 	tree lhs = TREE_OPERAND (exp, 0);
- 	tree rhs = TREE_OPERAND (exp, 1);
- 
- 	temp = expand_assignment (lhs, rhs, ! ignore);
- 	return temp;
-       }
- 
      case MODIFY_EXPR:
        {
  	/* If lhs is complex, expand calls in rhs before computing it.
--- 8759,8764 ----
*************** expand_expr_real_1 (tree exp, rtx target
*** 9130,9176 ****
      case IMAGPART_EXPR:
        op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
        return gen_imagpart (mode, op0);
- 
-     case CONJ_EXPR:
-       {
- 	enum machine_mode partmode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
- 	rtx imag_t;
- 	rtx insns;
- 
- 	op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
- 
- 	if (! target)
- 	  target = gen_reg_rtx (mode);
- 
- 	start_sequence ();
- 
- 	/* Store the realpart and the negated imagpart to target.  */
- 	emit_move_insn (gen_realpart (partmode, target),
- 			gen_realpart (partmode, op0));
- 
- 	imag_t = gen_imagpart (partmode, target);
- 	temp = expand_unop (partmode,
- 			    ! unsignedp && flag_trapv
- 			    && (GET_MODE_CLASS(partmode) == MODE_INT)
- 			    ? negv_optab : neg_optab,
- 			    gen_imagpart (partmode, op0), imag_t, 0);
- 	if (temp != imag_t)
- 	  emit_move_insn (imag_t, temp);
- 
- 	insns = get_insns ();
- 	end_sequence ();
- 
- 	/* Conjugate should appear as a single unit
- 	   If TARGET is a CONCAT, we got insns like RD = RS, ID = - IS,
- 	   each with a separate pseudo as destination.
- 	   It's not correct for flow to treat them as a unit.  */
- 	if (GET_CODE (target) != CONCAT)
- 	  emit_no_conflict_block (insns, target, op0, NULL_RTX, NULL_RTX);
- 	else
- 	  emit_insn (insns);
- 
- 	return target;
-       }
  
      case RESX_EXPR:
        expand_resx_expr (exp);
--- 9017,9022 ----

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