Commit cfa29a4c by Eric Botcazou Committed by Eric Botcazou

re PR middle-end/14988 (Analysis of ACATS cxg2006 failures at -O1)

	PR middle-end/14988
	* function.c (assign_stack_local_1): Use BITS_PER_UNIT alignment
	when passed -2 as 'align'.
	(put_var_into_stack): Use 'bool' as the type for the three local
	predicates.  Adjust calls to put_reg_into_stack.
	When passed a CONCAT, instruct put_reg_into_stack to use
	a consecutive stack slot for the second part.
	(put_reg_into_stack): Remove 'promoted_mode' parameter, add
	'consecutive_p' parameter.  Turn the three predicates into 'bool'
	parameters.  Retrieve the register mode from 'reg'.
	When consecutive_p is true, instruct assign_stack_local_1 to use
	BITS_PER_UNIT alignment.
	(put_addressof_into_stack): Use 'bool' as the type for the two
	local predicates. Adjust call to put_reg_into_stack.

From-SVN: r81411
parent fc627530
2004-05-02 Eric Botcazou <ebotcazou@act-europe.fr>
PR middle-end/14988
* function.c (assign_stack_local_1): Use BITS_PER_UNIT alignment
when passed -2 as 'align'.
(put_var_into_stack): Use 'bool' as the type for the three local
predicates. Adjust calls to put_reg_into_stack.
When passed a CONCAT, instruct put_reg_into_stack to use
a consecutive stack slot for the second part.
(put_reg_into_stack): Remove 'promoted_mode' parameter, add
'consecutive_p' parameter. Turn the three predicates into 'bool'
parameters. Retrieve the register mode from 'reg'.
When consecutive_p is true, instruct assign_stack_local_1 to use
BITS_PER_UNIT alignment.
(put_addressof_into_stack): Use 'bool' as the type for the two
local predicates. Adjust call to put_reg_into_stack.
2004-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2004-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fold-const.c (fold_convert_const, fold): Add missing * fold-const.c (fold_convert_const, fold): Add missing
......
...@@ -236,7 +236,7 @@ static rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int, ...@@ -236,7 +236,7 @@ static rtx assign_stack_local_1 (enum machine_mode, HOST_WIDE_INT, int,
struct function *); struct function *);
static struct temp_slot *find_temp_slot_from_address (rtx); static struct temp_slot *find_temp_slot_from_address (rtx);
static void put_reg_into_stack (struct function *, rtx, tree, enum machine_mode, static void put_reg_into_stack (struct function *, rtx, tree, enum machine_mode,
enum machine_mode, int, unsigned int, int, htab_t); unsigned int, bool, bool, bool, htab_t);
static void schedule_fixup_var_refs (struct function *, rtx, tree, enum machine_mode, static void schedule_fixup_var_refs (struct function *, rtx, tree, enum machine_mode,
htab_t); htab_t);
static void fixup_var_refs (rtx, enum machine_mode, int, rtx, htab_t); static void fixup_var_refs (rtx, enum machine_mode, int, rtx, htab_t);
...@@ -506,6 +506,7 @@ get_frame_size (void) ...@@ -506,6 +506,7 @@ get_frame_size (void)
ALIGN controls the amount of alignment for the address of the slot: ALIGN controls the amount of alignment for the address of the slot:
0 means according to MODE, 0 means according to MODE,
-1 means use BIGGEST_ALIGNMENT and round size to multiple of that, -1 means use BIGGEST_ALIGNMENT and round size to multiple of that,
-2 means use BITS_PER_UNIT,
positive specifies alignment boundary in bits. positive specifies alignment boundary in bits.
We do not round to stack_boundary here. We do not round to stack_boundary here.
...@@ -543,6 +544,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align, ...@@ -543,6 +544,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT; alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
size = CEIL_ROUND (size, alignment); size = CEIL_ROUND (size, alignment);
} }
else if (align == -2)
alignment = 1; /* BITS_PER_UNIT / BITS_PER_UNIT */
else else
alignment = align / BITS_PER_UNIT; alignment = align / BITS_PER_UNIT;
...@@ -1291,9 +1294,9 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1291,9 +1294,9 @@ put_var_into_stack (tree decl, int rescan)
enum machine_mode promoted_mode, decl_mode; enum machine_mode promoted_mode, decl_mode;
struct function *function = 0; struct function *function = 0;
tree context; tree context;
int can_use_addressof; bool can_use_addressof_p;
int volatilep = TREE_CODE (decl) != SAVE_EXPR && TREE_THIS_VOLATILE (decl); bool volatile_p = TREE_CODE (decl) != SAVE_EXPR && TREE_THIS_VOLATILE (decl);
int usedp = (TREE_USED (decl) bool used_p = (TREE_USED (decl)
|| (TREE_CODE (decl) != SAVE_EXPR && DECL_INITIAL (decl) != 0)); || (TREE_CODE (decl) != SAVE_EXPR && DECL_INITIAL (decl) != 0));
context = decl_function_context (decl); context = decl_function_context (decl);
...@@ -1340,7 +1343,7 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1340,7 +1343,7 @@ put_var_into_stack (tree decl, int rescan)
/* If this variable lives in the current function and we don't need to put it /* If this variable lives in the current function and we don't need to put it
in the stack for the sake of setjmp or the non-locality, try to keep it in in the stack for the sake of setjmp or the non-locality, try to keep it in
a register until we know we actually need the address. */ a register until we know we actually need the address. */
can_use_addressof can_use_addressof_p
= (function == 0 = (function == 0
&& ! (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl)) && ! (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl))
&& optimize > 0 && optimize > 0
...@@ -1353,7 +1356,8 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1353,7 +1356,8 @@ put_var_into_stack (tree decl, int rescan)
/* If we can't use ADDRESSOF, make sure we see through one we already /* If we can't use ADDRESSOF, make sure we see through one we already
generated. */ generated. */
if (! can_use_addressof && GET_CODE (reg) == MEM if (! can_use_addressof_p
&& GET_CODE (reg) == MEM
&& GET_CODE (XEXP (reg, 0)) == ADDRESSOF) && GET_CODE (XEXP (reg, 0)) == ADDRESSOF)
reg = XEXP (XEXP (reg, 0), 0); reg = XEXP (XEXP (reg, 0), 0);
...@@ -1361,11 +1365,11 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1361,11 +1365,11 @@ put_var_into_stack (tree decl, int rescan)
if (GET_CODE (reg) == REG) if (GET_CODE (reg) == REG)
{ {
if (can_use_addressof) if (can_use_addressof_p)
gen_mem_addressof (reg, decl, rescan); gen_mem_addressof (reg, decl, rescan);
else else
put_reg_into_stack (function, reg, TREE_TYPE (decl), promoted_mode, put_reg_into_stack (function, reg, TREE_TYPE (decl), decl_mode,
decl_mode, volatilep, 0, usedp, 0); 0, volatile_p, used_p, false, 0);
/* If this was previously a MEM but we've removed the ADDRESSOF, /* If this was previously a MEM but we've removed the ADDRESSOF,
set this address into that MEM so we always use the same set this address into that MEM so we always use the same
...@@ -1387,14 +1391,14 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1387,14 +1391,14 @@ put_var_into_stack (tree decl, int rescan)
#ifdef FRAME_GROWS_DOWNWARD #ifdef FRAME_GROWS_DOWNWARD
/* Since part 0 should have a lower address, do it second. */ /* Since part 0 should have a lower address, do it second. */
put_reg_into_stack (function, hipart, part_type, part_mode, put_reg_into_stack (function, hipart, part_type, part_mode,
part_mode, volatilep, 0, 0, 0); 0, volatile_p, false, false, 0);
put_reg_into_stack (function, lopart, part_type, part_mode, put_reg_into_stack (function, lopart, part_type, part_mode,
part_mode, volatilep, 0, 0, 0); 0, volatile_p, false, true, 0);
#else #else
put_reg_into_stack (function, lopart, part_type, part_mode, put_reg_into_stack (function, lopart, part_type, part_mode,
part_mode, volatilep, 0, 0, 0); 0, volatile_p, false, false, 0);
put_reg_into_stack (function, hipart, part_type, part_mode, put_reg_into_stack (function, hipart, part_type, part_mode,
part_mode, volatilep, 0, 0, 0); 0, volatile_p, false, true, 0);
#endif #endif
/* Change the CONCAT into a combined MEM for both parts. */ /* Change the CONCAT into a combined MEM for both parts. */
...@@ -1415,7 +1419,7 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1415,7 +1419,7 @@ put_var_into_stack (tree decl, int rescan)
/* Prevent sharing of rtl that might lose. */ /* Prevent sharing of rtl that might lose. */
if (GET_CODE (XEXP (reg, 0)) == PLUS) if (GET_CODE (XEXP (reg, 0)) == PLUS)
XEXP (reg, 0) = copy_rtx (XEXP (reg, 0)); XEXP (reg, 0) = copy_rtx (XEXP (reg, 0));
if (usedp && rescan) if (used_p && rescan)
{ {
schedule_fixup_var_refs (function, reg, TREE_TYPE (decl), schedule_fixup_var_refs (function, reg, TREE_TYPE (decl),
promoted_mode, 0); promoted_mode, 0);
...@@ -1429,20 +1433,24 @@ put_var_into_stack (tree decl, int rescan) ...@@ -1429,20 +1433,24 @@ put_var_into_stack (tree decl, int rescan)
/* Subroutine of put_var_into_stack. This puts a single pseudo reg REG /* Subroutine of put_var_into_stack. This puts a single pseudo reg REG
into the stack frame of FUNCTION (0 means the current function). into the stack frame of FUNCTION (0 means the current function).
TYPE is the user-level data type of the value hold in the register.
DECL_MODE is the machine mode of the user-level data type. DECL_MODE is the machine mode of the user-level data type.
PROMOTED_MODE is the machine mode of the register. ORIGINAL_REGNO must be set if the real regno is not visible in REG.
VOLATILE_P is nonzero if this is for a "volatile" decl. VOLATILE_P is true if this is for a "volatile" decl.
USED_P is nonzero if this reg might have already been used in an insn. */ USED_P is true if this reg might have already been used in an insn.
CONSECUTIVE_P is true if the stack slot assigned to reg must be
consecutive with the previous stack slot. */
static void static void
put_reg_into_stack (struct function *function, rtx reg, tree type, put_reg_into_stack (struct function *function, rtx reg, tree type,
enum machine_mode promoted_mode, enum machine_mode decl_mode, unsigned int original_regno,
enum machine_mode decl_mode, int volatile_p, bool volatile_p, bool used_p, bool consecutive_p,
unsigned int original_regno, int used_p, htab_t ht) htab_t ht)
{ {
struct function *func = function ? function : cfun; struct function *func = function ? function : cfun;
rtx new = 0; enum machine_mode mode = GET_MODE (reg);
unsigned int regno = original_regno; unsigned int regno = original_regno;
rtx new = 0;
if (regno == 0) if (regno == 0)
regno = REGNO (reg); regno = REGNO (reg);
...@@ -1455,7 +1463,8 @@ put_reg_into_stack (struct function *function, rtx reg, tree type, ...@@ -1455,7 +1463,8 @@ put_reg_into_stack (struct function *function, rtx reg, tree type,
} }
if (new == 0) if (new == 0)
new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func); new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode),
consecutive_p ? -2 : 0, func);
PUT_CODE (reg, MEM); PUT_CODE (reg, MEM);
PUT_MODE (reg, decl_mode); PUT_MODE (reg, decl_mode);
...@@ -1477,7 +1486,7 @@ put_reg_into_stack (struct function *function, rtx reg, tree type, ...@@ -1477,7 +1486,7 @@ put_reg_into_stack (struct function *function, rtx reg, tree type,
} }
if (used_p) if (used_p)
schedule_fixup_var_refs (function, reg, type, promoted_mode, ht); schedule_fixup_var_refs (function, reg, type, mode, ht);
} }
/* Make sure that all refs to the variable, previously made /* Make sure that all refs to the variable, previously made
...@@ -2918,7 +2927,7 @@ static void ...@@ -2918,7 +2927,7 @@ static void
put_addressof_into_stack (rtx r, htab_t ht) put_addressof_into_stack (rtx r, htab_t ht)
{ {
tree decl, type; tree decl, type;
int volatile_p, used_p; bool volatile_p, used_p;
rtx reg = XEXP (r, 0); rtx reg = XEXP (r, 0);
...@@ -2937,12 +2946,12 @@ put_addressof_into_stack (rtx r, htab_t ht) ...@@ -2937,12 +2946,12 @@ put_addressof_into_stack (rtx r, htab_t ht)
else else
{ {
type = NULL_TREE; type = NULL_TREE;
volatile_p = 0; volatile_p = false;
used_p = 1; used_p = true;
} }
put_reg_into_stack (0, reg, type, GET_MODE (reg), GET_MODE (reg), put_reg_into_stack (0, reg, type, GET_MODE (reg), ADDRESSOF_REGNO (r),
volatile_p, ADDRESSOF_REGNO (r), used_p, ht); volatile_p, used_p, false, ht);
} }
/* List of replacements made below in purge_addressof_1 when creating /* List of replacements made below in purge_addressof_1 when creating
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment