]> gcc.gnu.org Git - gcc.git/commitdiff
flow.c (life_analysis): New parameter remove_dead_code.
authorJan Hubicka <hubicka@limax.paru.cas.cz>
Sat, 10 Apr 1999 22:53:08 +0000 (00:53 +0200)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 10 Apr 1999 22:53:08 +0000 (15:53 -0700)
        * flow.c (life_analysis): New parameter remove_dead_code.
        (life_analysis_1): Likewise.
        (propagate_block): Likewise; use it.
        * output.h: Update prototype.
        * toplev.c: Update calls to life_analysis.

From-SVN: r26343

gcc/ChangeLog
gcc/flow.c
gcc/output.h
gcc/toplev.c

index 6eed4a05fb67bfd31f6e3b2b2b0cd42e4da69e54..94a1f4a91a80aaa8ebe3bf59f925634c8d302177 100644 (file)
@@ -1,3 +1,11 @@
+Sat Apr 10 22:51:53 1999  Jan Hubicka <hubicka@limax.paru.cas.cz>
+
+       * flow.c (life_analysis): New parameter remove_dead_code.
+       (life_analysis_1): Likewise.
+       (propagate_block): Likewise; use it.
+       * output.h: Update prototype.
+       * toplev.c: Update calls to life_analysis.
+
 Sat Apr 10 22:12:12 1999  Jan Hubicka <hubicka@freesoft.cz>
   
        * recog.c (constrain_operands): Ignore unary operators when
index ae9b967292c955effa621d665f669305a1a3d662..7952965ba35cbf32c13bee846adfb999c3c3338d 100644 (file)
@@ -303,11 +303,11 @@ static int noop_move_p                    PROTO((rtx));
 static void notice_stack_pointer_modification PROTO ((rtx, rtx));
 static void record_volatile_insns      PROTO((rtx));
 static void mark_regs_live_at_end      PROTO((regset));
-static void life_analysis_1            PROTO((rtx, int));
+static void life_analysis_1            PROTO((rtx, int, int));
 static void init_regset_vector         PROTO ((regset *, int,
                                                struct obstack *));
 static void propagate_block            PROTO((regset, rtx, rtx, int, 
-                                              regset, int));
+                                              regset, int, int));
 static int insn_dead_p                 PROTO((rtx, regset, int, rtx));
 static int libcall_dead_p              PROTO((rtx, regset, rtx, rtx));
 static void mark_set_regs              PROTO((regset, regset, rtx,
@@ -2059,10 +2059,11 @@ calculate_loop_depth (insns)
    in use.  */
 
 void
-life_analysis (f, nregs, file)
+life_analysis (f, nregs, file, remove_dead_code)
      rtx f;
      int nregs;
      FILE *file;
+     int remove_dead_code;
 {
 #ifdef ELIMINABLE_REGS
   register size_t i;
@@ -2086,7 +2087,7 @@ life_analysis (f, nregs, file)
 
   /* We want alias analysis information for local dead store elimination.  */
   init_alias_analysis ();
-  life_analysis_1 (f, nregs);
+  life_analysis_1 (f, nregs, remove_dead_code);
   end_alias_analysis ();
 
   if (file)
@@ -2302,9 +2303,10 @@ mark_regs_live_at_end (set)
    regset_size and regset_bytes are also set here.  */
 
 static void
-life_analysis_1 (f, nregs)
+life_analysis_1 (f, nregs, remove_dead_code)
      rtx f;
      int nregs;
+     int remove_dead_code;
 {
   int first_pass;
   int changed;
@@ -2449,7 +2451,7 @@ life_analysis_1 (f, nregs)
              propagate_block (bb->global_live_at_start,
                               bb->head, bb->end, 0,
                               first_pass ? bb->local_set : (regset) 0,
-                              i);
+                              i, remove_dead_code);
            }
 
          /* Update the new_live_at_end's of the block's predecessors.  */
@@ -2492,7 +2494,7 @@ life_analysis_1 (f, nregs)
         contents of global_live_at_end for posterity.  Fortunately,
         new_live_at_end, due to the way we converged on a solution,
         contains a duplicate of global_live_at_end that we can kill.  */
-      propagate_block ((regset) bb->aux, bb->head, bb->end, 1, (regset) 0, i);
+      propagate_block ((regset) bb->aux, bb->head, bb->end, 1, (regset) 0, i, remove_dead_code);
 
 #ifdef USE_C_ALLOCA
       alloca (0);
@@ -2626,13 +2628,14 @@ free_regset_vector (vector, nelts)
    BNUM is the number of the basic block.  */
 
 static void
-propagate_block (old, first, last, final, significant, bnum)
+propagate_block (old, first, last, final, significant, bnum, remove_dead_code)
      register regset old;
      rtx first;
      rtx last;
      int final;
      regset significant;
      int bnum;
+     int remove_dead_code;
 {
   register rtx insn;
   rtx prev;
@@ -2689,13 +2692,17 @@ propagate_block (old, first, last, final, significant, bnum)
        {
          register int i;
          rtx note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
-         int insn_is_dead
-           = (insn_dead_p (PATTERN (insn), old, 0, REG_NOTES (insn))
-              /* Don't delete something that refers to volatile storage!  */
-              && ! INSN_VOLATILE (insn));
-         int libcall_is_dead 
-           = (insn_is_dead && note != 0
-              && libcall_dead_p (PATTERN (insn), old, note, insn));
+         int insn_is_dead = 0;
+         int libcall_is_dead = 0;
+
+         if (remove_dead_code)
+           {
+             insn_is_dead = (insn_dead_p (PATTERN (insn), old, 0, REG_NOTES (insn))
+                             /* Don't delete something that refers to volatile storage!  */
+                             && ! INSN_VOLATILE (insn));
+             libcall_is_dead = (insn_is_dead && note != 0
+                                && libcall_dead_p (PATTERN (insn), old, note, insn));
+           }
 
          /* If an instruction consists of just dead store(s) on final pass,
             "delete" it by turning it into a NOTE of type NOTE_INSN_DELETED.
index 91708ae7d368363052bfc2cb13650255b0dfccbb..7e1c28bd7e57f26ff5a0ee4106533fb63d714906 100644 (file)
@@ -131,7 +131,7 @@ extern void dump_flow_info          PROTO((FILE *));
 extern void find_basic_blocks         PROTO((rtx, int, FILE *, int));
 extern void free_basic_block_vars     PROTO((int));
 extern void set_block_num             PROTO((rtx, int));
-extern void life_analysis             PROTO((rtx, int, FILE *));
+extern void life_analysis             PROTO((rtx, int, FILE *, int));
 #endif
 
 /* Functions in varasm.c.  */
index 282928435087551d277e05b1ca122e4c169da48b..4c332617966b3d92575bdeb8c028c61614fdea8f 100644 (file)
@@ -3983,7 +3983,7 @@ rest_of_compilation (decl)
        (flow_time,
         {
           find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
-          life_analysis (insns, max_reg_num (), rtl_dump_file);
+          life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
         });
 
       if (warn_uninitialized)
@@ -4168,7 +4168,7 @@ rest_of_compilation (decl)
        (flow2_time,
         {
           find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
-          life_analysis (insns, max_reg_num (), rtl_dump_file);
+          life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
         });
     }
 
This page took 0.092641 seconds and 5 git commands to generate.