extern tree canonicalize_cond_expr_cond (tree);
/* In omp-low.c. */
-extern void diagnose_omp_structured_block_errors (tree);
extern tree omp_reduction_init (tree, tree);
/* In tree-nested.c. */
/* In tree-ssa.c */
extern bool tree_ssa_useless_type_conversion (tree);
+extern tree tree_ssa_strip_useless_type_conversions (tree);
extern bool useless_type_conversion_p (tree, tree);
extern bool types_compatible_p (tree, tree);
return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
}
-/* Return the type of the main expression computed by STMT. Return
- void_type_node if the statement computes nothing. */
-
-static inline tree
-gimple_expr_type (const_gimple stmt)
-{
- enum gimple_code code = gimple_code (stmt);
-
- if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
- {
- tree type = TREE_TYPE (gimple_get_lhs (stmt));
- /* Integral sub-types are never the type of the expression,
- but they still can be the type of the result as the base
- type (in which expressions are computed) is trivially
- convertible to one of its sub-types. So always return
- the base type here. */
- if (INTEGRAL_TYPE_P (type)
- && TREE_TYPE (type)
- /* But only if they are trivially convertible. */
- && useless_type_conversion_p (type, TREE_TYPE (type)))
- type = TREE_TYPE (type);
- return type;
- }
- else if (code == GIMPLE_COND)
- return boolean_type_node;
- else
- return void_type_node;
-}
-
/* Return the tree code for the expression computed by STMT. This is
only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
{
GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
- gimple_set_op (gs, 1, build_fold_addr_expr (decl));
+ gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
}
gimple_cond_code (const_gimple gs)
{
GIMPLE_CHECK (gs, GIMPLE_COND);
- return gs->gsbase.subcode;
+ return (enum tree_code) gs->gsbase.subcode;
}
}
-/* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
-
-static inline tree
-gimple_cdt_new_type (gimple gs)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- return gimple_op (gs, 1);
-}
-
-/* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE
- statement GS. */
-
-static inline tree *
-gimple_cdt_new_type_ptr (gimple gs)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- return gimple_op_ptr (gs, 1);
-}
-
-/* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE
- statement GS. */
-
-static inline void
-gimple_cdt_set_new_type (gimple gs, tree new_type)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type);
- gimple_set_op (gs, 1, new_type);
-}
-
-
-/* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
-
-static inline tree
-gimple_cdt_location (gimple gs)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- return gimple_op (gs, 0);
-}
-
-
-/* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
- statement GS. */
-
-static inline tree *
-gimple_cdt_location_ptr (gimple gs)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- return gimple_op_ptr (gs, 0);
-}
-
-
-/* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
- statement GS. */
-
-static inline void
-gimple_cdt_set_location (gimple gs, tree ptr)
-{
- GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
- gimple_set_op (gs, 0, ptr);
-}
-
-
/* Return the predictor of GIMPLE_PREDICT statement GS. */
static inline enum br_predictor
}
+/* Return the type of the main expression computed by STMT. Return
+ void_type_node if the statement computes nothing. */
+
+static inline tree
+gimple_expr_type (const_gimple stmt)
+{
+ enum gimple_code code = gimple_code (stmt);
+
+ if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
+ {
+ tree type;
+ /* In general we want to pass out a type that can be substituted
+ for both the RHS and the LHS types if there is a possibly
+ useless conversion involved. That means returning the
+ original RHS type as far as we can reconstruct it. */
+ if (code == GIMPLE_CALL)
+ type = gimple_call_return_type (stmt);
+ else
+ switch (gimple_assign_rhs_code (stmt))
+ {
+ case POINTER_PLUS_EXPR:
+ type = TREE_TYPE (gimple_assign_rhs1 (stmt));
+ break;
+
+ default:
+ /* As fallback use the type of the LHS. */
+ type = TREE_TYPE (gimple_get_lhs (stmt));
+ break;
+ }
+ return type;
+ }
+ else if (code == GIMPLE_COND)
+ return boolean_type_node;
+ else
+ return void_type_node;
+}
+
+
/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
static inline gimple_stmt_iterator