Commit dc6d66b3 by Richard Kenner

(expand_expr, case VAR_DECL): Set REGNO_POINTER_ALIGN when copying address into memory.

(expand_expr, case VAR_DECL): Set REGNO_POINTER_ALIGN
when copying address into memory.
(expand_expr, case COMPONENT_REF, case ADDR_EXPR): Set alignment
of register when result or result's address.
(expand_expr, case CONVERT_EXPR): Don't handle -fforce-mem here.

From-SVN: r10869
parent 6c6166bd
...@@ -4520,6 +4520,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4520,6 +4520,9 @@ expand_expr (exp, target, tmode, modifier)
TREE_USED (exp) = 1; TREE_USED (exp) = 1;
} }
/* Show we haven't gotten RTL for this yet. */
temp = 0;
/* Handle variables inherited from containing functions. */ /* Handle variables inherited from containing functions. */
context = decl_function_context (exp); context = decl_function_context (exp);
...@@ -4547,32 +4550,44 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4547,32 +4550,44 @@ expand_expr (exp, target, tmode, modifier)
fix_lexical_addr (XEXP (addr, 0), exp)); fix_lexical_addr (XEXP (addr, 0), exp));
else else
addr = fix_lexical_addr (addr, exp); addr = fix_lexical_addr (addr, exp);
return change_address (DECL_RTL (exp), mode, addr); temp = change_address (DECL_RTL (exp), mode, addr);
} }
/* This is the case of an array whose size is to be determined /* This is the case of an array whose size is to be determined
from its initializer, while the initializer is still being parsed. from its initializer, while the initializer is still being parsed.
See expand_decl. */ See expand_decl. */
if (GET_CODE (DECL_RTL (exp)) == MEM else if (GET_CODE (DECL_RTL (exp)) == MEM
&& GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG) && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
return change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)), temp = change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
XEXP (DECL_RTL (exp), 0)); XEXP (DECL_RTL (exp), 0));
/* If DECL_RTL is memory, we are in the normal case and either /* If DECL_RTL is memory, we are in the normal case and either
the address is not valid or it is not a register and -fforce-addr the address is not valid or it is not a register and -fforce-addr
is specified, get the address into a register. */ is specified, get the address into a register. */
if (GET_CODE (DECL_RTL (exp)) == MEM else if (GET_CODE (DECL_RTL (exp)) == MEM
&& modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_SUM && modifier != EXPAND_SUM
&& modifier != EXPAND_INITIALIZER && modifier != EXPAND_INITIALIZER
&& (! memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0)) && (! memory_address_p (DECL_MODE (exp),
|| (flag_force_addr XEXP (DECL_RTL (exp), 0))
&& GET_CODE (XEXP (DECL_RTL (exp), 0)) != REG))) || (flag_force_addr
return change_address (DECL_RTL (exp), VOIDmode, && GET_CODE (XEXP (DECL_RTL (exp), 0)) != REG)))
temp = change_address (DECL_RTL (exp), VOIDmode,
copy_rtx (XEXP (DECL_RTL (exp), 0))); copy_rtx (XEXP (DECL_RTL (exp), 0)));
/* If we got something, return it. But first, set the alignment
the address is a register. */
if (temp != 0)
{
if (GET_CODE (temp) == MEM && GET_CODE (XEXP (temp, 0)) == REG)
mark_reg_pointer (XEXP (temp, 0),
DECL_ALIGN (exp) / BITS_PER_UNIT);
return temp;
}
/* If the mode of DECL_RTL does not match that of the decl, it /* If the mode of DECL_RTL does not match that of the decl, it
must be a promoted value. We return a SUBREG of the wanted mode, must be a promoted value. We return a SUBREG of the wanted mode,
but mark it so that we know that it was already extended. */ but mark it so that we know that it was already extended. */
...@@ -5206,7 +5221,12 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5206,7 +5221,12 @@ expand_expr (exp, target, tmode, modifier)
if (ext_mode == BLKmode) if (ext_mode == BLKmode)
abort (); abort ();
op0 = extract_bit_field (validize_mem (op0), bitsize, bitpos, op0 = validize_mem (op0);
if (GET_CODE (op0) == MEM && GET_CODE (XEXP (op0, 0)) == REG)
mark_reg_pointer (XEXP (op0, 0), alignment);
op0 = extract_bit_field (op0, bitsize, bitpos,
unsignedp, target, ext_mode, ext_mode, unsignedp, target, ext_mode, ext_mode,
alignment, alignment,
int_size_in_bytes (TREE_TYPE (tem))); int_size_in_bytes (TREE_TYPE (tem)));
...@@ -5238,6 +5258,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5238,6 +5258,9 @@ expand_expr (exp, target, tmode, modifier)
op0 = change_address (op0, mode1, op0 = change_address (op0, mode1,
plus_constant (XEXP (op0, 0), plus_constant (XEXP (op0, 0),
(bitpos / BITS_PER_UNIT))); (bitpos / BITS_PER_UNIT)));
if (GET_CODE (XEXP (op0, 0)) == REG)
mark_reg_pointer (XEXP (op0, 0), alignment);
MEM_IN_STRUCT_P (op0) = 1; MEM_IN_STRUCT_P (op0) = 1;
MEM_VOLATILE_P (op0) |= volatilep; MEM_VOLATILE_P (op0) |= volatilep;
if (mode == mode1 || mode1 == BLKmode || mode1 == tmode) if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
...@@ -5496,9 +5519,6 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5496,9 +5519,6 @@ expand_expr (exp, target, tmode, modifier)
if (modifier == EXPAND_INITIALIZER) if (modifier == EXPAND_INITIALIZER)
return gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0); return gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
if (flag_force_mem && GET_CODE (op0) == MEM)
op0 = copy_to_reg (op0);
if (target == 0) if (target == 0)
return return
convert_to_mode (mode, op0, convert_to_mode (mode, op0,
...@@ -6720,8 +6740,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6720,8 +6740,9 @@ expand_expr (exp, target, tmode, modifier)
if (flag_force_addr && GET_CODE (op0) != REG) if (flag_force_addr && GET_CODE (op0) != REG)
op0 = force_reg (Pmode, op0); op0 = force_reg (Pmode, op0);
if (GET_CODE (op0) == REG) if (GET_CODE (op0) == REG
mark_reg_pointer (op0); && ! REG_USERVAR_P (op0))
mark_reg_pointer (op0, TYPE_ALIGN (TREE_TYPE (type)) / BITS_PER_UNIT);
/* If we might have had a temp slot, add an equivalent address /* If we might have had a temp slot, add an equivalent address
for it. */ for it. */
......
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