Commit 8c8a8e34 by Jim Wilson

*** empty log message ***

From-SVN: r696
parent 915f619f
...@@ -3190,24 +3190,30 @@ expand_expr (exp, target, tmode, modifier) ...@@ -3190,24 +3190,30 @@ expand_expr (exp, target, tmode, modifier)
op0 = expand_expr (exp1, 0, VOIDmode, EXPAND_SUM); op0 = expand_expr (exp1, 0, VOIDmode, EXPAND_SUM);
op0 = memory_address (mode, op0); op0 = memory_address (mode, op0);
} }
}
temp = gen_rtx (MEM, mode, op0); temp = gen_rtx (MEM, mode, op0);
/* If address was computed by addition, /* If address was computed by addition,
mark this as an element of an aggregate. */ mark this as an element of an aggregate. */
if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
|| (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
|| TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE) || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
MEM_IN_STRUCT_P (temp) = 1; || (TREE_CODE (exp1) == ADDR_EXPR
MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile; && (exp2 = TREE_OPERAND (exp1, 0))
&& (TREE_CODE (TREE_TYPE (exp2)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp2)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp2)) == UNION_TYPE)))
MEM_IN_STRUCT_P (temp) = 1;
MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
#if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that #if 0 /* It is incorrectto set RTX_UNCHANGING_P here, because the fact that
a location is accessed through a pointer to const does not mean a location is accessed through a pointer to const does not mean
that the value there can never change. */ that the value there can never change. */
RTX_UNCHANGING_P (temp) = TREE_READONLY (exp); RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
#endif #endif
return temp; return temp;
}
case ARRAY_REF: case ARRAY_REF:
if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
...@@ -3293,15 +3299,29 @@ expand_expr (exp, target, tmode, modifier) ...@@ -3293,15 +3299,29 @@ expand_expr (exp, target, tmode, modifier)
&& TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0))) != ERROR_MARK) && TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0))) != ERROR_MARK)
{ {
tree index = fold (TREE_OPERAND (exp, 1)); tree index = fold (TREE_OPERAND (exp, 1));
if (TREE_CODE (index) == INTEGER_CST) if (TREE_CODE (index) == INTEGER_CST
&& TREE_INT_CST_HIGH (index) == 0)
{ {
int i = TREE_INT_CST_LOW (index); int i = TREE_INT_CST_LOW (index);
tree init = CONSTRUCTOR_ELTS (DECL_INITIAL (TREE_OPERAND (exp, 0))); tree init = DECL_INITIAL (TREE_OPERAND (exp, 0));
while (init && i--) if (TREE_CODE (init) == CONSTRUCTOR)
init = TREE_CHAIN (init); {
if (init) tree elem = CONSTRUCTOR_ELTS (init);
return expand_expr (fold (TREE_VALUE (init)), target, tmode, modifier);
while (elem && i--)
elem = TREE_CHAIN (elem);
if (elem)
return expand_expr (fold (TREE_VALUE (elem)), target,
tmode, modifier);
}
else if (TREE_CODE (init) == STRING_CST
&& i < TREE_STRING_LENGTH (init))
{
temp = gen_rtx (CONST_INT, VOIDmode,
TREE_STRING_POINTER (init)[i]);
return convert_to_mode (mode, temp, 0);
}
} }
} }
/* Treat array-ref with constant index as a component-ref. */ /* Treat array-ref with constant index as a component-ref. */
...@@ -3321,6 +3341,17 @@ expand_expr (exp, target, tmode, modifier) ...@@ -3321,6 +3341,17 @@ expand_expr (exp, target, tmode, modifier)
directly in an insn, we validate it. */ directly in an insn, we validate it. */
op0 = expand_expr (tem, 0, VOIDmode, EXPAND_SUM); op0 = expand_expr (tem, 0, VOIDmode, EXPAND_SUM);
/* If this is a constant, put it into a register if it is a
legimate constant and memory if it isn't. */
if (CONSTANT_P (op0))
{
enum machine_mode mode = TYPE_MODE (TREE_TYPE (tem));
if (LEGITIMATE_CONSTANT_P (op0))
op0 = force_reg (mode, op0);
else
op0 = validize_mem (force_const_mem (mode, op0));
}
/* Don't forget about volatility even if this is a bitfield. */ /* Don't forget about volatility even if this is a bitfield. */
if (GET_CODE (op0) == MEM && volatilep && ! MEM_VOLATILE_P (op0)) if (GET_CODE (op0) == MEM && volatilep && ! MEM_VOLATILE_P (op0))
{ {
...@@ -4683,7 +4714,7 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -4683,7 +4714,7 @@ expand_builtin (exp, target, subtarget, mode, ignore)
case BUILT_IN_FSQRT: case BUILT_IN_FSQRT:
/* If not optimizing, call the library function. */ /* If not optimizing, call the library function. */
if (!optimize) if (! optimize)
break; break;
if (arglist == 0 if (arglist == 0
...@@ -4700,21 +4731,21 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -4700,21 +4731,21 @@ expand_builtin (exp, target, subtarget, mode, ignore)
/* Test the argument to make sure it is in the proper domain for /* Test the argument to make sure it is in the proper domain for
the sqrt function. If it is not in the domain, branch to a the sqrt function. If it is not in the domain, branch to a
library call. */ library call. */
start_sequence(); start_sequence ();
lab1 = gen_label_rtx(); lab1 = gen_label_rtx ();
lab2 = gen_label_rtx(); lab2 = gen_label_rtx ();
/* By default check the arguments. If flag_fast_math is turned on, /* By default check the arguments. If flag_fast_math is turned on,
then assume sqrt will always be called with valid arguments. */ then assume sqrt will always be called with valid arguments. */
if (! flag_fast_math) if (! flag_fast_math)
{ {
/* By checking op > 0 we are able to catch all of the
/* By checking op >= 1 we are able to catch all of the
IEEE special cases with a single if conditional. */ IEEE special cases with a single if conditional. */
emit_cmp_insn (op0, CONST0_RTX (op0->mode), GT, 0, op0->mode, 0, 0); emit_cmp_insn (op0, CONST0_RTX (GET_MODE (op0)), GT, 0,
GET_MODE (op0), 0, 0);
emit_jump_insn (gen_bgt (lab1)); emit_jump_insn (gen_bgt (lab1));
/* The arguemnt was not in the domain; do this via library call. */ /* The argument was not in the domain; do this via library call. */
expand_call (exp, target, 0, 0); expand_call (exp, target, 0, 0);
/* Branch around open coded version */ /* Branch around open coded version */
...@@ -4725,23 +4756,23 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -4725,23 +4756,23 @@ expand_builtin (exp, target, subtarget, mode, ignore)
/* Arg is in the domain, compute sqrt, into TARGET. /* Arg is in the domain, compute sqrt, into TARGET.
Set TARGET to wherever the result comes back. */ Set TARGET to wherever the result comes back. */
target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))), target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
sqrt_optab, op0, target, 1); sqrt_optab, op0, target, 0);
/* If we were unable to expand via the builtin, stop the /* If we were unable to expand via the builtin, stop the
sequence (without outputting the insns) and break, causing sequence (without outputting the insns) and break, causing
a call the the library function. */ a call the the library function. */
if (target == 0) if (target == 0)
{ {
end_sequence(); end_sequence ();
break; break;
} }
emit_label (lab2); emit_label (lab2);
/* Output the entire sequence. */ /* Output the entire sequence. */
insns = get_insns(); insns = get_insns ();
end_sequence(); end_sequence ();
emit_insns(); emit_insns (insns);
return target; return target;
...@@ -4986,7 +5017,7 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -4986,7 +5017,7 @@ expand_builtin (exp, target, subtarget, mode, ignore)
op0 = expand_expr (TREE_VALUE (arglist), 0, VOIDmode, 0); op0 = expand_expr (TREE_VALUE (arglist), 0, VOIDmode, 0);
/* Allocate the desired space. */ /* Allocate the desired space. */
target = allocate_dynamic_stack_space (op0, target); target = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
/* Record the new stack level for nonlocal gotos. */ /* Record the new stack level for nonlocal gotos. */
if (nonlocal_goto_stack_level != 0) if (nonlocal_goto_stack_level != 0)
......
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