middle-end/9997: Coelesce stack slots for disjoint scopes.

Jim Wilson wilson@tuliptree.org
Sun Mar 9 16:36:00 GMT 2003


The following reply was made to PR middle-end/9997; it has been noted by GNATS.

From: Jim Wilson <wilson@tuliptree.org>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: middle-end/9997: Coelesce stack slots for disjoint scopes.
Date: Sun, 09 Mar 2003 11:32:47 -0500

 This patch seems more complicated than necessary.  expand_end_bindings 
 already calls pop_temp_slots.  So all you have to do is arrange for 
 locals to have the right temp_slot_level.
 
 I tried looking at this.  We are calling preserve_stack_temps, and that 
 preserves all temp slots whose address was taken.  This means a local of 
 array type won't be freed when its scope terminates.  The question then 
 is whether this is really necessary to preserve values whose address was 
       taken.
 
 This code is used to preserve values that might be needed by an 
 expression statement result.  In this case, the result is const0_rtx. 
 This code has a test for !MEM.  This is apparently to handle the case 
 where the result is in a REG that might contain an address.  However, 
 !MEM also includes constants, and constants can't possibly contain the 
 address of a stack local.  I think this problem would go away if we 
 fixed this code to do nothing for constant results.  The problematic 
 code is here:
    /* If X is not in memory or is at a constant address, it cannot be in
       a temporary slot, but it can contain something whose address was
       taken.  */
    if (p == 0 && (GET_CODE (x) != MEM || CONSTANT_P (XEXP (x, 0))))
 We should do nothing here if x is a constant, but there is no code for that.
 
 Jim
 



More information about the Gcc-prs mailing list