]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl.h (insn_location): Declare.
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 6 Jun 2014 07:32:25 +0000 (07:32 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 6 Jun 2014 07:32:25 +0000 (07:32 +0000)
* rtl.h (insn_location): Declare.
* cfgcleanup.c (try_forward_edges): Compare the locus of locations
with UNKNOWN_LOCATION.
* emit-rtl.c (insn_location): New function.
* final.c (notice_source_line): Check that the instruction has a
location before retrieving it and use insn_location.
* modulo-sched.c (loop_single_full_bb_p): Likewise.
* print-rtl.c (print_rtx): Likewise.

From-SVN: r211305

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/emit-rtl.c
gcc/final.c
gcc/modulo-sched.c
gcc/print-rtl.c
gcc/rtl.h

index e71d68f4fac6f0693c3143434b89be31b004eeaa..77ac41642786d99afb611755652c35a8e3fa8b07 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-06  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * rtl.h (insn_location): Declare.
+       * cfgcleanup.c (try_forward_edges): Compare the locus of locations
+       with UNKNOWN_LOCATION.
+       * emit-rtl.c (insn_location): New function.
+       * final.c (notice_source_line): Check that the instruction has a
+       location before retrieving it and use insn_location.
+       * modulo-sched.c (loop_single_full_bb_p): Likewise.
+       * print-rtl.c (print_rtx): Likewise.
+
 2014-06-06  Richard Biener  <rguenther@suse.de>
 
        * passes.def: Move 2nd VRP pass before phi-only-cprop.
index 7c24a6d7dde196a41f4a6b3f8cc95c5e49bac312..26dfbe62ddc278d394e63fc6ed5fa03ff26d0b8d 100644 (file)
@@ -482,31 +482,30 @@ try_forward_edges (int mode, basic_block b)
                  location_t new_locus = single_succ_edge (target)->goto_locus;
                  location_t locus = goto_locus;
 
-                 if (new_locus != UNKNOWN_LOCATION
-                     && locus != UNKNOWN_LOCATION
+                 if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION
+                     && LOCATION_LOCUS (locus) != UNKNOWN_LOCATION
                      && new_locus != locus)
                    new_target = NULL;
                  else
                    {
-                     rtx last;
-
-                     if (new_locus != UNKNOWN_LOCATION)
+                     if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION)
                        locus = new_locus;
 
-                     last = BB_END (target);
+                     rtx last = BB_END (target);
                      if (DEBUG_INSN_P (last))
                        last = prev_nondebug_insn (last);
+                     if (last && INSN_P (last))
+                       new_locus = INSN_LOCATION (last);
+                     else
+                       new_locus = UNKNOWN_LOCATION;
 
-                     new_locus = last && INSN_P (last)
-                                 ? INSN_LOCATION (last) : 0;
-
-                     if (new_locus != UNKNOWN_LOCATION
-                         && locus != UNKNOWN_LOCATION
+                     if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION
+                         && LOCATION_LOCUS (locus) != UNKNOWN_LOCATION
                          && new_locus != locus)
                        new_target = NULL;
                      else
                        {
-                         if (new_locus != UNKNOWN_LOCATION)
+                         if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION)
                            locus = new_locus;
 
                          goto_locus = locus;
index fe1da9ed8abf3e7d8ec2a9ade8941e4632584dc6..ceb072a5522194df322f4dfaf45a5a79802c4e3b 100644 (file)
@@ -6174,6 +6174,13 @@ insn_file (const_rtx insn)
   return LOCATION_FILE (INSN_LOCATION (insn));
 }
 
+/* Return expanded location of the statement that produced this insn.  */
+expanded_location
+insn_location (const_rtx insn)
+{
+  return expand_location (INSN_LOCATION (insn));
+}
+
 /* Return true if memory model MODEL requires a pre-operation (release-style)
    barrier or a post-operation (acquire-style) barrier.  While not universal,
    this function matches behavior of several targets.  */
index c32e177a426d965b37eba24f3a6a14247c4ec33d..4f08073341632c98a53e4a5636f8a6199dd984d5 100644 (file)
@@ -3019,10 +3019,16 @@ notice_source_line (rtx insn, bool *is_stmt)
       filename = override_filename;
       linenum = override_linenum;
     }
+  else if (INSN_HAS_LOCATION (insn))
+    {
+      expanded_location xloc = insn_location (insn);
+      filename = xloc.file;
+      linenum = xloc.line;
+    }
   else
     {
-      filename = insn_file (insn);
-      linenum = insn_line (insn);
+      filename = NULL;
+      linenum = 0;
     }
 
   if (filename == NULL)
index 16caa8fe64f33626ca96ea5bde9e8fda841f9c6d..6db1a21bbb59edcc557f3536ca3c59f20caa0259 100644 (file)
@@ -1244,11 +1244,10 @@ loop_single_full_bb_p (struct loop *loop)
 static void
 dump_insn_location (rtx insn)
 {
-  if (dump_file && INSN_LOCATION (insn))
+  if (dump_file && INSN_HAS_LOCATION (insn))
     {
-      const char *file = insn_file (insn);
-      if (file)
-       fprintf (dump_file, " %s:%i", file, insn_line (insn));
+      expanded_location xloc = insn_location (insn);
+      fprintf (dump_file, " %s:%i", xloc.file, xloc.line);
     }
 }
 
index 2f9f54738c093077beb0ac1444fe0b256c03d096..5dc8e94411a0051f500a2f08bc6f3f051e38f38d 100644 (file)
@@ -395,9 +395,11 @@ print_rtx (const_rtx in_rtx)
            /*  Pretty-print insn locations.  Ignore scoping as it is mostly
                redundant with line number information and do not print anything
                when there is no location information available.  */
-           if (INSN_LOCATION (in_rtx) && insn_file (in_rtx))
-             fprintf (outfile, " %s:%i", insn_file (in_rtx),
-                      insn_line (in_rtx));
+           if (INSN_HAS_LOCATION (in_rtx))
+             {
+               expanded_location xloc = insn_location (in_rtx);
+               fprintf (outfile, " %s:%i", xloc.file, xloc.line);
+             }
 #endif
          }
        else if (i == 6 && GET_CODE (in_rtx) == ASM_OPERANDS)
index 51cfae5ffa6a361ecd4ab1c088f5b2ae6c6b0ee1..6ec91a890a616224e26d4ec73cee37ef898aebd7 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2130,6 +2130,7 @@ extern rtx prev_cc0_setter (rtx);
 extern int insn_line (const_rtx);
 extern const char * insn_file (const_rtx);
 extern tree insn_scope (const_rtx);
+extern expanded_location insn_location (const_rtx);
 extern location_t prologue_location, epilogue_location;
 
 /* In jump.c */