From 039457fd07bc5240dab3e29a7c08aa6c817840ed Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Sat, 1 May 2004 21:55:58 +0000 Subject: * expr.c (expr_wfl_stack): Remove unused global. Pre-patches for future source_location / location_t merge. * tree.h (EXPR_LOCATION, EXPR_HAS_LOCATION): New macros. * expr.c (expand_expr_real, expand_expr_real_1): Use new macros. * gimple-low.c (lower_stmt): Likewise. * gimplify.c (annotate_all_with_locus): Likewise. * print-tree.c (print_node): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-pretty-print.c (tree-pretty-print.c): Likewise. * tree-sra.c (scalarize_structure_assignment, emit_scalar_copies, scalarize_call_expr): Likewise. * tree-ssa-pre.c (code_motion): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@81397 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/expr.c | 11 ++++------- gcc/gimple-low.c | 2 +- gcc/gimplify.c | 2 +- gcc/print-tree.c | 2 +- gcc/tree-inline.c | 4 ++-- gcc/tree-pretty-print.c | 2 +- gcc/tree-sra.c | 12 ++++++------ gcc/tree-ssa-pre.c | 4 ++-- gcc/tree.h | 10 ++++++++++ 10 files changed, 44 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d572a94de41..a705dda551b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2004-04-23 Per Bothner + + * expr.c (expr_wfl_stack): Remove unused global. + + Pre-patches for future source_location / location_t merge. + * tree.h (EXPR_LOCATION, EXPR_HAS_LOCATION): New macros. + * expr.c (expand_expr_real, expand_expr_real_1): Use new macros. + * gimple-low.c (lower_stmt): Likewise. + * gimplify.c (annotate_all_with_locus): Likewise. + * print-tree.c (print_node): Likewise. + * tree-inline.c (expand_call_inline): Likewise. + * tree-pretty-print.c (tree-pretty-print.c): Likewise. + * tree-sra.c (scalarize_structure_assignment, emit_scalar_copies, + scalarize_call_expr): Likewise. + * tree-ssa-pre.c (code_motion): Likewise. + 2004-04-28 Joseph S. Myers * Makefile.in ($(DESTDIR)$(infodir)/%.info): Don't condition diff --git a/gcc/expr.c b/gcc/expr.c index 7013d21385b..33fc7c7d8be 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -209,9 +209,6 @@ enum insn_code clrstr_optab[NUM_MACHINE_MODES]; enum insn_code cmpstr_optab[NUM_MACHINE_MODES]; enum insn_code cmpmem_optab[NUM_MACHINE_MODES]; -/* Stack of EXPR_WITH_FILE_LOCATION nested expressions. */ -struct file_stack *expr_wfl_stack; - /* SLOW_UNALIGNED_ACCESS is nonzero if unaligned accesses are very slow. */ #ifndef SLOW_UNALIGNED_ACCESS @@ -6353,10 +6350,10 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, information. It would be better of the diagnostic routines used the file/line information embedded in the tree nodes rather than globals. */ - if (cfun && EXPR_LOCUS (exp)) + if (cfun && EXPR_HAS_LOCATION (exp)) { location_t saved_location = input_location; - input_location = *EXPR_LOCUS (exp); + input_location = EXPR_LOCATION (exp); emit_line_note (input_location); /* Record where the insns produced belong. */ @@ -8444,9 +8441,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, for (; TREE_CODE (exp) == COND_EXPR; exp = TREE_OPERAND (exp, 2)) { expand_start_else (); - if (EXPR_LOCUS (exp)) + if (EXPR_HAS_LOCATION (exp)) { - emit_line_note (*(EXPR_LOCUS (exp))); + emit_line_note (EXPR_LOCATION (exp)); if (cfun->dont_emit_block_notes) record_block_change (TREE_BLOCK (exp)); } diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 8100acfc5e2..af2760279bc 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -125,7 +125,7 @@ lower_stmt (tree_stmt_iterator *tsi, struct lower_data *data) { tree stmt = tsi_stmt (*tsi); - if (EXPR_LOCUS (stmt) && data) + if (EXPR_HAS_LOCATION (stmt) && data) TREE_BLOCK (stmt) = data->block; switch (TREE_CODE (stmt)) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7a6f5eabbcc..f1c4eea8080 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -569,7 +569,7 @@ annotate_all_with_locus (tree *stmt_p, location_t locus) #endif if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t))) - && ! EXPR_LOCUS (t) + && ! EXPR_HAS_LOCATION (t) && should_carry_locus_p (t)) annotate_with_locus (t, locus); } diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 6b98e9fc947..fd90b181f46 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -742,7 +742,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) break; } - if (EXPR_LOCUS (node)) + if (EXPR_HAS_LOCATION (node)) { indent_to (file, indent+4); fprintf (file, "%s:%d", diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 279dd8e2c98..feb395f5c4b 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1419,8 +1419,8 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) /* Set input_location here so we get the right instantiation context if we call instantiate_decl from inlinable_function_p. */ saved_location = input_location; - if (EXPR_LOCUS (t)) - input_location = *EXPR_LOCUS (t); + if (EXPR_HAS_LOCATION (t)) + input_location = EXPR_LOCATION (t); /* Recurse, but letting recursive invocations know that we are inside the body of a TARGET_EXPR. */ diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 49305a20066..7eea529f063 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -197,7 +197,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, if (dumping_stmts && (flags & TDF_LINENO) - && EXPR_LOCUS (node)) + && EXPR_HAS_LOCATION (node)) { pp_character (buffer, '['); if (EXPR_FILENAME (node)) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index aef77c00772..2131d0047f2 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -497,8 +497,8 @@ scalarize_structure_assignment (block_stmt_iterator *si_p) return; /* Set line number information for our replacements. */ - if (EXPR_LOCUS (orig_stmt)) - annotate_all_with_locus (&list, *EXPR_LOCUS (orig_stmt)); + if (EXPR_HAS_LOCATION (orig_stmt)) + annotate_all_with_locus (&list, EXPR_LOCATION (orig_stmt)); /* Replace the existing statement with the newly created list of scalarized copies. When replacing the original statement, the first @@ -814,8 +814,8 @@ emit_scalar_copies (block_stmt_iterator *bsi, tree lhs, tree rhs, tree list = create_scalar_copies (lhs, rhs, mode); tree stmt = bsi_stmt (*bsi); - if (EXPR_LOCUS (stmt)) - annotate_all_with_locus (&list, *EXPR_LOCUS (stmt)); + if (EXPR_HAS_LOCATION (stmt)) + annotate_all_with_locus (&list, EXPR_LOCATION (stmt)); bsi_insert_before (bsi, list, BSI_SAME_STMT); } @@ -1007,8 +1007,8 @@ scalarize_call_expr (block_stmt_iterator *si_p) if (is_sra_candidate_decl (var)) { tree list = create_scalar_copies (var, var, SCALAR_FIELD); - if (EXPR_LOCUS (stmt)) - annotate_all_with_locus (&list, *EXPR_LOCUS (stmt)); + if (EXPR_HAS_LOCATION (stmt)) + annotate_all_with_locus (&list, EXPR_LOCATION (stmt)); if (stmt_ends_bb_p (stmt)) insert_edge_copies (list, bb_for_stmt (stmt)); else diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index bd222b7161a..d3ae62c9e56 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2784,7 +2784,7 @@ code_motion (struct expr_info *ei) fprintf (dump_file, " before statement "); print_generic_expr (dump_file, use_stmt, dump_flags); fprintf (dump_file, "\n"); - if (EXPR_LOCUS (use_stmt)) + if (EXPR_HAS_LOCATION (use_stmt)) fprintf (dump_file, " on line %d\n", EXPR_LINENO (use_stmt)); } @@ -2816,7 +2816,7 @@ code_motion (struct expr_info *ei) fprintf (dump_file, " in statement "); print_generic_stmt (dump_file, use_stmt, dump_flags); fprintf (dump_file, "\n"); - if (EXPR_LOCUS (use_stmt)) + if (EXPR_HAS_LOCATION (use_stmt)) fprintf (dump_file, " on line %d\n", EXPR_LINENO (use_stmt)); } diff --git a/gcc/tree.h b/gcc/tree.h index f7baf493095..dbe865f01da 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1069,6 +1069,16 @@ struct tree_vec GTY(()) (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) +#endif /* In a TARGET_EXPR node. */ #define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0) -- cgit v1.2.3