On 11/20/13 13:59, Steven Bosscher wrote:

        * jump.c (reset_insn_reg_label_operand_notes): New function,
        split out from ...
        (init_label_info): ... here.  Reset LABEL_NUSES in cfglayout mode.
        * cfgcleanup.c (delete_dead_jump_tables_between): New function,
        split out from ...
        (delete_dead_jumptables): ... here.  Handle cfglayout mode.
        (cleanup_cfg): Delete dead jump tables in cfglayout mode if an
        expensive CFG cleanup is called for.
        * cfgrtl.c (fixup_reorder_chain): Remove BARRIERs from fallthru paths.
        (cfg_layout_finalize): Delete dead jump tables before re-building
        the insns chain.
        * ira.c (ira): Rebuild jump labels*after*  deleting unreachable
        basic blocks, not before.
        * loop-init.c (rtl_loop_done): Call for an expensive CFG cleanup.

        * modulo-sched.c (sms_schedule): Do not look for BARRIERs in the
        insns chain of a scheduling extended basic block, they cannot appear
        there in cfglayout mode.
Code is fine from a cursory review -- you're as well versed in this code as anyone, so I'm going to assume it's a step in the right direction.

My comments are just whitespace and spelling nits.



@@ -186,34 +214,40 @@ init_label_info (rtx f)
  {
    rtx insn;

-  for (insn = f; insn; insn = NEXT_INSN (insn))
-    {
-      if (LABEL_P (insn))
-       LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
-
-      /* REG_LABEL_TARGET notes (including the JUMP_LABEL field) are
-        sticky and not reset here; that way we won't lose association
-        with a label when e.g. the source for a target register
-        disappears out of reach for targets that may use jump-target
-        registers.  Jump transformations are supposed to transform
-        any REG_LABEL_TARGET notes.  The target label reference in a
-        branch may disappear from the branch (and from the
-        instruction before it) for other reasons, like register
-        allocation.  */
-
-      if (INSN_P (insn))
-       {
-         rtx note, next;
-
-         for (note = REG_NOTES (insn); note; note = next)
-           {
-             next = XEXP (note, 1);
-             if (REG_NOTE_KIND (note) == REG_LABEL_OPERAND
-                 && ! reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
-               remove_note (insn, note);
-           }
-       }
-    }
+  if (current_ir_type () == IR_RTL_CFGLAYOUT)
+    {
+      basic_block bb;
+
+      FOR_EACH_BB (bb)
+       {
+         /* Labels only appear between BB_HEAD and the basic block note,
+            and in the basic block header and footer.  */
+         for (insn = BB_HEAD (bb);
+              insn && LABEL_P (insn);
+              insn = NEXT_INSN (insn))
+           LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
+         for (insn = BB_HEADER (bb); insn; insn = NEXT_INSN (insn))
+           if (LABEL_P (insn))
+             LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
+         for (insn = BB_FOOTER (bb); insn; insn = NEXT_INSN (insn))
+           if (LABEL_P (insn))
+             LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
This seems quite busy to my eyes. Perhaps vertical whitespace between the loops.

-  /* Don't call delete_dead_jumptables in cfglayout mode, because
-     that function assumes that jump tables are in the insns stream.
-     But we also don't_have_  to delete dead jumptables in cfglayout
                        ^^^ horizontal whitespace.


+  /* Annoying special case - stray barriers left in the code.  This happens
+     if a tablejump is transformed to a simpe or confitional jump, or if a
+     basic block ending in a tablejump is removed but the jump table itself
s/simpe/simple/


Nits fixed and it's good to go.

jeff

Reply via email to