This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] ipa-type-escape improvements
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Olga Golovanevsky <OLGA at il dot ibm dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, Daniel Berlin <dberlin at dberlin dot org>, Kenneth Zadeck <zadeck at naturalbridge dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 01 Mar 2007 18:58:24 -0500
- Subject: Re: [patch] ipa-type-escape improvements
- References: <OF45E4EF4A.32CC4E57-ONC2257291.0038D007-C2257291.00522F74@il.ibm.com>
Olga Golovanevsky wrote on 03/01/07 09:57:
+2007-03-01 Olga Golovanevsky <olga@il.ibm.com>
+
+ * tree.h : Add multiple_of_p declaration.
+ * fold-const.c (multiple_of_p): Make multiple_of_p public.
+ * ipa-type-escape.c (results_of_malloc): Redundant.
+ (visited_stmts): New. Visited stmt for walk_use_def_chains.
+ (cast_type): Extended with new members.
+ (check_cast): Returns cast_type.
+ (cast): New structure for data of walk_use_def_chains.
+ (is_malloc_result, is_cast_from_non_pointer_1,
+ is_cast_from_non_pointer,
+ is_array_access_through_pointer_and_index): New functions.
+ (look_for_casts): Returns cast types.
+ (check_call): Returns void.
+ (okay_pointer_operation): Use support of pointer plus index,
+ pointer plus constant and allow all multiplications.
+
OK with a couple minor changes.
+/* Static function from this file that are used before been defined. */
s/been/being/ (I think, I'm not actually sure in this case).
+static unsigned int look_for_casts (tree lhs __attribute__((unused)),
tree);
No. ATTRIBUTE_UNUSUED.
+/* This function returns nonzero if VAR is result of malloc call
+ function. */
+static bool
+is_malloc_result (tree var)
Blank line after comment.
+ if (TREE_CODE (def_stmt) != GIMPLE_MODIFY_STMT)
+ return false;
+
+ if (var != GIMPLE_STMT_OPERAND (def_stmt, 0))
+ return false;
+
+ rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
+
+ if (TREE_CODE (rhs) != CALL_EXPR)
+ return false;
+
Better use get_call_expr_in.
/* Check a cast FROM this variable, TO_TYPE. Mark the escaping types
- if appropriate. */
-static void
+ if appropriate. Returns cast_type as detected. */
+static enum cast_type
check_cast (tree to_type, tree from)
{
Spacing after comment.
+ case GIMPLE_MODIFY_STMT:
+ {
+ use_operand_p use_p;
+ ssa_op_iter iter;
+ tree lhs = GIMPLE_STMT_OPERAND (def_stmt, 0);
+ tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
+
+ unsigned int cast = look_for_casts (lhs, rhs);
Watch indentation.
:REVIEWMAIL: