Call put_var_into_stack when taking address of SAVE_EXPR

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sat Jun 16 17:20:00 GMT 2001


This simplifies the processing in this case by avoiding extra copies
and by better characterizing the resulting MEM.  Tested on Alphaev56.

Sat Jun 16 20:20:39 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* expr.c (expand_expr, case ADDR_EXPR): If taking address of SAVE_EXPR,
	use put_var_into_stack.

*** expr.c	2001/06/12 11:17:09	1.326
--- expr.c	2001/06/17 00:14:02
*************** expand_expr (exp, target, tmode, modifie
*** 7035,7046 ****
  		|| GET_CODE (op0) == CONCAT || GET_CODE (op0) == ADDRESSOF)
  	      {
! 		tree nt = build_qualified_type (TREE_TYPE (tem),
! 						(TYPE_QUALS (TREE_TYPE (tem))
! 						 | TYPE_QUAL_CONST));
! 		rtx memloc = assign_temp (nt, 1, 1, 1);
  
! 		mark_temp_addr_taken (memloc);
! 		emit_move_insn (memloc, op0);
! 		op0 = memloc;
  	      }
  
--- 7035,7054 ----
  		|| GET_CODE (op0) == CONCAT || GET_CODE (op0) == ADDRESSOF)
  	      {
! 		/* If the operand is a SAVE_EXPR, we can deal with this by
! 		   forcing the SAVE_EXPR into memory.  */
! 		if (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR)
! 		  put_var_into_stack (TREE_OPERAND (exp, 0));
! 		else
! 		  {
! 		    tree nt
! 		      = build_qualified_type (TREE_TYPE (tem),
! 					      (TYPE_QUALS (TREE_TYPE (tem))
! 					       | TYPE_QUAL_CONST));
! 		    rtx memloc = assign_temp (nt, 1, 1, 1);
  
! 		    mark_temp_addr_taken (memloc);
! 		    emit_move_insn (memloc, op0);
! 		    op0 = memloc;
! 		  }
  	      }
  



More information about the Gcc-patches mailing list