Patchwork Move gimple_set_modified

login
register
mail settings
Submitter Richard Guenther
Date May 15, 2012, 9:17 a.m.
Message ID <Pine.LNX.4.64.1205151115010.11924@jbgna.fhfr.qr>
Download mbox | patch
Permalink /patch/159266/
State New
Headers show

Comments

Richard Guenther - May 15, 2012, 9:17 a.m.
This moves gimple_set_modified to be inlined.  One important user
is update_stmt which looks like

static inline void
update_stmt (gimple s)
{
  if (gimple_has_ops (s))
    {
      gimple_set_modified (s, true);
      update_stmt_operands (s);
    }
}

and thus either is not worth inlining or we should inline
gimple_set_modified, too, to avoid the redundant gimple_has_ops
in gimple_set_modified and basically optimize the above to inline

  if (gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN)
    {
      s->gsbase.modified = (unsigned) modifiedp;
      update_stmt_operands (s);
    }

where the gimple_code () check is possibly optimized by preceeding code.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-05-15  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_set_modified): Move ...
	* gimple.h (gimple_set_modified): ... here.

Patch

Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 187456)
+++ gcc/gimple.c	(working copy)
@@ -2394,17 +2394,6 @@  gimple_copy (gimple stmt)
 }
 
 
-/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
-   a MODIFIED field.  */
-
-void
-gimple_set_modified (gimple s, bool modifiedp)
-{
-  if (gimple_has_ops (s))
-    s->gsbase.modified = (unsigned) modifiedp;
-}
-
-
 /* Return true if statement S has side-effects.  We consider a
    statement to have side effects if:
 
Index: gcc/gimple.h
===================================================================
--- gcc/gimple.h	(revision 187456)
+++ gcc/gimple.h	(working copy)
@@ -830,7 +830,6 @@  tree gimple_get_lhs (const_gimple);
 void gimple_set_lhs (gimple, tree);
 void gimple_replace_lhs (gimple, tree);
 gimple gimple_copy (gimple);
-void gimple_set_modified (gimple, bool);
 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
 gimple gimple_build_cond_from_tree (tree, tree, tree);
 void gimple_cond_set_condition_from_tree (gimple, tree);
@@ -1521,6 +1520,17 @@  gimple_modified_p (const_gimple g)
 }
 
 
+/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
+   a MODIFIED field.  */
+
+static inline void
+gimple_set_modified (gimple s, bool modifiedp)
+{
+  if (gimple_has_ops (s))
+    s->gsbase.modified = (unsigned) modifiedp;
+}
+
+
 /* Return the tree code for the expression computed by STMT.  This is
    only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN.  For
    GIMPLE_CALL, return CALL_EXPR as the expression code for