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]

[tree-ssa] minor locus cleanup


Use a location_t more places.


r~


        * c-simplify.c (c_gimplify_stmt): Upreate on location_t and not
        fine and line individually.
        (gimplify_c_loop, gimplify_switch_stmt): Likewise.
        * gimplify.c (wfl_locus): Merge wfl_filename+wfl_lineno.
        (annotate_all_with_locus_1): Rename from annotate_stmt_with_file_line.
        (annotate_all_with_locus): Replace annotate_all_with_file_line;
        update all callers.
        * tree-simple.h: Update.
        * tree.c, tree.h (annotate_with_locus): New.
cp/
        * pt.c (push_tinst_level): Use annotate_with_locus.
fortran/
        * trans.c (gfc_trans_code): Use annotate_all_with_locus.
java/
        * decl.c (java_add_stmt): Use annotate_with_locus.

Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.72
diff -c -p -d -u -r1.1.4.72 c-simplify.c
--- c-simplify.c	30 Sep 2003 21:04:55 -0000	1.1.4.72
+++ c-simplify.c	14 Oct 2003 00:01:23 -0000
@@ -189,14 +189,12 @@ c_gimplify_stmt (tree *stmt_p)
     {
       tree pre, post;
       int saved_stmts_are_full_exprs_p;
-      const char *stmt_filename;
-      int stmt_lineno;
+      location_t stmt_locus;
 
       /* Set up context appropriately for handling this statement.  */
       saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
       prep_stmt (stmt);
-      stmt_filename = input_filename;
-      stmt_lineno = input_line;
+      stmt_locus = input_location;
 
       pre = NULL_TREE;
       post = NULL_TREE;
@@ -306,7 +304,7 @@ c_gimplify_stmt (tree *stmt_p)
       add_tree (stmt, &pre);
       add_tree (post, &pre);
       pre = rationalize_compound_expr (pre);
-      annotate_all_with_file_line (&pre, stmt_filename, stmt_lineno);
+      annotate_all_with_locus (&pre, stmt_locus);
 
       add_tree (pre, &outer_pre);
     cont:
@@ -580,12 +578,10 @@ static tree
 gimplify_c_loop (tree cond, tree body, tree incr, int cond_is_first)
 {
   tree exit, cont_block, break_block, loop;
-  const char *stmt_filename;
-  int stmt_lineno;
+  location_t stmt_locus;
   tree stuff, entry = NULL_TREE;
 
-  stmt_filename = input_filename;
-  stmt_lineno = input_line;
+  stmt_locus = input_location;
 
   break_block = begin_bc_block (bc_break);
 
@@ -631,7 +627,7 @@ gimplify_c_loop (tree cond, tree body, t
       add_tree (exit, &stuff);
     }
 
-  annotate_all_with_file_line (&stuff, stmt_filename, stmt_lineno);
+  annotate_all_with_locus (&stuff, stmt_locus);
 
   LOOP_EXPR_BODY (loop) = rationalize_compound_expr (stuff);
 
@@ -767,8 +763,7 @@ gimplify_switch_stmt (tree *stmt_p)
   tree body = SWITCH_BODY (stmt);
   tree break_block, switch_;
   tree cond = SWITCH_COND (stmt);
-  const char *stmt_filename = input_filename;
-  int stmt_lineno = input_line;
+  location_t stmt_locus = input_location;
 
   gimplify_condition (&cond);
 
@@ -777,7 +772,7 @@ gimplify_switch_stmt (tree *stmt_p)
   c_gimplify_stmt (&body);
 
   switch_ = build (SWITCH_EXPR, SWITCH_TYPE (stmt), cond, body, NULL_TREE);
-  annotate_with_file_line (switch_, stmt_filename, stmt_lineno);
+  annotate_with_locus (switch_, stmt_locus);
 
   switch_ = finish_bc_block (break_block, switch_);
 
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
retrieving revision 1.1.2.92
diff -c -p -d -u -r1.1.2.92 gimplify.c
--- gimplify.c	13 Oct 2003 01:28:52 -0000	1.1.2.92
+++ gimplify.c	14 Oct 2003 00:01:23 -0000
@@ -63,7 +63,6 @@ static void gimplify_bind_expr (tree *, 
 static inline void remove_suffix (char *, int);
 static void push_gimplify_context (void);
 static void pop_gimplify_context (void);
-static void annotate_stmt_with_file_line (tree *);
 static tree copy_if_shared_r (tree *, int *, void *);
 static tree unmark_visited_r (tree *, int *, void *);
 static tree mostly_copy_tree_r (tree *, int *, void *);
@@ -695,10 +694,10 @@ gimplify_expr (tree *expr_p, tree *pre_p
   if (is_statement)
     {
       add_tree (*expr_p, pre_p);
-      annotate_all_with_file_line (&internal_post, input_filename, input_line);
+      annotate_all_with_locus (&internal_post, input_location);
       add_tree (internal_post, pre_p);
       tmp = rationalize_compound_expr (internal_pre);
-      annotate_all_with_file_line (&tmp, input_filename, input_line);
+      annotate_all_with_locus (&tmp, input_location);
       *expr_p = tmp;
 
       goto out;
@@ -764,7 +763,7 @@ gimplify_expr (tree *expr_p, tree *pre_p
 
   if (internal_post)
     {
-      annotate_all_with_file_line (&internal_post, input_filename, input_line);
+      annotate_all_with_locus (&internal_post, input_location);
       add_tree (internal_post, pre_p);
     }
 
@@ -1592,7 +1591,7 @@ gimplify_call_expr (tree *expr_p, tree *
   /* For reliable diagnostics during inlining, it is necessary that 
      every call_expr be annotated with file and line.  */
   if (!EXPR_LOCUS (*expr_p))
-    annotate_with_file_line (*expr_p, input_filename, input_line);
+    annotate_with_locus (*expr_p, input_location);
 
   /* This may be a call to a builtin function.
 
@@ -2355,11 +2354,10 @@ foreach_stmt (tree *stmt_p, foreach_stmt
   fn (stmt_p);
 }
 
-static const char *wfl_filename;
-static int wfl_lineno;
+static location_t wfl_locus;
 
 static void
-annotate_stmt_with_file_line (tree *stmt_p)
+annotate_all_with_locus_1 (tree *stmt_p)
 {
   /* Don't emit a line note for a label.  We particularly don't want to
      emit one for the break label, since it doesn't actually correspond
@@ -2367,15 +2365,14 @@ annotate_stmt_with_file_line (tree *stmt
   if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (*stmt_p)))
       && TREE_CODE (*stmt_p) != LABEL_EXPR
       && ! EXPR_LOCUS (*stmt_p))
-    annotate_with_file_line (*stmt_p, wfl_filename, wfl_lineno);
+    annotate_with_locus (*stmt_p, wfl_locus);
 }
 
 void
-annotate_all_with_file_line (tree *stmt_p, const char *file, int line)
+annotate_all_with_locus (tree *stmt_p, location_t locus)
 {
-  wfl_filename = file;
-  wfl_lineno = line;
-  foreach_stmt (stmt_p, annotate_stmt_with_file_line);
+  wfl_locus = locus;
+  foreach_stmt (stmt_p, annotate_all_with_locus_1);
 }
 
 /* Add STMT to EXISTING if possible, otherwise create a new
@@ -2658,7 +2655,7 @@ internal_get_tmp_var (tree val, tree *pr
   if (EXPR_LOCUS (val))
     SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
   else
-    annotate_with_file_line (mod, input_filename, input_line);
+    annotate_with_locus (mod, input_location);
   /* gimplify_modify_expr might want to reduce this further.  */
   gimplify_stmt (&mod);
   add_tree (mod, pre_p);
Index: tree-simple.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-simple.h,v
retrieving revision 1.1.4.32
diff -c -p -d -u -r1.1.4.32 tree-simple.h
--- tree-simple.h	12 Oct 2003 19:43:32 -0000	1.1.4.32
+++ tree-simple.h	14 Oct 2003 00:01:23 -0000
@@ -34,7 +34,7 @@ extern void declare_tmp_vars (tree, tree
 
 extern tree rationalize_compound_expr (tree);
 extern tree right_assocify_expr (tree);
-extern void annotate_all_with_file_line (tree *, const char *, int);
+extern void annotate_all_with_locus (tree *, location_t);
 
 /* Validation of GIMPLE expressions.  Note that these predicates only check
    the basic form of the expression, they don't recurse to make sure that
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.263.2.58
diff -c -p -d -u -r1.263.2.58 tree.c
--- tree.c	12 Oct 2003 19:43:33 -0000	1.263.2.58
+++ tree.c	14 Oct 2003 00:01:23 -0000
@@ -2595,6 +2595,7 @@ static GTY(()) tree last_annotated_node;
 
 /* Record the exact location where an expression or an identifier were
    encountered.  */
+
 void
 annotate_with_file_line (tree node, const char *file, int line)
 {
@@ -2627,6 +2628,12 @@ annotate_with_file_line (tree node, cons
   EXPR_LINENO (node) = line;
   EXPR_FILENAME (node) = file;
   last_annotated_node = node;
+}
+
+void
+annotate_with_locus (tree node, location_t locus)
+{
+  annotate_with_file_line (node, locus.file, locus.line);
 }
 
 /* Return a declaration like DDECL except that its DECL_ATTRIBUTES
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.107
diff -c -p -d -u -r1.342.2.107 tree.h
--- tree.h	12 Oct 2003 19:43:33 -0000	1.342.2.107
+++ tree.h	14 Oct 2003 00:01:23 -0000
@@ -2513,6 +2513,7 @@ extern tree build_tree_list (tree, tree)
 extern tree build_decl (enum tree_code, tree, tree);
 extern tree build_block (tree, tree, tree, tree, tree);
 extern void annotate_with_file_line (tree, const char *, int);
+extern void annotate_with_locus (tree, location_t);
 extern tree build_empty_stmt (void);
 
 /* Construct various nodes representing data types.  */
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.591.2.37
diff -c -p -d -u -r1.591.2.37 pt.c
--- cp/pt.c	12 Oct 2003 19:43:35 -0000	1.591.2.37
+++ cp/pt.c	14 Oct 2003 00:01:24 -0000
@@ -4647,7 +4647,7 @@ push_tinst_level (tree d)
     }
 
   new = make_node (TINST_LEVEL);
-  annotate_with_file_line (new, input_filename, input_line);
+  annotate_with_locus (new, input_location);
   TINST_DECL (new) = d;
   TREE_CHAIN (new) = current_tinst_level;
   current_tinst_level = new;
Index: fortran/trans.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/trans.c,v
retrieving revision 1.1.2.4
diff -c -p -d -u -r1.1.2.4 trans.c
--- fortran/trans.c	12 Sep 2003 19:34:25 -0000	1.1.2.4
+++ fortran/trans.c	14 Oct 2003 00:01:24 -0000
@@ -407,14 +407,14 @@ gfc_trans_code (gfc_code * code)
   for (; code; code = code->next)
     {
       gfc_set_backend_locus (&code->loc);
+
       if (code->here != 0)
 	{
 	  res = gfc_trans_label_here (code);
-	  annotate_all_with_file_line (&res, input_filename, input_line);
+	  annotate_all_with_locus (&res, input_location);
 	  gfc_add_expr_to_block (&block, res);
 	}
 
-
       switch (code->op)
 	{
 	case EXEC_NOP:
@@ -547,7 +547,7 @@ gfc_trans_code (gfc_code * code)
 
       if (res != NULL_TREE && ! IS_EMPTY_STMT (res))
 	{
-	  annotate_all_with_file_line (&res, input_filename, input_line);
+	  annotate_all_with_locus (&res, input_location);
 	  /* Add the new statemment to the block.  */
 	  gfc_add_expr_to_block (&block, res);
 	}
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.128.2.26
diff -c -p -d -u -r1.128.2.26 decl.c
--- java/decl.c	12 Oct 2003 19:43:38 -0000	1.128.2.26
+++ java/decl.c	14 Oct 2003 00:01:24 -0000
@@ -1939,7 +1939,7 @@ java_add_stmt (stmt)
      tree stmt;
 {
   if (input_filename)
-    annotate_with_file_line (stmt, input_filename, input_line);
+    annotate_with_locus (stmt, input_location);
   
   return current_binding_level->stmts 
     = add_stmt_to_compound (current_binding_level->stmts, 


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