public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]: Add annotations for expression and constants
@ 2004-06-06 18:27 Daniel Berlin
  2004-06-10 14:28 ` Diego Novillo
  2004-06-15 16:14 ` Mark Mitchell
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Berlin @ 2004-06-06 18:27 UTC (permalink / raw)
  To: GCC Patches

This is used by GVN-PRE.

The reason we annotate expressions is so we can cache the value  
handle/number in the expression on the RHS.
This avoids looking expressions up in the hash table again and again to  
get the value number (it's an optimization, not a correctness issue) of  
a particular RHS in different parts of GVN-PRE, such as during phi  
translation. This optimization makes a factor of 2 difference on some  
testcases (particularly those where right now, iterative_hash_expr  
called by DOM is high on the profile).  We can throw away these  
annotations after GVN-PRE is finished, since at that point, all the  
SSA_NAME's are annotated, so they don't waste a ton of memory.

The reason we annotate constants is twofold:
First, consistency.  If you didn't annotate them, you'd start having to  
special casing them where we get value numbers.
Second, not all constants with the same "value" are shared (ie  
different types, etc), but we want to be able to simply do "==" to tell  
if two value handles are the same value.  Thus, we need to annotate  
them with their own value handles so we can do get_value_handle on two  
constants, and == will be true if they have the same value.

All of this is gone over in detail at the top of the new  
tree-ssa-pre.c, of course.


2004-06-05  Daniel Berlin  <dberlin@dberlin.org>

	* tree-flow.h (tree_ann_type): Add CST_ANN, EXPR_ANN.
	(struct cst_ann_d): New.
	(struct expr_ann_d): New.
	(union tree_ann_d): Add cst_ann, expr_ann.
	* tree-dfa.c (create_cst_ann): New function.
	(create_expr_ann): Ditto.
	* tree-flow-inline.h (cst_ann): New function.
	(expr_ann): Ditto.
	(get_cst_ann): Ditto.
	(get_expr_ann): Ditto..

Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow.h,v
retrieving revision 2.4
diff -u -3 -p -r2.4 tree-flow.h
--- tree-flow.h	18 May 2004 02:53:55 -0000	2.4
+++ tree-flow.h	6 Jun 2004 16:04:13 -0000
@@ -40,7 +40,8 @@ typedef struct basic_block_def *basic_bl
   
/ 
*----------------------------------------------------------------------- 
----
  		   Tree annotations stored in tree_common.ann
   
------------------------------------------------------------------------ 
---*/
-enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN, SSA_NAME_ANN  
};
+enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, CST_ANN, EXPR_ANN,  
STMT_ANN,
+		     SSA_NAME_ANN };

  struct tree_ann_common_d GTY(())
  {
@@ -277,6 +283,25 @@ struct ssa_name_ann_d GTY(())
       pointer will be represented by this memory tag, instead of the  
type
       tag computed by TBAA.  */
    tree name_mem_tag;
+};
+
+struct cst_ann_d GTY (())
+{
+  struct tree_ann_common_d common;
+
+};
+
+struct expr_ann_d GTY(())
+{
+  struct tree_ann_common_d common;
+
  };


@@ -284,6 +309,8 @@ union tree_ann_d GTY((desc ("ann_type ((
  {
    struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
    struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
+  struct expr_ann_d GTY((tag ("EXPR_ANN"))) expr;
+  struct cst_ann_d GTY((tag ("CST_ANN"))) cst;
    struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
    struct ssa_name_ann_d GTY((tag ("SSA_NAME_ANN"))) ssa_name;
  };
@@ -292,7 +319,13 @@ typedef union tree_ann_d *tree_ann;
  typedef struct var_ann_d *var_ann_t;
  typedef struct stmt_ann_d *stmt_ann_t;
  typedef struct ssa_name_ann_d *ssa_name_ann_t;
+typedef struct expr_ann_d *expr_ann_t;
+typedef struct cst_ann_d *cst_ann_t;

+static inline cst_ann_t cst_ann (tree);
+static inline cst_ann_t get_cst_ann (tree);
+static inline expr_ann_t expr_ann (tree);
+static inline expr_ann_t get_expr_ann (tree);
  static inline var_ann_t var_ann (tree);
  static inline var_ann_t get_var_ann (tree);
  static inline stmt_ann_t stmt_ann (tree);
@@ -486,6 +519,8 @@ extern void dump_generic_bb (FILE *, bas

  /* In tree-dfa.c  */
  extern var_ann_t create_var_ann (tree);
+extern cst_ann_t create_cst_ann (tree);
+extern expr_ann_t create_expr_ann (tree);
  extern stmt_ann_t create_stmt_ann (tree);
  extern ssa_name_ann_t create_ssa_name_ann (tree);
  extern tree create_phi_node (tree, basic_block);
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.5
diff -u -3 -p -r2.5 tree-dfa.c
--- tree-dfa.c	30 May 2004 18:32:29 -0000	2.5
+++ tree-dfa.c	6 Jun 2004 16:04:13 -0000
@@ -462,6 +462,52 @@ create_stmt_ann (tree t)
  }


+/* Create a new annotation for a constant T.  */
+
+cst_ann_t
+create_cst_ann (tree t)
+{
+  cst_ann_t ann;
+
+#if defined ENABLE_CHECKING
+  if (t == NULL_TREE
+      || (t->common.ann
+	  && t->common.ann->common.type != CST_ANN))
+    abort ();
+#endif
+
+  ann = ggc_alloc (sizeof (*ann));
+  memset ((void *) ann, 0, sizeof (*ann));
+
+  ann->common.type = CST_ANN;
+  t->common.ann = (tree_ann) ann;
+
+  return ann;
+}
+
+/* Create a new annotation for an expression T.  */
+
+expr_ann_t
+create_expr_ann (tree t)
+{
+  expr_ann_t ann;
+
+#if defined ENABLE_CHECKING
+  if (t == NULL_TREE
+      || (t->common.ann
+	  && t->common.ann->common.type != EXPR_ANN))
+    abort ();
+#endif
+
+  ann = ggc_alloc (sizeof (*ann));
+  memset ((void *) ann, 0, sizeof (*ann));
+
+  ann->common.type = EXPR_ANN;
+  t->common.ann = (tree_ann) ann;
+
+  return ann;
+}
+
  /* Create a new annotation for an SSA name T.  */

  ssa_name_ann_t
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.2
diff -u -3 -p -r2.2 tree-flow-inline.h
--- tree-flow-inline.h	21 May 2004 15:24:54 -0000	2.2
+++ tree-flow-inline.h	6 Jun 2004 16:04:13 -0000
@@ -46,6 +46,47 @@ get_var_ann (tree var)
    return (ann) ? ann : create_var_ann (var);
  }

+
+static inline cst_ann_t
+cst_ann (tree t)
+{
+#if defined ENABLE_CHECKING
+  if (TREE_CODE_CLASS (TREE_CODE (t)) != 'c'
+      || (t->common.ann
+	  && t->common.ann->common.type != CST_ANN))
+    abort ();
+#endif
+
+  return (cst_ann_t) t->common.ann;
+}
+
+static inline cst_ann_t
+get_cst_ann (tree var)
+{
+  cst_ann_t ann = cst_ann (var);
+  return (ann) ? ann : create_cst_ann (var);
+}
+
+static inline expr_ann_t
+expr_ann (tree t)
+{
+#if defined ENABLE_CHECKING
+  if (!EXPR_P (t)
+      || (t->common.ann
+	  && t->common.ann->common.type != EXPR_ANN))
+    abort ();
+#endif
+
+  return (expr_ann_t) t->common.ann;
+}
+
+static inline expr_ann_t
+get_expr_ann (tree var)
+{
+  expr_ann_t ann = expr_ann (var);
+  return (ann) ? ann : create_expr_ann (var);
+}
+
  static inline stmt_ann_t
  stmt_ann (tree t)
  {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add annotations for expression and constants
  2004-06-06 18:27 [PATCH]: Add annotations for expression and constants Daniel Berlin
@ 2004-06-10 14:28 ` Diego Novillo
  2004-06-10 14:28   ` Daniel Berlin
  2004-06-15 16:14 ` Mark Mitchell
  1 sibling, 1 reply; 8+ messages in thread
From: Diego Novillo @ 2004-06-10 14:28 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: GCC Patches

On Sun, 2004-06-06 at 12:46, Daniel Berlin wrote:

> 	* tree-flow.h (tree_ann_type): Add CST_ANN, EXPR_ANN.
> 	(struct cst_ann_d): New.
> 	(struct expr_ann_d): New.
> 	(union tree_ann_d): Add cst_ann, expr_ann.
> 	* tree-dfa.c (create_cst_ann): New function.
> 	(create_expr_ann): Ditto.
> 	* tree-flow-inline.h (cst_ann): New function.
> 	(expr_ann): Ditto.
> 	(get_cst_ann): Ditto.
> 	(get_expr_ann): Ditto..
> 
The annotations are empty.  What are you going to store in there?  Just
a single hash value?  Perhaps we could make this faster and hijack
tree_common.ann to store them directly there.  After all, the hash
values will end up in a field of SSA_NAME nodes, right?

If that's the case, perhaps we would be better off just overloading
tree_common.ann while GVN-PRE runs and then move that value into the
corresponding SSA_NAME.  If there's more state that you want to keep,
let's use this approach.


Diego.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add annotations for expression and constants
  2004-06-10 14:28 ` Diego Novillo
@ 2004-06-10 14:28   ` Daniel Berlin
  2004-06-10 14:55     ` Diego Novillo
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Berlin @ 2004-06-10 14:28 UTC (permalink / raw)
  To: Diego Novillo; +Cc: GCC Patches


On Jun 10, 2004, at 9:24 AM, Diego Novillo wrote:

> On Sun, 2004-06-06 at 12:46, Daniel Berlin wrote:
>
>> 	* tree-flow.h (tree_ann_type): Add CST_ANN, EXPR_ANN.
>> 	(struct cst_ann_d): New.
>> 	(struct expr_ann_d): New.
>> 	(union tree_ann_d): Add cst_ann, expr_ann.
>> 	* tree-dfa.c (create_cst_ann): New function.
>> 	(create_expr_ann): Ditto.
>> 	* tree-flow-inline.h (cst_ann): New function.
>> 	(expr_ann): Ditto.
>> 	(get_cst_ann): Ditto.
>> 	(get_expr_ann): Ditto..
>>
> The annotations are empty.

For now ;)

>  What are you going to store in there?
A single value.
It's right now a tree, but will probably move to a hash value 
eventually. We use fake VAR_DECLs for the value right now so that they 
print out nicely, are easy to track, etc, but they are a bit memory 
intensive for this purpose so eventually we'll move away from this, i 
reckon.

> Just
> a single hash value?
yes.

> Perhaps we could make this faster and hijack tree_common.ann to store 
> them directly there.


I'd have to create a new union or void *ify it, since it's currently a 
union tree_ann_d *, not a void *.   But i can't easily void * it 
because it's GC'd.

(IE
struct tree_common GTY(())
{
   tree chain;
   tree type;
   union tree_ann_d *ann;
)

In order to support GC on it, I'm pretty sure i have to create a union, 
but the value number members would be marked deletable/skip, since we 
don't need them after a ggc_collect.  Either that, or i'd have to keep 
a list of expressions and CST's we hijacked, and re-null them at the 
end of the pass so it doesn't screw up GC.
Just thinking about this is starting to make my head hurt :(

>  After all, the hash
> values will end up in a field of SSA_NAME nodes, right?
yes.
When you deleted the ssa_name_ann yesterday, i moved it to the tree 
structure for SSA_NAME's.

>
> If that's the case, perhaps we would be better off just overloading
> tree_common.ann while GVN-PRE runs and then move that value into the
> corresponding SSA_NAME.  If there's more state that you want to keep,
> let's use this approach.
>

Nope, no more state.

>
> Diego.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add annotations for expression and constants
  2004-06-10 14:28   ` Daniel Berlin
@ 2004-06-10 14:55     ` Diego Novillo
  2004-06-10 15:38       ` Daniel Berlin
  0 siblings, 1 reply; 8+ messages in thread
From: Diego Novillo @ 2004-06-10 14:55 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: GCC Patches

On Thu, 2004-06-10 at 09:38, Daniel Berlin wrote:

> I'd have to create a new union or void *ify it, since it's currently a 
> union tree_ann_d *, not a void *.   But i can't easily void * it 
> because it's GC'd.
> 
OK.  Creating the annotations is easier then.  BTW, are you also going
to number naked decls to commonize multiple loads from global variables,
for instance?  If so, the hash value will also be needed in var_ann_d.  

I'm thinking if we shouldn't just put the hash value in
tree_common_ann_d directly.


Diego.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add annotations for expression and constants
  2004-06-10 14:55     ` Diego Novillo
@ 2004-06-10 15:38       ` Daniel Berlin
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Berlin @ 2004-06-10 15:38 UTC (permalink / raw)
  To: Diego Novillo; +Cc: GCC Patches


On Jun 10, 2004, at 10:14 AM, Diego Novillo wrote:

> On Thu, 2004-06-10 at 09:38, Daniel Berlin wrote:
>
>> I'd have to create a new union or void *ify it, since it's currently a
>> union tree_ann_d *, not a void *.   But i can't easily void * it
>> because it's GC'd.
>>
> OK.  Creating the annotations is easier then.  BTW, are you also going
> to number naked decls to commonize multiple loads from global 
> variables,
> for instance?

Yes, as part of load value numbering (which is going to be a followup, 
so i can get this stuff in as a starting point).

>  If so, the hash value will also be needed in var_ann_d.
>

Yup.

> I'm thinking if we shouldn't just put the hash value in
> tree_common_ann_d directly.
>
Yeah.
I'll do that in the GVN-PRE patch (which actually adds the annotations)

>
> Diego.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add annotations for expression and constants
  2004-06-06 18:27 [PATCH]: Add annotations for expression and constants Daniel Berlin
  2004-06-10 14:28 ` Diego Novillo
@ 2004-06-15 16:14 ` Mark Mitchell
  2004-06-15 19:09   ` [PATCH]: Add documentation for functions in tree-flow-inline.h Daniel Berlin
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 2004-06-15 16:14 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: GCC Patches

Daniel --

These functions are all missing comments.  There should be a comment for 
every parameter and an explanation of the value returned.

If this patch has already been checked in, please fix that up ASAP.  If 
not, please fix it before you check in. :-)

> +
> +static inline cst_ann_t
> +cst_ann (tree t)
> +{
> +#if defined ENABLE_CHECKING
> +  if (TREE_CODE_CLASS (TREE_CODE (t)) != 'c'
> +      || (t->common.ann
> +      && t->common.ann->common.type != CST_ANN))
> +    abort ();
> +#endif
> +
> +  return (cst_ann_t) t->common.ann;
> +}
> +
> +static inline cst_ann_t
> +get_cst_ann (tree var)
> +{
> +  cst_ann_t ann = cst_ann (var);
> +  return (ann) ? ann : create_cst_ann (var);
> +}
> +
> +static inline expr_ann_t
> +expr_ann (tree t)
> +{
> +#if defined ENABLE_CHECKING
> +  if (!EXPR_P (t)
> +      || (t->common.ann
> +      && t->common.ann->common.type != EXPR_ANN))
> +    abort ();
> +#endif
> +
> +  return (expr_ann_t) t->common.ann;
> +}
> +
> +static inline expr_ann_t
> +get_expr_ann (tree var)
> +{
> +  expr_ann_t ann = expr_ann (var);
> +  return (ann) ? ann : create_expr_ann (var);
> +}
> +
>  static inline stmt_ann_t
>  stmt_ann (tree t)
>  {
> 


-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH]: Add documentation for functions in tree-flow-inline.h
  2004-06-15 16:14 ` Mark Mitchell
@ 2004-06-15 19:09   ` Daniel Berlin
  2004-06-15 19:26     ` Mark Mitchell
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Berlin @ 2004-06-15 19:09 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: GCC Patches


On Jun 15, 2004, at 11:06 AM, Mark Mitchell wrote:

> Daniel --
>
> These functions are all missing comments.  There should be a comment 
> for every parameter and an explanation of the value returned.

Okey.

As penance, I also added comments for all the other functions in that 
file, which were all missing this documentation.

I've attached the patch for review

2004-06-14  Daniel Berlin  <dberlin@dberlin.org>

	* tree-flow-inline.h: Add documentation for all functions.

Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.5
diff -u -3 -p -r2.5 tree-flow-inline.h
--- tree-flow-inline.h	12 Jun 2004 00:18:31 -0000	2.5
+++ tree-flow-inline.h	15 Jun 2004 17:53:56 -0000
@@ -25,6 +25,8 @@ Boston, MA 02111-1307, USA.  */
  /* Inline functions for manipulating various data structures defined in
     tree-flow.h.  See tree-flow.h for documentation.  */

+/* Return the variable annotation for T, which must be a _DECL node.
+   Return NULL if the variable annotation doesn't already exist.  */
  static inline var_ann_t
  var_ann (tree t)
  {
@@ -39,6 +41,8 @@ var_ann (tree t)
    return (var_ann_t) t->common.ann;
  }

+/* Return the variable annotation for T, which must be a _DECL node.
+   Create the variable annotation if it doesn't exist.  */
  static inline var_ann_t
  get_var_ann (tree var)
  {
@@ -47,6 +51,8 @@ get_var_ann (tree var)
  }


+/* Return the constant annotation for T, which must be a _CST node.
+   Return NULL if the constant annotation doesn't already exist.  */
  static inline cst_ann_t
  cst_ann (tree t)
  {
@@ -60,6 +66,8 @@ cst_ann (tree t)
    return (cst_ann_t) t->common.ann;
  }

+/* Return the constant annotation for T, which must be a _CST node.
+   Create the constant annotation if it doesn't exist.  */
  static inline cst_ann_t
  get_cst_ann (tree var)
  {
@@ -67,6 +75,9 @@ get_cst_ann (tree var)
    return (ann) ? ann : create_cst_ann (var);
  }

+/* Return the expression annotation for T, which must be an expression
+   node.  Return NULL if the expression annotation doesn't already
+   exist.  */
  static inline expr_ann_t
  expr_ann (tree t)
  {
@@ -80,24 +91,30 @@ expr_ann (tree t)
    return (expr_ann_t) t->common.ann;
  }

+/* Return the expression annotation for T, which must be an expression
+   node.  Create the expression annotation if it doesn't exist.  */
  static inline expr_ann_t
-get_expr_ann (tree var)
+get_expr_ann (tree t)
  {
-  expr_ann_t ann = expr_ann (var);
-  return (ann) ? ann : create_expr_ann (var);
+  expr_ann_t ann = expr_ann (t);
+  return (ann) ? ann : create_expr_ann (t);
  }

+/* Return the statement annotation for T, which must be a statement
+   node.  Return NULL if the statement annotation doesn't exist.  */
  static inline stmt_ann_t
  stmt_ann (tree t)
  {
  #if defined ENABLE_CHECKING
    if (!is_gimple_stmt (t) && !is_essa_node (t))
      abort ();
  #endif

    return (stmt_ann_t) t->common.ann;
  }

+/* Return the statement annotation for T, which must be a statement
+   node.  Create the statement annotation if it doesn't exist.  */
  static inline stmt_ann_t
  get_stmt_ann (tree stmt)
  {
@@ -106,12 +123,14 @@ get_stmt_ann (tree stmt)
  }


+/* Return the annotation type for annotation ANN.  */
  static inline enum tree_ann_type
  ann_type (tree_ann ann)
  {
    return ann->common.type;
  }

+/* Return the basic block for statement T.  */
  static inline basic_block
  bb_for_stmt (tree t)
  {
@@ -119,6 +138,8 @@ bb_for_stmt (tree t)
    return ann ? ann->bb : NULL;
  }

+/* Return the may_aliases varray for variable VAR, or NULL if it has
+   no may aliases.  */
  static inline varray_type
  may_aliases (tree var)
  {
@@ -126,6 +147,7 @@ may_aliases (tree var)
    return ann ? ann->may_aliases : NULL;
  }

+/* Return true if VAR has a hidden use, false if it does not.  */
  static inline bool
  has_hidden_use (tree var)
  {
@@ -133,6 +155,7 @@ has_hidden_use (tree var)
    return ann ? ann->has_hidden_use : false;
  }

+/* Set the hidden use flag on VAR.  */
  static inline void
  set_has_hidden_use (tree var)
  {
@@ -142,6 +165,8 @@ set_has_hidden_use (tree var)
    ann->has_hidden_use = 1;
  }

+/* Return the line number for EXPR, or return -1 if we have no line
+   number information for it.  */
  static inline int
  get_lineno (tree expr)
  {
@@ -157,6 +182,8 @@ get_lineno (tree expr)
    return EXPR_LINENO (expr);
  }

+/* Return the file name for EXPR, or return "???" if we have no
+   filename information.  */
  static inline const char *
  get_filename (tree expr)
  {
@@ -172,6 +199,7 @@ get_filename (tree expr)
      return "???";
  }

+/* Mark statement T as modified.  */
  static inline void
  modify_stmt (tree t)
  {
@@ -181,6 +209,7 @@ modify_stmt (tree t)
    ann->modified = 1;
  }

+/* Mark statement T as unmodified.  */
  static inline void
  unmodify_stmt (tree t)
  {
@@ -190,6 +219,7 @@ unmodify_stmt (tree t)
    ann->modified = 0;
  }

+/* Return true if T is marked as modified, false otherwise.  */
  static inline bool
  stmt_modified_p (tree t)
  {
@@ -201,36 +231,48 @@ stmt_modified_p (tree t)
    return ann ? ann->modified : true;
  }

+/* Return the definitions present in ANN, a statement annotation.
+   Return NULL if this annotation contains no definitions.  */
  static inline def_optype
  get_def_ops (stmt_ann_t ann)
  {
    return ann ? ann->def_ops : NULL;
  }

+/* Return the uses present in ANN, a statement annotation.
+   Return NULL if this annotation contains no uses.  */
  static inline use_optype
  get_use_ops (stmt_ann_t ann)
  {
    return ann ? ann->use_ops : NULL;
  }

+/* Return the virtual may-defs present in ANN, a statement
+   annotation.
+   Return NULL if this annotation contains no virtual may-defs.  */
  static inline v_may_def_optype
  get_v_may_def_ops (stmt_ann_t ann)
  {
    return ann ? ann->v_may_def_ops : NULL;
  }

+/* Return the virtual uses present in ANN, a statement annotation.
+   Return NULL if this annotation contains no virtual uses.  */
  static inline vuse_optype
  get_vuse_ops (stmt_ann_t ann)
  {
    return ann ? ann->vuse_ops : NULL;
  }

+/* Return the virtual must-defs present in ANN, a statement
+   annotation.  Return NULL if this annotation contains no must-defs.*/
  static inline v_must_def_optype
  get_v_must_def_ops (stmt_ann_t ann)
  {
    return ann ? ann->v_must_def_ops : NULL;
  }

+/* Return a pointer to the tree that is at INDEX in the USES array.  */
  static inline tree *
  get_use_op_ptr (use_optype uses, unsigned int index)
  {
@@ -241,6 +283,7 @@ get_use_op_ptr (use_optype uses, unsigne
    return uses->uses[index];
  }

+/* Return a pointer to the tree that is at INDEX in the DEFS array.  */
  static inline tree *
  get_def_op_ptr (def_optype defs, unsigned int index)
  {
@@ -251,6 +294,9 @@ get_def_op_ptr (def_optype defs, unsigne
    return defs->defs[index];
  }

+
+/* Return a pointer to the tree that is the V_MAY_DEF_RESULT for the 
V_MAY_DEF
+   at INDEX in the V_MAY_DEFS array.  */
  static inline tree *
  get_v_may_def_result_ptr(v_may_def_optype v_may_defs, unsigned int 
index)
  {
@@ -261,6 +307,8 @@ get_v_may_def_result_ptr(v_may_def_optyp
    return &(v_may_defs->v_may_defs[index * 2]);
  }

+/* Return a pointer to the tree that is the V_MAY_DEF_OP for the 
V_MAY_DEF at
+   INDEX in the V_MAY_DEFS array.  */
  static inline tree *
  get_v_may_def_op_ptr(v_may_def_optype v_may_defs, unsigned int index)
  {
@@ -271,6 +319,7 @@ get_v_may_def_op_ptr(v_may_def_optype v_
    return &(v_may_defs->v_may_defs[index * 2 + 1]);
  }

+/* Return a pointer to the tree that is at INDEX in the VUSES array.  
*/
  static inline tree *
  get_vuse_op_ptr(vuse_optype vuses, unsigned int index)
  {
@@ -281,6 +330,8 @@ get_vuse_op_ptr(vuse_optype vuses, unsig
    return &(vuses->vuses[index]);
  }

+/* Return a pointer to the tree that is the V_MUST_DEF_OP for the
+   V_MUST_DEF at INDEX in the V_MUST_DEFS array.  */
  static inline tree *
  get_v_must_def_op_ptr (v_must_def_optype v_must_defs, unsigned int 
index)
  {
@@ -291,6 +342,7 @@ get_v_must_def_op_ptr (v_must_def_optype
    return &(v_must_defs->v_must_defs[index]);
  }

+/* Mark the beginning of changes to the SSA operands for STMT.  */
  static inline void
  start_ssa_stmt_operands (tree stmt ATTRIBUTE_UNUSED)
  {
@@ -299,6 +351,8 @@ start_ssa_stmt_operands (tree stmt ATTRI
  #endif
  }

+/* Return the bitmap of addresses taken by STMT, or NULL if it takes
+   no addresses.  */
  static inline bitmap
  addresses_taken (tree stmt)
  {
@@ -306,6 +360,8 @@ addresses_taken (tree stmt)
    return ann ? ann->addresses_taken : NULL;
  }

+/* Return the immediate uses of STMT, or NULL if this information is
+   not computed.  */
  static dataflow_t
  get_immediate_uses (tree stmt)
  {
@@ -313,6 +369,8 @@ get_immediate_uses (tree stmt)
    return ann ? ann->df : NULL;
  }

+/* Return the number of immediate uses present in the dataflow
+   information at DF.  */
  static inline int
  num_immediate_uses (dataflow_t df)
  {
@@ -328,6 +386,7 @@ num_immediate_uses (dataflow_t df)
    return VARRAY_ACTIVE_SIZE (imm) + 2;
  }

+/* Return the tree that is at NUM in the immediate use DF array.  */
  static inline tree
  immediate_use (dataflow_t df, int num)
  {
@@ -343,12 +402,15 @@ immediate_use (dataflow_t df, int num)
    return VARRAY_TREE (df->immediate_uses, num - 2);
  }

+/* Return the basic_block annotation for BB.  */
  static inline bb_ann_t
  bb_ann (basic_block bb)
  {
    return (bb_ann_t)bb->tree_annotations;
  }

+/* Return the PHI nodes for basic block BB, or NULL if there are no
+   PHI nodes.  */
  static inline tree
  phi_nodes (basic_block bb)
  {
@@ -402,6 +464,7 @@ phi_element_for_edge (tree phi, edge e)

  /*  
----------------------------------------------------------------------- 
  */

+/* Return true if T is an executable statement.  */
  static inline bool
  is_exec_stmt (tree t)
  {
@@ -427,6 +490,7 @@ is_label_stmt (tree t)
    return false;
  }

+/* Return true if we may propagate ORIG into DEST, false otherwise.  */
  static inline bool
  may_propagate_copy (tree dest, tree orig)
  {
@@ -507,6 +571,7 @@ may_propagate_copy (tree dest, tree orig
  	  && !DECL_HARD_REGISTER (SSA_NAME_VAR (dest)));
  }

+/* Set the default definition for VAR to DEF.  */
  static inline void
  set_default_def (tree var, tree def)
  {
@@ -516,6 +581,8 @@ set_default_def (tree var, tree def)
    ann->default_def = def;
  }

+/* Return the default definition for variable VAR, or NULL if none
+   exists.  */
  static inline tree
  default_def (tree var)
  {
@@ -541,6 +608,8 @@ phi_ssa_name_p (tree t)

  /*  
----------------------------------------------------------------------- 
  */

+/* Return a block_stmt_iterator that points to beginning of basic
+   block BB.  */
  static inline block_stmt_iterator
  bsi_start (basic_block bb)
  {
@@ -560,6 +629,8 @@ bsi_start (basic_block bb)
    return bsi;
  }

+/* Return a block statement iterator that points to the end of basic
+   block BB.  */
  static inline block_stmt_iterator
  bsi_last (basic_block bb)
  {
@@ -579,36 +650,47 @@ bsi_last (basic_block bb)
    return bsi;
  }

+/* Return true if block statement iterator I has reached the end of
+   the basic block.  */
  static inline bool
  bsi_end_p (block_stmt_iterator i)
  {
    return tsi_end_p (i.tsi);
  }

+/* Modify block statement iterator I so that it is at the next
+   statement in the basic block.  */
  static inline void
  bsi_next (block_stmt_iterator *i)
  {
    tsi_next (&i->tsi);
  }

+/* Modify block statement iterator I so that it is at the previous
+   statement in the basic block.  */
  static inline void
  bsi_prev (block_stmt_iterator *i)
  {
    tsi_prev (&i->tsi);
  }

+/* Return the statement that block statement iterator I is currently
+   at.  */
  static inline tree
  bsi_stmt (block_stmt_iterator i)
  {
    return tsi_stmt (i.tsi);
  }

+/* Return a pointer to the statement that block statement iterator I
+   is currently at.  */
  static inline tree *
  bsi_stmt_ptr (block_stmt_iterator i)
  {
    return tsi_stmt_ptr (i.tsi);
  }

+/* Return true if VAR may be aliased.  */
  static inline bool
  may_be_aliased (tree var)
  {
@@ -616,6 +698,7 @@ may_be_aliased (tree var)
            || decl_function_context (var) != current_function_decl);
  }

+/* Return true if VAR is a clobbered by function calls.  */
  static inline bool
  is_call_clobbered (tree var)
  {
@@ -623,6 +706,7 @@ is_call_clobbered (tree var)
  	 || bitmap_bit_p (call_clobbered_vars, var_ann (var)->uid);
  }

+/* Mark variable VAR as being clobbered by function calls.  */
  static inline void
  mark_call_clobbered (tree var)
  {
@@ -632,6 +716,7 @@ mark_call_clobbered (tree var)
    bitmap_set_bit (call_clobbered_vars, ann->uid);
  }

+/* Mark variable VAR as being non-addressable.  */
  static inline void
  mark_non_addressable (tree var)
  {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: Add documentation for functions in tree-flow-inline.h
  2004-06-15 19:09   ` [PATCH]: Add documentation for functions in tree-flow-inline.h Daniel Berlin
@ 2004-06-15 19:26     ` Mark Mitchell
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Mitchell @ 2004-06-15 19:26 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: GCC Patches

Daniel Berlin wrote:

> 
> On Jun 15, 2004, at 11:06 AM, Mark Mitchell wrote:
> 
>> Daniel --
>>
>> These functions are all missing comments.  There should be a comment 
>> for every parameter and an explanation of the value returned.
> 
> 
> Okey.
> 
> As penance, I also added comments for all the other functions in that 
> file, which were all missing this documentation.
> 
> I've attached the patch for review

Yay!  Looks good.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-06-15 18:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-06 18:27 [PATCH]: Add annotations for expression and constants Daniel Berlin
2004-06-10 14:28 ` Diego Novillo
2004-06-10 14:28   ` Daniel Berlin
2004-06-10 14:55     ` Diego Novillo
2004-06-10 15:38       ` Daniel Berlin
2004-06-15 16:14 ` Mark Mitchell
2004-06-15 19:09   ` [PATCH]: Add documentation for functions in tree-flow-inline.h Daniel Berlin
2004-06-15 19:26     ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).