]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/df-scan.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / df-scan.cc
index 4e3291a711b870b1d1137ad83709a7dc3e889dfd..1bade2cd71e2b0d13a89faabefdc87a4b061058c 100644 (file)
@@ -1,5 +1,5 @@
 /* Scanning of rtl for dataflow analysis.
-   Copyright (C) 1999-2022 Free Software Foundation, Inc.
+   Copyright (C) 1999-2024 Free Software Foundation, Inc.
    Originally contributed by Michael P. Hayes
              (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
    Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
@@ -104,7 +104,7 @@ static void df_insn_info_delete (unsigned int);
 /* Indexed by hardware reg number, is true if that register is ever
    used in the current function.
 
-   In df-scan.c, this is set up to record the hard regs used
+   In df-scan.cc, this is set up to record the hard regs used
    explicitly.  Reload adds in the hard regs used for holding pseudo
    regs.  Final uses it to generate the code in the function prologue
    and epilogue to save and restore registers as needed.  */
@@ -938,7 +938,7 @@ df_insn_delete (rtx_insn *insn)
   bb = BLOCK_FOR_INSN (insn);
 
   /* ??? bb can be NULL after pass_free_cfg.  At that point, DF should
-     not exist anymore (as mentioned in df-core.c: "The only requirement
+     not exist anymore (as mentioned in df-core.cc: "The only requirement
      [for DF] is that there be a correct control flow graph."  Clearly
      that isn't the case after pass_free_cfg.  But DF is freed much later
      because some back-ends want to use DF info even though the CFG is
@@ -1769,13 +1769,15 @@ df_insn_change_bb (rtx_insn *insn, basic_block new_bb)
   if (!INSN_P (insn))
     return;
 
-  df_set_bb_dirty (new_bb);
+  if (!DEBUG_INSN_P (insn))
+    df_set_bb_dirty (new_bb);
   if (old_bb)
     {
       if (dump_file)
        fprintf (dump_file, "  from %d to %d\n",
                 old_bb->index, new_bb->index);
-      df_set_bb_dirty (old_bb);
+      if (!DEBUG_INSN_P (insn))
+       df_set_bb_dirty (old_bb);
     }
   else
     if (dump_file)
@@ -2473,10 +2475,11 @@ df_ref_create_structure (enum df_ref_class cl,
                         enum df_ref_type ref_type,
                         int ref_flags)
 {
-  df_ref this_ref = NULL;
-  unsigned int regno = REGNO (GET_CODE (reg) == SUBREG ? SUBREG_REG (reg) : reg);
+  const unsigned int regno
+    = REGNO (GET_CODE (reg) == SUBREG ? SUBREG_REG (reg) : reg);
   struct df_scan_problem_data *problem_data
     = (struct df_scan_problem_data *) df_scan->problem_data;
+  df_ref this_ref;
 
   switch (cl)
     {
@@ -2496,12 +2499,15 @@ df_ref_create_structure (enum df_ref_class cl,
       this_ref->regular_ref.loc = loc;
       gcc_checking_assert (loc);
       break;
+
+    default:
+      gcc_unreachable ();
     }
 
   DF_REF_CLASS (this_ref) = cl;
   DF_REF_ID (this_ref) = -1;
   DF_REF_REG (this_ref) = reg;
-  DF_REF_REGNO (this_ref) =  regno;
+  DF_REF_REGNO (this_ref) = regno;
   DF_REF_TYPE (this_ref) = ref_type;
   DF_REF_INSN_INFO (this_ref) = info;
   DF_REF_CHAIN (this_ref) = NULL;
@@ -2510,17 +2516,17 @@ df_ref_create_structure (enum df_ref_class cl,
   DF_REF_PREV_REG (this_ref) = NULL;
   DF_REF_ORDER (this_ref) = df->ref_order++;
 
-  /* We need to clear this bit because fwprop, and in the future
-     possibly other optimizations sometimes create new refs using ond
-     refs as the model.  */
+  /* We need to clear the DF_HARD_REG_LIVE bit because fwprop, and in the
+     future possibly other optimizations, sometimes create new refs using
+     live refs as the model.  */
   DF_REF_FLAGS_CLEAR (this_ref, DF_HARD_REG_LIVE);
 
-  /* See if this ref needs to have DF_HARD_REG_LIVE bit set.  */
+  /* Now see if this ref really needs to have the bit set.  */
   if (regno < FIRST_PSEUDO_REGISTER
-      && !DF_REF_IS_ARTIFICIAL (this_ref)
-      && !DEBUG_INSN_P (DF_REF_INSN (this_ref)))
+      && cl != DF_REF_ARTIFICIAL
+      && !DEBUG_INSN_P (info->insn))
     {
-      if (DF_REF_REG_DEF_P (this_ref))
+      if (ref_type == DF_REF_REG_DEF)
        {
          if (!DF_REF_FLAGS_IS_SET (this_ref, DF_REF_MAY_CLOBBER))
            DF_REF_FLAGS_SET (this_ref, DF_HARD_REG_LIVE);
@@ -3714,6 +3720,16 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
     }
 #endif
 
+#ifdef EH_RETURN_TAKEN_RTX
+  if ((!targetm.have_epilogue () || ! epilogue_completed)
+      && crtl->calls_eh_return)
+    {
+      rtx tmp = EH_RETURN_TAKEN_RTX;
+      if (tmp && REG_P (tmp))
+       df_mark_reg (tmp, exit_block_uses);
+    }
+#endif
+
   if ((!targetm.have_epilogue () || ! epilogue_completed)
       && crtl->calls_eh_return)
     {