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]

PATCH to use cpplib's source_location for location_t


Attached is the patch to make use of the --enable-mapped-location
configure flag.  If you configure as normal, this (hopefully) does
not change the behavior of the compiler, and only changes the
internals in trivial ways (such as using different accessor macros).

However, if you configure with --enable-mapped-location then the
compiler uses the source_location cookies from line-map.[hc] for
all long-lived data structures, including the input_location global,
expression locations, the tree_decl locus field, and insn "line"
numbers.

This patch only covers the main directory; I have a follow-up patch
to support C++.

There are a few regression (mostly PCH-related) when using
--enable-mapped-location; I'm hoping to get help with those.
Plus only C and C++ have been converted yet.  I hope others
will help convert the other front-ends, though I may do the
Java front-end myself, when/if I find the time.

Is this OK for mainline?  I found no regressions when using the
default configuration.  I'm running another test now, since I've
done some tweaking since, and possible others will have suggestions.
And I'll do a final regression run before checking this in.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

2004-06-27  Per Bothner  <per@bothner.com>

	Conditionally compile support for --enable-mapped_location.
	* input.h:  #include line-map.h for source_location typedef.
	(BUILTINS_LOCATION, UNKNWON_LOCATION, expand_location,
	LOCATION_FILE, LOCATION_LINE):  New macros.
	(expanded_location, source_locus):  New typedefs.
	(push_srcloc):  Change parameter list if USE_MAPPED_LOCATION.
	* rtl.def (NOTE, ASM_OPERANDS):  Modify specifcation, if
	USE_MAPPED_LOCATION.
	* rtl.h (NOTE_DELETED_LABEL_NAME):  New macro.
	(NOTE_SOURCE_LOCATION, NOTE_EXPNDED_LOCATION, SET_INSN_DELETED):
	New conditional macros.
	(ASM_OPERANDS_SOURCE_FILE, ASM_OPERANDS_SOURCE_LINE):  Replace
	by ASM_OPERANDS_SOURCE_LOCATION if USE_MAPPED_LOCATION.
	* tree.h (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION,
	EXPR_LOCUS, SET_EXPR_LOCUS, EXPR_FILENAME, EXPR_LINENO):  New macros.
	(tree_exp):  Change type of locus to use new source_locus typedef.
	* basic-block.h (struct edge_def):  Use new source_locus typedef.
	* c-common.c (fname_decl):  Update save/clear/store of input_location.
	(c_do_switch_warnings):  Update for USE_MAPPED_LOCATION case.
	* c-decl.c (clone_underlying_type):  Likewise; use BUILTINS_LOCATION.
	(c_init_decl_processing):  Likewise use BUILTINS_LOCATION.
	* c-dump.c (dump_stmt):  Generalize using EXPR_LOCATION.
	* c-gimplify.c (c-gimplify.c):  Generalize using SET_EXPR_LOCATION.
	* c-lex.c (cb_line_change):  If USE_MAPPED_LOCATION use token's	src_loc
	to set input_location direction, rather than using linemap_lookup.
	(fe_file_change, cb_def_pragma):  Again use source_location directly.
	* c-opts.c (saved_lineno):  Remove static variable.
	(c_common_post_options, c_common_init):  Don't bothner to save,
	clear and restore input_Location - now handled by lang_dependent_init.
	* c-parse.in:  Use SET_EXPR_LOCATION macro.
	* gimple-low.c:  Likewise.
	* tree-mudflap.c:  Likewise.
	* gimplify.c:  Likewise.  Also use EXPR_LOCATION and EXPR_HAS_LOCATION.
	* c-ppoutput.c:  Use new source_location typedef instead of fileline.
	* c-semantics.c:  Use new macros.
	* c-typeck.c:  Likewise.
	* cfgexpand.c:  Handle USE_MAPPED_LOCATION case for function_end_locus.
	* cfglayout.c (insn_locators_initialize):  Const cleanup.  New macros.
	* cfgrtl.c (delete_insn):  Use new NOTE_DELETED_LABEL_NAME macro.
	* print-rtl.c (print_rtx):  Likewise.
	* emit-rtl.c:  Don't clear NOTE_SOURCE_FILE if USE_MAPPED_LOCATION.
	* combine.c:  Use new SET_INSN_DELETED macro.
	* flow.c:  Likewise.
	* haifa-sched.c:  Likewise.
	* ifcvt.c:  Likewise.
	* recog.c:  Likewise.
	* reload1.c:  Likewise.
	* diagnostic.c:  Use expand_location macro.
 	* dwarf2out.c:  Likewise.
	* pretty-print.c (pp_base_format_text):  Likewise.
	* profile.c:  Likewise.
 	* dwarf2out.c (dwarf2out_decl:  Use BUILTINS_LOCATION.
	* emit-rtl.c (emit_line_note):  Simplify if USE_MAPPED_LOCATION.
	(force_next_line_note, insn_emit):  Handle USE_MAPPED_LOCATION case.
	* final.c (final):  Likewise.
	* haifa-sched.c:  Likewise.
	* integrate.c:  Likewise.
	* jump.c:  Likewise.
	* rtl-error.c:  Likewise.
	* stmt.c (check_seenlabel):  Likewise.
	* tree-nested.c:  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.
	* toplev.c (unknown_location):  New static, when USE_MAPPED_LOCATION.
	(push_srcloc, pop_loc):  Adjust parameter handling.
	(process_options):  Don't set input_filename by itself.
	(lang_dependent_init):  Save, set input_location to <built-in>.
	* tree-cfg.c:  Use new macros and typedefs.
	* tree-complex.c:  Likewise.
	* tree-flow-inline.h:  Likewise.
	* tree-mudflap.c (mf_file_function_line_tree):  Take a location_t
	rather than a pointer to one.  Use expand_location.
	* tree.c (build1_stat):  Use SET_EXPR_LOCATION.
	(annotate_with_locus, annotate_with_file_line):  Conditionalize.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.199
diff -u -p -r1.199 basic-block.h
--- basic-block.h	14 Jun 2004 12:09:06 -0000	1.199
+++ basic-block.h	28 Jun 2004 21:32:05 -0000
@@ -143,7 +143,7 @@ struct edge_def GTY((chain_next ("%h.pre
   PTR GTY ((skip (""))) aux;
 
   /* Location of any goto implicit in the edge, during tree-ssa.  */
-  location_t *goto_locus;
+  source_locus goto_locus;
 
   int flags;			/* see EDGE_* below  */
   int probability;		/* biased by REG_BR_PROB_BASE */
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.522
diff -u -p -r1.522 c-common.c
--- c-common.c	26 Jun 2004 21:11:08 -0000	1.522
+++ c-common.c	28 Jun 2004 21:32:07 -0000
@@ -801,8 +801,12 @@ fname_decl (unsigned int rid, tree id)
 	 To avoid this problem set the lineno to 0 here; that prevents
 	 it from appearing in the RTL.  */
       tree stmts;
-      location_t saved_locus = input_location;
+      location_t saved_location = input_location;
+#ifdef USE_MAPPED_LOCATION
+      input_location = UNKNOWN_LOCATION;
+#else
       input_line = 0;
+#endif
 
       stmts = push_stmt_list ();
       decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
@@ -811,7 +815,7 @@ fname_decl (unsigned int rid, tree id)
 	saved_function_name_decls
 	  = tree_cons (decl, stmts, saved_function_name_decls);
       *fname_vars[ix].decl = decl;
-      input_location = saved_locus;
+      input_location = saved_location;
     }
   if (!ix && !current_function_decl)
     pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
@@ -3598,20 +3602,22 @@ void
 c_do_switch_warnings (splay_tree cases, tree switch_stmt)
 {
   splay_tree_node default_node;  
-  location_t *switch_locus;
+  location_t switch_location;
   tree type;
 
   if (!warn_switch && !warn_switch_enum && !warn_switch_default)
     return;
 
-  switch_locus = EXPR_LOCUS (switch_stmt);
-  if (!switch_locus)
-    switch_locus = &input_location;
+  if (EXPR_HAS_LOCATION (switch_stmt))
+    switch_location = EXPR_LOCATION (switch_stmt);
+  else
+    switch_location = input_location;
+
   type = SWITCH_TYPE (switch_stmt);
 
   default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
   if (warn_switch_default && !default_node)
-    warning ("%Hswitch missing default case", switch_locus);
+    warning ("%Hswitch missing default case", &switch_location);
 
   /* If the switch expression was an enumerated type, check that
      exactly all enumeration literals are covered by the cases.
@@ -3646,7 +3652,7 @@ c_do_switch_warnings (splay_tree cases, 
 	      /* Warn if there are enumerators that don't correspond to
 		 case expressions.  */
 	      warning ("%Henumeration value `%E' not handled in switch",
-		       switch_locus, TREE_PURPOSE (chain));
+		       &switch_location, TREE_PURPOSE (chain));
 	    }
 	}
 
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.519
diff -u -p -r1.519 c-decl.c
--- c-decl.c	26 Jun 2004 21:11:09 -0000	1.519
+++ c-decl.c	28 Jun 2004 21:32:09 -0000
@@ -1755,7 +1755,11 @@ warn_if_shadowing (tree new)
 static void
 clone_underlying_type (tree x)
 {
+#ifdef USE_MAPPED_LOCATION
+  if (DECL_SOURCE_LOCATION (x) <= BUILTINS_LOCATION)
+#else
   if (DECL_SOURCE_LINE (x) == 0)
+#endif
     {
       if (TYPE_NAME (TREE_TYPE (x)) == 0)
 	TYPE_NAME (TREE_TYPE (x)) = x;
@@ -2290,8 +2294,17 @@ 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.  */
+#ifdef USE_MAPPED_LOCATION
+#if 1
+  input_location = BUILTINS_LOCATION;
+#else
+  linemap_add (&line_table, LC_RENAME, 0, "<internal>", 0);
+  input_location = linemap_position_for_column (&line_table, 0);
+#endif
+#else
   input_location.file = "<internal>";
   input_location.line = 0;
+#endif
 
   build_common_tree_nodes (flag_signed_char);
 
Index: c-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-dump.c,v
retrieving revision 1.26
diff -u -p -r1.26 c-dump.c
--- c-dump.c	26 Jun 2004 21:11:10 -0000	1.26
+++ c-dump.c	28 Jun 2004 21:32:09 -0000
@@ -32,9 +32,8 @@ Software Foundation, 59 Temple Place - S
 void
 dump_stmt (dump_info_p di, tree t)
 {
-  location_t *locus = EXPR_LOCUS (t);
-  if (locus)
-    dump_int (di, "line", locus->line);
+  if (EXPR_HAS_LOCATION (t))
+    dump_int (di, "line", LOCATION_LINE (EXPR_LOCATION (t)));
 }
 
 /* Dump any C-specific tree codes and attributes of common codes.  */
Index: c-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-gimplify.c,v
retrieving revision 2.20
diff -u -p -r2.20 c-gimplify.c
--- c-gimplify.c	26 Jun 2004 21:11:10 -0000	2.20
+++ c-gimplify.c	28 Jun 2004 21:32:09 -0000
@@ -458,7 +458,7 @@ gimplify_switch_stmt (tree *stmt_p)
 
   *stmt_p = build (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
 		   body, NULL_TREE);
-  annotate_with_locus (*stmt_p, stmt_locus);
+  SET_EXPR_LOCATION (*stmt_p, stmt_locus);
   gimplify_stmt (stmt_p);
 
   *stmt_p = finish_bc_block (break_block, *stmt_p);
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.222
diff -u -p -r1.222 c-lex.c
--- c-lex.c	15 Jun 2004 21:43:20 -0000	1.222
+++ c-lex.c	28 Jun 2004 21:32:10 -0000
@@ -197,11 +197,15 @@ cb_line_change (cpp_reader *pfile ATTRIB
 		int parsing_args)
 {
   if (token->type != CPP_EOF && !parsing_args)
+#ifdef USE_MAPPED_LOCATION
+    input_location = token->src_loc;
+#else
     {
       source_location loc = token->src_loc;
       const struct line_map *map = linemap_lookup (&line_table, loc);
       input_line = SOURCE_LINE (map, loc);
     }
+#endif
 }
 
 void
@@ -216,10 +220,17 @@ fe_file_change (const struct line_map *n
 	 we already did in compile_file.  */
       if (! MAIN_FILE_P (new_map))
 	{
+#ifdef USE_MAPPED_LOCATION
+          int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1);
+
+	  input_location = included_at;
+	  push_srcloc (new_map->start_location);
+#else
           int included_at = LAST_SOURCE_LINE (new_map - 1);
 
 	  input_line = included_at;
 	  push_srcloc (new_map->to_file, 1);
+#endif
 	  (*debug_hooks->start_source_file) (included_at, new_map->to_file);
 #ifndef NO_IMPLICIT_EXTERN_C
 	  if (c_header_level)
@@ -249,8 +260,12 @@ fe_file_change (const struct line_map *n
 
   update_header_times (new_map->to_file);
   in_system_header = new_map->sysp != 0;
+#ifdef USE_MAPPED_LOCATION
+  input_location = new_map->start_location;
+#else
   input_filename = new_map->to_file;
   input_line = new_map->to_line;
+#endif
 
   /* Hook for C++.  */
   extract_interface_info ();
@@ -264,7 +279,9 @@ cb_def_pragma (cpp_reader *pfile, source
      -Wunknown-pragmas has been given.  */
   if (warn_unknown_pragmas > in_system_header)
     {
+#ifndef USE_MAPPED_LOCATION
       const struct line_map *map = linemap_lookup (&line_table, loc);
+#endif
       const unsigned char *space, *name;
       const cpp_token *s;
 
@@ -278,7 +295,11 @@ cb_def_pragma (cpp_reader *pfile, source
 	    name = cpp_token_as_text (pfile, s);
 	}
 
+#ifdef USE_MAPPED_LOCATION
+      input_location = loc;
+#else
       input_line = SOURCE_LINE (map, loc);
+#endif
       warning ("ignoring #pragma %s %s", space, name);
     }
 }
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.118
diff -u -p -r1.118 c-opts.c
--- c-opts.c	25 Jun 2004 21:24:21 -0000	1.118
+++ c-opts.c	28 Jun 2004 21:32:10 -0000
@@ -51,8 +51,6 @@ Software Foundation, 59 Temple Place - S
 #define TARGET_OPTF(ARG)
 #endif
 
-static int saved_lineno;
-
 /* CPP's options.  */
 static cpp_options *cpp_opts;
 
@@ -998,7 +996,7 @@ 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 = UNKNOWN_LOCATION;
     }
 
   cb = cpp_get_callbacks (parse_in);
@@ -1006,8 +1004,7 @@ c_common_post_options (const char **pfil
   cb->dir_change = cb_dir_change;
   cpp_post_options (parse_in);
 
-  saved_lineno = input_line;
-  input_line = 0;
+  input_location = UNKNOWN_LOCATION;
 
   /* If an error has occurred in cpplib, note it so we fail
      immediately.  */
@@ -1033,8 +1030,6 @@ c_common_post_options (const char **pfil
 bool
 c_common_init (void)
 {
-  input_line = saved_lineno;
-
   /* Set up preprocessor arithmetic.  Must be done after call to
      c_common_nodes_and_builtins for type nodes to be good.  */
   cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.221
diff -u -p -r1.221 c-parse.in
--- c-parse.in	26 Jun 2004 21:11:09 -0000	1.221
+++ c-parse.in	28 Jun 2004 21:32:11 -0000
@@ -2092,19 +2092,19 @@ lineno_stmt:
 		     because (recursively) all of the component statments
 		     should already have line numbers assigned.  */
 		  if ($2 && EXPR_P ($2))
-		    annotate_with_locus ($2, $1);
+		    SET_EXPR_LOCATION ($2, $1);
 		}
 	;
 
 lineno_label:
 	  save_location label
-		{ if ($2) annotate_with_locus ($2, $1); }
+		{ if ($2) SET_EXPR_LOCATION ($2, $1); }
 	;
 
 condition: save_location expr
 		{ $$ = lang_hooks.truthvalue_conversion ($2);
 		  if (EXPR_P ($$))
-		    annotate_with_locus ($$, $1); }
+		    SET_EXPR_LOCATION ($$, $1); }
 	;
 
 /* Implement -Wparenthesis by special casing IF statement directly nested
@@ -2191,7 +2191,7 @@ for_cond_expr: save_location xexpr
 		    {
 		      $$ = lang_hooks.truthvalue_conversion ($2);
 		      if (EXPR_P ($$))
-			annotate_with_locus ($$, $1);
+			SET_EXPR_LOCATION ($$, $1);
 		    }
 		  else
 		    $$ = NULL;
Index: c-ppoutput.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-ppoutput.c,v
retrieving revision 1.20
diff -u -p -r1.20 c-ppoutput.c
--- c-ppoutput.c	22 Jun 2004 06:51:50 -0000	1.20
+++ c-ppoutput.c	28 Jun 2004 21:32:11 -0000
@@ -51,12 +51,12 @@ static void maybe_print_line (source_loc
 /* Callback routines for the parser.   Most of these are active only
    in specific modes.  */
 static void cb_line_change (cpp_reader *, const cpp_token *, int);
-static void cb_define (cpp_reader *, fileline, cpp_hashnode *);
-static void cb_undef (cpp_reader *, fileline, cpp_hashnode *);
-static void cb_include (cpp_reader *, fileline, const unsigned char *,
+static void cb_define (cpp_reader *, source_location, cpp_hashnode *);
+static void cb_undef (cpp_reader *, source_location, cpp_hashnode *);
+static void cb_include (cpp_reader *, source_location, const unsigned char *,
 			const char *, int);
-static void cb_ident (cpp_reader *, fileline, const cpp_string *);
-static void cb_def_pragma (cpp_reader *, fileline);
+static void cb_ident (cpp_reader *, source_location, const cpp_string *);
+static void cb_def_pragma (cpp_reader *, source_location);
 static void cb_read_pch (cpp_reader *pfile, const char *name,
 			 int fd, const char *orig_name);
 
@@ -300,7 +300,7 @@ cb_line_change (cpp_reader *pfile, const
 }
 
 static void
-cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, fileline line,
+cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
 	  const cpp_string *str)
 {
   maybe_print_line (line);
@@ -309,7 +309,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UN
 }
 
 static void
-cb_define (cpp_reader *pfile, fileline line, cpp_hashnode *node)
+cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
 {
   maybe_print_line (line);
   fputs ("#define ", print.outf);
@@ -401,7 +401,7 @@ pp_file_change (const struct line_map *m
 
 /* Copy a #pragma directive to the preprocessed output.  */
 static void
-cb_def_pragma (cpp_reader *pfile, fileline line)
+cb_def_pragma (cpp_reader *pfile, source_location line)
 {
   maybe_print_line (line);
   fputs ("#pragma ", print.outf);
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.89
diff -u -p -r1.89 c-semantics.c
--- c-semantics.c	24 Jun 2004 23:12:28 -0000	1.89
+++ c-semantics.c	28 Jun 2004 21:32:11 -0000
@@ -132,8 +132,8 @@ add_stmt (tree t)
 
   if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
     {
-      if (!EXPR_LOCUS (t))
-	annotate_with_locus (t, input_location);
+      if (!EXPR_HAS_LOCATION (t))
+	SET_EXPR_LOCATION (t, input_location);
 
       /* When we expand a statement-tree, we must know whether or not the
 	 statements are full-expressions.  We record that fact here.  */
@@ -149,7 +149,7 @@ add_stmt (tree t)
 
 /* Build a generic statement based on the given type of node and
    arguments. Similar to `build_nt', except that we set
-   EXPR_LOCUS to be the current source location.  */
+   EXPR_LOCATION to be the current source location.  */
 /* ??? This should be obsolete with the lineno_stmt productions
    in the grammar.  */
 
@@ -166,7 +166,7 @@ build_stmt (enum tree_code code, ...)
   ret = make_node (code);
   TREE_TYPE (ret) = void_type_node;
   length = TREE_CODE_LENGTH (code);
-  annotate_with_locus (ret, input_location);
+  SET_EXPR_LOCATION (ret, input_location);
 
   /* Most statements have implicit side effects all on their own, 
      such as control transfer.  For those that do, we'll compute
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.332
diff -u -p -r1.332 c-typeck.c
--- c-typeck.c	26 Jun 2004 05:03:47 -0000	1.332
+++ c-typeck.c	28 Jun 2004 21:32:13 -0000
@@ -6540,7 +6540,7 @@ c_finish_if_stmt (location_t if_locus, t
     }
 
   stmt = build3 (COND_EXPR, NULL_TREE, cond, then_block, else_block);
-  annotate_with_locus (stmt, if_locus);
+  SET_EXPR_LOCATION (stmt, if_locus);
   add_stmt (stmt);
 }
 
@@ -6584,7 +6584,7 @@ c_finish_loop (location_t start_locus, t
                 }
               else
                 t = build1 (GOTO_EXPR, void_type_node, clab);
-	      annotate_with_locus (t, start_locus);
+	      SET_EXPR_LOCATION (t, start_locus);
               add_stmt (t);
             }
  
@@ -6592,9 +6592,9 @@ c_finish_loop (location_t start_locus, t
           exit = build (COND_EXPR, void_type_node, cond, exit, t);
           exit = fold (exit);
 	  if (cond_is_first)
-            annotate_with_locus (exit, start_locus);
+            SET_EXPR_LOCATION (exit, start_locus);
 	  else
-            annotate_with_locus (exit, input_location);
+            SET_EXPR_LOCATION (exit, input_location);
         }
  
       add_stmt (top);
@@ -6687,7 +6687,7 @@ c_process_expr_stmt (tree expr)
     expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
 
   if (EXPR_P (expr))
-    annotate_with_locus (expr, input_location);
+    SET_EXPR_LOCATION (expr, input_location);
 
   return expr;
 }
Index: cfgexpand.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgexpand.c,v
retrieving revision 2.2
diff -u -p -r2.2 cfgexpand.c
--- cfgexpand.c	26 Jun 2004 05:03:47 -0000	2.2
+++ cfgexpand.c	28 Jun 2004 21:32:14 -0000
@@ -319,7 +319,11 @@ construct_exit_block (void)
 
   /* Make sure the locus is set to the end of the function, so that 
      epilogue line numbers and warnings are set properly.  */
+#ifdef USE_MAPPED_LOCATION
+  if (cfun->function_end_locus != UNKNOWN_LOCATION)
+#else
   if (cfun->function_end_locus.file)
+#endif
     input_location = cfun->function_end_locus;
 
   /* The following insns belong to the top scope.  */
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.62
diff -u -p -r1.62 cfglayout.c
--- cfglayout.c	16 Jun 2004 16:49:22 -0000	1.62
+++ cfglayout.c	28 Jun 2004 21:32:14 -0000
@@ -254,7 +254,7 @@ insn_locators_initialize (void)
   rtx insn, next;
   int loc = 0;
   int line_number = 0, last_line_number = 0;
-  char *file_name = NULL, *last_file_name = NULL;
+  const char *file_name = NULL, *last_file_name = NULL;
 
   prologue_locator = epilogue_locator = 0;
 
@@ -293,7 +293,7 @@ insn_locators_initialize (void)
 	    {
 	      loc++;
 	      VARRAY_PUSH_INT (file_locators_locs, loc);
-	      VARRAY_PUSH_CHAR_PTR (file_locators_files, file_name);
+	      VARRAY_PUSH_CHAR_PTR (file_locators_files, (char *) file_name);
 	      last_file_name = file_name;
 	    }
 	}
@@ -324,8 +324,10 @@ insn_locators_initialize (void)
 	    default:
 	      if (NOTE_LINE_NUMBER (insn) > 0)
 		{
-		  line_number = NOTE_LINE_NUMBER (insn);
-		  file_name = (char *)NOTE_SOURCE_FILE (insn);
+		  expanded_location xloc;
+		  NOTE_EXPANDED_LOCATION (xloc, insn);
+		  line_number = xloc.line;
+		  file_name = xloc.file;
 		}
 	      break;
 	    }
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.122
diff -u -p -r1.122 cfgrtl.c
--- cfgrtl.c	20 Jun 2004 17:03:03 -0000	1.122
+++ cfgrtl.c	28 Jun 2004 21:32:15 -0000
@@ -130,7 +130,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.435
diff -u -p -r1.435 combine.c
--- combine.c	24 Jun 2004 19:15:43 -0000	1.435
+++ combine.c	28 Jun 2004 21:32:19 -0000
@@ -2597,19 +2597,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int
 	PATTERN (i2) = newi2pat;
       }
     else
-      {
-	PUT_CODE (i2, NOTE);
-	NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i2) = 0;
-      }
+      SET_INSN_DELETED (i2);
 
     if (i1)
       {
 	LOG_LINKS (i1) = 0;
 	REG_NOTES (i1) = 0;
-	PUT_CODE (i1, NOTE);
-	NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i1) = 0;
+	SET_INSN_DELETED (i1);
       }
 
     /* Get death notes for everything that is now used in either I3 or
@@ -11869,9 +11863,7 @@ distribute_notes (rtx notes, rtx from_in
 			  distribute_notes (old_notes, tem, tem, NULL_RTX);
 			  distribute_links (LOG_LINKS (tem));
 
-			  PUT_CODE (tem, NOTE);
-			  NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED;
-			  NOTE_SOURCE_FILE (tem) = 0;
+			  SET_INSN_DELETED (tem);
 
 #ifdef HAVE_cc0
 			  /* Delete the setter too.  */
@@ -11885,10 +11877,7 @@ distribute_notes (rtx notes, rtx from_in
 						cc0_setter, NULL_RTX);
 			      distribute_links (LOG_LINKS (cc0_setter));
 
-			      PUT_CODE (cc0_setter, NOTE);
-			      NOTE_LINE_NUMBER (cc0_setter)
-				= NOTE_INSN_DELETED;
-			      NOTE_SOURCE_FILE (cc0_setter) = 0;
+			      SET_INSN_DELETED (cc0_setter);
 			    }
 #endif
 			}
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.139
diff -u -p -r1.139 diagnostic.c
--- diagnostic.c	14 Jun 2004 14:17:50 -0000	1.139
+++ diagnostic.c	28 Jun 2004 21:32:19 -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();
+  expanded_location s = expand_location (diagnostic->location);
+  if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
+    abort();
 
-  return diagnostic->location.file
+  return s.file
     ? build_message_string ("%s:%d: %s",
-                            diagnostic->location.file,
-                            diagnostic->location.line,
+                            s.file, s.line,
                             _(diagnostic_kind_text[diagnostic->kind]))
     : build_message_string ("%s: %s", progname,
                             _(diagnostic_kind_text[diagnostic->kind]));
@@ -206,8 +206,9 @@ diagnostic_count_diagnostic (diagnostic_
 	   || diagnostic_kind_count (context, DK_SORRY) > 0)
 	  && !context->abort_on_error)
 	{
+	  expanded_location s = expand_location (diagnostic->location);
 	  fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
-		   diagnostic->location.file, diagnostic->location.line);
+		   s.file, s.line);
 	  exit (FATAL_EXIT_CODE);
 	}
 #endif
@@ -313,16 +314,20 @@ diagnostic_report_current_module (diagno
       pp_needs_newline (context->printer) = false;
     }
 
-  if (input_file_stack && diagnostic_last_module_changed (context))
+  p = input_file_stack;
+  if (p && diagnostic_last_module_changed (context))
     {
-      p = input_file_stack;
+      expanded_location xloc = expand_location (p->location);
       pp_verbatim (context->printer,
                    "In file included from %s:%d",
-                   p->location.file, p->location.line);
+		   xloc.file, xloc.line);
       while ((p = p->next) != NULL)
-	pp_verbatim (context->printer,
-                     ",\n                 from %s:%d",
-                     p->location.file, p->location.line);
+	{
+	  xloc = expand_location (p->location);
+	  pp_verbatim (context->printer,
+		       ",\n                 from %s:%d",
+		       xloc.file, xloc.line);
+	}
       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.522
diff -u -p -r1.522 dwarf2out.c
--- dwarf2out.c	15 Jun 2004 18:02:15 -0000	1.522
+++ dwarf2out.c	28 Jun 2004 21:32:23 -0000
@@ -10501,10 +10501,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));
+  expanded_location s = expand_location (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
@@ -11199,7 +11200,8 @@ gen_subprogram_die (tree decl, dw_die_re
     }
   else if (old_die)
     {
-      unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+      expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl));
+      unsigned file_index = lookup_filename (s.file);
 
       if (!get_AT_flag (old_die, DW_AT_declaration)
 	  /* We can have a normal definition following an inline one in the
@@ -11228,7 +11230,7 @@ gen_subprogram_die (tree decl, dw_die_re
 	  && (DECL_ARTIFICIAL (decl)
 	      || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index
 		  && (get_AT_unsigned (old_die, DW_AT_decl_line)
-		      == (unsigned) DECL_SOURCE_LINE (decl)))))
+		      == (unsigned) s.line))))
 	{
 	  subr_die = old_die;
 
@@ -11247,9 +11249,9 @@ gen_subprogram_die (tree decl, dw_die_re
 	  if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
 	    add_AT_unsigned (subr_die, DW_AT_decl_file, file_index);
 	  if (get_AT_unsigned (old_die, DW_AT_decl_line)
-	      != (unsigned) DECL_SOURCE_LINE (decl))
+	      != (unsigned) s.line)
 	    add_AT_unsigned
-	      (subr_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
+	      (subr_die, DW_AT_decl_line, s.line);
 	}
     }
   else
@@ -11476,16 +11478,16 @@ gen_variable_die (tree decl, dw_die_ref 
       add_AT_specification (var_die, old_die);
       if (DECL_NAME (decl))
 	{
-	  unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+	  expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl));
+	  unsigned file_index = lookup_filename (s.file);
 
 	  if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
 	    add_AT_unsigned (var_die, DW_AT_decl_file, file_index);
 
 	  if (get_AT_unsigned (old_die, DW_AT_decl_line)
-	      != (unsigned) DECL_SOURCE_LINE (decl))
+	      != (unsigned) s.line)
 
-	    add_AT_unsigned (var_die, DW_AT_decl_line,
-			     DECL_SOURCE_LINE (decl));
+	    add_AT_unsigned (var_die, DW_AT_decl_line, s.line);
 	}
     }
   else
@@ -12898,7 +12900,11 @@ dwarf2out_decl (tree decl)
 
       /* Don't bother trying to generate any DIEs to represent any of the
 	 normal built-in types for the language we are compiling.  */
+#ifdef USE_MAPPED_LOCATION
+      if (DECL_SOURCE_LOCATION (decl) == BUILTINS_LOCATION)
+#else
       if (DECL_SOURCE_LINE (decl) == 0)
+#endif
 	{
 	  /* OK, we need to generate one for `bool' so GDB knows what type
 	     comparisons have.  */
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.397
diff -u -p -r1.397 emit-rtl.c
--- emit-rtl.c	26 Jun 2004 10:10:25 -0000	1.397
+++ emit-rtl.c	28 Jun 2004 21:32:25 -0000
@@ -4131,7 +4131,9 @@ emit_note_before (int subtype, rtx befor
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
+#ifndef USE_MAPPED_LOCATION
   NOTE_SOURCE_FILE (note) = 0;
+#endif
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
 
@@ -4354,7 +4356,9 @@ emit_note_after (int subtype, rtx after)
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
+#ifndef USE_MAPPED_LOCATION
   NOTE_SOURCE_FILE (note) = 0;
+#endif
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
   add_insn_after (note, after);
@@ -4629,10 +4633,15 @@ emit_line_note (location_t location)
   
   set_file_and_line_for_stmt (location);
   
+#ifdef USE_MAPPED_LOCATION
+  if (location == last_location)
+    return NULL_RTX;
+#else
   if (location.file && last_location.file
       && !strcmp (location.file, last_location.file)
       && location.line == last_location.line)
     return NULL_RTX;
+#endif
   last_location = location;
   
   if (no_line_numbers)
@@ -4641,8 +4650,12 @@ emit_line_note (location_t location)
       return NULL_RTX;
     }
 
+#ifdef USE_MAPPED_LOCATION
+  note = emit_note ((int) location);
+#else
   note = emit_note (location.line);
   NOTE_SOURCE_FILE (note) = location.file;
+#endif
   
   return note;
 }
@@ -4694,7 +4707,11 @@ emit_note (int note_no)
 void
 force_next_line_note (void)
 {
+#ifdef USE_MAPPED_LOCATION
+  last_location = -1;
+#else
   last_location.line = -1;
+#endif
 }
 
 /* Place a note of KIND on insn INSN with DATUM as the datum. If a
@@ -5154,8 +5171,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 = UNKNOWN_LOCATION;
   first_label_num = label_num;
   last_label_num = 0;
   seq_stack = NULL;
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.315
diff -u -p -r1.315 final.c
--- final.c	15 Jun 2004 18:02:19 -0000	1.315
+++ final.c	28 Jun 2004 21:32:26 -0000
@@ -1520,8 +1520,13 @@ final (rtx first, FILE *file, int optimi
 	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
 	  {
 	    if (last != 0
+#ifdef USE_MAPPED_LOCATION
+		&& NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last)
+#else
 		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
-		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last))
+		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)
+#endif)
+	      )
 	      {
 		delete_insn (insn);	/* Use delete_note.  */
 		continue;
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.589
diff -u -p -r1.589 flow.c
--- flow.c	15 Jun 2004 18:02:20 -0000	1.589
+++ flow.c	28 Jun 2004 21:32:28 -0000
@@ -3391,8 +3391,7 @@ attempt_auto_inc (struct propagate_block
 	}
 
       PUT_CODE (incr, NOTE);
-      NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
-      NOTE_SOURCE_FILE (incr) = 0;
+      SET_INSN_DELETED (incr);
     }
 
   if (regno >= FIRST_PSEUDO_REGISTER)
Index: gengtype-lex.l
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype-lex.l,v
retrieving revision 1.21
diff -u -p -r1.21 gengtype-lex.l
--- gengtype-lex.l	31 May 2004 19:49:50 -0000	1.21
+++ gengtype-lex.l	28 Jun 2004 21:32:28 -0000
@@ -83,7 +83,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: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.51
diff -u -p -r1.51 gengtype.c
--- gengtype.c	9 Jun 2004 20:10:09 -0000	1.51
+++ gengtype.c	28 Jun 2004 21:32:29 -0000
@@ -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",
@@ -2987,6 +2987,10 @@ main(int argc ATTRIBUTE_UNUSED, char **a
   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);
@@ -3009,6 +3013,12 @@ main(int argc ATTRIBUTE_UNUSED, char **a
         }
       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: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimple-low.c,v
retrieving revision 2.6
diff -u -p -r2.6 gimple-low.c
--- gimple-low.c	22 Jun 2004 03:06:39 -0000	2.6
+++ gimple-low.c	28 Jun 2004 21:32:29 -0000
@@ -94,7 +94,7 @@ lower_function_body (void)
           || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
     {
       x = build (RETURN_EXPR, void_type_node, NULL);
-      annotate_with_locus (x, cfun->function_end_locus);
+      SET_EXPR_LOCATION (x, cfun->function_end_locus);
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     }
 
@@ -109,7 +109,11 @@ lower_function_body (void)
 	 It now fills in for many such returns.  Failure to remove this
 	 will result in incorrect results for coverage analysis.  */
       x = TREE_VALUE (t);
+#ifdef USE_MAPPED_LOCATION
+      SET_EXPR_LOCATION (x, UNKNOWN_LOCATION);
+#else
       SET_EXPR_LOCUS (x, NULL);
+#endif
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     }
 
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.35
diff -u -p -r2.35 gimplify.c
--- gimplify.c	26 Jun 2004 21:11:11 -0000	2.35
+++ gimplify.c	28 Jun 2004 21:32:30 -0000
@@ -453,10 +453,10 @@ internal_get_tmp_var (tree val, tree *pr
   mod = build (MODIFY_EXPR, TREE_TYPE (t), t, val);
 
   class = TREE_CODE_CLASS (TREE_CODE (val));
-  if (EXPR_LOCUS (val))
+  if (EXPR_HAS_LOCATION (val))
     SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
   else
-    annotate_with_locus (mod, input_location);
+    SET_EXPR_LOCATION (mod, input_location);
 
   /* gimplify_modify_expr might want to reduce this further.  */
   gimplify_and_add (mod, pre_p);
@@ -559,7 +559,7 @@ annotate_one_with_locus (tree t, locatio
   if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t)))
       && ! EXPR_HAS_LOCATION (t)
       && should_carry_locus_p (t))
-    annotate_with_locus (t, locus);
+    SET_EXPR_LOCATION (t, locus);
 }
 
 void
@@ -2109,8 +2109,8 @@ 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_locus (*expr_p, input_location);
+  if (! EXPR_HAS_LOCATION (*expr_p))
+    SET_EXPR_LOCATION (*expr_p, input_location);
 
   /* This may be a call to a builtin function.
 
@@ -3378,7 +3378,6 @@ gimplify_expr (tree *expr_p, tree *pre_p
   tree internal_post = NULL_TREE;
   tree save_expr;
   int is_statement = (pre_p == NULL);
-  location_t *locus;
   location_t saved_location;
   enum gimplify_status ret;
 
@@ -3398,12 +3397,9 @@ gimplify_expr (tree *expr_p, tree *pre_p
     post_p = &internal_post;
 
   saved_location = input_location;
-  if (save_expr == error_mark_node)
-    locus = NULL;
-  else
-    locus = EXPR_LOCUS (save_expr);
-  if (locus)
-    input_location = *locus;
+  if (save_expr != error_mark_node
+      && EXPR_HAS_LOCATION (*expr_p))
+    input_location = EXPR_LOCATION (*expr_p);
 
   /* Loop over the specific gimplifiers until the toplevel node
      remains the same.  */
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.245
diff -u -p -r1.245 haifa-sched.c
--- haifa-sched.c	15 Jun 2004 18:02:23 -0000	1.245
+++ haifa-sched.c	28 Jun 2004 21:32:31 -0000
@@ -1559,8 +1559,13 @@ restore_line_notes (rtx head, rtx tail)
 	     && (note = LINE_NOTE (insn)) != 0
 	     && note != line
 	     && (line == 0
+#ifdef USE_MAPPED_LOCATION
+		 || NOTE_SOURCE_LOCATION (note) != NOTE_SOURCE_LOCATION (line)
+#else
 		 || NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line)
-		 || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)))
+		 || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)
+#endif
+		 ))
       {
 	line = note;
 	prev = PREV_INSN (insn);
@@ -1577,7 +1582,9 @@ restore_line_notes (rtx head, rtx tail)
 	  {
 	    added_notes++;
 	    new = emit_note_after (NOTE_LINE_NUMBER (note), prev);
+#ifndef USE_MAPPED_LOCATION
 	    NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note);
+#endif
 	  }
       }
   if (sched_verbose && added_notes)
@@ -1605,17 +1612,20 @@ rm_redundant_line_notes (void)
 	if (active_insn == 0)
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (insn) = 0;
-	    NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+	    SET_INSN_DELETED (insn);
 	  }
 	/* If the line number is unchanged, LINE is redundant.  */
 	else if (line
+#ifdef USE_MAPPED_LOCATION
+		 && NOTE_SOURCE_LOCATION (line) == NOTE_SOURCE_LOCATION (insn)
+#else
 		 && NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn)
-		 && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn))
+		 && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn)
+#endif
+)
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (line) = 0;
-	    NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED;
+	    SET_INSN_DELETED (line);
 	    line = insn;
 	  }
 	else
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.149
diff -u -p -r1.149 ifcvt.c
--- ifcvt.c	26 Jun 2004 01:43:57 -0000	1.149
+++ ifcvt.c	28 Jun 2004 21:32:32 -0000
@@ -260,9 +260,7 @@ cond_exec_process_insns (ce_if_block_t *
 	{
 	  /* ??? Ug.  Actually unlinking the thing is problematic,
 	     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;
+	  SET_INSN_DELETED (insn);
 	  goto insn_done;
 	}
 
Index: input.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/input.h,v
retrieving revision 1.18
diff -u -p -r1.18 input.h
--- input.h	13 May 2004 06:39:43 -0000	1.18
+++ input.h	28 Jun 2004 21:32:32 -0000
@@ -22,19 +22,64 @@ Software Foundation, 59 Temple Place - S
 #ifndef GCC_INPUT_H
 #define GCC_INPUT_H
 
+#include "line-map.h"
 extern struct line_maps line_table;
 
-/* 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 (())
+/* The location for declarations in "<internal>" or "<built-in>" ??? */
+#define BUILTINS_LOCATION ((source_location) 2)
+
+typedef struct location_s GTY(())
 {
   /* The name of the source file involved.  */
   const char *file;
 
   /* The line-location in the source file.  */
   int line;
-};
+} expanded_location;
+
+#ifdef USE_MAPPED_LOCATION
+
+#ifdef __GNUC__
+#define expand_location(SOURCE_LOCATION) __extension__ ({ \
+  struct location_s __t; \
+  source_location __line = (SOURCE_LOCATION); \
+  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
+expanded location
+expand_location (source_location 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
+
+#define UNKNOWN_LOCATION ((source_location) 0)
+typedef source_location location_t; /* deprecated typedef */
+typedef source_location source_locus; /* to be removed */
+
+#else /* ! USE_MAPPED_LOCATION */
+
 typedef struct location_s location_t;
+typedef location_t *source_locus;
+
+#define expand_location(FILELINE) (FILELINE)
+extern location_t unknown_location;
+#define UNKNOWN_LOCATION unknown_location
+
+#endif /* ! USE_MAPPED_LOCATION */
 
 struct file_stack
 {
@@ -46,8 +91,58 @@ 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 USE_MAPPED_LOCATION
+#ifdef __GNUC__
+#define LOCATION_FILE(FILELINE) __extension__ \
+ ({ source_location __line = (FILELINE); \
+    __line == 0 ? NULL \
+   : __extension__ ({ \
+       const struct line_map *__map = linemap_lookup (&line_table, __line); \
+      __map->to_file; }); })
+#define LOCATION_LINE(FILELINE) __extension__ \
+ ({ source_location __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(source_location 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(source_location fline)
+{
+  if (fline == 0) return 0;
+  else
+    {
+      const struct line_map *map = linemap_lookup (&line_table, fline);
+      return SOURCE_LINE (map, fline);
+    }
+}
+#endif
+
+extern void push_srcloc (location_t);
+extern void pop_srcloc (void);
+
+#else /* ! USE_MAPPED_LOCATION */
+
+#define LOCATION_FILE(LOC) ((LOC).file)
+#define LOCATION_LINE(LOC) ((LOC).line)
+
+extern void push_srcloc (const char *name, int line);
+extern void pop_srcloc (void);
+
+#endif /* ! USE_MAPPED_LOCATION */
+
+#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.  */
@@ -56,7 +151,4 @@ extern struct file_stack *input_file_sta
 /* 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 pop_srcloc (void);
-
 #endif
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.258
diff -u -p -r1.258 integrate.c
--- integrate.c	20 Jun 2004 17:03:03 -0000	1.258
+++ integrate.c	28 Jun 2004 21:32:33 -0000
@@ -505,8 +505,13 @@ 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;
+#ifdef USE_MAPPED_LOCATION
+	  ASM_OPERANDS_SOURCE_LOCATION (copy)
+	    = ASM_OPERANDS_SOURCE_LOCATION (orig);
+#else
 	  ASM_OPERANDS_SOURCE_FILE (copy) = ASM_OPERANDS_SOURCE_FILE (orig);
 	  ASM_OPERANDS_SOURCE_LINE (copy) = ASM_OPERANDS_SOURCE_LINE (orig);
+#endif
 	  return copy;
 	}
       break;
Index: jump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/jump.c,v
retrieving revision 1.247
diff -u -p -r1.247 jump.c
--- jump.c	15 Jun 2004 18:02:26 -0000	1.247
+++ jump.c	28 Jun 2004 21:32:33 -0000
@@ -142,8 +142,13 @@ purge_line_number_notes (rtx f)
 	  {
 	    /* Delete this note if it is identical to previous note.  */
 	    if (last_note
+#ifdef USE_MAPPED_LOCATION
+		&& NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last_note)
+#else
 		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last_note)
-		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note))
+		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note)
+#endif
+)
 	      {
 		delete_related_insns (insn);
 		continue;
Index: modulo-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/modulo-sched.c,v
retrieving revision 1.4
diff -u -p -r1.4 modulo-sched.c
--- modulo-sched.c	26 Jun 2004 05:03:52 -0000	1.4
+++ modulo-sched.c	28 Jun 2004 21:32:34 -0000
@@ -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: pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.c,v
retrieving revision 2.14
diff -u -p -r2.14 pretty-print.c
--- pretty-print.c	29 May 2004 20:10:10 -0000	2.14
+++ pretty-print.c	28 Jun 2004 21:32:34 -0000
@@ -305,11 +305,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 *);
+	    expanded_location s = expand_location (*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.110
diff -u -p -r1.110 print-rtl.c
--- print-rtl.c	15 Jun 2004 18:02:29 -0000	1.110
+++ print-rtl.c	28 Jun 2004 21:32:34 -0000
@@ -272,10 +272,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:
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.132
diff -u -p -r1.132 profile.c
--- profile.c	13 May 2004 06:39:44 -0000	1.132
+++ profile.c	28 Jun 2004 21:32:35 -0000
@@ -922,23 +922,26 @@ branch_prob (void)
 		    ignore_next_note = 0;
 		  else
 		    {
+		      expanded_location s;
+
 		      if (!offset)
 			{
 			  offset = gcov_write_tag (GCOV_TAG_LINES);
 			  gcov_write_unsigned (BB_TO_GCOV_INDEX (bb));
 			}
 
+		      NOTE_EXPANDED_LOCATION (s, 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.19
diff -u -p -r1.19 ra-debug.c
--- ra-debug.c	15 Jun 2004 18:02:31 -0000	1.19
+++ ra-debug.c	28 Jun 2004 21:32:35 -0000
@@ -389,9 +389,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));
+	      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: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.202
diff -u -p -r1.202 recog.c
--- recog.c	15 Jun 2004 18:02:31 -0000	1.202
+++ recog.c	28 Jun 2004 21:32:36 -0000
@@ -2677,9 +2677,7 @@ split_insn (rtx insn)
     return NULL_RTX;
 
   /* try_split returns the NOTE that INSN became.  */
-  PUT_CODE (insn, NOTE);
-  NOTE_SOURCE_FILE (insn) = 0;
-  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+  SET_INSN_DELETED (insn);
 
   /* ??? Coddle to md files that generate subregs in post-reload
      splitters instead of computing the proper hard register.  */
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.437
diff -u -p -r1.437 reload1.c
--- reload1.c	15 Jun 2004 18:02:34 -0000	1.437
+++ reload1.c	28 Jun 2004 21:32:39 -0000
@@ -1059,11 +1059,7 @@ reload (rtx first, int global)
 	      else if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn)))
 		delete_dead_insn (equiv_insn);
 	      else
-		{
-		  PUT_CODE (equiv_insn, NOTE);
-		  NOTE_SOURCE_FILE (equiv_insn) = 0;
-		  NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
-		}
+		SET_INSN_DELETED (equiv_insn);
 	    }
 	}
     }
@@ -1911,9 +1907,7 @@ delete_dead_insn (rtx insn)
       && ! side_effects_p (SET_SRC (PATTERN (prev))))
     delete_dead_insn (prev);
 
-  PUT_CODE (insn, NOTE);
-  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-  NOTE_SOURCE_FILE (insn) = 0;
+  SET_INSN_DELETED (insn);
 }
 
 /* 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	28 Jun 2004 21:32:39 -0000
@@ -59,10 +59,14 @@ location_for_asm (rtx insn)
     asmop = NULL;
 
   if (asmop)
+#ifdef USE_MAPPED_LOCATION
+    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
+#else
     {
       loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
       loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
     }
+#endif
   else
     loc = input_location;
   return loc;
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.def,v
retrieving revision 1.85
diff -u -p -r1.85 rtl.def
--- rtl.def	3 Jun 2004 22:17:20 -0000	1.85
+++ rtl.def	28 Jun 2004 21:32:40 -0000
@@ -640,11 +640,20 @@ DEF_RTL_EXPR(BARRIER, "barrier", "iuu000
    7: is the user-given name of the label, if any.  */
 DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", RTX_EXTRA)
 
+#ifdef USE_MAPPED_LOCATION
+/* Say where in the code a source line starts, for symbol table's sake.
+   Operand:
+   4: unused if line number > 0, note-specific data otherwise.
+   5: line number if > 0, enum note_insn otherwise.
+   6: CODE_LABEL_NUMBER if line number == NOTE_INSN_DELETED_LABEL.  */
+#else
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:
    4: filename, if line number > 0, note-specific data otherwise.
+   4: unused if line number > 0, note-specific data otherwise.
    5: line number if > 0, enum note_insn otherwise.
    6: unique number if line number == note_insn_deleted_label.  */
+#endif
 DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", RTX_EXTRA)
 
 /* ----------------------------------------------------------------------
@@ -671,6 +680,20 @@ DEF_RTL_EXPR(PARALLEL, "parallel", "E", 
      as a convenient way to hold a string.  */
 DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s", RTX_EXTRA)
 
+#ifdef USE_MAPPED_LOCATION
+/* An assembler instruction with operands.
+   1st operand is the instruction template.
+   2nd operand is the constraint for the output.
+   3rd operand is the number of the output this expression refers to.
+     When an insn stores more than one value, a separate ASM_OPERANDS
+     is made for each output; this integer distinguishes them.
+   4th is a vector of values of input operands.
+   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 source line number.  */
+DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEi", RTX_EXTRA)
+#else
 /* An assembler instruction with operands.
    1st operand is the instruction template.
    2nd operand is the constraint for the output.
@@ -684,6 +707,7 @@ DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s"
    6th is the name of the containing source file.
    7th is the source line number.  */
 DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEsi", RTX_EXTRA)
+#endif
 
 /* 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.481
diff -u -p -r1.481 rtl.h
--- rtl.h	20 Jun 2004 17:03:04 -0000	1.481
+++ rtl.h	28 Jun 2004 21:32:41 -0000
@@ -914,7 +914,22 @@ extern const char * const reg_note_name[
 
 /* Opaque data.  */
 #define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 4, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
+#ifdef USE_MAPPED_LOCATION
+#define NOTE_SOURCE_LOCATION(INSN) XCUINT (INSN, 5, NOTE)
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)	\
+  (XLOC) = expand_location (NOTE_SOURCE_LOCATION (INSN))
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE), NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#else
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)	\
+  ((XLOC).file = NOTE_SOURCE_FILE (INSN),	\
+   (XLOC).line = NOTE_LINE_NUMBER (INSN))
 #define NOTE_SOURCE_FILE(INSN)	XCSTR (INSN, 4, NOTE)
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE),  NOTE_SOURCE_FILE (INSN) = 0, \
+   NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#endif
 #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)
@@ -1247,8 +1262,12 @@ do {									\
   XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
 #define ASM_OPERANDS_INPUT_MODE(RTX, N)  \
   GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
+#ifdef USE_MAPPED_LOCATION
+#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
+#else
 #define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
 #define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
+#endif
 
 /* 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
@@ -2001,6 +2020,11 @@ extern GTY(()) rtx return_address_pointe
 
 #ifndef NO_GENRTL_H
 #include "genrtl.h"
+#ifndef USE_MAPPED_LOCATION
+#undef gen_rtx_ASM_OPERANDS
+#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
+  gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
+#endif
 #endif
 
 /* There are some RTL codes that require special attention; the
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.74
diff -u -p -r1.74 sched-rgn.c
--- sched-rgn.c	15 Jun 2004 18:02:36 -0000	1.74
+++ sched-rgn.c	28 Jun 2004 21:32:42 -0000
@@ -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: sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.30
diff -u -p -r1.30 sched-vis.c
--- sched-vis.c	20 Mar 2004 04:52:57 -0000	1.30
+++ sched-vis.c	28 Jun 2004 21:32:42 -0000
@@ -787,8 +787,12 @@ 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));
+	{
+	  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: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.362
diff -u -p -r1.362 stmt.c
--- stmt.c	22 Jun 2004 03:06:39 -0000	1.362
+++ stmt.c	28 Jun 2004 21:32:44 -0000
@@ -1565,7 +1565,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;
 
@@ -1715,7 +1715,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;
 	}
@@ -3871,8 +3871,12 @@ check_seenlabel (void)
 	      if (insn)
                 {
                   location_t locus;
+#ifdef USE_MAPPED_LOCATION
+                  locus = NOTE_SOURCE_LOCATION (insn);
+#else
                   locus.file = NOTE_SOURCE_FILE (insn);
                   locus.line = NOTE_LINE_NUMBER (insn);
+#endif
                   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.907
diff -u -p -r1.907 toplev.c
--- toplev.c	20 Jun 2004 21:31:28 -0000	1.907
+++ toplev.c	28 Jun 2004 21:32:45 -0000
@@ -140,6 +140,10 @@ static const char **save_argv;
 
 const char *main_input_filename;
 
+#ifndef USE_MAPPED_LOCATION
+location_t unknown_location = { NULL, 0 };
+#endif
+
 /* Used to enable -fvar-tracking, -fweb and -frename-registers according
    to optimize and default_debug_hooks in process_options ().  */
 #define AUTODETECT_FLAG_VAR_TRACKING 2
@@ -914,15 +918,23 @@ warn_deprecated_use (tree node)
    INPUT_LOCATION accordingly.  */
 
 void
+#ifdef USE_MAPPED_LOCATION
+push_srcloc (location_t fline)
+#else
 push_srcloc (const char *file, int line)
+#endif
 {
   struct file_stack *fs;
 
   fs = xmalloc (sizeof (struct file_stack));
   fs->location = input_location;
   fs->next = input_file_stack;
+#ifdef USE_MAPPED_LOCATION
+  input_location = fline;
+#else
   input_filename = file;
   input_line = line;
+#endif
   input_file_stack = fs;
   input_file_stack_tick++;
 }
@@ -1607,7 +1619,9 @@ 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);
+#ifndef USE_MAPPED_LOCATION
   input_filename = main_input_filename;
+#endif
 
 #ifdef OVERRIDE_OPTIONS
   /* Some machines may reject certain combinations of options.  */
@@ -1928,12 +1942,20 @@ backend_init (void)
 static int
 lang_dependent_init (const char *name)
 {
+  location_t save_loc = input_location;
   if (dump_base_name == 0)
     dump_base_name = name ? name : "gccdump";
 
   /* Other front-end initialization.  */
+#ifdef USE_MAPPED_LOCATION
+  input_location = BUILTINS_LOCATION;
+#else
+  input_filename = "<built-in>";
+  input_line = 0;
+#endif
   if (lang_hooks.init () == 0)
     return 0;
+  input_location = save_loc;
 
   init_asm_output (name);
 
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.21
diff -u -p -r2.21 tree-cfg.c
--- tree-cfg.c	26 Jun 2004 05:03:52 -0000	2.21
+++ tree-cfg.c	28 Jun 2004 21:32:46 -0000
@@ -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
 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;
     }
@@ -2857,7 +2874,11 @@ bsi_replace (const block_stmt_iterator *
   int eh_region;
   tree orig_stmt = bsi_stmt (*bsi);
 
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (stmt, EXPR_LOCATION (orig_stmt));
+#else
   SET_EXPR_LOCUS (stmt, EXPR_LOCUS (orig_stmt));
+#endif
   set_bb_for_stmt (stmt, bsi->bb);
 
   /* Preserve EH region information from the original statement, if
@@ -4702,7 +4723,11 @@ struct tree_opt_pass pass_split_crit_edg
 static void
 execute_warn_function_return (void)
 {
+#ifdef USE_MAPPED_LOCATION
+  source_location location;
+#else
   location_t *locus;
+#endif
   tree last;
   edge e;
 
@@ -4717,17 +4742,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
@@ -4742,10 +4781,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: tree-complex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-complex.c,v
retrieving revision 2.5
diff -u -p -r2.5 tree-complex.c
--- tree-complex.c	9 Jun 2004 15:07:01 -0000	2.5
+++ tree-complex.c	28 Jun 2004 21:32:46 -0000
@@ -44,7 +44,11 @@ gimplify_val (block_stmt_iterator *bsi, 
   new_stmt = build (MODIFY_EXPR, type, t, exp);
 
   orig_stmt = bsi_stmt (*bsi);
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (new_stmt, EXPR_LOCATION (orig_stmt));
+#else
   SET_EXPR_LOCUS (new_stmt, EXPR_LOCUS (orig_stmt));
+#endif
   TREE_BLOCK (new_stmt) = TREE_BLOCK (orig_stmt);
 
   bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT);
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.11
diff -u -p -r2.11 tree-flow-inline.h
--- tree-flow-inline.h	18 Jun 2004 14:05:19 -0000	2.11
+++ tree-flow-inline.h	28 Jun 2004 21:32:46 -0000
@@ -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 "???";
 }
Index: tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-mudflap.c,v
retrieving revision 2.10
diff -u -p -r2.10 tree-mudflap.c
--- tree-mudflap.c	26 Jun 2004 05:03:52 -0000	2.10
+++ tree-mudflap.c	28 Jun 2004 21:32:47 -0000
@@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - S
 /* Helpers.  */
 static tree mf_build_string (const char *string);
 static tree mf_varname_tree (tree);
-static tree mf_file_function_line_tree (location_t *);
+static tree mf_file_function_line_tree (location_t);
 
 /* Initialization of all the mf-runtime.h extern decls.  */
 static void mf_init_extern_trees (void);
@@ -188,25 +188,23 @@ mf_varname_tree (tree decl)
 /* And another friend, for producing a simpler message.  */
 
 static tree
-mf_file_function_line_tree (location_t *locus)
+mf_file_function_line_tree (location_t location)
 {
+  expanded_location xloc = expand_location (location);
   const char *file = NULL, *colon, *line, *op, *name, *cp;
   char linebuf[18];
   char *string;
   tree result;
 
-  /* Add FILENAME.  */
-  if (locus != NULL)
-    file = locus->file;
-  if (file == NULL && current_function_decl != NULL_TREE)
-    file = DECL_SOURCE_FILE (current_function_decl);
-  if (file == NULL)
-    file = "<unknown file>";
+  /* Add FILENAME[:LINENUMBER]. */
+  if (xloc.file == NULL && current_function_decl != NULL_TREE)
+    xloc.file = DECL_SOURCE_FILE (current_function_decl);
+  if (xloc.file == NULL)
+    xloc.file = "<unknown file>";
 
-  /* Add :LINENUMBER.  */
-  if (locus != NULL && locus->line > 0)
+  if (xloc.line > 0)
     {
-      sprintf (linebuf, "%d", locus->line);
+      sprintf (linebuf, "%d", xloc.line);
       colon = ":";
       line = linebuf;
     }
@@ -348,13 +346,13 @@ mf_decl_cache_locals (void)
      globals into the cache variables.  */
   t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l),
              mf_cache_shift_decl_l, mf_cache_shift_decl);
-  annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
+  SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   shift_init_stmts = t;
 
   t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
              mf_cache_mask_decl_l, mf_cache_mask_decl);
-  annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
+  SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   mask_init_stmts = t;
 
@@ -548,7 +546,10 @@ mf_build_check_statement_for (tree addr,
 
      This is the body of the conditional.  */
   
-  u = tree_cons (NULL_TREE, mf_file_function_line_tree (locus), NULL_TREE);
+  u = tree_cons (NULL_TREE,
+		 mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION
+					     : *locus),
+		 NULL_TREE);
   u = tree_cons (NULL_TREE, dirflag, u);
   u = tree_cons (NULL_TREE, size, u);
   u = tree_cons (NULL_TREE, mf_value, u);
@@ -920,7 +921,7 @@ mx_register_decls (tree decl, tree *stmt
                                                       register_fncall_params);
 
           /* Accumulate the two calls.  */
-          /* ??? Set EXPR_LOCUS.  */
+          /* ??? Set EXPR_LOCATION.  */
           gimplify_stmt (&register_fncall);
           gimplify_stmt (&unregister_fncall);
 
Index: tree-nested.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-nested.c,v
retrieving revision 2.6
diff -u -p -r2.6 tree-nested.c
--- tree-nested.c	25 Jun 2004 20:33:09 -0000	2.6
+++ tree-nested.c	28 Jun 2004 21:32:47 -0000
@@ -364,7 +364,11 @@ init_tmp_var (struct nesting_info *info,
 
   t = create_tmp_var_for (info, TREE_TYPE (exp), NULL);
   stmt = build (MODIFY_EXPR, TREE_TYPE (t), t, exp);
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (stmt, EXPR_LOCATION (tsi_stmt (*tsi)));
+#else
   SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi)));
+#endif
   tsi_link_before (tsi, stmt, TSI_SAME_STMT);
 
   return t;
@@ -932,7 +936,11 @@ convert_local_reference (tree *tp, int *
       x = build_addr (t);
       y = get_frame_field (info, info->context, field, &wi->tsi);
       x = build (MODIFY_EXPR, void_type_node, y, x);
+#ifdef USE_MAPPED_LOCATION
+      SET_EXPR_LOCATION (x, EXPR_LOCATION (tsi_stmt (wi->tsi)));
+#else
       SET_EXPR_LOCUS (x, EXPR_LOCUS (tsi_stmt (wi->tsi)));
+#endif
       tsi_link_after (&wi->tsi, x, TSI_SAME_STMT);
       break;
 
@@ -1034,7 +1042,11 @@ convert_nl_goto_reference (tree *tp, int
   x = implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO];
   x = build_function_call_expr (x, arg);
 
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (x, EXPR_LOCATION (tsi_stmt (wi->tsi)));
+#else
   SET_EXPR_LOCUS (x, EXPR_LOCUS (tsi_stmt (wi->tsi)));
+#endif
   *tsi_stmt_ptr (wi->tsi) = x;
 
   return NULL_TREE;
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.14
diff -u -p -r2.14 tree-pretty-print.c
--- tree-pretty-print.c	24 Jun 2004 23:12:29 -0000	2.14
+++ tree-pretty-print.c	28 Jun 2004 21:32:47 -0000
@@ -2195,15 +2195,27 @@ dump_implicit_edges (pretty_printer *buf
     {
       INDENT (indent);
 
-      if ((flags & TDF_LINENO) && e->goto_locus)
+      if ((flags & TDF_LINENO)
+#ifdef USE_MAPPED_LOCATION
+	  && e->goto_locus != UNKNOWN_LOCATION
+#else
+	  && e->goto_locus
+#endif
+	  )
 	{
+	  expanded_location goto_xloc;
+#ifdef USE_MAPPED_LOCATION
+	  goto_xloc = expand_location (e->goto_locus);
+#else
+	  goto_xloc = *e->goto_locus;
+#endif
 	  pp_character (buffer, '[');
-	  if (e->goto_locus->file)
+	  if (goto_xloc.file)
 	    {
-	      pp_string (buffer, e->goto_locus->file);
+	      pp_string (buffer, goto_xloc.file);
 	      pp_string (buffer, " : ");
 	    }
-	  pp_decimal_int (buffer, e->goto_locus->line);
+	  pp_decimal_int (buffer, goto_xloc.line);
 	  pp_string (buffer, "] ");
 	}
 
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.380
diff -u -p -r1.380 tree.c
--- tree.c	26 Jun 2004 21:11:13 -0000	1.380
+++ tree.c	28 Jun 2004 21:32:49 -0000
@@ -2438,7 +2438,11 @@ build1_stat (enum tree_code code, tree t
   TREE_SET_CODE (t, code);
 
   TREE_TYPE (t) = type;
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (t, UNKNOWN_LOCATION);
+#else
   SET_EXPR_LOCUS (t, NULL);
+#endif
   TREE_COMPLEXITY (t) = 0;
   TREE_OPERAND (t, 0) = node;
   TREE_BLOCK (t) = NULL_TREE;
@@ -2746,7 +2750,12 @@ build_block (tree vars, tree tags ATTRIB
   return block;
 }
 
+#if 1 /* ! defined(USE_MAPPED_LOCATION) */
+/* ??? gengtype doesn't handle conditionals */
 static GTY(()) tree last_annotated_node;
+#endif
+
+#ifndef USE_MAPPED_LOCATION
 
 /* Record the exact location where an expression or an identifier were
    encountered.  */
@@ -2790,6 +2799,7 @@ annotate_with_locus (tree node, location
 {
   annotate_with_file_line (node, locus.file, locus.line);
 }
+#endif
 
 /* Return a declaration like DDECL except that its DECL_ATTRIBUTES
    is ATTRIBUTE.  */
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.530
diff -u -p -r1.530 tree.h
--- tree.h	26 Jun 2004 21:11:13 -0000	1.530
+++ tree.h	28 Jun 2004 21:32:50 -0000
@@ -1036,6 +1036,29 @@ struct tree_vec GTY(())
 /* In a LOOP_EXPR node.  */
 #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
 
+#ifdef USE_MAPPED_LOCATION
+/* The source location of this expression.  Non-tree_exp nodes such as
+   decls and constants can be shared among multiple locations, so
+   return nothing.  */
+#define EXPR_LOCATION(NODE)					\
+  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
+   ? (NODE)->exp.locus						\
+   : UNKNOWN_LOCATION)
+#define SET_EXPR_LOCATION(NODE, FROM) \
+  (EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
+/* EXPR_LOCUS and SET_EXPR_LOCUS are deprecated. */
+#define EXPR_LOCUS(NODE)					\
+  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
+   ? &(NODE)->exp.locus						\
+   : (location_t *)NULL)
+#define SET_EXPR_LOCUS(NODE, FROM) \
+  (EXPR_CHECK (NODE)->exp.locus = *(FROM))
+#define EXPR_FILENAME(NODE) \
+  LOCATION_FILE (EXPR_CHECK (NODE)->exp.locus)
+#define EXPR_LINENO(NODE) \
+  LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
+#else
 /* The source location of this expression.  Non-tree_exp nodes such as
    decls and constants can be shared among multiple locations, so
    return nothing.  */
@@ -1045,19 +1068,14 @@ struct tree_vec GTY(())
    : (location_t *)NULL)
 #define SET_EXPR_LOCUS(NODE, FROM) \
   (EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define SET_EXPR_LOCATION(NODE, FROM) annotate_with_locus (NODE, FROM)
 #define EXPR_FILENAME(NODE) \
   (EXPR_CHECK (NODE)->exp.locus->file)
 #define EXPR_LINENO(NODE) \
   (EXPR_CHECK (NODE)->exp.locus->line)
-#ifdef USE_MAPPED_LOCATION
-#define EXPR_LOCATION(NODE)					\
-  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
-   ? (NODE)->exp.locus						\
-   : UNKNOWN_LOCATION)
-#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
-#else
-#define EXPR_LOCATION(NODE) (*EXPR_LOCUS (NODE))
 #define EXPR_HAS_LOCATION(NODE) (EXPR_LOCUS (NODE) != NULL)
+#define EXPR_LOCATION(NODE) \
+  (EXPR_HAS_LOCATION(NODE) ? *(NODE)->exp.locus : UNKNOWN_LOCATION)
 #endif
 
 /* In a TARGET_EXPR node.  */
@@ -1135,7 +1153,7 @@ struct tree_vec GTY(())
 struct tree_exp GTY(())
 {
   struct tree_common common;
-  location_t *locus;
+  source_locus locus;
   int complexity;
   tree block;
   tree GTY ((special ("tree_exp"),
@@ -1759,8 +1777,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)
@@ -2651,8 +2669,10 @@ extern tree build_tree_list_stat (tree, 
 extern tree build_decl_stat (enum tree_code, tree, tree MEM_STAT_DECL);
 #define build_decl(c,t,q) build_decl_stat (c,t,q MEM_STAT_INFO)
 extern tree build_block (tree, tree, tree, tree, tree);
+#ifndef USE_MAPPED_LOCATION
 extern void annotate_with_file_line (tree, const char *, int);
 extern void annotate_with_locus (tree, location_t);
+#endif
 extern tree build_empty_stmt (void);
 
 /* Construct various nodes representing data types.  */

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