(push_range_check_info): Likewise.
(gnat_to_gnu) <N_Code_Statement>: Likewise.
* gcc-interface/utils2.c (build_unary_op) <INDIRECT_REF>: Likewise.
(gnat_invariant_expr): Likewise.
* gcc-interface/utils.c (compute_related_constant): Likewise.
(max_size): Fix handling of SAVE_EXPR.
(remove_conversions): Fix formatting.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179873
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-10-12 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (Attribute_to_gnu): Use remove_conversions.
+ (push_range_check_info): Likewise.
+ (gnat_to_gnu) <N_Code_Statement>: Likewise.
+ * gcc-interface/utils2.c (build_unary_op) <INDIRECT_REF>: Likewise.
+ (gnat_invariant_expr): Likewise.
+ * gcc-interface/utils.c (compute_related_constant): Likewise.
+ (max_size): Fix handling of SAVE_EXPR.
+ (remove_conversions): Fix formatting.
+
+2011-10-12 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/ada-tree.h (DECL_LOOP_PARM_P): New flag.
(DECL_INDUCTION_VAR): New macro.
(SET_DECL_INDUCTION_VAR): Likewise.
don't try to build a trampoline. */
if (attribute == Attr_Code_Address)
{
- for (gnu_expr = gnu_result;
- CONVERT_EXPR_P (gnu_expr);
- gnu_expr = TREE_OPERAND (gnu_expr, 0))
- TREE_CONSTANT (gnu_expr) = 1;
+ gnu_expr = remove_conversions (gnu_result, false);
if (TREE_CODE (gnu_expr) == ADDR_EXPR)
TREE_NO_TRAMPOLINE (gnu_expr) = TREE_CONSTANT (gnu_expr) = 1;
a useful warning with -Wtrampolines. */
else if (TREE_CODE (TREE_TYPE (gnu_prefix)) == FUNCTION_TYPE)
{
- for (gnu_expr = gnu_result;
- CONVERT_EXPR_P (gnu_expr);
- gnu_expr = TREE_OPERAND (gnu_expr, 0))
- ;
+ gnu_expr = remove_conversions (gnu_result, false);
if (TREE_CODE (gnu_expr) == ADDR_EXPR
&& decl_function_context (TREE_OPERAND (gnu_expr, 0)))
if (VEC_empty (loop_info, gnu_loop_stack))
return NULL;
- while (CONVERT_EXPR_P (var) || TREE_CODE (var) == VIEW_CONVERT_EXPR)
- var = TREE_OPERAND (var, 0);
+ var = remove_conversions (var, false);
if (TREE_CODE (var) != VAR_DECL)
return NULL;
is modelled on the C front-end. */
if (!allows_reg)
{
- STRIP_NOPS (output);
+ output = remove_conversions (output, false);
if (TREE_CODE (output) == CONST_DECL
&& DECL_CONST_CORRESPONDING_VAR (output))
output = DECL_CONST_CORRESPONDING_VAR (output);
mark it addressable. */
if (!allows_reg && allows_mem)
{
- STRIP_NOPS (input);
+ input = remove_conversions (input, false);
if (TREE_CODE (input) == CONST_DECL
&& DECL_CONST_CORRESPONDING_VAR (input))
input = DECL_CONST_CORRESPONDING_VAR (input);
static tree
split_plus (tree in, tree *pvar)
{
- /* Strip NOPS in order to ease the tree traversal and maximize the
- potential for constant or plus/minus discovery. We need to be careful
+ /* Strip conversions in order to ease the tree traversal and maximize the
+ potential for constant or plus/minus discovery. We need to be careful
to always return and set *pvar to bitsizetype trees, but it's worth
the effort. */
- STRIP_NOPS (in);
+ in = remove_conversions (in, false);
*pvar = convert (bitsizetype, in);
switch (TREE_CODE_LENGTH (code))
{
case 1:
- if (code == NON_LVALUE_EXPR)
+ if (code == SAVE_EXPR)
+ return exp;
+ else if (code == NON_LVALUE_EXPR)
return max_size (TREE_OPERAND (exp, 0), max_p);
else
return
}
case 3:
- if (code == SAVE_EXPR)
- return exp;
- else if (code == COND_EXPR)
+ if (code == COND_EXPR)
return fold_build2 (max_p ? MAX_EXPR : MIN_EXPR, type,
max_size (TREE_OPERAND (exp, 1), max_p),
max_size (TREE_OPERAND (exp, 2), max_p));
return remove_conversions (TREE_OPERAND (exp, 0), true_address);
break;
- case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR:
CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
+ case NON_LVALUE_EXPR:
return remove_conversions (TREE_OPERAND (exp, 0), true_address);
default:
case INDIRECT_REF:
{
- bool can_never_be_null;
- tree t = operand;
-
- while (CONVERT_EXPR_P (t) || TREE_CODE (t) == VIEW_CONVERT_EXPR)
- t = TREE_OPERAND (t, 0);
-
- can_never_be_null = DECL_P (t) && DECL_CAN_NEVER_BE_NULL_P (t);
+ tree t = remove_conversions (operand, false);
+ bool can_never_be_null = DECL_P (t) && DECL_CAN_NEVER_BE_NULL_P (t);
/* If TYPE is a thin pointer, first convert to the fat pointer. */
if (TYPE_IS_THIN_POINTER_P (type)
{
tree type = TREE_TYPE (expr), t;
- STRIP_NOPS (expr);
+ expr = remove_conversions (expr, false);
while ((TREE_CODE (expr) == CONST_DECL
|| (TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr)))
&& decl_function_context (expr) == current_function_decl
&& DECL_INITIAL (expr))
- {
- expr = DECL_INITIAL (expr);
- STRIP_NOPS (expr);
- }
+ expr = remove_conversions (DECL_INITIAL (expr), false);
if (TREE_CONSTANT (expr))
return fold_convert (type, expr);