From: Alexandre Oliva Date: Wed, 21 Nov 2018 16:59:59 +0000 (+0000) Subject: compute discriminator info for overrides X-Git-Tag: upstream/12.2.0~27912 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6bdb055ea850bb5497e52b5b1acbd8dabe93e01f;p=platform%2Fupstream%2Fgcc.git compute discriminator info for overrides In some cases of overriding or resetting locations, we might retain discriminator info from earlier locations, when we should take discriminator information from the overriding location or reset it. for gcc/ChangeLog * final.c (compute_discriminator): Declare. Renamed from... (maybe_set_discriminator): ... this. Set and return a local. (override_discriminator): New. (final_scan_insn_1): Set it. (notice_source_line): Adjust. Always set discriminator. From-SVN: r266349 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 185bf1c..88db1c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-11-21 Alexandre Oliva + + * final.c (compute_discriminator): Declare. Renamed from... + (maybe_set_discriminator): ... this. Set and return a local. + (override_discriminator): New. + (final_scan_insn_1): Set it. + (notice_source_line): Adjust. Always set discriminator. + 2018-11-21 Jakub Jelinek PR target/87839 diff --git a/gcc/final.c b/gcc/final.c index 0c1ac62..f707d2f 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -128,6 +128,7 @@ static int last_discriminator; /* Discriminator to be written to assembly for current instruction. Note: actual usage depends on loc_discriminator_kind setting. */ static int discriminator; +static inline int compute_discriminator (location_t loc); /* Discriminator identifying current basic block among others sharing the same locus. */ @@ -149,6 +150,7 @@ static const char *last_filename; static const char *override_filename; static int override_linenum; static int override_columnnum; +static int override_discriminator; /* Whether to force emission of a line note before the next insn. */ static bool force_source_line = false; @@ -2342,6 +2344,7 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, override_filename = LOCATION_FILE (*locus_ptr); override_linenum = LOCATION_LINE (*locus_ptr); override_columnnum = LOCATION_COLUMN (*locus_ptr); + override_discriminator = compute_discriminator (*locus_ptr); } } break; @@ -2379,12 +2382,14 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, override_filename = LOCATION_FILE (*locus_ptr); override_linenum = LOCATION_LINE (*locus_ptr); override_columnnum = LOCATION_COLUMN (*locus_ptr); + override_discriminator = compute_discriminator (*locus_ptr); } else { override_filename = NULL; override_linenum = 0; override_columnnum = 0; + override_discriminator = 0; } } break; @@ -3185,9 +3190,11 @@ map_decl_to_instance (const_tree decl) /* Set DISCRIMINATOR to the appropriate value, possibly derived from LOC. */ -static inline void -maybe_set_discriminator (location_t loc) +static inline int +compute_discriminator (location_t loc) { + int discriminator; + if (!decl_to_instance_map) discriminator = bb_discriminator; else @@ -3209,6 +3216,8 @@ maybe_set_discriminator (location_t loc) discriminator = map_decl_to_instance (decl); } + + return discriminator; } /* Return whether a source line note needs to be emitted before INSN. @@ -3234,7 +3243,7 @@ notice_source_line (rtx_insn *insn, bool *is_stmt) filename = xloc.file; linenum = xloc.line; columnnum = xloc.column; - maybe_set_discriminator (loc); + discriminator = compute_discriminator (loc); force_source_line = true; } else if (override_filename) @@ -3242,6 +3251,7 @@ notice_source_line (rtx_insn *insn, bool *is_stmt) filename = override_filename; linenum = override_linenum; columnnum = override_columnnum; + discriminator = override_discriminator; } else if (INSN_HAS_LOCATION (insn)) { @@ -3249,13 +3259,14 @@ notice_source_line (rtx_insn *insn, bool *is_stmt) filename = xloc.file; linenum = xloc.line; columnnum = xloc.column; - maybe_set_discriminator (INSN_LOCATION (insn)); + discriminator = compute_discriminator (INSN_LOCATION (insn)); } else { filename = NULL; linenum = 0; columnnum = 0; + discriminator = 0; } if (filename == NULL)