This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] ipa-type-escape improvements


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:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]