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]

fix to tree checking problem in put_var_into_stack


Sun Jun 18 21:42:15 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* function.c (put_var_into_stack): Don't reference DECL_ fields
	if input is a SAVE_EXPR.
	Use set_mem_attributes in COMPLEX case.

*** function.c	2000/06/05 16:58:25	1.204
--- function.c	2000/06/18 22:45:44
*************** put_var_into_stack (decl)
*** 1336,1339 ****
--- 1336,1342 ----
    tree context;
    int can_use_addressof;
+   int volatilep = TREE_CODE (decl) != SAVE_EXPR && TREE_THIS_VOLATILE (decl);
+   int usedp = (TREE_USED (decl)
+ 	       || (TREE_CODE (decl) != SAVE_EXPR && DECL_INITIAL (decl) != 0));
  
    context = decl_function_context (decl);
*************** put_var_into_stack (decl)
*** 1363,1367 ****
    /* If this is a variable-size object with a pseudo to address it,
       put that pseudo into the stack, if the var is nonlocal.  */
!   if (DECL_NONLOCAL (decl)
        && GET_CODE (reg) == MEM
        && GET_CODE (XEXP (reg, 0)) == REG
--- 1366,1370 ----
    /* If this is a variable-size object with a pseudo to address it,
       put that pseudo into the stack, if the var is nonlocal.  */
!   if (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl)
        && GET_CODE (reg) == MEM
        && GET_CODE (XEXP (reg, 0)) == REG
*************** put_var_into_stack (decl)
*** 1398,1410 ****
  	gen_mem_addressof (reg, decl);
        else
! 	put_reg_into_stack (function, reg, TREE_TYPE (decl),
! 			    promoted_mode, decl_mode,
! 			    (TREE_CODE (decl) != SAVE_EXPR
! 			     && TREE_THIS_VOLATILE (decl)),
! 			    0,
! 			    (TREE_USED (decl)
! 			     || (TREE_CODE (decl) != SAVE_EXPR
! 				 && DECL_INITIAL (decl) != 0)),
! 			    0);
      }
    else if (GET_CODE (reg) == CONCAT)
--- 1401,1406 ----
  	gen_mem_addressof (reg, decl);
        else
! 	put_reg_into_stack (function, reg, TREE_TYPE (decl), promoted_mode,
! 			    decl_mode, volatilep, 0, usedp, 0);
      }
    else if (GET_CODE (reg) == CONCAT)
*************** put_var_into_stack (decl)
*** 1417,1443 ****
        /* Since part 0 should have a lower address, do it second.  */
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
! 			  part_mode, TREE_SIDE_EFFECTS (decl), 0,
! 			  TREE_USED (decl) || DECL_INITIAL (decl) != 0,
! 			  0);
        put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
! 			  part_mode, TREE_SIDE_EFFECTS (decl), 0,
! 			  TREE_USED (decl) || DECL_INITIAL (decl) != 0,
! 			  0);
  #else
        put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
! 			  part_mode, TREE_SIDE_EFFECTS (decl), 0,
! 			  TREE_USED (decl) || DECL_INITIAL (decl) != 0,
! 			  0);
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
! 			  part_mode, TREE_SIDE_EFFECTS (decl), 0,
! 			  TREE_USED (decl) || DECL_INITIAL (decl) != 0,
! 			  0);
  #endif
  
        /* Change the CONCAT into a combined MEM for both parts.  */
        PUT_CODE (reg, MEM);
!       MEM_VOLATILE_P (reg) = MEM_VOLATILE_P (XEXP (reg, 0));
!       MEM_ALIAS_SET (reg) = get_alias_set (decl);
!       MEM_SET_IN_STRUCT_P (reg, AGGREGATE_TYPE_P (TREE_TYPE (decl)));
  
        /* The two parts are in memory order already.
--- 1413,1429 ----
        /* Since part 0 should have a lower address, do it second.  */
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
! 			  part_mode, volatilep, 0, usedp, 0);
        put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
! 			  part_mode, volatilep, 0, usedp, 0);
  #else
        put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
! 			  part_mode, volatilep, 0, usedp, 0);
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
! 			  part_mode, volatilep, 0, usedp, 0);
  #endif
  
        /* Change the CONCAT into a combined MEM for both parts.  */
        PUT_CODE (reg, MEM);
!       set_mem_attributes (reg, decl, 1);
  
        /* The two parts are in memory order already.

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