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]

typedef fileline location_t


The attached in an initial attempt at using the fileline
magic cookie in the places where struct location_s is used.
I configured with --enable-languages=c and succeeded in
boostrapping the compiler, and am running the testsuite now.
(So far looking good, with 3208 PASSes, 6 XFAILs, and 0 FAILs.)

The patch is somewhat preliminary and incomplete, in that
one the C front-end has been converted, and I've only
tested on GNU/Linux.  Furthermore, EXPR_WITH_FILE_LOCATION
has been commented out.  And I've done a fair bit of
hacking and slashing with line-notes, without really
understanding rtl very well.

I don't know what effect this will have on compile-time.
We have a word in each decl node.  It may also possible
be possible to save a word in each line NOTE, but I don't
know rtl well enough to actually change the size.  We
save the linemap_lookup each time we set the input_location
from cpplib's fileline state.  On the other hand, we have
to call linemap_lookup on a location_t now whenever we
want to actually use the file/line separately.  (If this
is a probalem, caching could probably help.)

I've tested this on the mainline, but the question is
whether such an extensive change is appropriate for
3.4 at this stage.  However, my understanding is that
this would be helpful for the tree-ssa work, and it would
certainly be helpful for the compile-server.  (Otherwise
we probably have to add an extra pointer field to each
tree_decl.)

So before I go further I'd like some feedback.  Does this
look like a good approach?  Can I get help from backend
people - and maybe other front-ends?  Plus we need to
figure out what to do with EXPR_WITH_FILE_LOCATION.  (I
would like to extend fileline to column numbers, as
I've mentioned before.)
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


? c-tree.info
? c-tree.info-1
? c-tree.info-2
? c-tree.info-3
? cpp.info
? cpp.info-1
? cpp.info-2
? cpp.info-3
? cppinternals.info
? function.c.DIFF
? gcc.info
? gcc.info-1
? gcc.info-10
? gcc.info-11
? gcc.info-12
? gcc.info-13
? gcc.info-14
? gcc.info-15
? gcc.info-16
? gcc.info-17
? gcc.info-18
? gcc.info-19
? gcc.info-2
? gcc.info-20
? gcc.info-21
? gcc.info-22
? gcc.info-23
? gcc.info-24
? gcc.info-25
? gcc.info-26
? gcc.info-27
? gcc.info-28
? gcc.info-29
? gcc.info-3
? gcc.info-30
? gcc.info-31
? gcc.info-32
? gcc.info-33
? gcc.info-34
? gcc.info-35
? gcc.info-36
? gcc.info-37
? gcc.info-4
? gcc.info-5
? gcc.info-6
? gcc.info-7
? gcc.info-8
? gcc.info-9
? head-lines.patch
? hno
? jcf-dump.diff
? LOG.CVS
? PATCH
? cp/g++int.info
? cp/parse.c
? doc/codingconv.texi
? java/foo
? java/jv-misc.patch
? java/PATCHES
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.463
diff -u -p -r1.463 c-common.c
--- c-common.c	12 Oct 2003 22:09:20 -0000	1.463
+++ c-common.c	15 Oct 2003 03:23:50 -0000
@@ -1138,8 +1138,8 @@ fname_decl (unsigned int rid, tree id)
 	 beginning of the function and this line number will be wrong.
 	 To avoid this problem set the lineno to 0 here; that prevents
 	 it from appearing in the RTL.  */
-      int saved_lineno = input_line;
-      input_line = 0;
+      location_t saved_lineno = input_location;
+      input_location = 0;
 
       decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
       if (last_tree != saved_last_tree)
@@ -1155,7 +1155,7 @@ fname_decl (unsigned int rid, tree id)
 						 saved_function_name_decls);
 	}
       *fname_vars[ix].decl = decl;
-      input_line = saved_lineno;
+      input_location = saved_lineno;
     }
   if (!ix && !current_function_decl)
     pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
@@ -5820,7 +5820,6 @@ c_estimate_num_insns_1 (tree *tp, int *w
     case RETURN_STMT:
     case LABEL_STMT:
     case SCOPE_STMT:
-    case FILE_STMT:
     case CASE_LABEL:
     case STMT_EXPR:
     case CLEANUP_STMT:
Index: c-common.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.def,v
retrieving revision 1.14
diff -u -p -r1.14 c-common.def
--- c-common.def	7 Apr 2003 06:03:09 -0000	1.14
+++ c-common.def	15 Oct 2003 03:23:50 -0000
@@ -89,10 +89,6 @@ DEFTREECODE (ASM_STMT, "asm_stmt", 'e', 
    variables declared in this scope.  */
 DEFTREECODE (SCOPE_STMT, "scope_stmt", 'e', 1)
 
-/* A FILE_STMT marks the spot where a function changes files.  It has no
-   other semantics.  FILE_STMT_FILENAME gives the name.  */
-DEFTREECODE (FILE_STMT, "file_stmt", 'e', 1)
-
 /* Used to represent a CASE_LABEL. The operands are CASE_LOW and
    CASE_HIGH, respectively. If CASE_LOW is NULL_TREE, the label is a
    'default' label. If CASE_HIGH is NULL_TREE, the label is a normal case
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.210
diff -u -p -r1.210 c-common.h
--- c-common.h	28 Sep 2003 19:09:48 -0000	1.210
+++ c-common.h	15 Oct 2003 03:23:50 -0000
@@ -1140,17 +1140,13 @@ extern void finish_file	(void);
 #define CLEANUP_EXPR(NODE) \
   TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
 
-/* The filename we are changing to as of this FILE_STMT.  */
-#define FILE_STMT_FILENAME_NODE(NODE) \
-  (TREE_OPERAND (FILE_STMT_CHECK (NODE), 0))
-#define FILE_STMT_FILENAME(NODE) \
-  (IDENTIFIER_POINTER (FILE_STMT_FILENAME_NODE (NODE)))
-
 /* The line-number at which a statement began.  But if
    STMT_LINENO_FOR_FN_P does holds, then this macro gives the
    line number for the end of the current function instead.  */
-#define STMT_LINENO(NODE)			\
+#define STMT_FILELINE(NODE)			\
   (TREE_COMPLEXITY ((NODE)))
+#define STMT_LINENO(NODE)			\
+  LOCATION_LINE (STMT_FILELINE ((NODE)))
 
 /* If nonzero, the STMT_LINENO for NODE is the line at which the
    function ended.  */
@@ -1181,7 +1177,7 @@ enum c_tree_code {
    WHILE_STMT,		DO_STMT,	RETURN_STMT,	\
    BREAK_STMT,		CONTINUE_STMT,	SCOPE_STMT,	\
    SWITCH_STMT,		GOTO_STMT,	LABEL_STMT,	\
-   ASM_STMT,		FILE_STMT,	CASE_LABEL
+   ASM_STMT,		CASE_LABEL
 
 /* TRUE if a code represents a statement.  The front end init
    langhook should take care of initialization of this array.  */
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.454
diff -u -p -r1.454 c-decl.c
--- c-decl.c	4 Oct 2003 16:49:26 -0000	1.454
+++ c-decl.c	15 Oct 2003 03:23:54 -0000
@@ -1624,7 +1624,7 @@ warn_if_shadowing (tree x, tree old)
 static void
 clone_underlying_type (tree x)
 {
-  if (DECL_SOURCE_LINE (x) == 0)
+  if (DECL_SOURCE_LOCATION (x) == 0)
     {
       if (TYPE_NAME (TREE_TYPE (x)) == 0)
 	TYPE_NAME (TREE_TYPE (x)) = x;
@@ -2260,8 +2260,8 @@ c_init_decl_processing (void)
   /* Declarations from c_common_nodes_and_builtins must not be associated
      with this input file, lest we get differences between using and not
      using preprocessed headers.  */
-  input_location.file = "<internal>";
-  input_location.line = 0;
+  /*input_location.file = "<internal>";*/
+  input_location = 0;
 
   /* Make the DECL for the toplevel file scope.  */
   current_file_decl = build_decl (TRANSLATION_UNIT_DECL, NULL, NULL);
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.215
diff -u -p -r1.215 c-lex.c
--- c-lex.c	2 Oct 2003 07:03:41 -0000	1.215
+++ c-lex.c	15 Oct 2003 03:23:54 -0000
@@ -199,7 +199,7 @@ cb_line_change (cpp_reader *pfile ATTRIB
   if (token->type == CPP_EOF || parsing_args)
     return;
 
-  input_line = SOURCE_LINE (map, token->line);
+  input_location = token->line;
 }
 
 static void
@@ -226,11 +226,9 @@ fe_file_change (const struct line_map *n
 	main_input_filename = new_map->to_file;
       else
 	{
-          int included_at = SOURCE_LINE (new_map - 1, new_map->from_line - 1);
-
-	  input_line = included_at;
-	  push_srcloc (new_map->to_file, 1);
-	  (*debug_hooks->start_source_file) (included_at, new_map->to_file);
+	  input_location = new_map->from_line - 1;
+	  push_srcloc (input_location);
+	  (*debug_hooks->start_source_file) (input_line, new_map->to_file);
 #ifndef NO_IMPLICIT_EXTERN_C
 	  if (c_header_level)
 	    ++c_header_level;
@@ -259,8 +257,8 @@ fe_file_change (const struct line_map *n
 
   update_header_times (new_map->to_file);
   in_system_header = new_map->sysp != 0;
-  input_filename = new_map->to_file;
-  input_line = new_map->to_line;
+  input_location = new_map->from_line;
+
   map = new_map;
 
   /* Hook for C++.  */
@@ -288,7 +286,7 @@ cb_def_pragma (cpp_reader *pfile, unsign
 	    name = cpp_token_as_text (pfile, s);
 	}
 
-      input_line = SOURCE_LINE (map, line);
+      input_location = line;
       warning ("ignoring #pragma %s %s", space, name);
     }
 }
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.91
diff -u -p -r1.91 c-opts.c
--- c-opts.c	2 Oct 2003 07:25:02 -0000	1.91
+++ c-opts.c	15 Oct 2003 03:23:55 -0000
@@ -46,7 +46,7 @@ Software Foundation, 59 Temple Place - S
 # define TARGET_SYSTEM_ROOT NULL
 #endif
 
-static int saved_lineno;
+static location_t saved_lineno;
 
 /* CPP's options.  */
 static cpp_options *cpp_opts;
@@ -203,7 +203,7 @@ c_common_init_options (unsigned int argc
     }
 
   parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
-				ident_hash);
+				ident_hash, &line_table);
 
   cpp_opts = cpp_get_options (parse_in);
   cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
@@ -1146,14 +1146,14 @@ c_common_post_options (const char **pfil
       init_c_lex ();
 
       /* Yuk.  WTF is this?  I do know ObjC relies on it somewhere.  */
-      input_line = 0;
+      input_location = 0;
     }
 
   cpp_get_callbacks (parse_in)->file_change = cb_file_change;
   cpp_post_options (parse_in);
 
-  saved_lineno = input_line;
-  input_line = 0;
+  saved_lineno = input_location;
+  input_location = 0;
 
   /* If an error has occurred in cpplib, note it so we fail
      immediately.  */
@@ -1166,7 +1166,7 @@ c_common_post_options (const char **pfil
 bool
 c_common_init (void)
 {
-  input_line = saved_lineno;
+  input_location = saved_lineno;
 
   /* Set up preprocessor arithmetic.  Must be done after call to
      c_common_nodes_and_builtins for type nodes to be good.  */
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.32
diff -u -p -r1.32 c-pretty-print.c
--- c-pretty-print.c	8 Oct 2003 18:13:53 -0000	1.32
+++ c-pretty-print.c	15 Oct 2003 03:23:55 -0000
@@ -2107,6 +2107,7 @@ pp_c_statement (c_pretty_printer *pp, tr
       }
       break;
 
+#if 0
     case FILE_STMT:
       pp_c_identifier (pp, "__FILE__");
       pp_space (pp);
@@ -2116,6 +2117,7 @@ pp_c_statement (c_pretty_printer *pp, tr
       pp_c_semicolon (pp);
       pp_needs_newline (pp) = true;
       break;
+#endif
 
     default:
       pp_unsupported_tree (pp, stmt);
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.73
diff -u -p -r1.73 c-semantics.c
--- c-semantics.c	7 Oct 2003 22:10:37 -0000	1.73
+++ c-semantics.c	15 Oct 2003 03:23:56 -0000
@@ -73,7 +73,6 @@ begin_stmt_tree (tree *t)
   *t = build_nt (EXPR_STMT, void_zero_node);
   last_tree = *t;
   last_expr_type = NULL_TREE;
-  last_expr_filename = input_filename;
 }
 
 /* T is a statement.  Add it to the statement-tree.  */
@@ -81,19 +80,6 @@ begin_stmt_tree (tree *t)
 tree
 add_stmt (tree t)
 {
-  if (input_filename != last_expr_filename)
-    {
-      /* If the filename has changed, also add in a FILE_STMT.  Do a string
-	 compare first, though, as it might be an equivalent string.  */
-      int add = (strcmp (input_filename, last_expr_filename) != 0);
-      last_expr_filename = input_filename;
-      if (add)
-	{
-	  tree pos = build_nt (FILE_STMT, get_identifier (input_filename));
-	  add_stmt (pos);
-	}
-    }
-
   /* Add T to the statement-tree.  */
   TREE_CHAIN (last_tree) = t;
   last_tree = t;
@@ -176,7 +162,7 @@ finish_stmt_tree (tree *t)
     {
       /* The line-number recorded in the outermost statement in a function
 	 is the line number of the end of the function.  */
-      STMT_LINENO (stmt) = input_line;
+      STMT_FILELINE (stmt) = input_location;
       STMT_LINENO_FOR_FN_P (stmt) = 1;
     }
 }
@@ -199,7 +185,7 @@ build_stmt (enum tree_code code, ...)
 
   t = make_node (code);
   length = TREE_CODE_LENGTH (code);
-  STMT_LINENO (t) = input_line;
+  STMT_FILELINE (t) = input_location;
 
   for (i = 0; i < length; i++)
     TREE_OPERAND (t, i) = va_arg (p, tree);
@@ -770,7 +756,7 @@ void
 prep_stmt (tree t)
 {
   if (!STMT_LINENO_FOR_FN_P (t))
-    input_line = STMT_LINENO (t);
+    input_location = STMT_FILELINE (t);
   current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
 }
 
@@ -790,10 +776,6 @@ expand_stmt (tree t)
 
       switch (TREE_CODE (t))
 	{
-	case FILE_STMT:
-	  input_filename = FILE_STMT_FILENAME (t);
-	  break;
-
 	case RETURN_STMT:
 	  genrtl_return_stmt (t);
 	  t = expand_unreachable_stmt (TREE_CHAIN (t), warn_notreached);
@@ -991,7 +973,7 @@ expand_unreachable_stmt (tree t, int war
 	  case IF_STMT:
 	  case RETURN_STMT:
 	    if (!STMT_LINENO_FOR_FN_P (t))
-	      input_line = STMT_LINENO (t);
+	      input_location = STMT_FILELINE (t);
 	    warning("will never be executed");
 	    warn = false;
 	    break;
@@ -1005,10 +987,6 @@ expand_unreachable_stmt (tree t, int war
 	case GOTO_STMT:
 	case CONTINUE_STMT:
 	case BREAK_STMT:
-	  break;
-
-	case FILE_STMT:
-	  input_filename = FILE_STMT_FILENAME (t);
 	  break;
 
 	case RETURN_STMT:
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.48
diff -u -p -r1.48 cfglayout.c
--- cfglayout.c	5 Oct 2003 13:09:48 -0000	1.48
+++ cfglayout.c	15 Oct 2003 03:23:56 -0000
@@ -321,10 +321,7 @@ insn_locators_initialize (void)
 	      break;
 	    default:
 	      if (NOTE_LINE_NUMBER (insn) > 0)
-		{
-		  line_number = NOTE_LINE_NUMBER (insn);
-		  file_name = (char *)NOTE_SOURCE_FILE (insn);
-		}
+		input_location = NOTE_SOURCE_LOCATION (insn);
 	      break;
 	    }
 	}
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.98
diff -u -p -r1.98 cfgrtl.c
--- cfgrtl.c	17 Sep 2003 07:10:59 -0000	1.98
+++ cfgrtl.c	15 Oct 2003 03:23:58 -0000
@@ -133,7 +133,7 @@ delete_insn (rtx insn)
 	  really_delete = false;
 	  PUT_CODE (insn, NOTE);
 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL;
-	  NOTE_SOURCE_FILE (insn) = name;
+	  NOTE_DELETED_LABEL_NAME (insn) = name;
 	}
 
       remove_node_from_expr_list (insn, &nonlocal_goto_handler_labels);
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.393
diff -u -p -r1.393 combine.c
--- combine.c	13 Oct 2003 21:16:16 -0000	1.393
+++ combine.c	15 Oct 2003 03:24:04 -0000
@@ -2619,7 +2619,6 @@ try_combine (rtx i3, rtx i2, rtx i1, int
       {
 	PUT_CODE (i2, NOTE);
 	NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i2) = 0;
       }
 
     if (i1)
@@ -2628,7 +2627,6 @@ try_combine (rtx i3, rtx i2, rtx i1, int
 	REG_NOTES (i1) = 0;
 	PUT_CODE (i1, NOTE);
 	NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i1) = 0;
       }
 
     /* Get death notes for everything that is now used in either I3 or
@@ -12711,7 +12709,6 @@ distribute_notes (rtx notes, rtx from_in
 
 			  PUT_CODE (tem, NOTE);
 			  NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED;
-			  NOTE_SOURCE_FILE (tem) = 0;
 
 #ifdef HAVE_cc0
 			  /* Delete the setter too.  */
@@ -12727,7 +12724,6 @@ distribute_notes (rtx notes, rtx from_in
 			      PUT_CODE (cc0_setter, NOTE);
 			      NOTE_LINE_NUMBER (cc0_setter)
 				= NOTE_INSN_DELETED;
-			      NOTE_SOURCE_FILE (cc0_setter) = 0;
 			    }
 #endif
 			}
Index: cpperror.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpperror.c,v
retrieving revision 1.69
diff -u -p -r1.69 cpperror.c
--- cpperror.c	28 Aug 2003 00:21:34 -0000	1.69
+++ cpperror.c	15 Oct 2003 03:24:04 -0000
@@ -45,8 +45,8 @@ print_location (cpp_reader *pfile, filel
       const struct line_map *map;
       unsigned int lin;
 
-      map = linemap_lookup (&pfile->line_maps, line);
-      linemap_print_containing_files (&pfile->line_maps, map);
+      map = linemap_lookup (pfile->line_table, line);
+      linemap_print_containing_files (pfile->line_table, map);
 
       lin = SOURCE_LINE (map, line);
       if (col == 0)
Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.192
diff -u -p -r1.192 cppfiles.c
--- cppfiles.c	5 Oct 2003 19:50:54 -0000	1.192
+++ cppfiles.c	15 Oct 2003 03:24:05 -0000
@@ -1197,7 +1197,7 @@ validate_pch (cpp_reader *pfile, _cpp_fi
       if (CPP_OPTION (pfile, print_include_names))
 	{
 	  unsigned int i;
-	  for (i = 1; i < pfile->line_maps.depth; i++)
+	  for (i = 1; i < pfile->line_table->depth; i++)
 	    putc ('.', stderr);
 	  fprintf (stderr, "%c %s\n",
 		   valid ? '!' : 'x', pchname);
Index: cpphash.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpphash.h,v
retrieving revision 1.202
diff -u -p -r1.202 cpphash.h
--- cpphash.h	2 Oct 2003 07:23:26 -0000	1.202
+++ cpphash.h	15 Oct 2003 03:24:05 -0000
@@ -330,7 +330,7 @@ struct cpp_reader
   struct lexer_state state;
 
   /* Source line tracking.  */
-  struct line_maps line_maps;
+  struct line_maps *line_table;
   const struct line_map *map;
   fileline line;
 
Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.296
diff -u -p -r1.296 cppinit.c
--- cppinit.c	2 Oct 2003 07:23:25 -0000	1.296
+++ cppinit.c	15 Oct 2003 03:24:06 -0000
@@ -124,7 +124,8 @@ init_library (void)
 
 /* Initialize a cpp_reader structure.  */
 cpp_reader *
-cpp_create_reader (enum c_lang lang, hash_table *table)
+cpp_create_reader (enum c_lang lang, hash_table *table,
+		   struct line_maps *line_table)
 {
   cpp_reader *pfile;
 
@@ -169,7 +170,7 @@ cpp_create_reader (enum c_lang lang, has
 
   /* Initialize the line map.  Start at logical line 1, so we can use
      a line number of zero for special states.  */
-  linemap_init (&pfile->line_maps);
+  pfile->line_table = line_table;
   pfile->line = 1;
 
   /* Initialize lexer state.  */
@@ -259,7 +260,6 @@ cpp_destroy (cpp_reader *pfile)
       free (context);
     }
 
-  linemap_free (&pfile->line_maps);
   free (pfile);
 }
 
@@ -497,7 +497,7 @@ cpp_push_main_file (cpp_reader *pfile)
   /* Set this here so the client can change the option if it wishes,
      and after stacking the main file so we don't trace the main
      file.  */
-  pfile->line_maps.trace_includes = CPP_OPTION (pfile, print_include_names);
+  pfile->line_table->trace_includes = CPP_OPTION (pfile, print_include_names);
 }
 
 /* For preprocessed files, if the first tokens are of the form # NUM.
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.c,v
retrieving revision 1.353
diff -u -p -r1.353 cpplib.c
--- cpplib.c	2 Oct 2003 07:30:31 -0000	1.353
+++ cpplib.c	15 Oct 2003 03:24:06 -0000
@@ -673,7 +673,7 @@ do_include_common (cpp_reader *pfile, en
     return;
 
   /* Prevent #include recursion.  */
-  if (pfile->line_maps.depth >= CPP_STACK_MAX)
+  if (pfile->line_table->depth >= CPP_STACK_MAX)
     cpp_error (pfile, DL_ERROR, "#include nested too deeply");
   else
     {
@@ -891,7 +891,7 @@ _cpp_do_file_change (cpp_reader *pfile, 
 		     const char *to_file, unsigned int file_line,
 		     unsigned int sysp)
 {
-  pfile->map = linemap_add (&pfile->line_maps, reason, sysp,
+  pfile->map = linemap_add (pfile->line_table, reason, sysp,
 			    pfile->line, to_file, file_line);
 
   if (pfile->cb.file_change)
@@ -1896,7 +1896,7 @@ cpp_get_callbacks (cpp_reader *pfile)
 const struct line_maps *
 cpp_get_line_maps (cpp_reader *pfile)
 {
-  return &pfile->line_maps;
+  return pfile->line_table;
 }
 
 /* Copy the given callbacks structure to our own.  */
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.h,v
retrieving revision 1.268
diff -u -p -r1.268 cpplib.h
--- cpplib.h	2 Oct 2003 07:23:26 -0000	1.268
+++ cpplib.h	15 Oct 2003 03:24:07 -0000
@@ -507,7 +507,8 @@ struct cpp_hashnode GTY(())
    pointer.  Otherwise you should pass in an initialized hash table
    that cpplib will share; this technique is used by the C front
    ends.  */
-extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *);
+extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *,
+				      struct line_maps *);
 
 /* Call this to change the selected language standard (e.g. because of
    command line options).  */
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.140
diff -u -p -r1.140 cppmacro.c
--- cppmacro.c	2 Oct 2003 07:30:32 -0000	1.140
+++ cppmacro.c	15 Oct 2003 03:24:08 -0000
@@ -80,7 +80,7 @@ _cpp_warn_if_unused_macro (cpp_reader *p
       cpp_macro *macro = node->value.macro;
 
       if (!macro->used
-	  && MAIN_FILE_P (linemap_lookup (&pfile->line_maps, macro->line)))
+	  && MAIN_FILE_P (linemap_lookup (pfile->line_table, macro->line)))
 	cpp_error_with_line (pfile, DL_WARNING, macro->line, 0,
 			     "macro \"%s\" is not used", NODE_NAME (node));
     }
@@ -136,7 +136,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
 
 	if (node->value.builtin == BT_BASE_FILE)
 	  while (! MAIN_FILE_P (map))
-	    map = INCLUDED_FROM (&pfile->line_maps, map);
+	    map = INCLUDED_FROM (pfile->line_table, map);
 
 	name = map->to_file;
 	len = strlen (name);
@@ -153,7 +153,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
       /* The line map depth counts the primary source as level 1, but
 	 historically __INCLUDE_DEPTH__ has called the primary source
 	 level 0.  */
-      number = pfile->line_maps.depth - 1;
+      number = pfile->line_table->depth - 1;
       break;
 
     case BT_SPECLINE:
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.133
diff -u -p -r1.133 diagnostic.c
--- diagnostic.c	22 Sep 2003 05:09:12 -0000	1.133
+++ diagnostic.c	15 Oct 2003 03:24:08 -0000
@@ -173,13 +173,13 @@ diagnostic_build_prefix (diagnostic_info
 #undef DEFINE_DIAGNOSTIC_KIND
     "must-not-happen"
   };
-   if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
-     abort();
+  const char *file = LOCATION_FILE (diagnostic->location);
+  if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
+    abort();
 
-  return diagnostic->location.file
+  return file
     ? build_message_string ("%s:%d: %s",
-                            diagnostic->location.file,
-                            diagnostic->location.line,
+                            file, LOCATION_LINE (diagnostic->location),
                             _(diagnostic_kind_text[diagnostic->kind]))
     : build_message_string ("%s: %s", progname,
                             _(diagnostic_kind_text[diagnostic->kind]));
@@ -300,8 +300,6 @@ diagnostic_report_current_function (diag
 void
 diagnostic_report_current_module (diagnostic_context *context)
 {
-  struct file_stack *p;
-
   if (pp_needs_newline (context->printer))
     {
       pp_newline (context->printer);
@@ -310,14 +308,18 @@ diagnostic_report_current_module (diagno
 
   if (input_file_stack && diagnostic_last_module_changed (context))
     {
-      p = input_file_stack;
+      struct file_stack *p = input_file_stack;
+      const struct line_map *map = linemap_lookup (&line_table, p->location);
       pp_verbatim (context->printer,
                    "In file included from %s:%d",
-                   p->location.file, p->location.line);
+                   map->to_file, SOURCE_LINE (map, p->location));
       while ((p = p->next) != NULL)
-	pp_verbatim (context->printer,
-                     ",\n                 from %s:%d",
-                     p->location.file, p->location.line);
+	{
+	  map = linemap_lookup (&line_table, p->location);
+	  pp_verbatim (context->printer,
+		       ",\n                 from %s:%d",
+		       map->to_file, SOURCE_LINE (map, p->location));
+	}
       pp_verbatim (context->printer, ":\n");
       diagnostic_set_last_module (context);
     }
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.457
diff -u -p -r1.457 dwarf2out.c
--- dwarf2out.c	6 Oct 2003 22:25:15 -0000	1.457
+++ dwarf2out.c	15 Oct 2003 03:24:14 -0000
@@ -9906,10 +9906,11 @@ add_pure_or_virtual_attribute (dw_die_re
 static void
 add_src_coords_attributes (dw_die_ref die, tree decl)
 {
-  unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+  struct location_s s = get_location_s (DECL_SOURCE_LOCATION (decl));
+  unsigned file_index = lookup_filename (s.file);
 
   add_AT_unsigned (die, DW_AT_decl_file, file_index);
-  add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
+  add_AT_unsigned (die, DW_AT_decl_line, s.line);
 }
 
 /* Add a DW_AT_name attribute and source coordinate attribute for the
Index: dwarfout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarfout.c,v
retrieving revision 1.138
diff -u -p -r1.138 dwarfout.c
--- dwarfout.c	13 Oct 2003 21:16:18 -0000	1.138
+++ dwarfout.c	15 Oct 2003 03:24:17 -0000
@@ -3392,7 +3392,8 @@ name_and_src_coords_attributes (tree dec
       name_attribute (IDENTIFIER_POINTER (decl_name));
 #ifdef DWARF_DECL_COORDINATES
       {
-	register unsigned file_index;
+	struct location_s s = get_location_s (DECL_SOURCE_LOCATION (decl));
+	unsigned file_index = lookup_filename (s.file);
 
 	/* This is annoying, but we have to pop out of the .debug section
 	   for a moment while we call `lookup_filename' because calling it
@@ -3405,10 +3406,9 @@ name_and_src_coords_attributes (tree dec
 	   Fred Fish sez that m68k/svr4 assemblers botch those.  */
 
 	ASM_OUTPUT_POP_SECTION (asm_out_file);
-	file_index = lookup_filename (DECL_SOURCE_FILE (decl));
 	ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
 
-	src_coords_attribute (file_index, DECL_SOURCE_LINE (decl));
+	src_coords_attribute (file_index, s.line);
       }
 #endif /* defined(DWARF_DECL_COORDINATES) */
     }
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.350
diff -u -p -r1.350 emit-rtl.c
--- emit-rtl.c	11 Sep 2003 21:40:41 -0000	1.350
+++ emit-rtl.c	15 Oct 2003 03:24:19 -0000
@@ -4196,7 +4196,6 @@ emit_note_before (int subtype, rtx befor
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
-  NOTE_SOURCE_FILE (note) = 0;
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
 
@@ -4419,7 +4418,6 @@ emit_note_after (int subtype, rtx after)
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
-  NOTE_SOURCE_FILE (note) = 0;
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
   add_insn_after (note, after);
@@ -4682,11 +4680,21 @@ emit_line_note (location_t location)
   
   set_file_and_line_for_stmt (location);
   
-  if (location.file && last_location.file
-      && !strcmp (location.file, last_location.file)
-      && location.line == last_location.line)
+#if 1
+  if (location == last_location)
     return NULL_RTX;
   last_location = location;
+#else
+  const struct line_map *map = linemap_lookup (&line_table, location);
+  int line = SOURCE_LINE (map, p->location);
+  if (map && map->to_file && last_location_file
+      && !strcmp (map->to_file, last_location_file)
+      && line == last_location_line)
+    return NULL_RTX;
+  last_location = location;
+  last_location_file = map->to_file;
+  last_location_line = line;
+#endif
   
   if (no_line_numbers)
     {
@@ -4694,8 +4702,7 @@ emit_line_note (location_t location)
       return NULL_RTX;
     }
 
-  note = emit_note (location.line);
-  NOTE_SOURCE_FILE (note) = location.file;
+  note = emit_note ((int) location);
   
   return note;
 }
@@ -4747,7 +4754,7 @@ emit_note (int note_no)
 void
 force_next_line_note (void)
 {
-  last_location.line = -1;
+  last_location = -1;
 }
 
 /* Place a note of KIND on insn INSN with DATUM as the datum. If a
@@ -5214,8 +5221,7 @@ init_emit (void)
   seq_rtl_expr = NULL;
   cur_insn_uid = 1;
   reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
-  last_location.line = 0;
-  last_location.file = 0;
+  last_location = 0;
   first_label_num = label_num;
   last_label_num = 0;
   seq_stack = NULL;
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.596
diff -u -p -r1.596 expr.c
--- expr.c	14 Oct 2003 15:01:44 -0000	1.596
+++ expr.c	15 Oct 2003 03:24:24 -0000
@@ -6550,6 +6550,7 @@ expand_expr (tree exp, rtx target, enum 
 				      copy_rtx (XEXP (temp, 0)));
       return temp;
 
+#if 0
     case EXPR_WITH_FILE_LOCATION:
       {
 	rtx to_return;
@@ -6572,6 +6573,7 @@ expand_expr (tree exp, rtx target, enum 
 	expr_wfl_stack = fs.next;
 	return to_return;
       }
+#endif
 
     case SAVE_EXPR:
       context = decl_function_context (exp);
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.292
diff -u -p -r1.292 final.c
--- final.c	11 Oct 2003 19:00:49 -0000	1.292
+++ final.c	15 Oct 2003 03:24:26 -0000
@@ -1529,26 +1529,32 @@ final (rtx first, FILE *file, int optimi
       for (insn = first; insn; insn = NEXT_INSN (insn))
 	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
 	  {
+	    int line;
+
 	    if ((RTX_INTEGRATED_P (insn)
 		 && strcmp (NOTE_SOURCE_FILE (insn), main_input_filename) != 0)
-		 || (last != 0
-		     && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
-		     && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
+		|| (last != 0 /* FIXME */
+		    && NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last)))
 	      {
 		delete_insn (insn);	/* Use delete_note.  */
 		continue;
 	      }
 	    last = insn;
-	    if (NOTE_LINE_NUMBER (insn) > max_line)
-	      max_line = NOTE_LINE_NUMBER (insn);
+	    line = NOTE_SOURCE_LINE (insn);
+	    if (line > max_line)
+	      max_line = line;
 	  }
     }
   else
 #endif
     {
       for (insn = first; insn; insn = NEXT_INSN (insn))
-	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > max_line)
-	  max_line = NOTE_LINE_NUMBER (insn);
+	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+	  {
+	    int line = NOTE_SOURCE_LINE (insn);
+	    if (line > max_line)
+	      max_line = line;
+	  }
     }
 
   line_note_exists = xcalloc (max_line + 1, sizeof (char));
@@ -1558,7 +1564,7 @@ final (rtx first, FILE *file, int optimi
       if (INSN_UID (insn) > max_uid)       /* Find largest UID.  */
 	max_uid = INSN_UID (insn);
       if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
-	line_note_exists[NOTE_LINE_NUMBER (insn)] = 1;
+	line_note_exists[NOTE_SOURCE_LINE (insn)] = 1;
 #ifdef HAVE_cc0
       /* If CC tracking across branches is enabled, record the insn which
 	 jumps to each branch only reached from one place.  */
Index: fix-header.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fix-header.c,v
retrieving revision 1.103
diff -u -p -r1.103 fix-header.c
--- fix-header.c	2 Oct 2003 07:23:26 -0000	1.103
+++ fix-header.c	15 Oct 2003 03:24:27 -0000
@@ -590,10 +590,12 @@ read_scan_file (char *in_fname, int argc
   struct fn_decl *fn;
   int i, strings_processed;
   struct symbol_list *cur_symbols;
+  struct line_maps line_table;
 
   obstack_init (&scan_file_obstack);
 
-  scan_in = cpp_create_reader (CLK_GNUC89, NULL);
+  linemap_init (&line_table);
+  scan_in = cpp_create_reader (CLK_GNUC89, NULL, &line_table);
   cb = cpp_get_callbacks (scan_in);
   cb->file_change = cb_file_change;
 
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.562
diff -u -p -r1.562 flow.c
--- flow.c	12 Sep 2003 15:07:50 -0000	1.562
+++ flow.c	15 Oct 2003 03:24:29 -0000
@@ -3369,7 +3369,6 @@ attempt_auto_inc (struct propagate_block
 
       PUT_CODE (incr, NOTE);
       NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
-      NOTE_SOURCE_FILE (incr) = 0;
     }
 
   if (regno >= FIRST_PSEUDO_REGISTER)
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.39
diff -u -p -r1.39 gengtype.c
--- gengtype.c	14 Aug 2003 03:10:49 -0000	1.39
+++ gengtype.c	15 Oct 2003 03:24:30 -0000
@@ -2914,6 +2914,8 @@ main(int argc ATTRIBUTE_UNUSED, char **a
   do_scalar_typedef ("uint8", &pos);
   do_scalar_typedef ("jword", &pos);
   do_scalar_typedef ("JCF_u2", &pos);
+  do_scalar_typedef ("fileline", &pos);
+  do_scalar_typedef ("location_t", &pos);
 
   do_typedef ("PTR", create_pointer (create_scalar_type ("void",
 							 strlen ("void"))),
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.231
diff -u -p -r1.231 haifa-sched.c
--- haifa-sched.c	9 Oct 2003 09:08:32 -0000	1.231
+++ haifa-sched.c	15 Oct 2003 03:24:31 -0000
@@ -1563,8 +1563,7 @@ restore_line_notes (rtx head, rtx tail)
 	     && (note = LINE_NOTE (insn)) != 0
 	     && note != line
 	     && (line == 0
-		 || NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line)
-		 || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)))
+		 || NOTE_SOURCE_LOCATION (note) != NOTE_SOURCE_LOCATION (line)))
       {
 	line = note;
 	prev = PREV_INSN (insn);
@@ -1581,7 +1580,6 @@ restore_line_notes (rtx head, rtx tail)
 	  {
 	    added_notes++;
 	    new = emit_note_after (NOTE_LINE_NUMBER (note), prev);
-	    NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note);
 	    RTX_INTEGRATED_P (new) = RTX_INTEGRATED_P (note);
 	  }
       }
@@ -1610,16 +1608,13 @@ rm_redundant_line_notes (void)
 	if (active_insn == 0)
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (insn) = 0;
 	    NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
 	  }
 	/* If the line number is unchanged, LINE is redundant.  */
 	else if (line
-		 && NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn)
-		 && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn))
+		 && NOTE_SOURCE_LOCATION (line) == NOTE_SOURCE_LOCATION (insn))
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (line) = 0;
 	    NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED;
 	    line = insn;
 	  }
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.127
diff -u -p -r1.127 ifcvt.c
--- ifcvt.c	14 Oct 2003 00:06:52 -0000	1.127
+++ ifcvt.c	15 Oct 2003 03:24:33 -0000
@@ -280,7 +280,6 @@ cond_exec_process_insns (ce_if_block_t *
 	     given what we'd have to coordinate with our callers.  */
 	  PUT_CODE (insn, NOTE);
 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-	  NOTE_SOURCE_FILE (insn) = 0;
 	  goto insn_done;
 	}
 
Index: input.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/input.h,v
retrieving revision 1.14
diff -u -p -r1.14 input.h
--- input.h	16 Sep 2003 07:58:23 -0000	1.14
+++ input.h	15 Oct 2003 03:24:33 -0000
@@ -22,9 +22,11 @@ Software Foundation, 59 Temple Place - S
 #ifndef GCC_INPUT_H
 #define GCC_INPUT_H
 
-/* The data structure used to record a location in a translation unit.  */
-/* Long-term, we want to get rid of this and typedef fileline location_t.  */
-struct location_s GTY (())
+#include "line-map.h"
+typedef fileline location_t;
+extern struct line_maps line_table;
+
+struct location_s
 {
   /* The name of the source file involved.  */
   const char *file;
@@ -32,7 +34,34 @@ struct location_s GTY (())
   /* The line-location in the source file.  */
   int line;
 };
-typedef struct location_s location_t;
+
+
+#ifdef __GNUC__
+#define get_location_s(FILELINE) __extension__ ({ \
+  struct location_s __t; \
+  fileline __line = (FILELINE); \
+  if (__line == 0) { __t.file = NULL; __t.line = 0; } \
+  else { \
+    const struct line_map *__map = linemap_lookup (&line_table, __line); \
+    __t.file = __map->to_file; \
+    __t.line = SOURCE_LINE (__map, __line); \
+  };\
+  __t; })
+#else
+static struct location_s
+get_location_s (fileline fline)
+{
+  struct location_s s;
+  if (__line == 0) { __t.file = NULL; __t.line = 0; }
+  else
+    {
+      const struct line_map *map = linemap_lookup (&line_table, fline);
+      s.file = map->to_file;
+      s.line = SOURCE_LINE (map, fline);
+    }
+  return s;
+}
+#endif
 
 struct file_stack
 {
@@ -44,8 +73,44 @@ struct file_stack
 extern const char *main_input_filename;
 
 extern location_t input_location;
-#define input_line (input_location.line)
-#define input_filename (input_location.file)
+#ifdef __GNUC__
+#define LOCATION_FILE(FILELINE) __extension__ \
+ ({ fileline __line = (FILELINE); \
+    __line == 0 ? NULL \
+   : __extension__ ({ \
+      const struct line_map *__map = linemap_lookup (&line_table, __line); \
+      __map->to_file; }); })
+#define LOCATION_LINE(FILELINE) __extension__ \
+ ({ fileline __line = (FILELINE); \
+    __line == 0 ? 0 \
+   : __extension__ ({ \
+      const struct line_map *__map = linemap_lookup (&line_table, __line); \
+      SOURCE_LINE (__map, __line); }); })
+#else
+static const char *
+LOCATION_FILE(fileline fline)
+{
+  if (fline == 0) return NULL;
+  else
+    {
+      const struct line_map *map = linemap_lookup (&line_table, fline);
+      return map->to_file;
+    }
+}
+static int
+LOCATION_LINE(fileline fline)
+{
+  if (fline == 0) return 0;
+  else
+    {
+      const struct line_map *map = linemap_lookup (&line_table, fline);
+      return SOURCE_LINE (map, fline);
+    }
+}
+#endif
+
+#define input_line LOCATION_LINE(input_location)
+#define input_filename LOCATION_FILE(input_location)
 
 /* Stack of currently pending input files.
    The line member is not accurate for the innermost file on the stack.  */
@@ -57,7 +122,7 @@ extern struct file_stack *expr_wfl_stack
 /* Incremented on each change to input_file_stack.  */
 extern int input_file_stack_tick;
 
-extern void push_srcloc (const char *name, int line);
+extern void push_srcloc (fileline);
 extern void pop_srcloc (void);
 
 #endif
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.237
diff -u -p -r1.237 integrate.c
--- integrate.c	22 Sep 2003 05:09:12 -0000	1.237
+++ integrate.c	15 Oct 2003 03:24:35 -0000
@@ -1639,7 +1639,8 @@ copy_insn_list (rtx insns, struct inline
 	    {
 	      copy = emit_label (get_label_from_map (map,
 						    CODE_LABEL_NUMBER (insn)));
-	      LABEL_NAME (copy) = NOTE_SOURCE_FILE (insn);
+	      /* FIXME - see delete_insn */
+	      LABEL_NAME (copy) = NOTE_DELETED_LABEL_NAME (insn);
 	      map->const_age++;
 	      break;
 	    }
@@ -2210,8 +2211,8 @@ copy_rtx_and_substitute (rtx orig, struc
 	  ASM_OPERANDS_INPUT_VEC (copy) = map->copy_asm_operands_vector;
 	  ASM_OPERANDS_INPUT_CONSTRAINT_VEC (copy)
 	    = map->copy_asm_constraints_vector;
-	  ASM_OPERANDS_SOURCE_FILE (copy) = ASM_OPERANDS_SOURCE_FILE (orig);
-	  ASM_OPERANDS_SOURCE_LINE (copy) = ASM_OPERANDS_SOURCE_LINE (orig);
+	  ASM_OPERANDS_SOURCE_LOCATION (copy)
+	    = ASM_OPERANDS_SOURCE_LOCATION (orig);
 	  return copy;
 	}
       break;
Index: jump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/jump.c,v
retrieving revision 1.236
diff -u -p -r1.236 jump.c
--- jump.c	22 Jul 2003 23:15:28 -0000	1.236
+++ jump.c	15 Oct 2003 03:24:36 -0000
@@ -193,8 +193,7 @@ purge_line_number_notes (rtx f)
 	  {
 	    /* Delete this note if it is identical to previous note.  */
 	    if (last_note
-		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last_note)
-		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note))
+		&& NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last_note))
 	      {
 		delete_related_insns (insn);
 		continue;
@@ -406,10 +405,7 @@ duplicate_loop_exit_test (rtx loop_start
 	case NOTE:
 	  /* Only copy line-number notes.  */
 	  if (NOTE_LINE_NUMBER (insn) >= 0)
-	    {
-	      copy = emit_note_before (NOTE_LINE_NUMBER (insn), loop_start);
-	      NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
-	    }
+	    copy = emit_note_before (NOTE_LINE_NUMBER (insn), loop_start);
 	  break;
 
 	case INSN:
@@ -1890,9 +1886,7 @@ never_reached_warning (rtx avoided_insn,
     }
   if (two_avoided_lines && contains_insn)
     {
-      location_t locus;
-      locus.file = NOTE_SOURCE_FILE (a_line_note);
-      locus.line = NOTE_LINE_NUMBER (a_line_note);
+      location_t locus = NOTE_SOURCE_LOCATION (a_line_note);
       warning ("%Hwill never be executed", &locus);
     }
 }
Index: pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.c,v
retrieving revision 2.6
diff -u -p -r2.6 pretty-print.c
--- pretty-print.c	12 Sep 2003 23:47:01 -0000	2.6
+++ pretty-print.c	15 Oct 2003 03:24:36 -0000
@@ -281,11 +281,12 @@ pp_base_format_text (pretty_printer *pp,
 
         case 'H':
           {
-            const location_t *locus = va_arg (*text->args_ptr, location_t *);
+            location_t *locus = va_arg (*text->args_ptr, location_t *);
+	    struct location_s s = get_location_s (*locus);
             pp_string (pp, "file '");
-            pp_string (pp, locus->file);
+            pp_string (pp, s.file);
             pp_string (pp, "', line ");
-            pp_decimal_int (pp, locus->line);
+            pp_decimal_int (pp, s.line);
           }
           break;
 
Index: print-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-rtl.c,v
retrieving revision 1.102
diff -u -p -r1.102 print-rtl.c
--- print-rtl.c	13 Oct 2003 21:16:18 -0000	1.102
+++ print-rtl.c	15 Oct 2003 03:24:36 -0000
@@ -276,10 +276,13 @@ print_rtx (rtx in_rtx)
 		break;
 
 	      case NOTE_INSN_DELETED_LABEL:
-		if (NOTE_SOURCE_FILE (in_rtx))
-		  fprintf (outfile, " (\"%s\")", NOTE_SOURCE_FILE (in_rtx));
-		else
-		  fprintf (outfile, " \"\"");
+		{
+		  const char *label = NOTE_DELETED_LABEL_NAME (in_rtx);
+		  if (label)
+		    fprintf (outfile, " (\"%s\")", label);
+		  else
+		    fprintf (outfile, " \"\"");
+		}
 		break;
 
 	      case NOTE_INSN_PREDICTION:
@@ -293,7 +296,7 @@ print_rtx (rtx in_rtx)
 
 	      default:
 		{
-		  const char * const str = X0STR (in_rtx, i);
+		  const char * const str = X0STR (in_rtx, i); /* ??? */
 
 		  if (NOTE_LINE_NUMBER (in_rtx) < 0)
 		    ;
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.126
diff -u -p -r1.126 profile.c
--- profile.c	29 Sep 2003 21:19:09 -0000	1.126
+++ profile.c	15 Oct 2003 03:24:37 -0000
@@ -922,23 +922,26 @@ branch_prob (void)
 		    ignore_next_note = 0;
 		  else
 		    {
+		      struct location_s s;
+
 		      if (!offset)
 			{
 			  offset = gcov_write_tag (GCOV_TAG_LINES);
 			  gcov_write_unsigned (BB_TO_GCOV_INDEX (bb));
 			}
 
+		      s = get_location_s (NOTE_SOURCE_LOCATION (insn));
+
 		      /* If this is a new source file, then output the
 			 file's name to the .bb file.  */
 		      if (!prev_file_name
-			  || strcmp (NOTE_SOURCE_FILE (insn),
-				     prev_file_name))
+			  || strcmp (s.file, prev_file_name))
 			{
-			  prev_file_name = NOTE_SOURCE_FILE (insn);
+			  prev_file_name = s.file;
 			  gcov_write_unsigned (0);
 			  gcov_write_string (prev_file_name);
 			}
-		      gcov_write_unsigned (NOTE_LINE_NUMBER (insn));
+		      gcov_write_unsigned (s.line);
 		    }
 		}
 	      insn = NEXT_INSN (insn);
Index: ra-debug.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-debug.c,v
retrieving revision 1.13
diff -u -p -r1.13 ra-debug.c
--- ra-debug.c	14 Sep 2003 13:42:33 -0000	1.13
+++ ra-debug.c	15 Oct 2003 03:24:37 -0000
@@ -388,9 +388,11 @@ ra_print_rtx (FILE *file, rtx x, int wit
 	    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));
+	      struct location_s s
+		= get_location_s (NOTE_SOURCE_LOCATION (x));
+	      fprintf (file, " line %d", s.line);
+	      if (s.file != NULL)
+		fprintf (file, ":%s", s.file);
 	    }
 	}
       else
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.186
diff -u -p -r1.186 recog.c
--- recog.c	22 Aug 2003 06:25:08 -0000	1.186
+++ recog.c	15 Oct 2003 03:24:39 -0000
@@ -2681,7 +2681,6 @@ split_insn (rtx insn)
 	{
 	  /* try_split returns the NOTE that INSN became.  */
 	  PUT_CODE (insn, NOTE);
-	  NOTE_SOURCE_FILE (insn) = 0;
 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
 
 	  /* ??? Coddle to md files that generate subregs in post-
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.406
diff -u -p -r1.406 reload1.c
--- reload1.c	19 Jul 2003 14:47:13 -0000	1.406
+++ reload1.c	15 Oct 2003 03:24:43 -0000
@@ -1038,7 +1038,6 @@ reload (rtx first, int global)
 	      else
 		{
 		  PUT_CODE (equiv_insn, NOTE);
-		  NOTE_SOURCE_FILE (equiv_insn) = 0;
 		  NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
 		}
 	    }
@@ -1883,7 +1882,6 @@ delete_dead_insn (rtx insn)
 
   PUT_CODE (insn, NOTE);
   NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-  NOTE_SOURCE_FILE (insn) = 0;
 }
 
 /* Modify the home of pseudo-reg I.
Index: rtl-error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl-error.c,v
retrieving revision 1.12
diff -u -p -r1.12 rtl-error.c
--- rtl-error.c	6 Jul 2003 09:56:08 -0000	1.12
+++ rtl-error.c	15 Oct 2003 03:24:43 -0000
@@ -59,10 +59,7 @@ location_for_asm (rtx insn)
     asmop = NULL;
 
   if (asmop)
-    {
-      loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
-      loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
-    }
+    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
   else
     loc = input_location;
   return loc;
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.def,v
retrieving revision 1.72
diff -u -p -r1.72 rtl.def
--- rtl.def	11 Jul 2003 23:49:43 -0000	1.72
+++ rtl.def	15 Oct 2003 03:24:44 -0000
@@ -668,9 +668,8 @@ DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s"
    5th is a vector of modes and constraints for the input operands.
      Each element is an ASM_INPUT containing a constraint string
      and whose mode indicates the mode of the input operand.
-   6th is the name of the containing source file.
-   7th is the source line number.  */
-DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEsi", 'x')
+   6th is the source line number.  */
+DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEi", 'x')
 
 /* A machine-specific operation.
    1st operand is a vector of operands being used by the operation so that
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.436
diff -u -p -r1.436 rtl.h
--- rtl.h	11 Oct 2003 22:57:46 -0000	1.436
+++ rtl.h	15 Oct 2003 03:24:45 -0000
@@ -784,7 +784,10 @@ extern const char * const reg_note_name[
 
 /* Opaque data.  */
 #define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 4, NOTE)
-#define NOTE_SOURCE_FILE(INSN)	XCSTR (INSN, 4, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
+#define NOTE_SOURCE_LOCATION(INSN) XCUINT (INSN, 5, NOTE)
+#define NOTE_SOURCE_LINE(INSN)	LOCATION_LINE (NOTE_SOURCE_LOCATION (INSN))
+#define NOTE_SOURCE_FILE(INSN)	LOCATION_FILE (NOTE_SOURCE_LOCATION (INSN))
 #define NOTE_BLOCK(INSN)	XCTREE (INSN, 4, NOTE)
 #define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 4, NOTE)
 #define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 4, NOTE)
@@ -1083,8 +1086,7 @@ do {									\
   XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
 #define ASM_OPERANDS_INPUT_MODE(RTX, N)  \
   GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
-#define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
-#define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
+#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
 
 /* 1 if RTX is a mem and we should keep the alias set for this mem
    unchanged when we access a component.  Set to 1, or example, when we
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.65
diff -u -p -r1.65 sched-rgn.c
--- sched-rgn.c	7 Oct 2003 08:18:41 -0000	1.65
+++ sched-rgn.c	15 Oct 2003 03:24:47 -0000
@@ -2324,8 +2324,13 @@ 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));
+			{
+			  const struct line_map *map
+			    = linemap_lookup (&line_table, (fileline) n);
+			  fprintf (sched_dump, "line %d, file %s\n",
+				   SOURCE_LINE (map, (fileline) n),
+				   map->to_file);
+			}
 		    }
 		  else
 		    fprintf (sched_dump, " {%s}\n", GET_RTX_NAME (GET_CODE (insn)));
Index: sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.28
diff -u -p -r1.28 sched-vis.c
--- sched-vis.c	19 Jul 2003 14:47:13 -0000	1.28
+++ sched-vis.c	15 Oct 2003 03:24:47 -0000
@@ -787,8 +787,11 @@ print_insn (char *buf, rtx x, int verbos
       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));
+	{
+	  struct location_s s = get_location_s (NOTE_SOURCE_LOCATION (x));
+	  sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
+		   s.file, s.line);
+	}
       else
 	sprintf (buf, "%4d %s", INSN_UID (x),
 		 GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x)));
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.334
diff -u -p -r1.334 stmt.c
--- stmt.c	9 Oct 2003 05:44:51 -0000	1.334
+++ stmt.c	15 Oct 2003 03:24:50 -0000
@@ -1651,7 +1651,7 @@ expand_asm_operands (tree string, tree o
 				: GET_MODE (output_rtx[0])),
 			       TREE_STRING_POINTER (string),
 			       empty_string, 0, argvec, constraintvec,
-			       locus.file, locus.line);
+			       locus);
 
   MEM_VOLATILE_P (body) = vol;
 
@@ -1798,7 +1798,7 @@ expand_asm_operands (tree string, tree o
 			   (GET_MODE (output_rtx[i]),
 			    TREE_STRING_POINTER (string),
 			    constraints[i], i, argvec, constraintvec,
-			    locus.file, locus.line));
+			    locus));
 
 	  MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;
 	}
@@ -4399,8 +4399,7 @@ check_seenlabel (void)
 	      if (insn)
                 {
                   location_t locus;
-                  locus.file = NOTE_SOURCE_FILE (insn);
-                  locus.line = NOTE_LINE_NUMBER (insn);
+                  locus = NOTE_SOURCE_LOCATION (insn);
                   warning ("%Hunreachable code at beginning of %s", &locus,
                            case_stack->data.case_stmt.printname);
                 }
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.832
diff -u -p -r1.832 toplev.c
--- toplev.c	11 Oct 2003 22:57:46 -0000	1.832
+++ toplev.c	15 Oct 2003 03:24:52 -0000
@@ -185,6 +185,8 @@ const char *main_input_filename;
 
 location_t input_location;
 
+struct line_maps line_table;
+
 /* Nonzero if it is unsafe to create any new pseudo registers.  */
 int no_new_pseudos;
 
@@ -1768,15 +1770,14 @@ warn_deprecated_use (tree node)
    INPUT_LOCATION accordingly.  */
 
 void
-push_srcloc (const char *file, int line)
+push_srcloc (fileline fline)
 {
   struct file_stack *fs;
 
   fs = xmalloc (sizeof (struct file_stack));
   fs->location = input_location;
   fs->next = input_file_stack;
-  input_filename = file;
-  input_line = line;
+  input_location = fline;
   input_file_stack = fs;
   input_file_stack_tick++;
 }
@@ -4128,6 +4129,7 @@ general_init (const char *argv0)
      table.  */
   init_ggc ();
   init_stringpool ();
+  linemap_init (&line_table);
   init_ttree ();
 
   /* Initialize register usage now so switches may override.  */
@@ -4149,7 +4151,6 @@ process_options (void)
      sets the original filename if appropriate (e.g. foo.i -> foo.c)
      so we can correctly initialize debug output.  */
   no_backend = (*lang_hooks.post_options) (&main_input_filename);
-  input_filename = main_input_filename;
 
 #ifdef OVERRIDE_OPTIONS
   /* Some machines may reject certain combinations of options.  */
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.84
diff -u -p -r1.84 tree-inline.c
--- tree-inline.c	5 Oct 2003 19:50:55 -0000	1.84
+++ tree-inline.c	15 Oct 2003 03:24:54 -0000
@@ -1365,6 +1365,7 @@ expand_call_inline (tree *tp, int *walk_
       abort ();
 #endif /* INLINER_FOR_JAVA */
     }
+#if 0
   else if (TREE_CODE (t) == EXPR_WITH_FILE_LOCATION)
     {
       /* We're walking the subtree directly.  */
@@ -1378,6 +1379,7 @@ expand_call_inline (tree *tp, int *walk_
 
       return NULL_TREE;
     }
+#endif
 
   if (TYPE_P (t))
     /* Because types were not copied in copy_body, CALL_EXPRs beneath
@@ -1434,7 +1436,7 @@ expand_call_inline (tree *tp, int *walk_
      line numbers corresponding to the function we are calling.  We
      wrap the whole inlined body in an EXPR_WITH_FILE_AND_LINE as well
      because individual statements don't record the filename.  */
-  push_srcloc (DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn));
+  push_srcloc (DECL_SOURCE_LOCATION (fn));
 
 #ifndef INLINER_FOR_JAVA
   /* Build a statement-expression containing code to initialize the
@@ -1634,9 +1636,13 @@ expand_call_inline (tree *tp, int *walk_
 #ifndef INLINER_FOR_JAVA
   chain = TREE_CHAIN (*tp);
 #endif /* INLINER_FOR_JAVA */
+#if 1
+  *tp = expr;
+#else
   *tp = build_expr_wfl (expr, DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn),
 			/*col=*/0);
   EXPR_WFL_EMIT_LINE_NOTE (*tp) = 1;
+#endif
 #ifndef INLINER_FOR_JAVA
   TREE_CHAIN (*tp) = chain;
 #endif /* not INLINER_FOR_JAVA */
@@ -1865,7 +1871,7 @@ walk_tree (tree *tp, walk_tree_fn func, 
       /* Set lineno here so we get the right instantiation context
 	 if we call instantiate_decl from inlinable_function_p.  */
       if (STATEMENT_CODE_P (code) && !STMT_LINENO_FOR_FN_P (*tp))
-	input_line = STMT_LINENO (*tp);
+	input_location = STMT_FILELINE (*tp);
 #endif /* not INLINER_FOR_JAVA */
 
       /* Walk over all the sub-trees of this operand.  */
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.448
diff -u -p -r1.448 tree.h
--- tree.h	9 Oct 2003 05:44:51 -0000	1.448
+++ tree.h	15 Oct 2003 03:24:55 -0000
@@ -1314,8 +1314,8 @@ struct tree_type GTY(())
    function that is declared first and then defined later), this
    information should refer to the definition.  */
 #define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus)
-#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file)
-#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line)
+#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
+#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
 /* Holds the size of the datum, in bits, as a tree expression.
    Need not be constant.  */
 #define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)

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