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]

[docs patch]: Remove obsolete section in tree-ssa.texi, addV_MUST_DEF iterator


This patch removes the section in tree-ssa.texi that describes the now
deprecated/unsupported interface to accessing the tree operands.
All accesses are supposed to go through iterators now.

I've also added, to the operand iterator section, the V_MUST_DEF
iterator that now exists.

Bootstrapped on i686-pc-linux-gnu.

Okay for mainline?

2005-01-21  Daniel Berlin  <dberlin@dberlin.org>

	* doc/tree-ssa.texi (Statement Operands): Add example for new
	must-def macro. Remove section containing deprecated/unsupported
	interface to operands. 
Index: doc/tree-ssa.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tree-ssa.texi,v
retrieving revision 1.14
diff -u -p -r1.14 tree-ssa.texi
--- doc/tree-ssa.texi	5 Nov 2004 01:36:57 -0000	1.14
+++ doc/tree-ssa.texi	21 Jan 2005 14:41:01 -0000
@@ -812,84 +812,6 @@ function is converted into SSA form.  Th
 the non-killing definitions to prevent optimizations from making
 incorrect assumptions about them.
 
-Operands are collected by @file{tree-ssa-operands.c}.  They are stored
-inside each statement's annotation and can be accessed with
-@code{DEF_OPS}, @code{USE_OPS}, @code{V_MAY_DEF_OPS},
-@code{V_MUST_DEF_OPS} and @code{VUSE_OPS}.  The following are all the
-accessor macros available to access USE operands.  To access all the
-other operand arrays, just change the name accordingly:
-
-@defmac USE_OPS (@var{ann})
-Returns the array of operands used by the statement with annotation
-@var{ann}.
-@end defmac
-
-@defmac STMT_USE_OPS (@var{stmt})
-Alternate version of USE_OPS that takes the statement @var{stmt} as
-input.
-@end defmac
-
-@defmac NUM_USES (@var{ops})
-Return the number of USE operands in array @var{ops}.
-@end defmac
-
-@defmac USE_OP_PTR (@var{ops}, @var{i})
-Return a pointer to the @var{i}th operand in array @var{ops}.
-@end defmac
-
-@defmac USE_OP (@var{ops}, @var{i})
-Return the @var{i}th operand in array @var{ops}.
-@end defmac
-
-The following function shows how to print all the operands of a given
-statement:
-
-@smallexample
-void
-print_ops (tree stmt)
-@{
-  vuse_optype vuses;
-  v_may_def_optype v_may_defs;
-  v_must_def_optype v_must_defs;
-  def_optype defs;
-  use_optype uses;
-  stmt_ann_t ann;
-  size_t i;
-
-  get_stmt_operands (stmt);
-  ann = stmt_ann (stmt);
-
-  defs = DEF_OPS (ann);
-  for (i = 0; i < NUM_DEFS (defs); i++)
-    print_generic_expr (stderr, DEF_OP (defs, i), 0);
-
-  uses = USE_OPS (ann);
-  for (i = 0; i < NUM_USES (uses); i++)
-    print_generic_expr (stderr, USE_OP (uses, i), 0);
-
-  v_may_defs = V_MAY_DEF_OPS (ann);
-  for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
-    @{
-      print_generic_expr (stderr, V_MAY_DEF_OP (v_may_defs, i), 0);
-      print_generic_expr (stderr, V_MAY_DEF_RESULT (v_may_defs, i), 0);
-    @}
-
-  v_must_defs = V_MUST_DEF_OPS (ann);
-  for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
-    print_generic_expr (stderr, V_MUST_DEF_OP (v_must_defs, i), 0);
-
-  vuses = VUSE_OPS (ann);
-  for (i = 0; i < NUM_VUSES (vuses); i++)
-    print_generic_expr (stderr, VUSE_OP (vuses, i), 0);
-@}
-@end smallexample
-
-To collect the operands, you first need to call
-@code{get_stmt_operands}.  Since that is a potentially expensive
-operation, statements are only scanned if they have been marked
-modified by a call to @code{modify_stmt}.  So, if your pass replaces
-operands in a statement, make sure to call @code{modify_stmt}.
-
 @subsection Operand Iterators
 @cindex Operand Iterators
 
@@ -977,7 +899,7 @@ aren't using operand pointers, use and d
     @}
 @end smallexample
 
-Note that @code{V_MAY_DEFS} are broken into 2 flags, one for the
+@code{V_MAY_DEFS} are broken into 2 flags, one for the
 @code{DEF} portion (@code{SSA_OP_VMAYDEF}) and one for the USE portion
 (@code{SSA_OP_VMAYUSE}).  If all you want to look at are the
 @code{V_MAY_DEFS} together, there is a fourth iterator macro for this,
@@ -996,6 +918,25 @@ this one.
     @}
 @end smallexample
 
+@code{V_MUST_DEFS} are broken into 2 flags, one for the
+@code{DEF} portion (@code{SSA_OP_VMUSTDEF}) and one for the kill portion
+(@code{SSA_OP_VMUSTDEFKILL}).  If all you want to look at are the
+@code{V_MUST_DEFS} together, there is a fourth iterator macro for this,
+which returns both a def_operand_p and a use_operand_p for each
+@code{V_MUST_DEF} in the statement.  Note that you don't need any flags for
+this one.
+
+@smallexample
+  use_operand_p kill_p;
+  def_operand_p def_p;
+  ssa_op_iter iter;
+
+  FOR_EACH_SSA_MUSTDEF_OPERAND (def_p, kill_p, stmt, iter)
+    @{
+      my_code;
+    @}
+@end smallexample
+
 
 There are many examples in the code as well, as well as the
 documentation in @file{tree-ssa-operands.h}.

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