]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Conditionally compile support for --enable-mapped_location.
authorPer Bothner <per@bothner.com>
Wed, 30 Jun 2004 18:21:54 +0000 (11:21 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Wed, 30 Jun 2004 18:21:54 +0000 (11:21 -0700)
* gengtype-lex.l:  Temporary kludge to avoid duplicate typedef.
* gengtype.c:  Update for now typdefs in input.h.  More kludges.
* modulo-sched.c (sms_schedule):  Use NOTE_EXPANDED_LOCATION macro.
* ra-debug.c (ra_print_rtl):  Likewise.
* sched-rgn.c:  Likewise.
* sched-vis.c:  Likewise.
* rtl.h (gen_rtx_ASM_OPERANDS):  Redefine if USE_MAPPED_LOCATION.
* stmt.c (expand_asm_operands):  Adjust calls to gen_rtx_ASM_OPERANDS.
* tree-cfg.c:  Use new macros and typedefs.
* tree-flow-inline.h:  Likewise.

From-SVN: r83922

gcc/ChangeLog
gcc/gengtype-lex.l
gcc/gengtype.c
gcc/modulo-sched.c
gcc/ra-debug.c
gcc/sched-rgn.c
gcc/sched-vis.c
gcc/tree-cfg.c
gcc/tree-flow-inline.h

index b217e27ee7994771693413d041724a275240914c..2e424d7c14acfbd97d1ad84e979aefbd791dc9b7 100644 (file)
        * rtl-error.c:  Likewise.
        * stmt.c (check_seenlabel):  Likewise.
        * tree-pretty-print.c:  Likewise.
+       * gengtype-lex.l:  Temporary kludge to avoid duplicate typedef.
+       * gengtype.c:  Update for now typdefs in input.h.  More kludges.
+       * modulo-sched.c (sms_schedule):  Use NOTE_EXPANDED_LOCATION macro.
+       * ra-debug.c (ra_print_rtl):  Likewise.
+       * sched-rgn.c:  Likewise.
+       * sched-vis.c:  Likewise.
+       * rtl.h (gen_rtx_ASM_OPERANDS):  Redefine if USE_MAPPED_LOCATION.
+       * stmt.c (expand_asm_operands):  Adjust calls to gen_rtx_ASM_OPERANDS.
+       * tree-cfg.c:  Use new macros and typedefs.
+       * tree-flow-inline.h:  Likewise.
 
 2004-06-30  Richard Sandiford  <rsandifo@redhat.com>
            Eric Christopher  <echristo@redhat.com>
index ed9100829ee8e65329a509e79643123f1366b4db..22a5cd8ee0fdd988cbe09804600a6e41acbf3d2e 100644 (file)
@@ -88,7 +88,12 @@ ITYPE        {IWORD}({WS}{IWORD})*
   t = find_structure (xmemdup (tagstart, taglen, taglen+1), union_p);
   if (is_pointer)
     t = create_pointer (t);
-  do_typedef (xmemdup (namestart, namelen, namelen+1), t, &lexer_line);
+  namestart = xmemdup (namestart, namelen, namelen+1);
+#ifdef USE_MAPPED_LOCATION
+  /* temporary kludge - gentype doesn't handle cpp conditionals */
+  if (strcmp (namestart, "location_t") != 0)
+#endif
+  do_typedef (namestart, t, &lexer_line);
   update_lineno (yytext, yyleng);
 }
 
index 85e856f89fdeb51e96ce10497a264feb401f6347..6c19725f86808dbd27e97eaad5f0e5003b407b25 100644 (file)
@@ -1104,7 +1104,7 @@ open_base_files (void)
     /* The order of files here matters very much.  */
     static const char *const ifiles [] = {
       "config.h", "system.h", "coretypes.h", "tm.h", "varray.h", 
-      "hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h",
+      "hashtab.h", "splay-tree.h", "bitmap.h", "input.h", "tree.h", "rtl.h",
       "function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
       "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
       "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
@@ -2988,6 +2988,10 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
   do_scalar_typedef ("uint8", &pos);
   do_scalar_typedef ("jword", &pos);
   do_scalar_typedef ("JCF_u2", &pos);
+#ifdef USE_MAPPED_LOCATION
+  do_scalar_typedef ("location_t", &pos);
+  do_scalar_typedef ("source_locus", &pos);
+#endif
   do_scalar_typedef ("void", &pos);
 
   do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos);
@@ -3010,6 +3014,12 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
         }
       if (!dupflag)
         parse_file (all_files[i]);
+#ifndef USE_MAPPED_LOCATION
+      /* temporary kludge - gengtype doesn't handle conditionals.
+        Manually add source_locus *after* we've processed input.h. */
+      if (i == 0)
+       do_typedef ("source_locus", create_pointer (resolve_typedef ("location_t", &pos)), &pos);
+#endif
     }
 
   if (hit_error != 0)
index 68eeb364e9f82e04aca04f64e7429eb269cb3ca7..c14b58f8699211c51d32da4c5f4d9516f538e597 100644 (file)
@@ -900,8 +900,12 @@ sms_schedule (FILE *dump_file)
              rtx line_note = find_line_note (tail);
 
              if (line_note)
-               fprintf (stats_file, "SMS bb %s %d (file, line)\n",
-                        NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note));
+               {
+                 expanded_location xloc;
+                 NOTE_EXPANDED_LOCATION (xloc, line_note);
+                 fprintf (stats_file, "SMS bb %s %d (file, line)\n",
+                          xloc.file, xloc.line);
+               }
              fprintf (stats_file, "SMS single-bb-loop\n");
              if (profile_info && flag_branch_probabilities)
                {
@@ -996,8 +1000,12 @@ sms_schedule (FILE *dump_file)
          rtx line_note = find_line_note (tail);
 
          if (line_note)
-           fprintf (stats_file, "SMS bb %s %d (file, line)\n",
-                    NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note));
+           {
+             expanded_location xloc;
+             NOTE_EXPANDED_LOCATION (xloc, line_note);
+             fprintf (stats_file, "SMS bb %s %d (file, line)\n",
+                      xloc.file, xloc.line);
+           }
          fprintf (stats_file, "SMS single-bb-loop\n");
          if (profile_info && flag_branch_probabilities)
            {
index a5c4f0983f45f173b3c0b84addd6829e2041656d..9bbfeb7fdb8ad9fdf928259c8ac5032cf6f85aa9 100644 (file)
@@ -389,9 +389,11 @@ ra_print_rtx (FILE *file, rtx x, int with_pn)
            fprintf (file, " %s", GET_NOTE_INSN_NAME (ln));
          else
            {
-             fprintf (file, " line %d", ln);
-             if (NOTE_SOURCE_FILE (x))
-               fprintf (file, ":%s", NOTE_SOURCE_FILE (x));
+             expanded_location s;
+             NOTE_EXPANDED_LOCATION (s, x);
+             fprintf (file, " line %d", s.line);
+             if (s.file != NULL)
+               fprintf (file, ":%s", s.file);
            }
        }
       else
index 14175776a4a1cdefb4a40f368d5cf58b2a48ee2b..1630a3d297aeaf53e61901a58a9f6fa410004ad8 100644 (file)
@@ -2321,8 +2321,12 @@ debug_dependencies (void)
                      if (n < 0)
                        fprintf (sched_dump, "%s\n", GET_NOTE_INSN_NAME (n));
                      else
-                       fprintf (sched_dump, "line %d, file %s\n", n,
-                                NOTE_SOURCE_FILE (insn));
+                       {
+                         expanded_location xloc;
+                         NOTE_EXPANDED_LOCATION (xloc, insn);
+                         fprintf (sched_dump, "line %d, file %s\n",
+                                  xloc.line, xloc.file);
+                       }
                    }
                  else
                    fprintf (sched_dump, " {%s}\n", GET_RTX_NAME (GET_CODE (insn)));
index b7544d2ef8eaf8de71093e187f9786f8796da630..856830693e656652f0f16cebc6c552ec801209ba 100644 (file)
@@ -787,8 +787,12 @@ print_insn (char *buf, rtx x, int verbose)
       break;
     case NOTE:
       if (NOTE_LINE_NUMBER (x) > 0)
-       sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
-                NOTE_SOURCE_FILE (x), NOTE_LINE_NUMBER (x));
+       {
+         expanded_location xloc;
+         NOTE_EXPANDED_LOCATION (xloc, x);
+         sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
+                  xloc.file, xloc.line);
+       }
       else
        sprintf (buf, "%4d %s", INSN_UID (x),
                 GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x)));
index 88e66f7badce6c3fb4e0688d0bf1f81fb3ccce9a..509803cee991ef1242dfd755a0f5029bcb5e26fd 100644 (file)
@@ -666,7 +666,11 @@ make_goto_expr_edges (basic_block bb)
       if (simple_goto_p (goto_t))
        {
          edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
+#ifdef USE_MAPPED_LOCATION
+         e->goto_locus = EXPR_LOCATION (goto_t);
+#else
          e->goto_locus = EXPR_LOCUS (goto_t);
+#endif
          bsi_remove (&last);
          return;
        }
@@ -1115,9 +1119,10 @@ static void remove_useless_stmts_1 (tree *, struct rus_data *);
 static bool
 remove_useless_stmts_warn_notreached (tree stmt)
 {
-  if (EXPR_LOCUS (stmt))
+  if (EXPR_HAS_LOCATION (stmt))
     {
-      warning ("%Hwill never be executed", EXPR_LOCUS (stmt));
+      location_t loc = EXPR_LOCATION (stmt);
+      warning ("%Hwill never be executed", &loc);
       return true;
     }
 
@@ -1776,7 +1781,7 @@ static void
 remove_bb (basic_block bb)
 {
   block_stmt_iterator i;
-  location_t *loc = NULL;
+  source_locus loc = 0;
 
   if (dump_file)
     {
@@ -1799,8 +1804,12 @@ remove_bb (basic_block bb)
         jump threading, thus resulting in bogus warnings.  Not great,
         since this way we lose warnings for gotos in the original
         program that are indeed unreachable.  */
-      if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_LOCUS (stmt) && !loc)
+      if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_HAS_LOCATION (stmt) && !loc)
+#ifdef USE_MAPPED_LOCATION
+       loc = EXPR_LOCATION (stmt);
+#else
        loc = EXPR_LOCUS (stmt);
+#endif
     }
 
   /* If requested, give a warning that the first statement in the
@@ -1808,7 +1817,11 @@ remove_bb (basic_block bb)
      loop above, so the last statement we process is the first statement
      in the block.  */
   if (warn_notreached && loc)
+#ifdef USE_MAPPED_LOCATION
+    warning ("%Hwill never be executed", &loc);
+#else
     warning ("%Hwill never be executed", loc);
+#endif
 
   remove_phi_nodes_and_edges_for_unreachable_block (bb);
 }
@@ -2641,7 +2654,11 @@ disband_implicit_edges (void)
       label = tree_block_label (e->dest);
 
       stmt = build1 (GOTO_EXPR, void_type_node, label);
+#ifdef USE_MAPPED_LOCATION
+      SET_EXPR_LOCATION (stmt, e->goto_locus);
+#else
       SET_EXPR_LOCUS (stmt, e->goto_locus);
+#endif
       bsi_insert_after (&last, stmt, BSI_NEW_STMT);
       e->flags &= ~EDGE_FALLTHRU;
     }
@@ -4759,7 +4776,11 @@ struct tree_opt_pass pass_split_crit_edges =
 static void
 execute_warn_function_return (void)
 {
+#ifdef USE_MAPPED_LOCATION
+  source_location location;
+#else
   location_t *locus;
+#endif
   tree last;
   edge e;
 
@@ -4774,17 +4795,31 @@ execute_warn_function_return (void)
   if (TREE_THIS_VOLATILE (cfun->decl)
       && EXIT_BLOCK_PTR->pred != NULL)
     {
+#ifdef USE_MAPPED_LOCATION
+      location = UNKNOWN_LOCATION;
+#else
       locus = NULL;
+#endif
       for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
        {
          last = last_stmt (e->src);
          if (TREE_CODE (last) == RETURN_EXPR
+#ifdef USE_MAPPED_LOCATION
+             && (location = EXPR_LOCATION (last)) != UNKNOWN_LOCATION)
+#else
              && (locus = EXPR_LOCUS (last)) != NULL)
+#endif
            break;
        }
+#ifdef USE_MAPPED_LOCATION
+      if (location == UNKNOWN_LOCATION)
+       location = cfun->function_end_locus;
+      warning ("%H`noreturn' function does return", &location);
+#else
       if (!locus)
        locus = &cfun->function_end_locus;
       warning ("%H`noreturn' function does return", locus);
+#endif
     }
 
   /* If we see "return;" in some basic block, then we do reach the end
@@ -4799,10 +4834,17 @@ execute_warn_function_return (void)
          if (TREE_CODE (last) == RETURN_EXPR
              && TREE_OPERAND (last, 0) == NULL)
            {
+#ifdef USE_MAPPED_LOCATION
+             location = EXPR_LOCATION (last);
+             if (location == UNKNOWN_LOCATION)
+                 location = cfun->function_end_locus;
+             warning ("%Hcontrol reaches end of non-void function", &location);
+#else
              locus = EXPR_LOCUS (last);
              if (!locus)
                locus = &cfun->function_end_locus;
              warning ("%Hcontrol reaches end of non-void function", locus);
+#endif
              break;
            }
        }
index 48d8b34bfaaf00e7027082c1192abc2666ff5823..bda65ca7f5c89234c9a9887863ac1810448b8ac4 100644 (file)
@@ -126,7 +126,7 @@ get_lineno (tree expr)
   if (TREE_CODE (expr) == COMPOUND_EXPR)
     expr = TREE_OPERAND (expr, 0);
 
-  if (! EXPR_LOCUS (expr))
+  if (! EXPR_HAS_LOCATION (expr))
     return -1;
 
   return EXPR_LINENO (expr);
@@ -137,14 +137,15 @@ get_lineno (tree expr)
 static inline const char *
 get_filename (tree expr)
 {
+  const char *filename;
   if (expr == NULL_TREE)
     return "???";
 
   if (TREE_CODE (expr) == COMPOUND_EXPR)
     expr = TREE_OPERAND (expr, 0);
 
-  if (EXPR_LOCUS (expr) && EXPR_FILENAME (expr))
-    return EXPR_FILENAME (expr);
+  if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
+    return filename;
   else
     return "???";
 }